diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-01-30 19:02:16 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2014-02-13 11:54:14 +0100 |
commit | 7fd9ee632e53e6c901aa8e38d11aeda09c2075c8 (patch) | |
tree | 001c58f5fcf4dce4da9df27844ac304233414a78 /source4 | |
parent | 16b56d7726f419ec2ec831f90f9e1b26e30d4543 (diff) | |
download | samba-7fd9ee632e53e6c901aa8e38d11aeda09c2075c8.tar.gz samba-7fd9ee632e53e6c901aa8e38d11aeda09c2075c8.tar.xz samba-7fd9ee632e53e6c901aa8e38d11aeda09c2075c8.zip |
s4:rpc_server/spoolss: use dcerpc_parse_binding() to create the notify binding
This is much better than creating the binding by hand.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/rpc_server/spoolss/dcesrv_spoolss.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c b/source4/rpc_server/spoolss/dcesrv_spoolss.c index cb892a6cb51..14929764e4d 100644 --- a/source4/rpc_server/spoolss/dcesrv_spoolss.c +++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c @@ -1156,6 +1156,7 @@ static WERROR dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_ struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r) { struct dcerpc_pipe *p; + char *binding_string; struct dcerpc_binding *binding; NTSTATUS status; struct spoolss_ReplyOpenPrinter rop; @@ -1171,12 +1172,20 @@ static WERROR dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_ * and the torture suite passing */ - binding = talloc_zero(mem_ctx, struct dcerpc_binding); - - binding->transport = NCACN_NP; - if (strncmp(r->in.local_machine, "\\\\", 2)) + if (strncmp(r->in.local_machine, "\\\\", 2)) { return WERR_INVALID_COMPUTERNAME; - binding->host = r->in.local_machine+2; + } + + binding_string = talloc_asprintf(mem_ctx, "ncacn_np:%s", + r->in.local_machine+2); + if (binding_string == NULL) { + return WERR_NOMEM; + } + + status = dcerpc_parse_binding(mem_ctx, binding_string, &binding); + if (!NT_STATUS_IS_OK(status)) { + return ntstatus_to_werror(status); + } creds = cli_credentials_init_anon(mem_ctx); /* FIXME: Use machine credentials instead ? */ |