s3-netlogon: use WERRORs in NETLOGON_INFO structures.
authorGünther Deschner <gd@samba.org>
Wed, 2 Sep 2009 13:29:44 +0000 (15:29 +0200)
committerGünther Deschner <gd@samba.org>
Wed, 2 Sep 2009 13:29:44 +0000 (15:29 +0200)
Guenther

librpc/gen_ndr/ndr_netlogon.c
librpc/gen_ndr/netlogon.h
librpc/idl/netlogon.idl
source3/rpc_server/srv_netlog_nt.c

index 46247b499883ca2491174e80c5ad2fa51ac4bc97..7337d2697a5684a7c10bbe5861e5be08d4b0c9e0 100644 (file)
@@ -5627,7 +5627,7 @@ static enum ndr_err_code ndr_push_netr_NETLOGON_INFO_1(struct ndr_push *ndr, int
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
                NDR_CHECK(ndr_push_netr_InfoFlags(ndr, NDR_SCALARS, r->flags));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pdc_connection_status));
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->pdc_connection_status));
        }
        if (ndr_flags & NDR_BUFFERS) {
        }
@@ -5639,7 +5639,7 @@ static enum ndr_err_code ndr_pull_netr_NETLOGON_INFO_1(struct ndr_pull *ndr, int
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_pull_align(ndr, 4));
                NDR_CHECK(ndr_pull_netr_InfoFlags(ndr, NDR_SCALARS, &r->flags));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pdc_connection_status));
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->pdc_connection_status));
        }
        if (ndr_flags & NDR_BUFFERS) {
        }
@@ -5651,7 +5651,7 @@ _PUBLIC_ void ndr_print_netr_NETLOGON_INFO_1(struct ndr_print *ndr, const char *
        ndr_print_struct(ndr, name, "netr_NETLOGON_INFO_1");
        ndr->depth++;
        ndr_print_netr_InfoFlags(ndr, "flags", r->flags);
-       ndr_print_uint32(ndr, "pdc_connection_status", r->pdc_connection_status);
+       ndr_print_WERROR(ndr, "pdc_connection_status", r->pdc_connection_status);
        ndr->depth--;
 }
 
@@ -5660,9 +5660,9 @@ static enum ndr_err_code ndr_push_netr_NETLOGON_INFO_2(struct ndr_push *ndr, int
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
                NDR_CHECK(ndr_push_netr_InfoFlags(ndr, NDR_SCALARS, r->flags));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pdc_connection_status));
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->pdc_connection_status));
                NDR_CHECK(ndr_push_unique_ptr(ndr, r->trusted_dc_name));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->tc_connection_status));
+               NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->tc_connection_status));
        }
        if (ndr_flags & NDR_BUFFERS) {
                if (r->trusted_dc_name) {
@@ -5682,14 +5682,14 @@ static enum ndr_err_code ndr_pull_netr_NETLOGON_INFO_2(struct ndr_pull *ndr, int
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_pull_align(ndr, 4));
                NDR_CHECK(ndr_pull_netr_InfoFlags(ndr, NDR_SCALARS, &r->flags));
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pdc_connection_status));
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->pdc_connection_status));
                NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_trusted_dc_name));
                if (_ptr_trusted_dc_name) {
                        NDR_PULL_ALLOC(ndr, r->trusted_dc_name);
                } else {
                        r->trusted_dc_name = NULL;
                }
-               NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->tc_connection_status));
+               NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->tc_connection_status));
        }
        if (ndr_flags & NDR_BUFFERS) {
                if (r->trusted_dc_name) {
@@ -5713,14 +5713,14 @@ _PUBLIC_ void ndr_print_netr_NETLOGON_INFO_2(struct ndr_print *ndr, const char *
        ndr_print_struct(ndr, name, "netr_NETLOGON_INFO_2");
        ndr->depth++;
        ndr_print_netr_InfoFlags(ndr, "flags", r->flags);
-       ndr_print_uint32(ndr, "pdc_connection_status", r->pdc_connection_status);
+       ndr_print_WERROR(ndr, "pdc_connection_status", r->pdc_connection_status);
        ndr_print_ptr(ndr, "trusted_dc_name", r->trusted_dc_name);
        ndr->depth++;
        if (r->trusted_dc_name) {
                ndr_print_string(ndr, "trusted_dc_name", r->trusted_dc_name);
        }
        ndr->depth--;
-       ndr_print_uint32(ndr, "tc_connection_status", r->tc_connection_status);
+       ndr_print_WERROR(ndr, "tc_connection_status", r->tc_connection_status);
        ndr->depth--;
 }
 
index b3cf3f35cf772ab97d349db78271faeae6ac0718..931222f27c866de7f0f3d4e63bafaa676b5e5c15 100644 (file)
@@ -656,14 +656,14 @@ struct netr_AccountBuffer {
 
 struct netr_NETLOGON_INFO_1 {
        uint32_t flags;
-       uint32_t pdc_connection_status;
+       WERROR pdc_connection_status;
 };
 
 struct netr_NETLOGON_INFO_2 {
        uint32_t flags;
-       uint32_t pdc_connection_status;
+       WERROR pdc_connection_status;
        const char *trusted_dc_name;/* [unique,charset(UTF16)] */
-       uint32_t tc_connection_status;
+       WERROR tc_connection_status;
 };
 
 struct netr_NETLOGON_INFO_3 {
index cec686b5380bdeceee86424ed27e58547462b4ab..736a0fd9e46cefc10be7e2c95ff7929ded5f7e8d 100644 (file)
@@ -843,14 +843,14 @@ interface netlogon
 
        typedef struct {
                netr_InfoFlags flags;
-               uint32 pdc_connection_status;
+               WERROR pdc_connection_status;
        } netr_NETLOGON_INFO_1;
 
        typedef struct {
                netr_InfoFlags flags;
-               uint32 pdc_connection_status;
+               WERROR pdc_connection_status;
                [string,charset(UTF16)] uint16 *trusted_dc_name;
-               uint32 tc_connection_status;
+               WERROR tc_connection_status;
        } netr_NETLOGON_INFO_2;
 
        typedef struct {
index 0b476e1cae7ed7853d10fd9e58100e74cb3c9604..f21c80e327013d9d5fb1c58aaa95d9e50abe42eb 100644 (file)
@@ -38,46 +38,6 @@ struct netlogon_server_pipe_state {
        struct netr_Credential server_challenge;
 };
 
-/*******************************************************************
- Inits a netr_NETLOGON_INFO_1 structure.
-********************************************************************/
-
-static void init_netlogon_info1(struct netr_NETLOGON_INFO_1 *r,
-                               uint32_t flags,
-                               uint32_t pdc_connection_status)
-{
-       r->flags = flags;
-       r->pdc_connection_status = pdc_connection_status;
-}
-
-/*******************************************************************
- Inits a netr_NETLOGON_INFO_2 structure.
-********************************************************************/
-
-static void init_netlogon_info2(struct netr_NETLOGON_INFO_2 *r,
-                               uint32_t flags,
-                               uint32_t pdc_connection_status,
-                               const char *trusted_dc_name,
-                               uint32_t tc_connection_status)
-{
-       r->flags = flags;
-       r->pdc_connection_status = pdc_connection_status;
-       r->trusted_dc_name = trusted_dc_name;
-       r->tc_connection_status = tc_connection_status;
-}
-
-/*******************************************************************
- Inits a netr_NETLOGON_INFO_3 structure.
-********************************************************************/
-
-static void init_netlogon_info3(struct netr_NETLOGON_INFO_3 *r,
-                               uint32_t flags,
-                               uint32_t logon_attempts)
-{
-       r->flags = flags;
-       r->logon_attempts = logon_attempts;
-}
-
 /*************************************************************************
  _netr_LogonControl
  *************************************************************************/
@@ -141,10 +101,10 @@ WERROR _netr_LogonControl2(pipes_struct *p,
 WERROR _netr_LogonControl2Ex(pipes_struct *p,
                             struct netr_LogonControl2Ex *r)
 {
-        uint32 flags = 0x0;
-        uint32 pdc_connection_status = 0x0;
-        uint32 logon_attempts = 0x0;
-        uint32 tc_status;
+       uint32_t flags = 0x0;
+       WERROR pdc_connection_status = WERR_OK;
+       uint32_t logon_attempts = 0x0;
+       WERROR tc_status;
        fstring dc_name2;
        const char *dc_name = NULL;
        struct sockaddr_storage dc_ss;
@@ -168,7 +128,7 @@ WERROR _netr_LogonControl2Ex(pipes_struct *p,
                        return WERR_INVALID_PARAM;
        }
 
-       tc_status = W_ERROR_V(WERR_NO_SUCH_DOMAIN);
+       tc_status = WERR_NO_SUCH_DOMAIN;
 
        switch (r->in.function_code) {
                case NETLOGON_CONTROL_TC_QUERY:
@@ -178,7 +138,7 @@ WERROR _netr_LogonControl2Ex(pipes_struct *p,
                                break;
 
                        if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) {
-                               tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS);
+                               tc_status = WERR_NO_LOGON_SERVERS;
                                break;
                        }
 
@@ -187,7 +147,7 @@ WERROR _netr_LogonControl2Ex(pipes_struct *p,
                                return WERR_NOMEM;
                        }
 
-                       tc_status = W_ERROR_V(WERR_OK);
+                       tc_status = WERR_OK;
 
                        break;
 
@@ -198,7 +158,7 @@ WERROR _netr_LogonControl2Ex(pipes_struct *p,
                                break;
 
                        if ( !get_dc_name( domain, NULL, dc_name2, &dc_ss ) ) {
-                               tc_status = W_ERROR_V(WERR_NO_LOGON_SERVERS);
+                               tc_status = WERR_NO_LOGON_SERVERS;
                                break;
                        }
 
@@ -207,7 +167,7 @@ WERROR _netr_LogonControl2Ex(pipes_struct *p,
                                return WERR_NOMEM;
                        }
 
-                       tc_status = W_ERROR_V(WERR_OK);
+                       tc_status = WERR_OK;
 
                        break;
 
@@ -225,29 +185,29 @@ WERROR _netr_LogonControl2Ex(pipes_struct *p,
                        info1 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_1);
                        W_ERROR_HAVE_NO_MEMORY(info1);
 
-                       init_netlogon_info1(info1,
-                                           flags,
-                                           pdc_connection_status);
+                       info1->flags                    = flags;
+                       info1->pdc_connection_status    = pdc_connection_status;
+
                        r->out.query->info1 = info1;
                        break;
                case 2:
                        info2 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_2);
                        W_ERROR_HAVE_NO_MEMORY(info2);
 
-                       init_netlogon_info2(info2,
-                                           flags,
-                                           pdc_connection_status,
-                                           dc_name,
-                                           tc_status);
+                       info2->flags                    = flags;
+                       info2->pdc_connection_status    = pdc_connection_status;
+                       info2->trusted_dc_name          = dc_name;
+                       info2->tc_connection_status     = tc_status;
+
                        r->out.query->info2 = info2;
                        break;
                case 3:
                        info3 = TALLOC_ZERO_P(p->mem_ctx, struct netr_NETLOGON_INFO_3);
                        W_ERROR_HAVE_NO_MEMORY(info3);
 
-                       init_netlogon_info3(info3,
-                                           flags,
-                                           logon_attempts);
+                       info3->flags                    = flags;
+                       info3->logon_attempts           = logon_attempts;
+
                        r->out.query->info3 = info3;
                        break;
                default: