diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-18 05:01:10 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-18 05:01:10 +0000 |
commit | 9b7b5e5c516155d9606cc92bd22a958a8435ef48 (patch) | |
tree | bf528139415fa9b6588f5f35e30ee2e10aa69c3c /source4/librpc/rpc | |
parent | c88b0b2bb2c3c41b7e51db4b4dd6c1423af86de8 (diff) | |
download | samba-9b7b5e5c516155d9606cc92bd22a958a8435ef48.tar.gz samba-9b7b5e5c516155d9606cc92bd22a958a8435ef48.tar.bz2 samba-9b7b5e5c516155d9606cc92bd22a958a8435ef48.zip |
use the auto-generated UUID, version and name rather than listing them
in the dcerpc core code
(This used to be commit 16ffeb7c80bfe7f1bfbfce8c98066e9ddbca7686)
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 53 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 3 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc_smb.c | 7 |
3 files changed, 23 insertions, 40 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index aa8b8520f3..aeeee092ce 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -560,7 +560,9 @@ NTSTATUS dcerpc_bind(struct dcerpc_pipe *p, return status; } - if (pkt.hdr.ptype != DCERPC_PKT_BIND_ACK) { + if (pkt.hdr.ptype != DCERPC_PKT_BIND_ACK || + pkt.out.bind_ack.num_results == 0 || + pkt.out.bind_ack.ctx_list[0].result != 0) { status = NT_STATUS_UNSUCCESSFUL; } @@ -572,49 +574,30 @@ NTSTATUS dcerpc_bind(struct dcerpc_pipe *p, return status; } -static const struct { - const char *name; - struct dcerpc_syntax_id syntax; - const struct dcerpc_syntax_id transfer_syntax; -} known_pipes[] = { - { "lsarpc" , { "12345778-1234-abcd-ef00-0123456789ab", 0 }, DCERPC_TRANSFER_SYNTAX_V2 }, - { "samr" , { "12345778-1234-abcd-ef00-0123456789ac", 1 }, DCERPC_TRANSFER_SYNTAX_V2 }, - { "netlogon", { "12345778-1234-abcd-ef00-01234567cffb", 1 }, DCERPC_TRANSFER_SYNTAX_V2 }, - { "srvsvc" , { "4b324fc8-1670-01d3-1278-5a47bf6ee188", 3 }, DCERPC_TRANSFER_SYNTAX_V2 }, - { "wkssvc" , { "6bffd098-a112-3610-9833-46c3f87e345a", 1 }, DCERPC_TRANSFER_SYNTAX_V2 }, - { "winreg" , { "338cd001-2244-31f1-aaaa-900038001003", 1 }, DCERPC_TRANSFER_SYNTAX_V2 }, - { "spoolss" , { "12345678-1234-abcd-ef00-0123456789ab", 1 }, DCERPC_TRANSFER_SYNTAX_V2 }, - { "netdfs" , { "4fc742e0-4a10-11cf-8273-00aa004ae673", 3 }, DCERPC_TRANSFER_SYNTAX_V2 }, - { "rpcecho" , { "60a15ec5-4de8-11d7-a637-005056a20182", 1 }, DCERPC_TRANSFER_SYNTAX_V2 }, - { NULL , } -}; - - -/* Perform a bind using the given well-known pipe name */ -NTSTATUS dcerpc_bind_byname(struct dcerpc_pipe *p, const char *pipe_name) +/* Perform a bind using the given UUID and version */ +NTSTATUS dcerpc_bind_byuuid(struct dcerpc_pipe *p, + const char *uuid, unsigned version) { - int i; + struct dcerpc_syntax_id syntax; + struct dcerpc_syntax_id transfer_syntax; - for (i=0; known_pipes[i].name; i++) { - if (strcasecmp(known_pipes[i].name, pipe_name) == 0) - break; - } - - if (known_pipes[i].name == NULL) { - return NT_STATUS_OBJECT_NAME_NOT_FOUND; - } + syntax.uuid_str = uuid; + syntax.if_version = version; - return dcerpc_bind(p, &known_pipes[i].syntax, &known_pipes[i].transfer_syntax); + transfer_syntax.uuid_str = "8a885d04-1ceb-11c9-9fe8-08002b104860"; + transfer_syntax.if_version = 2; + + return dcerpc_bind(p, &syntax, &transfer_syntax); } /* perform a full request/response pair on a dcerpc pipe */ NTSTATUS dcerpc_request(struct dcerpc_pipe *p, - uint16 opnum, - TALLOC_CTX *mem_ctx, - DATA_BLOB *stub_data_in, - DATA_BLOB *stub_data_out) + uint16 opnum, + TALLOC_CTX *mem_ctx, + DATA_BLOB *stub_data_in, + DATA_BLOB *stub_data_out) { struct dcerpc_packet pkt; diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index d67969e76c..81cefa1678 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -130,6 +130,3 @@ struct dcerpc_packet { } out; }; -/* this seems to be the only transfer syntax used */ -#define DCERPC_TRANSFER_SYNTAX_V2 {"8a885d04-1ceb-11c9-9fe8-08002b104860", 2} - diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c index 0541200015..a5570a4ea9 100644 --- a/source4/librpc/rpc/dcerpc_smb.c +++ b/source4/librpc/rpc/dcerpc_smb.c @@ -26,7 +26,10 @@ /* open a rpc connection to a named pipe */ -NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe *p, const char *pipe_name) +NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe *p, + const char *pipe_name, + const char *pipe_uuid, + uint32 pipe_version) { NTSTATUS status; char *name = NULL; @@ -73,7 +76,7 @@ NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe *p, const char *pipe_name) p->fnum = io.ntcreatex.out.fnum; /* bind to the pipe, using the pipe_name as the key */ - status = dcerpc_bind_byname(p, pipe_name); + status = dcerpc_bind_byuuid(p, pipe_uuid, pipe_version); if (!NT_STATUS_IS_OK(status)) { union smb_close c; |