diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2009-06-12 12:38:22 +0200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-06-18 13:49:25 +1000 |
commit | efe6552f0c1b2cf7e7f95987e7c808667166a303 (patch) | |
tree | cae01772b8433e1ba5361cc0ce979a861c702742 /source4 | |
parent | f666da6940c2cc0c82419ec68b1a83bddfe680c9 (diff) | |
download | samba-efe6552f0c1b2cf7e7f95987e7c808667166a303.tar.gz samba-efe6552f0c1b2cf7e7f95987e7c808667166a303.tar.bz2 samba-efe6552f0c1b2cf7e7f95987e7c808667166a303.zip |
NETLOGON pipe improvements
Patch for bug #4939
This refactors the NETLOGON code related to this bug:
- Introduces a new "SYNCSTATE" enum required by the "DatabaseSync2" call (acc.
to WSPP)
- Make "DatabaseSync" dependant from "DatabaseSync2" (acc. to WSPP)
- Let "DatabaseSync2" return NT_STATUS_NOT_IMPLEMENTED (I'm not sure if this is
also true when a domain is running in mixed mode)
- Make "LogonControl" and "LogonControl2" dependant form "LogonControl2Ex"
(acc. to WSPP)
- Let "LogonControl2Ex" return WERR_NOT_SUPPORTED for now
Diffstat (limited to 'source4')
-rw-r--r-- | source4/rpc_server/netlogon/dcerpc_netlogon.c | 110 | ||||
-rw-r--r-- | source4/torture/rpc/netlogon.c | 4 |
2 files changed, 81 insertions, 33 deletions
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index 51849fc52e..dc2d078d6b 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -786,13 +786,40 @@ static NTSTATUS dcesrv_netr_DatabaseDeltas(struct dcesrv_call_state *dce_call, T /* + netr_DatabaseSync2 +*/ +static NTSTATUS dcesrv_netr_DatabaseSync2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct netr_DatabaseSync2 *r) +{ + /* win2k3 native mode returns "NOT IMPLEMENTED" for this call */ + return NT_STATUS_NOT_IMPLEMENTED; +} + + +/* netr_DatabaseSync */ static NTSTATUS dcesrv_netr_DatabaseSync(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct netr_DatabaseSync *r) { - /* win2k3 native mode returns "NOT IMPLEMENTED" for this call */ - return NT_STATUS_NOT_IMPLEMENTED; + struct netr_DatabaseSync2 r2; + NTSTATUS status; + + ZERO_STRUCT(r2); + + r2.in.logon_server = r->in.logon_server; + r2.in.computername = r->in.computername; + r2.in.credential = r->in.credential; + r2.in.database_id = r->in.database_id; + r2.in.restart_state = SYNCSTATE_NORMAL_STATE; + r2.in.sync_context = r->in.sync_context; + r2.out.sync_context = r->out.sync_context; + r2.out.delta_enum_array = r->out.delta_enum_array; + r2.in.preferredmaximumlength = r->in.preferredmaximumlength; + + status = dcesrv_netr_DatabaseSync2(dce_call, mem_ctx, &r2); + + return status; } @@ -863,31 +890,39 @@ static WERROR dcesrv_netr_GetDcName(struct dcesrv_call_state *dce_call, TALLOC_C /* - netr_LogonControl + netr_LogonControl2Ex */ -static WERROR dcesrv_netr_LogonControl(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct netr_LogonControl *r) +static WERROR dcesrv_netr_LogonControl2Ex(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct netr_LogonControl2Ex *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + return WERR_NOT_SUPPORTED; } /* - netr_GetAnyDCName + netr_LogonControl */ -static WERROR dcesrv_netr_GetAnyDCName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct netr_GetAnyDCName *r) +static WERROR dcesrv_netr_LogonControl(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct netr_LogonControl *r) { - struct netr_GetDcName r2; + struct netr_LogonControl2Ex r2; WERROR werr; - ZERO_STRUCT(r2); + if (r->in.level == 0x00000001) { + ZERO_STRUCT(r2); - r2.in.logon_server = r->in.logon_server; - r2.in.domainname = r->in.domainname; - r2.out.dcname = r->out.dcname; + r2.in.logon_server = r->in.logon_server; + r2.in.function_code = r->in.function_code; + r2.in.level = r->in.level; + r2.in.data = NULL; + r2.out.query = r->out.query; - werr = dcesrv_netr_GetDcName(dce_call, mem_ctx, &r2); + werr = dcesrv_netr_LogonControl2Ex(dce_call, mem_ctx, &r2); + } else if (r->in.level == 0x00000002) { + werr = WERR_NOT_SUPPORTED; + } else { + werr = WERR_UNKNOWN_LEVEL; + } return werr; } @@ -899,18 +934,41 @@ static WERROR dcesrv_netr_GetAnyDCName(struct dcesrv_call_state *dce_call, TALLO static WERROR dcesrv_netr_LogonControl2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct netr_LogonControl2 *r) { - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); + struct netr_LogonControl2Ex r2; + WERROR werr; + + ZERO_STRUCT(r2); + + r2.in.logon_server = r->in.logon_server; + r2.in.function_code = r->in.function_code; + r2.in.level = r->in.level; + r2.in.data = r->in.data; + r2.out.query = r->out.query; + + werr = dcesrv_netr_LogonControl2Ex(dce_call, mem_ctx, &r2); + + return werr; } /* - netr_DatabaseSync2 + netr_GetAnyDCName */ -static NTSTATUS dcesrv_netr_DatabaseSync2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct netr_DatabaseSync2 *r) +static WERROR dcesrv_netr_GetAnyDCName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, + struct netr_GetAnyDCName *r) { - /* win2k3 native mode returns "NOT IMPLEMENTED" for this call */ - return NT_STATUS_NOT_IMPLEMENTED; + struct netr_GetDcName r2; + WERROR werr; + + ZERO_STRUCT(r2); + + r2.in.logon_server = r->in.logon_server; + r2.in.domainname = r->in.domainname; + r2.out.dcname = r->out.dcname; + + werr = dcesrv_netr_GetDcName(dce_call, mem_ctx, &r2); + + return werr; } @@ -925,16 +983,6 @@ static NTSTATUS dcesrv_netr_DatabaseRedo(struct dcesrv_call_state *dce_call, TAL /* - netr_LogonControl2Ex -*/ -static WERROR dcesrv_netr_LogonControl2Ex(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct netr_LogonControl2Ex *r) -{ - DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR); -} - - -/* netr_NetrEnumerateTurstedDomains */ static WERROR dcesrv_netr_NetrEnumerateTrustedDomains(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 23443cc9d1..57bfcbfb7a 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -1491,12 +1491,12 @@ static bool test_LogonControl(struct torture_context *tctx, { NTSTATUS status; struct netr_LogonControl r; - union netr_CONTROL_QUERY_INFORMATION info; + union netr_CONTROL_QUERY_INFORMATION query; int i; r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.in.function_code = 1; - r.out.info = &info; + r.out.query = &query; for (i=1;i<4;i++) { r.in.level = i; |