diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-12-23 00:04:37 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2015-07-08 18:38:22 +0200 |
commit | 6f859f40b8186ed384cde15c0ae15ebfb5dbfde8 (patch) | |
tree | 82671f4165965492fd7d318e49e7243d2a72266f | |
parent | 03e846bc276ea532b5a31ca8c3043cd0e0c3d669 (diff) | |
download | samba-6f859f40b8186ed384cde15c0ae15ebfb5dbfde8.tar.gz |
s3:winbindd: add wb_irpc_LogonControl()
This can be called by the netlogon server to pass netr_LogonControl*()
to a winbindd child process in order to do the real work.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source3/winbindd/winbindd_irpc.c | 73 |
1 files changed, 72 insertions, 1 deletions
diff --git a/source3/winbindd/winbindd_irpc.c b/source3/winbindd/winbindd_irpc.c index aeaea71199a..a30f9bf52fd 100644 --- a/source3/winbindd/winbindd_irpc.c +++ b/source3/winbindd/winbindd_irpc.c @@ -153,9 +153,70 @@ static NTSTATUS wb_irpc_SamLogon(struct irpc_message *msg, domain, IRPC_CALL_TIMEOUT); } +static NTSTATUS wb_irpc_LogonControl(struct irpc_message *msg, + struct winbind_LogonControl *req) +{ + TALLOC_CTX *frame = talloc_stackframe(); + char *domain_name = NULL; + struct winbindd_domain *domain = NULL; + + DEBUG(5, ("wb_irpc_LogonControl called\n")); + + switch (req->in.function_code) { + case NETLOGON_CONTROL_REDISCOVER: + case NETLOGON_CONTROL_TC_QUERY: + case NETLOGON_CONTROL_CHANGE_PASSWORD: + case NETLOGON_CONTROL_TC_VERIFY: + if (req->in.data->domain == NULL) { + TALLOC_FREE(frame); + return NT_STATUS_INVALID_PARAMETER; + } + + domain_name = talloc_strdup(frame, req->in.data->domain); + if (domain_name == NULL) { + req->out.result = WERR_NOMEM; + TALLOC_FREE(frame); + return NT_STATUS_OK; + } + + break; + default: + TALLOC_FREE(frame); + return NT_STATUS_NOT_IMPLEMENTED; + } + + if (req->in.function_code == NETLOGON_CONTROL_REDISCOVER) { + char *p = NULL; + + /* + * NETLOGON_CONTROL_REDISCOVER + * get's an optional \dcname appended to the domain name + */ + p = strchr_m(domain_name, '\\'); + if (p != NULL) { + *p = '\0'; + } + } + + domain = find_domain_from_name_noinit(domain_name); + if (domain == NULL) { + req->out.result = WERR_NO_SUCH_DOMAIN; + TALLOC_FREE(frame); + return NT_STATUS_OK; + } + + TALLOC_FREE(frame); + return wb_irpc_forward_rpc_call(msg, msg, + winbind_event_context(), + req, NDR_WINBIND_LOGONCONTROL, + "winbind_LogonControl", + domain, 45 /* timeout */); +} + NTSTATUS wb_irpc_register(void) { NTSTATUS status; + status = IRPC_REGISTER(winbind_imessaging_context(), winbind, WINBIND_DSRUPDATEREADONLYSERVERDNSRECORDS, wb_irpc_DsrUpdateReadOnlyServerDnsRecords, NULL); if (!NT_STATUS_IS_OK(status)) { @@ -163,5 +224,15 @@ NTSTATUS wb_irpc_register(void) } status = IRPC_REGISTER(winbind_imessaging_context(), winbind, WINBIND_SAMLOGON, wb_irpc_SamLogon, NULL); - return status; + if (!NT_STATUS_IS_OK(status)) { + return status; + } + status = IRPC_REGISTER(winbind_imessaging_context(), winbind, + WINBIND_LOGONCONTROL, + wb_irpc_LogonControl, NULL); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return NT_STATUS_OK; } |