The branch, v3-2-test has been updated
       via  a495e0e7c1eb91dd700a7d0fe9832fd0811cb2bb (commit)
       via  8abeea9922ac09e7307730ee7695453718356873 (commit)
      from  ac8db3d29bf3f99a492b8265a64430538c8c1cc4 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit a495e0e7c1eb91dd700a7d0fe9832fd0811cb2bb
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Thu Feb 7 10:28:56 2008 +0100

    Remove unused marshalling for NET_GETANYDCNAME and NET_GETANYDCNAME.
    
    Guenther

commit 8abeea9922ac09e7307730ee7695453718356873
Author: Günther Deschner <[EMAIL PROTECTED]>
Date:   Thu Feb 7 10:24:18 2008 +0100

    Use rpccli_netr_GetAnyDCName and rpccli_netr_GetDCName everywhere.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/include/rpc_netlogon.h    |   34 --------
 source/rpc_client/cli_netlogon.c |   78 -----------------
 source/rpc_parse/parse_net.c     |  171 --------------------------------------
 source/rpcclient/cmd_netlogon.c  |   52 ++++++++----
 source/winbindd/winbindd_cm.c    |   30 ++++---
 source/winbindd/winbindd_misc.c  |   30 +++++--
 6 files changed, 72 insertions(+), 323 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/rpc_netlogon.h b/source/include/rpc_netlogon.h
index 244e37d..362ff5f 100644
--- a/source/include/rpc_netlogon.h
+++ b/source/include/rpc_netlogon.h
@@ -398,40 +398,6 @@ typedef struct net_r_logon_ctrl2_info {
        NTSTATUS status; /* return code */
 } NET_R_LOGON_CTRL2;
 
-/* NET_Q_GETANYDCNAME - Ask a DC for a trusted DC name */
-
-typedef struct net_q_getanydcname {
-       uint32  ptr_logon_server;
-       UNISTR2 uni_logon_server;
-       uint32  ptr_domainname;
-       UNISTR2 uni_domainname;
-} NET_Q_GETANYDCNAME;
-
-/* NET_R_GETANYDCNAME - Ask a DC for a trusted DC name */
-
-typedef struct net_r_getanydcname {
-       uint32  ptr_dcname;
-       UNISTR2 uni_dcname;
-       WERROR status;
-} NET_R_GETANYDCNAME;
-
-
-/* NET_Q_GETDCNAME - Ask a DC for a trusted DC name */
-
-typedef struct net_q_getdcname {
-       UNISTR2 uni_logon_server;
-       uint32  ptr_domainname;
-       UNISTR2 uni_domainname;
-} NET_Q_GETDCNAME;
-
-/* NET_R_GETDCNAME - Ask a DC for a trusted DC name */
-
-typedef struct net_r_getdcname {
-       uint32  ptr_dcname;
-       UNISTR2 uni_dcname;
-       WERROR status;
-} NET_R_GETDCNAME;
-
 /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
 typedef struct net_q_trust_dom_info {
        uint32       ptr;             /* undocumented buffer pointer */
diff --git a/source/rpc_client/cli_netlogon.c b/source/rpc_client/cli_netlogon.c
index 54c6c7f..33c0e41 100644
--- a/source/rpc_client/cli_netlogon.c
+++ b/source/rpc_client/cli_netlogon.c
@@ -379,84 +379,6 @@ NTSTATUS rpccli_netlogon_logon_ctrl2(struct 
rpc_pipe_client *cli, TALLOC_CTX *me
        return result;
 }
 
-/* GetAnyDCName */
-
-WERROR rpccli_netlogon_getanydcname(struct rpc_pipe_client *cli,
-                                   TALLOC_CTX *mem_ctx, const char *mydcname,
-                                   const char *domainname, char **newdcname)
-{
-       prs_struct qbuf, rbuf;
-       NET_Q_GETANYDCNAME q;
-       NET_R_GETANYDCNAME r;
-       WERROR result;
-       fstring mydcname_slash;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Initialise input parameters */
-
-       slprintf(mydcname_slash, sizeof(fstring)-1, "\\\\%s", mydcname);
-       init_net_q_getanydcname(&q, mydcname_slash, domainname);
-
-       /* Marshall data and send request */
-
-       CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_GETANYDCNAME,
-               q, r,
-               qbuf, rbuf,
-               net_io_q_getanydcname,
-               net_io_r_getanydcname,
-               WERR_GENERAL_FAILURE);
-
-       result = r.status;
-
-       if (W_ERROR_IS_OK(result) && newdcname) {
-               *newdcname = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dcname);
-               W_ERROR_HAVE_NO_MEMORY(*newdcname);
-       }
-
-       return result;
-}
-
-/* GetDCName */
-
-WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli,
-                                TALLOC_CTX *mem_ctx, const char *mydcname,
-                                const char *domainname, char **newdcname)
-{
-       prs_struct qbuf, rbuf;
-       NET_Q_GETDCNAME q;
-       NET_R_GETDCNAME r;
-       WERROR result;
-       fstring mydcname_slash;
-
-       ZERO_STRUCT(q);
-       ZERO_STRUCT(r);
-
-       /* Initialise input parameters */
-
-       slprintf(mydcname_slash, sizeof(fstring)-1, "\\\\%s", mydcname);
-       init_net_q_getdcname(&q, mydcname_slash, domainname);
-
-       /* Marshall data and send request */
-
-       CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_GETDCNAME,
-               q, r,
-               qbuf, rbuf,
-               net_io_q_getdcname,
-               net_io_r_getdcname,
-               WERR_GENERAL_FAILURE);
-
-       result = r.status;
-
-       if (W_ERROR_IS_OK(result) && newdcname) {
-               *newdcname = rpcstr_pull_unistr2_talloc(mem_ctx, &r.uni_dcname);
-               W_ERROR_HAVE_NO_MEMORY(*newdcname);
-       }
-
-       return result;
-}
-
 static WERROR pull_domain_controller_info_from_getdcname_reply(TALLOC_CTX 
*mem_ctx,
                                                               struct 
DS_DOMAIN_CONTROLLER_INFO **info_out, 
                                                               
NET_R_DSR_GETDCNAME *r)
diff --git a/source/rpc_parse/parse_net.c b/source/rpc_parse/parse_net.c
index d6a99b8..8eeefb6 100644
--- a/source/rpc_parse/parse_net.c
+++ b/source/rpc_parse/parse_net.c
@@ -479,177 +479,6 @@ bool net_io_r_logon_ctrl(const char *desc, 
NET_R_LOGON_CTRL *r_l, prs_struct *ps
 }
 
 /*******************************************************************
- Inits an NET_R_GETANYDCNAME structure.
-********************************************************************/
-void init_net_q_getanydcname(NET_Q_GETANYDCNAME *r_t, const char *logon_server,
-                            const char *domainname)
-{
-       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);
-       r_t->ptr_domainname = (domainname != NULL);
-       init_unistr2(&r_t->uni_domainname, domainname, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_GETANYDCNAME structure.
-********************************************************************/
-
-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_getanydcname");
-       depth++;
-
-       if (!prs_uint32("ptr_logon_server", ps, depth, &r_t->ptr_logon_server))
-               return False;
-
-       if (!smb_io_unistr2("logon_server", &r_t->uni_logon_server,
-                           r_t->ptr_logon_server, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr_domainname", ps, depth, &r_t->ptr_domainname))
-               return False;
-
-       if (!smb_io_unistr2("domainname", &r_t->uni_domainname,
-                           r_t->ptr_domainname, ps, depth))
-               return False;
-
-       return True;
-}
-
-
-/*******************************************************************
- Inits an NET_R_GETANYDCNAME structure.
-********************************************************************/
-void init_net_r_getanydcname(NET_R_GETANYDCNAME *r_t, const char *dcname)
-{
-       DEBUG(5,("init_r_getanydcname\n"));
-
-       init_unistr2(&r_t->uni_dcname, dcname, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_R_GETANYDCNAME structure.
-********************************************************************/
-
-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_getanydcname");
-       depth++;
-
-       if (!prs_uint32("ptr_dcname", ps, depth, &r_t->ptr_dcname))
-               return False;
-
-       if (!smb_io_unistr2("dcname", &r_t->uni_dcname,
-                           r_t->ptr_dcname, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_werror("status", ps, depth, &r_t->status))
-               return False;
-
-       return True;
-}
-
-
-/*******************************************************************
- Inits an NET_R_GETDCNAME structure.
-********************************************************************/
-void init_net_q_getdcname(NET_Q_GETDCNAME *r_t, const char *logon_server,
-                         const char *domainname)
-{
-       DEBUG(5,("init_q_getdcname\n"));
-
-       init_unistr2(&r_t->uni_logon_server, logon_server, UNI_STR_TERMINATE);
-       r_t->ptr_domainname = (domainname != NULL);
-       init_unistr2(&r_t->uni_domainname, domainname, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_Q_GETDCNAME structure.
-********************************************************************/
-
-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_getdcname");
-       depth++;
-
-       if (!smb_io_unistr2("logon_server", &r_t->uni_logon_server,
-                           1, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_uint32("ptr_domainname", ps, depth, &r_t->ptr_domainname))
-               return False;
-
-       if (!smb_io_unistr2("domainname", &r_t->uni_domainname,
-                           r_t->ptr_domainname, ps, depth))
-               return False;
-
-       return True;
-}
-
-
-/*******************************************************************
- Inits an NET_R_GETDCNAME structure.
-********************************************************************/
-void init_net_r_getdcname(NET_R_GETDCNAME *r_t, const char *dcname)
-{
-       DEBUG(5,("init_r_getdcname\n"));
-
-       init_unistr2(&r_t->uni_dcname, dcname, UNI_STR_TERMINATE);
-}
-
-/*******************************************************************
- Reads or writes an NET_R_GETDCNAME structure.
-********************************************************************/
-
-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_getdcname");
-       depth++;
-
-       if (!prs_uint32("ptr_dcname", ps, depth, &r_t->ptr_dcname))
-               return False;
-
-       if (!smb_io_unistr2("dcname", &r_t->uni_dcname,
-                           r_t->ptr_dcname, ps, depth))
-               return False;
-
-       if (!prs_align(ps))
-               return False;
-
-       if (!prs_werror("status", ps, depth, &r_t->status))
-               return False;
-
-       return True;
-}
-
-/*******************************************************************
  Inits an NET_R_TRUST_DOM_LIST structure.
 ********************************************************************/
 
diff --git a/source/rpcclient/cmd_netlogon.c b/source/rpcclient/cmd_netlogon.c
index aad538a..e1d13d3 100644
--- a/source/rpcclient/cmd_netlogon.c
+++ b/source/rpcclient/cmd_netlogon.c
@@ -48,8 +48,9 @@ static WERROR cmd_netlogon_getanydcname(struct 
rpc_pipe_client *cli,
                                        TALLOC_CTX *mem_ctx, int argc, 
                                        const char **argv)
 {
-       char *dcname = NULL;
-       WERROR result = WERR_GENERAL_FAILURE;
+       const char *dcname = NULL;
+       WERROR werr;
+       NTSTATUS status;
        int old_timeout;
 
        if (argc != 2) {
@@ -60,27 +61,35 @@ static WERROR cmd_netlogon_getanydcname(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_getanydcname(cli, mem_ctx, cli->cli->desthost, 
argv[1], &dcname);
-
+       status = rpccli_netr_GetAnyDCName(cli, mem_ctx,
+                                         cli->cli->desthost,
+                                         argv[1],
+                                         &dcname,
+                                         &werr);
        cli_set_timeout(cli->cli, old_timeout);
 
-       if (!W_ERROR_IS_OK(result))
-               goto done;
+       if (!NT_STATUS_IS_OK(status)) {
+               return ntstatus_to_werror(status);
+       }
+
+       if (!W_ERROR_IS_OK(werr)) {
+               return werr;
+       }
 
        /* Display results */
 
        printf("%s\n", dcname);
 
- done:
-       return result;
+       return werr;
 }
 
-static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli, 
-                                    TALLOC_CTX *mem_ctx, int argc, 
+static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
+                                    TALLOC_CTX *mem_ctx, int argc,
                                     const char **argv)
 {
-       char *dcname = NULL;
-       WERROR result = WERR_GENERAL_FAILURE;
+       const char *dcname = NULL;
+       NTSTATUS status;
+       WERROR werr;
        int old_timeout;
 
        if (argc != 2) {
@@ -91,19 +100,26 @@ 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);
-
+       status = rpccli_netr_GetDcName(cli, mem_ctx,
+                                      cli->cli->desthost,
+                                      argv[1],
+                                      &dcname,
+                                      &werr);
        cli_set_timeout(cli->cli, old_timeout);
 
-       if (!W_ERROR_IS_OK(result))
-               goto done;
+       if (!NT_STATUS_IS_OK(status)) {
+               return ntstatus_to_werror(status);
+       }
+
+       if (!W_ERROR_IS_OK(werr)) {
+               return werr;
+       }
 
        /* Display results */
 
        printf("%s\n", dcname);
 
- done:
-       return result;
+       return werr;
 }
 
 static WERROR cmd_netlogon_dsr_getdcname(struct rpc_pipe_client *cli,
diff --git a/source/winbindd/winbindd_cm.c b/source/winbindd/winbindd_cm.c
index 7bc449c..17afd1e 100644
--- a/source/winbindd/winbindd_cm.c
+++ b/source/winbindd/winbindd_cm.c
@@ -570,8 +570,8 @@ static bool get_dc_name_via_netlogon(struct winbindd_domain 
*domain,
        WERROR werr;
        TALLOC_CTX *mem_ctx;
        unsigned int orig_timeout;
-       char *tmp = NULL;
-       char *p;
+       const char *tmp = NULL;
+       const char *p;
 
        /* Hmmmm. We can only open one connection to the NETLOGON pipe at the
         * moment.... */
@@ -630,25 +630,31 @@ static bool get_dc_name_via_netlogon(struct 
winbindd_domain *domain,
                        }
                }
        } else {
-
-               werr = rpccli_netlogon_getanydcname(netlogon_pipe,
-                                                   mem_ctx,
-                                                   our_domain->dcname,
-                                                   domain->name,
-                                                   &tmp);
+               result = rpccli_netr_GetAnyDCName(netlogon_pipe, mem_ctx,
+                                                 our_domain->dcname,
+                                                 domain->name,
+                                                 &tmp,
+                                                 &werr);
        }
 
        /* And restore our original timeout. */
        cli_set_timeout(netlogon_pipe->cli, orig_timeout);
 
+       if (!NT_STATUS_IS_OK(result)) {
+               DEBUG(10,("rpccli_netr_GetAnyDCName failed: %s\n",
+                       nt_errstr(result)));
+               talloc_destroy(mem_ctx);
+               return false;
+       }
+
        if (!W_ERROR_IS_OK(werr)) {
-               DEBUG(10, ("rpccli_netlogon_getanydcname failed: %s\n",
+               DEBUG(10,("rpccli_netr_GetAnyDCName failed: %s\n",
                           dos_errstr(werr)));
                talloc_destroy(mem_ctx);
-               return False;
+               return false;
        }
 
-       /* cli_netlogon_getanydcname gives us a name with \\ */
+       /* rpccli_netr_GetAnyDCName gives us a name with \\ */
        p = tmp;
        if (*p == '\\') {
                p+=1;
@@ -661,7 +667,7 @@ static bool get_dc_name_via_netlogon(struct winbindd_domain 
*domain,
 
        talloc_destroy(mem_ctx);
 
-       DEBUG(10, ("rpccli_netlogon_getanydcname returned %s\n", dcname));
+       DEBUG(10,("rpccli_netr_GetAnyDCName returned %s\n", dcname));
 
        if (!resolve_name(dcname, dc_ss, 0x20)) {
                return False;
diff --git a/source/winbindd/winbindd_misc.c b/source/winbindd/winbindd_misc.c
index 76f2554..c22da3e 100644
--- a/source/winbindd/winbindd_misc.c
+++ b/source/winbindd/winbindd_misc.c
@@ -231,8 +231,8 @@ void winbindd_getdcname(struct winbindd_cli_state *state)
 enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain,
                                             struct winbindd_cli_state *state)
 {
-       char *dcname_slash = NULL;
-       char *p;
+       const char *dcname_slash = NULL;
+       const char *p;
        struct rpc_pipe_client *netlogon_pipe;
        NTSTATUS result;
        WERROR werr;
@@ -259,19 +259,29 @@ enum winbindd_result winbindd_dual_getdcname(struct 
winbindd_domain *domain,
 
        req_domain = find_domain_from_name_noinit(state->request.domain_name);
        if (req_domain == domain) {
-               werr = rpccli_netlogon_getdcname(netlogon_pipe, state->mem_ctx,
-                                                domain->dcname,
-                                                state->request.domain_name,
-                                                &dcname_slash);
+               result = rpccli_netr_GetDcName(netlogon_pipe,


-- 
Samba Shared Repository

Reply via email to