diff options
author | Günther Deschner <gd@samba.org> | 2009-09-02 15:29:44 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-09-02 15:29:44 +0200 |
commit | a0b1968167c36c345711a98c65c3974590b1ce6a (patch) | |
tree | aae8b1640a0b45c2c4886df307c8e1cb297b16cc | |
parent | 6657598168724d4fe076f9014c2b5c16a034fe52 (diff) | |
download | samba-a0b1968167c36c345711a98c65c3974590b1ce6a.tar.gz samba-a0b1968167c36c345711a98c65c3974590b1ce6a.tar.bz2 samba-a0b1968167c36c345711a98c65c3974590b1ce6a.zip |
s3-netlogon: use WERRORs in NETLOGON_INFO structures.
Guenther
-rw-r--r-- | librpc/gen_ndr/ndr_netlogon.c | 18 | ||||
-rw-r--r-- | librpc/gen_ndr/netlogon.h | 6 | ||||
-rw-r--r-- | librpc/idl/netlogon.idl | 6 | ||||
-rw-r--r-- | source3/rpc_server/srv_netlog_nt.c | 80 |
4 files changed, 35 insertions, 75 deletions
diff --git a/librpc/gen_ndr/ndr_netlogon.c b/librpc/gen_ndr/ndr_netlogon.c index 46247b4998..7337d2697a 100644 --- a/librpc/gen_ndr/ndr_netlogon.c +++ b/librpc/gen_ndr/ndr_netlogon.c @@ -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--; } diff --git a/librpc/gen_ndr/netlogon.h b/librpc/gen_ndr/netlogon.h index b3cf3f35cf..931222f27c 100644 --- a/librpc/gen_ndr/netlogon.h +++ b/librpc/gen_ndr/netlogon.h @@ -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 { diff --git a/librpc/idl/netlogon.idl b/librpc/idl/netlogon.idl index cec686b538..736a0fd9e4 100644 --- a/librpc/idl/netlogon.idl +++ b/librpc/idl/netlogon.idl @@ -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 { diff --git a/source3/rpc_server/srv_netlog_nt.c b/source3/rpc_server/srv_netlog_nt.c index 0b476e1cae..f21c80e327 100644 --- a/source3/rpc_server/srv_netlog_nt.c +++ b/source3/rpc_server/srv_netlog_nt.c @@ -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: |