summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-05-29 15:27:13 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:22:54 -0500
commitd8e454664a97385d798ad53633856044f928a491 (patch)
tree57efd6c2ccede0a1c244ee086f1fa5cae9faa9cf /source3
parent6a824bb1206228b4afa0e61a06c68027d0d9db59 (diff)
downloadsamba-d8e454664a97385d798ad53633856044f928a491.tar.gz
samba-d8e454664a97385d798ad53633856044f928a491.tar.bz2
samba-d8e454664a97385d798ad53633856044f928a491.zip
r23210: Very funny, we thought to use netr_GetDcName (e.g. in winbind) but were using
netr_GetDcAnyName all the time (which is the correct thing to do). Fix the naming and opcode mixup in all branches. Guenther (This used to be commit def6464c872a5939f0028837254f2c019d2d71c8)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/rpc_netlogon.h30
-rw-r--r--source3/nsswitch/winbindd_cm.c10
-rw-r--r--source3/nsswitch/winbindd_misc.c6
-rw-r--r--source3/rpc_client/cli_netlogon.c46
-rw-r--r--source3/rpc_parse/parse_net.c62
-rw-r--r--source3/rpcclient/cmd_netlogon.c24
6 files changed, 89 insertions, 89 deletions
diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h
index 2583a5bd40..163b18a266 100644
--- a/source3/include/rpc_netlogon.h
+++ b/source3/include/rpc_netlogon.h
@@ -32,9 +32,9 @@
#define NET_AUTH 0x05
#define NET_SRVPWSET 0x06
#define NET_SAM_DELTAS 0x07
-#define NET_GETANYDCNAME 0x0b
+#define NET_GETDCNAME 0x0b
#define NET_LOGON_CTRL 0x0c
-#define NET_GETDCNAME 0x0d
+#define NET_GETANYDCNAME 0x0d
#define NET_AUTH2 0x0f
#define NET_LOGON_CTRL2 0x0e
#define NET_SAM_SYNC 0x10
@@ -411,39 +411,39 @@ typedef struct net_r_logon_ctrl2_info {
NTSTATUS status; /* return code */
} NET_R_LOGON_CTRL2;
-/* NET_Q_GETDCNAME - Ask a DC for a trusted DC name */
+/* NET_Q_GETANYDCNAME - Ask a DC for a trusted DC name */
-typedef struct net_q_getdcname {
+typedef struct net_q_getanydcname {
uint32 ptr_logon_server;
UNISTR2 uni_logon_server;
uint32 ptr_domainname;
UNISTR2 uni_domainname;
-} NET_Q_GETDCNAME;
+} NET_Q_GETANYDCNAME;
-/* NET_R_GETDCNAME - Ask a DC for a trusted DC name */
+/* NET_R_GETANYDCNAME - Ask a DC for a trusted DC name */
-typedef struct net_r_getdcname {
+typedef struct net_r_getanydcname {
uint32 ptr_dcname;
UNISTR2 uni_dcname;
WERROR status;
-} NET_R_GETDCNAME;
+} NET_R_GETANYDCNAME;
-/* NET_Q_GETANYDCNAME - Ask a DC for a trusted DC name */
+/* NET_Q_GETDCNAME - Ask a DC for a trusted DC name */
-typedef struct net_q_getanydcname {
+typedef struct net_q_getdcname {
UNISTR2 uni_logon_server;
uint32 ptr_domainname;
UNISTR2 uni_domainname;
-} NET_Q_GETANYDCNAME;
+} NET_Q_GETDCNAME;
-/* NET_R_GETANYDCNAME - Ask a DC for a trusted DC name */
+/* NET_R_GETDCNAME - Ask a DC for a trusted DC name */
-typedef struct net_r_getanydcname {
+typedef struct net_r_getdcname {
uint32 ptr_dcname;
UNISTR2 uni_dcname;
- WERROR status;
-} NET_R_GETANYDCNAME;
+ NTSTATUS status;
+} NET_R_GETDCNAME;
/* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
typedef struct net_q_trust_dom_info {
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index ba91239a73..b8b11b8466 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -602,8 +602,8 @@ static BOOL get_dc_name_via_netlogon(const struct winbindd_domain *domain,
orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000);
- werr = rpccli_netlogon_getdcname(netlogon_pipe, mem_ctx, our_domain->dcname,
- domain->name, tmp);
+ werr = rpccli_netlogon_getanydcname(netlogon_pipe, mem_ctx, our_domain->dcname,
+ domain->name, tmp);
/* And restore our original timeout. */
cli_set_timeout(netlogon_pipe->cli, orig_timeout);
@@ -611,12 +611,12 @@ static BOOL get_dc_name_via_netlogon(const struct winbindd_domain *domain,
talloc_destroy(mem_ctx);
if (!W_ERROR_IS_OK(werr)) {
- DEBUG(10, ("rpccli_netlogon_getdcname failed: %s\n",
+ DEBUG(10, ("rpccli_netlogon_getanydcname failed: %s\n",
dos_errstr(werr)));
return False;
}
- /* cli_netlogon_getdcname gives us a name with \\ */
+ /* cli_netlogon_getanydcname gives us a name with \\ */
p = tmp;
if (*p == '\\') {
p+=1;
@@ -627,7 +627,7 @@ static BOOL get_dc_name_via_netlogon(const struct winbindd_domain *domain,
fstrcpy(dcname, p);
- DEBUG(10, ("rpccli_netlogon_getdcname returned %s\n", dcname));
+ DEBUG(10, ("rpccli_netlogon_getanydcname returned %s\n", dcname));
if (!resolve_name(dcname, dc_ip, 0x20)) {
return False;
diff --git a/source3/nsswitch/winbindd_misc.c b/source3/nsswitch/winbindd_misc.c
index ac751bf2a8..acb7dbf8a9 100644
--- a/source3/nsswitch/winbindd_misc.c
+++ b/source3/nsswitch/winbindd_misc.c
@@ -247,9 +247,9 @@ enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain,
orig_timeout = cli_set_timeout(netlogon_pipe->cli, 35000);
- werr = rpccli_netlogon_getdcname(netlogon_pipe, state->mem_ctx, domain->dcname,
- state->request.domain_name,
- dcname_slash);
+ werr = rpccli_netlogon_getanydcname(netlogon_pipe, state->mem_ctx, domain->dcname,
+ state->request.domain_name,
+ dcname_slash);
/* And restore our original timeout. */
cli_set_timeout(netlogon_pipe->cli, orig_timeout);
diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c
index eaa398087b..f155c736e9 100644
--- a/source3/rpc_client/cli_netlogon.c
+++ b/source3/rpc_client/cli_netlogon.c
@@ -380,15 +380,15 @@ NTSTATUS rpccli_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, TALLOC_CTX *me
return result;
}
-/* GetDCName */
+/* GetAnyDCName */
-WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx, const char *mydcname,
- const char *domainname, fstring newdcname)
+WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx, const char *mydcname,
+ const char *domainname, fstring newdcname)
{
prs_struct qbuf, rbuf;
- NET_Q_GETDCNAME q;
- NET_R_GETDCNAME r;
+ NET_Q_GETANYDCNAME q;
+ NET_R_GETANYDCNAME r;
WERROR result;
fstring mydcname_slash;
@@ -398,15 +398,15 @@ WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli,
/* Initialise input parameters */
slprintf(mydcname_slash, sizeof(fstring)-1, "\\\\%s", mydcname);
- init_net_q_getdcname(&q, mydcname_slash, domainname);
+ init_net_q_getanydcname(&q, mydcname_slash, domainname);
/* Marshall data and send request */
- CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_GETDCNAME,
+ CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_GETANYDCNAME,
q, r,
qbuf, rbuf,
- net_io_q_getdcname,
- net_io_r_getdcname,
+ net_io_q_getanydcname,
+ net_io_r_getanydcname,
WERR_GENERAL_FAILURE);
result = r.status;
@@ -418,16 +418,16 @@ WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli,
return result;
}
-/* GetAnyDCName */
+/* GetDCName */
-WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx, const char *mydcname,
- const char *domainname, fstring newdcname)
+NTSTATUS rpccli_netlogon_getdcname(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx, const char *mydcname,
+ const char *domainname, fstring newdcname)
{
prs_struct qbuf, rbuf;
- NET_Q_GETANYDCNAME q;
- NET_R_GETANYDCNAME r;
- WERROR result;
+ NET_Q_GETDCNAME q;
+ NET_R_GETDCNAME r;
+ NTSTATUS result;
fstring mydcname_slash;
ZERO_STRUCT(q);
@@ -436,20 +436,20 @@ WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli,
/* Initialise input parameters */
slprintf(mydcname_slash, sizeof(fstring)-1, "\\\\%s", mydcname);
- init_net_q_getanydcname(&q, mydcname_slash, domainname);
+ init_net_q_getdcname(&q, mydcname_slash, domainname);
/* Marshall data and send request */
- CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_GETANYDCNAME,
+ CLI_DO_RPC(cli, mem_ctx, PI_NETLOGON, NET_GETDCNAME,
q, r,
qbuf, rbuf,
- net_io_q_getanydcname,
- net_io_r_getanydcname,
- WERR_GENERAL_FAILURE);
+ net_io_q_getdcname,
+ net_io_r_getdcname,
+ NT_STATUS_UNSUCCESSFUL);
result = r.status;
- if (W_ERROR_IS_OK(result)) {
+ if (NT_STATUS_IS_OK(result)) {
rpcstr_pull_unistr2_fstring(newdcname, &r.uni_dcname);
}
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
index 2f215dd938..20e4dea23c 100644
--- a/source3/rpc_parse/parse_net.c
+++ b/source3/rpc_parse/parse_net.c
@@ -480,12 +480,12 @@ BOOL net_io_r_logon_ctrl(const char *desc, NET_R_LOGON_CTRL *r_l, prs_struct *ps
}
/*******************************************************************
- Inits an NET_R_GETDCNAME structure.
+ Inits an NET_R_GETANYDCNAME structure.
********************************************************************/
-void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server,
- const char *domainname)
+void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server,
+ const char *domainname)
{
- DEBUG(5,("init_q_getdcname\n"));
+ DEBUG(5,("init_q_getanydcname\n"));
r_t->ptr_logon_server = (logon_server != NULL);
init_unistr2(&r_t->uni_logon_server, logon_server, UNI_STR_TERMINATE);
@@ -494,16 +494,16 @@ void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server,
}
/*******************************************************************
- Reads or writes an NET_Q_GETDCNAME structure.
+ Reads or writes an NET_Q_GETANYDCNAME structure.
********************************************************************/
-BOOL net_io_q_getdcname(const char *desc, NET_Q_GETDCNAME *r_t, prs_struct *ps,
- int depth)
+BOOL net_io_q_getanydcname(const char *desc, NET_Q_GETANYDCNAME *r_t, prs_struct *ps,
+ int depth)
{
if (r_t == NULL)
return False;
- prs_debug(ps, depth, desc, "net_io_q_getdcname");
+ prs_debug(ps, depth, desc, "net_io_q_getanydcname");
depth++;
if (!prs_uint32("ptr_logon_server", ps, depth, &r_t->ptr_logon_server))
@@ -528,26 +528,26 @@ BOOL net_io_q_getdcname(const char *desc, NET_Q_GETDCNAME *r_t, prs_struct *ps,
/*******************************************************************
- Inits an NET_R_GETDCNAME structure.
+ Inits an NET_R_GETANYDCNAME structure.
********************************************************************/
-void init_net_r_getdcname(NET_R_GETDCNAME *r_t, const char *dcname)
+void init_net_r_getanydcname(NET_R_GETANYDCNAME *r_t, const char *dcname)
{
- DEBUG(5,("init_r_getdcname\n"));
+ DEBUG(5,("init_r_getanydcname\n"));
init_unistr2(&r_t->uni_dcname, dcname, UNI_STR_TERMINATE);
}
/*******************************************************************
- Reads or writes an NET_R_GETDCNAME structure.
+ Reads or writes an NET_R_GETANYDCNAME structure.
********************************************************************/
-BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps,
- int depth)
+BOOL net_io_r_getanydcname(const char *desc, NET_R_GETANYDCNAME *r_t, prs_struct *ps,
+ int depth)
{
if (r_t == NULL)
return False;
- prs_debug(ps, depth, desc, "net_io_r_getdcname");
+ prs_debug(ps, depth, desc, "net_io_r_getanydcname");
depth++;
if (!prs_uint32("ptr_dcname", ps, depth, &r_t->ptr_dcname))
@@ -568,12 +568,12 @@ BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps,
/*******************************************************************
- Inits an NET_R_GETANYDCNAME structure.
+ Inits an NET_R_GETDCNAME structure.
********************************************************************/
-void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server,
- const char *domainname)
+void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server,
+ const char *domainname)
{
- DEBUG(5,("init_q_getanydcname\n"));
+ DEBUG(5,("init_q_getdcname\n"));
init_unistr2(&r_t->uni_logon_server, logon_server, UNI_STR_TERMINATE);
r_t->ptr_domainname = (domainname != NULL);
@@ -581,16 +581,16 @@ void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server,
}
/*******************************************************************
- Reads or writes an NET_Q_GETANYDCNAME structure.
+ Reads or writes an NET_Q_GETDCNAME structure.
********************************************************************/
-BOOL net_io_q_getanydcname(const char *desc, NET_Q_GETANYDCNAME *r_t, prs_struct *ps,
- int depth)
+BOOL net_io_q_getdcname(const char *desc, NET_Q_GETDCNAME *r_t, prs_struct *ps,
+ int depth)
{
if (r_t == NULL)
return False;
- prs_debug(ps, depth, desc, "net_io_q_getanydcname");
+ prs_debug(ps, depth, desc, "net_io_q_getdcname");
depth++;
if (!smb_io_unistr2("logon_server", &r_t->uni_logon_server,
@@ -612,26 +612,26 @@ BOOL net_io_q_getanydcname(const char *desc, NET_Q_GETANYDCNAME *r_t, prs_struct
/*******************************************************************
- Inits an NET_R_GETANYDCNAME structure.
+ Inits an NET_R_GETDCNAME structure.
********************************************************************/
-void init_net_r_getanydcname(NET_R_GETANYDCNAME *r_t, const char *dcname)
+void init_net_r_getdcname(NET_R_GETDCNAME *r_t, const char *dcname)
{
- DEBUG(5,("init_r_getanydcname\n"));
+ DEBUG(5,("init_r_getdcname\n"));
init_unistr2(&r_t->uni_dcname, dcname, UNI_STR_TERMINATE);
}
/*******************************************************************
- Reads or writes an NET_R_GETANYDCNAME structure.
+ Reads or writes an NET_R_GETDCNAME structure.
********************************************************************/
-BOOL net_io_r_getanydcname(const char *desc, NET_R_GETANYDCNAME *r_t, prs_struct *ps,
- int depth)
+BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps,
+ int depth)
{
if (r_t == NULL)
return False;
- prs_debug(ps, depth, desc, "net_io_r_getanydcname");
+ prs_debug(ps, depth, desc, "net_io_r_getdcname");
depth++;
if (!prs_uint32("ptr_dcname", ps, depth, &r_t->ptr_dcname))
@@ -644,7 +644,7 @@ BOOL net_io_r_getanydcname(const char *desc, NET_R_GETANYDCNAME *r_t, prs_struct
if (!prs_align(ps))
return False;
- if (!prs_werror("status", ps, depth, &r_t->status))
+ if (!prs_ntstatus("status", ps, depth, &r_t->status))
return False;
return True;
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 93d47eeb83..d78b7fc26e 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -45,9 +45,9 @@ static NTSTATUS cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli,
return result;
}
-static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx, int argc,
- const char **argv)
+static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx, int argc,
+ const char **argv)
{
fstring dcname;
WERROR result = WERR_GENERAL_FAILURE;
@@ -61,7 +61,7 @@ static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
/* Make sure to wait for our DC's reply */
old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */
- result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname);
+ result = rpccli_netlogon_getanydcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname);
cli_set_timeout(cli->cli, old_timeout);
@@ -76,27 +76,27 @@ static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
return result;
}
-static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx, int argc,
- const char **argv)
+static NTSTATUS cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx, int argc,
+ const char **argv)
{
fstring dcname;
- WERROR result = WERR_GENERAL_FAILURE;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
int old_timeout;
if (argc != 2) {
fprintf(stderr, "Usage: %s domainname\n", argv[0]);
- return WERR_OK;
+ return NT_STATUS_OK;
}
/* Make sure to wait for our DC's reply */
old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */
- result = rpccli_netlogon_getanydcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname);
+ result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname);
cli_set_timeout(cli->cli, old_timeout);
- if (!W_ERROR_IS_OK(result))
+ if (!NT_STATUS_IS_OK(result))
goto done;
/* Display results */
@@ -579,8 +579,8 @@ struct cmd_set netlogon_commands[] = {
{ "NETLOGON" },
{ "logonctrl2", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl2, NULL, PI_NETLOGON, NULL, "Logon Control 2", "" },
- { "getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getdcname, PI_NETLOGON, NULL, "Get trusted PDC name", "" },
{ "getanydcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getanydcname, PI_NETLOGON, NULL, "Get trusted DC name", "" },
+ { "getdcname", RPC_RTYPE_NTSTATUS, cmd_netlogon_getdcname, NULL, PI_NETLOGON, NULL, "Get trusted PDC name", "" },
{ "dsr_getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcname, PI_NETLOGON, NULL, "Get trusted DC name", "" },
{ "dsr_getdcnameex", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex, PI_NETLOGON, NULL, "Get trusted DC name", "" },
{ "dsr_getdcnameex2", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcnameex2, PI_NETLOGON, NULL, "Get trusted DC name", "" },