From fdeea341ed1bae670382e45eb731db1b5838ad21 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 11 Mar 1998 21:11:04 +0000 Subject: "For I have laboured mightily on Luke's code, and hath broken all I saw" - the book of Jeremy, chapter 1 :-). So here is the mega-merge of the NTDOM branch server code. It doesn't include the new client side pieces, we'll look at that later. This should give the same functionality, server wise, as the NTDOM branch does, only merged into the main branch. Any fixes to domain controler functionality should be added to the main branch, not the NTDOM branch. This code compiles without warnings on gcc2.8, but will need further testing before we are sure all the working functionality of the NTDOM server branch has been correctly carried over. I hereby declare the server side of the NTDOM branch dead (and all who sail in her :-). Jeremy. (This used to be commit 118ba4d77a33248e762a2cf843fb7cbc906ee6e7) --- source3/rpc_parse/parse_rpc.c | 528 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 528 insertions(+) create mode 100644 source3/rpc_parse/parse_rpc.c (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c new file mode 100644 index 0000000000..b025d3f1c8 --- /dev/null +++ b/source3/rpc_parse/parse_rpc.c @@ -0,0 +1,528 @@ + +/* + * Unix SMB/Netbios implementation. + * Version 1.9. + * RPC Pipe client / server routines + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "includes.h" + +extern int DEBUGLEVEL; + + +/******************************************************************* +interface/version dce/rpc pipe identification +********************************************************************/ + +#define TRANS_SYNT_V2 \ +{ \ + { \ + 0x04, 0x5d, 0x88, 0x8a, \ + 0xeb, 0x1c, 0xc9, 0x11, \ + 0x9f, 0xe8, 0x08, 0x00, \ + 0x2b, 0x10, 0x48, 0x60 \ + }, 0x02 \ +} \ + +#define SYNT_NETLOGON_V2 \ +{ \ + { \ + 0x04, 0x5d, 0x88, 0x8a, \ + 0xeb, 0x1c, 0xc9, 0x11, \ + 0x9f, 0xe8, 0x08, 0x00, \ + 0x2b, 0x10, 0x48, 0x60 \ + }, 0x02 \ +} \ + +#define SYNT_WKSSVC_V1 \ +{ \ + { \ + 0x98, 0xd0, 0xff, 0x6b, \ + 0x12, 0xa1, 0x10, 0x36, \ + 0x98, 0x33, 0x46, 0xc3, \ + 0xf8, 0x7e, 0x34, 0x5a \ + }, 0x01 \ +} \ + +#define SYNT_SRVSVC_V3 \ +{ \ + { \ + 0xc8, 0x4f, 0x32, 0x4b, \ + 0x70, 0x16, 0xd3, 0x01, \ + 0x12, 0x78, 0x5a, 0x47, \ + 0xbf, 0x6e, 0xe1, 0x88 \ + }, 0x03 \ +} \ + +#define SYNT_LSARPC_V0 \ +{ \ + { \ + 0x78, 0x57, 0x34, 0x12, \ + 0x34, 0x12, 0xcd, 0xab, \ + 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xab \ + }, 0x00 \ +} \ + +#define SYNT_SAMR_V1 \ +{ \ + { \ + 0x78, 0x57, 0x34, 0x12, \ + 0x34, 0x12, 0xcd, 0xab, \ + 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xac \ + }, 0x01 \ +} \ + +#define SYNT_NETLOGON_V1 \ +{ \ + { \ + 0x78, 0x56, 0x34, 0x12, \ + 0x34, 0x12, 0xcd, 0xab, \ + 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0xcf, 0xfb \ + }, 0x01 \ +} \ + +#define SYNT_WINREG_V1 \ +{ \ + { \ + 0x01, 0xd0, 0x8c, 0x33, \ + 0x44, 0x22, 0xf1, 0x31, \ + 0xaa, 0xaa, 0x90, 0x00, \ + 0x38, 0x00, 0x10, 0x03 \ + }, 0x01 \ +} \ + +#define SYNT_NONE_V0 \ +{ \ + { \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00 \ + }, 0x00 \ +} \ + +/* pipe string names */ +#define PIPE_SRVSVC "\\PIPE\\srvsvc" +#define PIPE_SAMR "\\PIPE\\samr" +#define PIPE_WINREG "\\PIPE\\winreg" +#define PIPE_WKSSVC "\\PIPE\\wkssvc" +#define PIPE_NETLOGON "\\PIPE\\NETLOGON" +#define PIPE_NTLSA "\\PIPE\\ntlsa" +#define PIPE_NTSVCS "\\PIPE\\ntsvcs" +#define PIPE_LSASS "\\PIPE\\lsass" +#define PIPE_LSARPC "\\PIPE\\lsarpc" + +struct pipe_id_info pipe_names [] = +{ + /* client pipe , abstract syntax , server pipe , transfer syntax */ + { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, + { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } +}; + +/******************************************************************* +creates an RPC_HDR structure. +********************************************************************/ +void make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, + uint32 call_id, int data_len, int auth_len) +{ + if (hdr == NULL) return; + + hdr->major = 5; /* RPC version 5 */ + hdr->minor = 0; /* minor version 0 */ + hdr->pkt_type = pkt_type; /* RPC packet type */ + hdr->flags = flags; /* dce/rpc flags */ + hdr->pack_type = 0x10; /* packed data representation */ + hdr->frag_len = data_len; /* fragment length, fill in later */ + hdr->auth_len = auth_len; /* authentication length */ + hdr->call_id = call_id; /* call identifier - match incoming RPC */ +} + +/******************************************************************* +reads or writes an RPC_HDR structure. +********************************************************************/ +void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr"); + depth++; + + prs_uint8 ("major ", ps, depth, &(rpc->major)); + prs_uint8 ("minor ", ps, depth, &(rpc->minor)); + prs_uint8 ("pkt_type ", ps, depth, &(rpc->pkt_type)); + prs_uint8 ("flags ", ps, depth, &(rpc->flags)); + prs_uint32("pack_type ", ps, depth, &(rpc->pack_type)); + prs_uint16("frag_len ", ps, depth, &(rpc->frag_len)); + prs_uint16("auth_len ", ps, depth, &(rpc->auth_len)); + prs_uint32("call_id ", ps, depth, &(rpc->call_id)); +} + +/******************************************************************* +creates an RPC_IFACE structure. +********************************************************************/ +void make_rpc_iface(RPC_IFACE *ifc, char data[16], uint32 version) +{ + if (ifc == NULL || data == NULL) return; + + memcpy(ifc->data, data, sizeof(ifc->data)); /* 16 bytes of number */ + ifc->version = version; /* the interface number */ +} + +/******************************************************************* +reads or writes an RPC_IFACE structure. +********************************************************************/ +void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +{ + if (ifc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_iface"); + depth++; + + prs_align(ps); + + prs_uint8s (False, "data ", ps, depth, ifc->data, sizeof(ifc->data)); + prs_uint32 ( "version", ps, depth, &(ifc->version)); +} + +/******************************************************************* +creates an RPC_ADDR_STR structure. +********************************************************************/ +void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) +{ + if (str == NULL || name == NULL) return; + + str->len = strlen(name) + 1; + fstrcpy(str->str, name); +} + +/******************************************************************* +reads or writes an RPC_ADDR_STR structure. +********************************************************************/ +void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +{ + if (str == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_addr_str"); + depth++; + prs_align(ps); + + prs_uint16 ( "len", ps, depth, &(str->len)); + prs_uint8s (True, "str", ps, depth, (uchar*)str->str, str->len); +} + +/******************************************************************* +creates an RPC_HDR_BBA structure. +********************************************************************/ +void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) +{ + if (bba == NULL) return; + + bba->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ + bba->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ + bba->assoc_gid = assoc_gid; /* associated group id (0x0) */ +} + +/******************************************************************* +reads or writes an RPC_HDR_BBA structure. +********************************************************************/ +void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_bba"); + depth++; + + prs_uint16("max_tsize", ps, depth, &(rpc->max_tsize)); + prs_uint16("max_rsize", ps, depth, &(rpc->max_rsize)); + prs_uint32("assoc_gid", ps, depth, &(rpc->assoc_gid)); +} + +/******************************************************************* +creates an RPC_HDR_RB structure. +********************************************************************/ +void make_rpc_hdr_rb(RPC_HDR_RB *rpc, + uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, + uint32 num_elements, uint16 context_id, uint8 num_syntaxes, + RPC_IFACE *abstract, RPC_IFACE *transfer) +{ + if (rpc == NULL) return; + + make_rpc_hdr_bba(&(rpc->bba), max_tsize, max_rsize, assoc_gid); + + rpc->num_elements = num_elements ; /* the number of elements (0x1) */ + rpc->context_id = context_id ; /* presentation context identifier (0x0) */ + rpc->num_syntaxes = num_syntaxes ; /* the number of syntaxes (has always been 1?)(0x1) */ + + /* num and vers. of interface client is using */ + memcpy(&(rpc->abstract), abstract, sizeof(rpc->abstract)); + + /* num and vers. of interface to use for replies */ + memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); +} + +/******************************************************************* +reads or writes an RPC_HDR_RB structure. +********************************************************************/ +void smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rb"); + depth++; + + smb_io_rpc_hdr_bba("", &(rpc->bba), ps, depth); + + prs_uint32("num_elements", ps, depth, &(rpc->num_elements)); + prs_uint16("context_id ", ps, depth, &(rpc->context_id )); + prs_uint8 ("num_syntaxes", ps, depth, &(rpc->num_syntaxes)); + + smb_io_rpc_iface("", &(rpc->abstract), ps, depth); + smb_io_rpc_iface("", &(rpc->transfer), ps, depth); +} + +/******************************************************************* +creates an RPC_RESULTS structure. + +lkclXXXX only one reason at the moment! + +********************************************************************/ +void make_rpc_results(RPC_RESULTS *res, + uint8 num_results, uint16 result, uint16 reason) +{ + if (res == NULL) return; + + res->num_results = num_results; /* the number of results (0x01) */ + res->result = result ; /* result (0x00 = accept) */ + res->reason = reason ; /* reason (0x00 = no reason specified) */ +} + +/******************************************************************* +reads or writes an RPC_RESULTS structure. + +lkclXXXX only one reason at the moment! + +********************************************************************/ +void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +{ + if (res == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_results"); + depth++; + + prs_align(ps); + + prs_uint8 ("num_results", ps, depth, &(res->num_results)); + + prs_align(ps); + + prs_uint16("result ", ps, depth, &(res->result )); + prs_uint16("reason ", ps, depth, &(res->reason )); +} + +/******************************************************************* +creates an RPC_HDR_BA structure. + +lkclXXXX only one reason at the moment! + +********************************************************************/ +void make_rpc_hdr_ba(RPC_HDR_BA *rpc, + uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, + char *pipe_addr, + uint8 num_results, uint16 result, uint16 reason, + RPC_IFACE *transfer) +{ + if (rpc == NULL || transfer == NULL || pipe_addr == NULL) return; + + make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid); + make_rpc_addr_str(&(rpc->addr), pipe_addr); + make_rpc_results (&(rpc->res ), num_results, result, reason); + + /* the transfer syntax from the request */ + memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); +} + +/******************************************************************* +reads or writes an RPC_HDR_BA structure. +********************************************************************/ +void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_ba"); + depth++; + + smb_io_rpc_hdr_bba ("", &(rpc->bba) , ps, depth); + smb_io_rpc_addr_str("", &(rpc->addr) , ps, depth); + smb_io_rpc_results ("", &(rpc->res) , ps, depth); + smb_io_rpc_iface ("", &(rpc->transfer), ps, depth); +} + +/******************************************************************* +creates an RPC_HDR_RR structure. +********************************************************************/ +void make_rpc_hdr_rr(RPC_HDR_RR *hdr, uint32 data_len, uint8 opnum) +{ + if (hdr == NULL) return; + + hdr->alloc_hint = data_len - 0x18; /* allocation hint */ + hdr->context_id = 0; /* presentation context identifier */ + hdr->cancel_count = 0; /* cancel count */ + hdr->opnum = opnum; /* opnum */ + hdr->reserved = 0; /* 0 - reserved */ +} + +/******************************************************************* +reads or writes an RPC_HDR_RR structure. +********************************************************************/ +void smb_io_rpc_hdr_rr(char *desc, RPC_HDR_RR *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rr"); + depth++; + + prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); + prs_uint8 ("context_id", ps, depth, &(rpc->context_id)); + prs_uint8 ("cancel_ct ", ps, depth, &(rpc->cancel_count)); + prs_uint8 ("opnum ", ps, depth, &(rpc->opnum)); + prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); +} + +/******************************************************************* +creates an RPC_AUTH_NTLMSSP_REQ structure. +********************************************************************/ +void make_rpc_auth_ntlmssp_req(RPC_AUTH_NTLMSSP_REQ *req, + fstring ntlmssp_str, uint32 ntlmssp_ver, + uint32 unknown_0, fstring myname, fstring domain) +{ + int len_myname = strlen(myname); + int len_domain = strlen(domain); + + if (req == NULL) return; + + fstrcpy(req->ntlmssp_str, ntlmssp_str); /* "NTLMSSP" */ + req->ntlmssp_ver = ntlmssp_ver; /* 0x0000 0001 */ + + req->unknown_0 = unknown_0 ; /* 0x00b2b3 */ + make_str_hdr(&req->hdr_myname, len_myname, len_myname, 1); + make_str_hdr(&req->hdr_domain, len_domain, len_domain, 1); + + fstrcpy(req->myname, myname); + fstrcpy(req->domain, domain); +} + +/******************************************************************* +reads or writes an RPC_AUTH_NTLMSSP_REQ structure. +********************************************************************/ +void smb_io_rpc_auth_ntlmssp_req(char *desc, RPC_AUTH_NTLMSSP_REQ *req, prs_struct *ps, int depth) +{ + if (req == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_req"); + depth++; + + prs_string("ntlmssp_str", ps, depth, req->ntlmssp_str, 0); /* "NTLMSSP" */ + prs_uint32("ntlmssp_ver", ps, depth, &(req->ntlmssp_ver )); + + prs_uint32("unknown_0 ", ps, depth, &(req->unknown_0 )); + smb_io_strhdr("hdr_myname", &(req->hdr_myname), ps, depth); + smb_io_strhdr("hdr_domain", &(req->hdr_domain), ps, depth); + + prs_string("myname", ps, depth, req->myname, req->hdr_myname.str_str_len); + prs_string("domain", ps, depth, req->domain, req->hdr_domain.str_str_len); +} + +/******************************************************************* +creates an RPC_AUTH_NTLMSSP_RESP structure. +********************************************************************/ +void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, + uint8 auth_type, uint8 auth_level, uint8 stub_type_len, + fstring ntlmssp_str, uint32 ntlmssp_ver, + uint32 unknown_1, uint32 unknown_2, uint32 unknown_3, + uint8 data[16]) +{ + if (rsp == NULL) return; + + rsp->auth_type = auth_type; /* nt lm ssp 0x0a */ + rsp->auth_level = auth_level; /* 0x06 */ + rsp->stub_type_len = stub_type_len; /* dunno. */ + rsp->padding = 0; /* padding */ + + rsp->ptr_0 = 1; /* non-zero pointer to something */ + + fstrcpy(rsp->ntlmssp_str, ntlmssp_str); /* "NTLMSSP" */ + rsp->ntlmssp_ver = ntlmssp_ver; /* 0x0000 0002 */ + + rsp->unknown_1 = unknown_1; /* 0x0000 0000 */ + rsp->unknown_2 = unknown_2; /* 0x00b2b3 */ + rsp->unknown_3 = unknown_3; /* 0x0082b1 */ + + memcpy(rsp->data, data, sizeof(rsp->data)); /* 0x10 bytes of something, 8 of which are zeros */ +} + +/******************************************************************* +reads or writes an RPC_AUTH_NTLMSSP_RESP structure. +********************************************************************/ +void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) +{ + if (rsp == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); + depth++; + + prs_uint8("auth_type", ps, depth, &(rsp->auth_type)); /* nt lm ssp 0x0a */ + prs_uint8("auth_level", ps, depth, &(rsp->auth_level));/* 0x06 */ + prs_uint8("stub_type_len", ps, depth, &(rsp->stub_type_len)); + prs_uint8("padding", ps, depth, &(rsp->padding)); + + prs_uint32("ptr_0", ps, depth, &(rsp->ptr_0 )); /* non-zero pointer to something */ + + prs_string("ntlmssp_str", ps, depth, rsp->ntlmssp_str, 0); /* "NTLMSSP" */ + prs_uint32("ntlmssp_ver", ps, depth, &(rsp->ntlmssp_ver )); /* 0x0000 0002 */ + + prs_uint32("unknown_1", ps, depth, &(rsp->unknown_1)); /* 0x0000 0000 */ + prs_uint32("unknown_2", ps, depth, &(rsp->unknown_2)); /* 0x00b2b3 */ + prs_uint32("unknown_3", ps, depth, &(rsp->unknown_3)); /* 0x0082b1 */ + + prs_uint8s (False, "data", ps, depth, rsp->data, sizeof(rsp->data)); +} + +#if 0 + +/* attached to the end of encrypted rpc requests and responses */ +/* RPC_AUTH_NTLMSSP_CHK */ +typedef struct rpc_auth_ntlmssp_chk_info +{ + uint32 ver; /* 0x1 */ + uint8 data[12]; + +} RPC_AUTH_NTLMSSP_CHK; + +#endif /* 0 */ + -- cgit From e300c0346ff92035ff9568b55b34469193e29769 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 10 Apr 1998 18:21:16 +0000 Subject: includes.h: Moved HPUX undefine of SEMMSL to where it actually does something. ipc.c: Added Luke's debug statement. locking_slow.c: Added FTRUNCATE_NEEDS_ROOT code for broken systems that need it (not sure what these are yet). membuffer.c ntdomain.h proto.h lib/rpc/include/rpc_dce.h lib/rpc/include/rpc_srvsvc.h lib/rpc/parse/parse_prs.c lib/rpc/parse/parse_rpc.c lib/rpc/server/srv_pipe_hnd.c lib/rpc/server/srv_util.c: Re-merge of Luke's NTDOM changes 'cos he's a lazy git with carpel tunnel syndrome :-). Jeremy. (This used to be commit 52e3966fbcf7b5fbdbc7cbe9ac0b453ab5bf3217) --- source3/rpc_parse/parse_rpc.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index b025d3f1c8..8a5b6c172e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -384,33 +384,58 @@ void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) } /******************************************************************* -creates an RPC_HDR_RR structure. +creates an RPC_HDR_REQ structure. ********************************************************************/ -void make_rpc_hdr_rr(RPC_HDR_RR *hdr, uint32 data_len, uint8 opnum) +void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 data_len, uint16 opnum) { if (hdr == NULL) return; hdr->alloc_hint = data_len - 0x18; /* allocation hint */ hdr->context_id = 0; /* presentation context identifier */ - hdr->cancel_count = 0; /* cancel count */ hdr->opnum = opnum; /* opnum */ +} + +/******************************************************************* +reads or writes an RPC_HDR_REQ structure. +********************************************************************/ +void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_req"); + depth++; + + prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); + prs_uint16("context_id", ps, depth, &(rpc->context_id)); + prs_uint16("opnum ", ps, depth, &(rpc->opnum)); +} + +/******************************************************************* +creates an RPC_HDR_RESP structure. +********************************************************************/ +void make_rpc_hdr_resp(RPC_HDR_RESP *hdr, uint32 data_len) +{ + if (hdr == NULL) return; + + hdr->alloc_hint = data_len - 0x18; /* allocation hint */ + hdr->context_id = 0; /* presentation context identifier */ + hdr->cancel_count = 0; /* cancel count */ hdr->reserved = 0; /* 0 - reserved */ } /******************************************************************* -reads or writes an RPC_HDR_RR structure. +reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -void smb_io_rpc_hdr_rr(char *desc, RPC_HDR_RR *rpc, prs_struct *ps, int depth) +void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return; - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rr"); + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_resp"); depth++; prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); - prs_uint8 ("context_id", ps, depth, &(rpc->context_id)); + prs_uint16("context_id", ps, depth, &(rpc->context_id)); prs_uint8 ("cancel_ct ", ps, depth, &(rpc->cancel_count)); - prs_uint8 ("opnum ", ps, depth, &(rpc->opnum)); prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); } -- cgit From e9ea36e4d2270bd7d32da12ef6d6e2299641582d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 Sep 1998 05:07:05 +0000 Subject: tridge the destroyer returns! prompted by the interpret_security() dead code that Jean-Francois pointed out I added a make target "finddead" that finds potentially dead (ie. unused) code. It spat out 304 function names ... I went through these are deleted many of them, making others static (finddead also reports functions that are used only in the local file). in doing this I have almost certainly deleted some useful code. I may have even prevented compilation with some compile options. I apologise. I decided it was better to get rid of this code now and add back the one or two functions that are needed than to keep all this baggage. So, if I have done a bit too much "destroying" then let me know. Keep the swearing to a minimum :) One bit I didn't do is the ubibt code. Chris, can you look at that? Heaps of unused functions there. Can they be made static? (This used to be commit 2204475c87f3024ea8fd1fbd7385b2def617a46f) --- source3/rpc_parse/parse_rpc.c | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 8a5b6c172e..ac01e7f0b1 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -183,21 +183,10 @@ void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) prs_uint32("call_id ", ps, depth, &(rpc->call_id)); } -/******************************************************************* -creates an RPC_IFACE structure. -********************************************************************/ -void make_rpc_iface(RPC_IFACE *ifc, char data[16], uint32 version) -{ - if (ifc == NULL || data == NULL) return; - - memcpy(ifc->data, data, sizeof(ifc->data)); /* 16 bytes of number */ - ifc->version = version; /* the interface number */ -} - /******************************************************************* reads or writes an RPC_IFACE structure. ********************************************************************/ -void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { if (ifc == NULL) return; @@ -213,7 +202,7 @@ void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) /******************************************************************* creates an RPC_ADDR_STR structure. ********************************************************************/ -void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) +static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) { if (str == NULL || name == NULL) return; @@ -224,7 +213,7 @@ void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) /******************************************************************* reads or writes an RPC_ADDR_STR structure. ********************************************************************/ -void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +static void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { if (str == NULL) return; @@ -239,7 +228,7 @@ void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int dep /******************************************************************* creates an RPC_HDR_BBA structure. ********************************************************************/ -void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) +static void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) { if (bba == NULL) return; @@ -251,7 +240,7 @@ void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint /******************************************************************* reads or writes an RPC_HDR_BBA structure. ********************************************************************/ -void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +static void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return; @@ -312,7 +301,7 @@ creates an RPC_RESULTS structure. lkclXXXX only one reason at the moment! ********************************************************************/ -void make_rpc_results(RPC_RESULTS *res, +static void make_rpc_results(RPC_RESULTS *res, uint8 num_results, uint16 result, uint16 reason) { if (res == NULL) return; @@ -328,7 +317,7 @@ reads or writes an RPC_RESULTS structure. lkclXXXX only one reason at the moment! ********************************************************************/ -void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { if (res == NULL) return; @@ -410,19 +399,6 @@ void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth prs_uint16("opnum ", ps, depth, &(rpc->opnum)); } -/******************************************************************* -creates an RPC_HDR_RESP structure. -********************************************************************/ -void make_rpc_hdr_resp(RPC_HDR_RESP *hdr, uint32 data_len) -{ - if (hdr == NULL) return; - - hdr->alloc_hint = data_len - 0x18; /* allocation hint */ - hdr->context_id = 0; /* presentation context identifier */ - hdr->cancel_count = 0; /* cancel count */ - hdr->reserved = 0; /* 0 - reserved */ -} - /******************************************************************* reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -- cgit From c07b2bdf9032c870f7f50a9671e8d9fb0a56739a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 6 Oct 1998 22:03:04 +0000 Subject: dce/rpc (This used to be commit eb279cabd059603b6c8d9b74e4fd31c4ffe87593) --- source3/rpc_parse/parse_rpc.c | 188 ++++++++++++++++++++++++++++++------------ 1 file changed, 134 insertions(+), 54 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ac01e7f0b1..2e7b950810 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -416,75 +416,155 @@ void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dep } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_REQ structure. +creates an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_req(RPC_AUTH_NTLMSSP_REQ *req, - fstring ntlmssp_str, uint32 ntlmssp_ver, - uint32 unknown_0, fstring myname, fstring domain) +void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, + uint32 neg_flgs, + fstring myname, fstring domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); - if (req == NULL) return; + if (neg == NULL) return; - fstrcpy(req->ntlmssp_str, ntlmssp_str); /* "NTLMSSP" */ - req->ntlmssp_ver = ntlmssp_ver; /* 0x0000 0001 */ + neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - req->unknown_0 = unknown_0 ; /* 0x00b2b3 */ - make_str_hdr(&req->hdr_myname, len_myname, len_myname, 1); - make_str_hdr(&req->hdr_domain, len_domain, len_domain, 1); + make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 1); + make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 1); - fstrcpy(req->myname, myname); - fstrcpy(req->domain, domain); + fstrcpy(neg->myname, myname); + fstrcpy(neg->domain, domain); } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_REQ structure. +reads or writes an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_req(char *desc, RPC_AUTH_NTLMSSP_REQ *req, prs_struct *ps, int depth) +void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { - if (req == NULL) return; + if (neg == NULL) return; - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_req"); + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_neg"); depth++; - prs_string("ntlmssp_str", ps, depth, req->ntlmssp_str, 0); /* "NTLMSSP" */ - prs_uint32("ntlmssp_ver", ps, depth, &(req->ntlmssp_ver )); + prs_uint32("neg_flgs ", ps, depth, &(neg->neg_flgs)); - prs_uint32("unknown_0 ", ps, depth, &(req->unknown_0 )); - smb_io_strhdr("hdr_myname", &(req->hdr_myname), ps, depth); - smb_io_strhdr("hdr_domain", &(req->hdr_domain), ps, depth); + smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); + smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - prs_string("myname", ps, depth, req->myname, req->hdr_myname.str_str_len); - prs_string("domain", ps, depth, req->domain, req->hdr_domain.str_str_len); + prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len, sizeof(neg->myname)); + prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len, sizeof(neg->domain)); +} + +/******************************************************************* +creates an RPC_AUTH_VERIFIER structure. +********************************************************************/ +void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, + uint8 auth_type, uint8 auth_level, + uint8 stub_type_len, + char *signature, uint32 msg_type) +{ + if (rav == NULL) return; + + rav->auth_type = auth_type; /* nt lm ssp 0x0a */ + rav->auth_level = auth_level; /* 0x06 */ + rav->stub_type_len = stub_type_len; /* 0x00 */ + rav->padding = 0; /* padding 0x00 */ + + rav->ptr_0 = 1; /* non-zero pointer to something */ + + fstrcpy(rav->signature, signature); /* "NTLMSSP" */ + rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ +} + +/******************************************************************* +reads or writes an RPC_AUTH_VERIFIER structure. +********************************************************************/ +void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +{ + if (rav == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); + depth++; + + prs_uint8("auth_type ", ps, depth, &(rav->auth_type)); /* nt lm ssp 0x0a */ + prs_uint8("auth_level ", ps, depth, &(rav->auth_level));/* 0x06 */ + prs_uint8("stub_type_len", ps, depth, &(rav->stub_type_len)); + prs_uint8("padding ", ps, depth, &(rav->padding)); + + prs_uint32("ptr_0", ps, depth, &(rav->ptr_0 )); /* non-zero pointer to something */ + + prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ + prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ +} + +/******************************************************************* +creates an RPC_AUTH_NTLMSSP_CHAL structure. +********************************************************************/ +void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, + uint32 neg_flags, + uint8 challenge[8]) +{ + if (chl == NULL) return; + + chl->unknown_1 = 0x0; + chl->unknown_2 = 0x00000028; + chl->neg_flags = neg_flags; /* 0x0082b1 */ + + memcpy(chl->challenge, challenge, sizeof(chl->challenge)); + bzero (chl->reserved , sizeof(chl->reserved)); +} + +/******************************************************************* +reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. +********************************************************************/ +void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) +{ + if (chl == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chal"); + depth++; + + prs_uint32("unknown_1", ps, depth, &(chl->unknown_1)); /* 0x0000 0000 */ + prs_uint32("unknown_2", ps, depth, &(chl->unknown_2)); /* 0x0000 b2b3 */ + prs_uint32("neg_flags", ps, depth, &(chl->neg_flags)); /* 0x0000 82b1 */ + + prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); + prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); } /******************************************************************* creates an RPC_AUTH_NTLMSSP_RESP structure. ********************************************************************/ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, - uint8 auth_type, uint8 auth_level, uint8 stub_type_len, - fstring ntlmssp_str, uint32 ntlmssp_ver, - uint32 unknown_1, uint32 unknown_2, uint32 unknown_3, - uint8 data[16]) + uchar lm_resp[24], uchar nt_resp[24], + char *domain, char *user, char *wks, + uint32 neg_flags) { - if (rsp == NULL) return; + int dom_len = strlen(domain) * 2; + int wks_len = strlen(wks ) * 2; + int usr_len = strlen(user ) * 2; + int lm_len = lm_resp != NULL ? 24 : 0; + int nt_len = nt_resp != NULL ? 24 : 0; - rsp->auth_type = auth_type; /* nt lm ssp 0x0a */ - rsp->auth_level = auth_level; /* 0x06 */ - rsp->stub_type_len = stub_type_len; /* dunno. */ - rsp->padding = 0; /* padding */ + if (rsp == NULL) return; - rsp->ptr_0 = 1; /* non-zero pointer to something */ + make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, 1); + make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, 1); + make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, 1); + make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, 1); + make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, 1); + make_str_hdr(&rsp->hdr_sess_key, 0, 0, 1); - fstrcpy(rsp->ntlmssp_str, ntlmssp_str); /* "NTLMSSP" */ - rsp->ntlmssp_ver = ntlmssp_ver; /* 0x0000 0002 */ + rsp->neg_flags = neg_flags; - rsp->unknown_1 = unknown_1; /* 0x0000 0000 */ - rsp->unknown_2 = unknown_2; /* 0x00b2b3 */ - rsp->unknown_3 = unknown_3; /* 0x0082b1 */ + memcpy(&rsp->lm_resp, lm_resp, 24); + memcpy(&rsp->nt_resp, nt_resp, 24); + fstrcpy(rsp->domain, domain); + fstrcpy(rsp->user , user ); + fstrcpy(rsp->wks , wks ); + rsp->sess_key[0] = 0; - memcpy(rsp->data, data, sizeof(rsp->data)); /* 0x10 bytes of something, 8 of which are zeros */ + } /******************************************************************* @@ -497,21 +577,21 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; - prs_uint8("auth_type", ps, depth, &(rsp->auth_type)); /* nt lm ssp 0x0a */ - prs_uint8("auth_level", ps, depth, &(rsp->auth_level));/* 0x06 */ - prs_uint8("stub_type_len", ps, depth, &(rsp->stub_type_len)); - prs_uint8("padding", ps, depth, &(rsp->padding)); - - prs_uint32("ptr_0", ps, depth, &(rsp->ptr_0 )); /* non-zero pointer to something */ - - prs_string("ntlmssp_str", ps, depth, rsp->ntlmssp_str, 0); /* "NTLMSSP" */ - prs_uint32("ntlmssp_ver", ps, depth, &(rsp->ntlmssp_ver )); /* 0x0000 0002 */ - - prs_uint32("unknown_1", ps, depth, &(rsp->unknown_1)); /* 0x0000 0000 */ - prs_uint32("unknown_2", ps, depth, &(rsp->unknown_2)); /* 0x00b2b3 */ - prs_uint32("unknown_3", ps, depth, &(rsp->unknown_3)); /* 0x0082b1 */ - - prs_uint8s (False, "data", ps, depth, rsp->data, sizeof(rsp->data)); + smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); + smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); + smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); + smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); + smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); + smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); + + prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ + + prs_string("sess_key", ps, depth, rsp->sess_key, rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)); + prs_string("wks ", ps, depth, rsp->wks , rsp->hdr_wks .str_str_len, sizeof(rsp->wks )); + prs_string("user ", ps, depth, rsp->user , rsp->hdr_usr .str_str_len, sizeof(rsp->user )); + prs_string("domain ", ps, depth, rsp->domain , rsp->hdr_domain .str_str_len, sizeof(rsp->domain )); + prs_string("nt_resp ", ps, depth, rsp->nt_resp , rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )); + prs_string("lm_resp ", ps, depth, rsp->lm_resp , rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp )); } #if 0 -- cgit From f931d7181c944102f0d00311a5b8a7ae315f7bba Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 7 Oct 1998 01:01:26 +0000 Subject: put #if BROKEN_CODE around all the bits of code in rpc_parse.c that don't compile. Luke, you'll need to remove these when you've fixed the code. (This used to be commit 4f411d62640615ce94667ddb9946082e72e23bb6) --- source3/rpc_parse/parse_rpc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 2e7b950810..6a1d2f5713 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -551,19 +551,22 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, 1); make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, 1); make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, 1); +#if BROKEN_CODE make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, 1); make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, 1); make_str_hdr(&rsp->hdr_sess_key, 0, 0, 1); +#endif rsp->neg_flags = neg_flags; +#if BROKEN_CODE memcpy(&rsp->lm_resp, lm_resp, 24); memcpy(&rsp->nt_resp, nt_resp, 24); fstrcpy(rsp->domain, domain); fstrcpy(rsp->user , user ); fstrcpy(rsp->wks , wks ); rsp->sess_key[0] = 0; - +#endif } @@ -580,18 +583,22 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); +#if BROKEN_CODE smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); +#endif prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ +#if BROKEN_CODE prs_string("sess_key", ps, depth, rsp->sess_key, rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)); prs_string("wks ", ps, depth, rsp->wks , rsp->hdr_wks .str_str_len, sizeof(rsp->wks )); prs_string("user ", ps, depth, rsp->user , rsp->hdr_usr .str_str_len, sizeof(rsp->user )); prs_string("domain ", ps, depth, rsp->domain , rsp->hdr_domain .str_str_len, sizeof(rsp->domain )); prs_string("nt_resp ", ps, depth, rsp->nt_resp , rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )); prs_string("lm_resp ", ps, depth, rsp->lm_resp , rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp )); +#endif } #if 0 -- cgit From 2fef8f2e87f61043e3f1a2cf7d1f2a4ff9f119ff Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 7 Oct 1998 15:22:49 +0000 Subject: dce/rpc (This used to be commit 34afa638f6f7bb145ec094510ac58f7a22dfc3aa) --- source3/rpc_parse/parse_rpc.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6a1d2f5713..90a013dc12 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -470,7 +470,7 @@ void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, rav->stub_type_len = stub_type_len; /* 0x00 */ rav->padding = 0; /* padding 0x00 */ - rav->ptr_0 = 1; /* non-zero pointer to something */ + rav->ptr_0 = 0x0014a0c0; /* non-zero pointer to something */ fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ @@ -511,7 +511,9 @@ void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, chl->neg_flags = neg_flags; /* 0x0082b1 */ memcpy(chl->challenge, challenge, sizeof(chl->challenge)); +/* bzero (chl->reserved , sizeof(chl->reserved)); + */ } /******************************************************************* @@ -529,7 +531,9 @@ void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st prs_uint32("neg_flags", ps, depth, &(chl->neg_flags)); /* 0x0000 82b1 */ prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); +/* prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); + */ } /******************************************************************* @@ -551,22 +555,19 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, 1); make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, 1); make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, 1); -#if BROKEN_CODE make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, 1); make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, 1); make_str_hdr(&rsp->hdr_sess_key, 0, 0, 1); -#endif rsp->neg_flags = neg_flags; -#if BROKEN_CODE memcpy(&rsp->lm_resp, lm_resp, 24); memcpy(&rsp->nt_resp, nt_resp, 24); fstrcpy(rsp->domain, domain); fstrcpy(rsp->user , user ); fstrcpy(rsp->wks , wks ); rsp->sess_key[0] = 0; -#endif + } @@ -583,22 +584,18 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); -#if BROKEN_CODE smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); -#endif prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ -#if BROKEN_CODE prs_string("sess_key", ps, depth, rsp->sess_key, rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)); prs_string("wks ", ps, depth, rsp->wks , rsp->hdr_wks .str_str_len, sizeof(rsp->wks )); prs_string("user ", ps, depth, rsp->user , rsp->hdr_usr .str_str_len, sizeof(rsp->user )); prs_string("domain ", ps, depth, rsp->domain , rsp->hdr_domain .str_str_len, sizeof(rsp->domain )); prs_string("nt_resp ", ps, depth, rsp->nt_resp , rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )); prs_string("lm_resp ", ps, depth, rsp->lm_resp , rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp )); -#endif } #if 0 -- cgit From 48b31ae44fb2a1961bd738b0b3e7a986259168a2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 7 Oct 1998 21:42:24 +0000 Subject: dce/rpc (This used to be commit 6677b888bdb45df00646eb7cc13005b9465ff971) --- source3/rpc_parse/parse_rpc.c | 210 +++++++++++++++++++++++++++++++++--------- 1 file changed, 169 insertions(+), 41 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 90a013dc12..a1773bb827 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -415,6 +415,83 @@ void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dep prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); } +/******************************************************************* +creates an RPC_HDR_AUTHA structure. +********************************************************************/ +void make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, + uint16 max_tsize, uint16 max_rsize, + uint8 auth_type, uint8 auth_level, + uint8 stub_type_len) +{ + if (rai == NULL) return; + + rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ + rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ + + rai->auth_type = auth_type; /* nt lm ssp 0x0a */ + rai->auth_level = auth_level; /* 0x06 */ + rai->stub_type_len = stub_type_len; /* 0x00 */ + rai->padding = 0; /* padding 0x00 */ + + rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ +} + +/******************************************************************* +reads or writes an RPC_HDR_AUTHA structure. +********************************************************************/ +void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) +{ + if (rai == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); + depth++; + + prs_uint16("max_tsize ", ps, depth, &(rai->max_tsize)); + prs_uint16("max_rsize ", ps, depth, &(rai->max_rsize)); + + prs_uint8 ("auth_type ", ps, depth, &(rai->auth_type )); /* 0x0a nt lm ssp */ + prs_uint8 ("auth_level ", ps, depth, &(rai->auth_level ));/* 0x06 */ + prs_uint8 ("stub_type_len", ps, depth, &(rai->stub_type_len)); + prs_uint8 ("padding ", ps, depth, &(rai->padding )); + + prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ +} + +/******************************************************************* +creates an RPC_HDR_AUTH structure. +********************************************************************/ +void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, + uint8 auth_type, uint8 auth_level, + uint8 stub_type_len) +{ + if (rai == NULL) return; + + rai->auth_type = auth_type; /* nt lm ssp 0x0a */ + rai->auth_level = auth_level; /* 0x06 */ + rai->stub_type_len = stub_type_len; /* 0x00 */ + rai->padding = 0; /* padding 0x00 */ + + rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ +} + +/******************************************************************* +reads or writes an RPC_HDR_AUTH structure. +********************************************************************/ +void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +{ + if (rai == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); + depth++; + + prs_uint8 ("auth_type ", ps, depth, &(rai->auth_type )); /* 0x0a nt lm ssp */ + prs_uint8 ("auth_level ", ps, depth, &(rai->auth_level ));/* 0x06 */ + prs_uint8 ("stub_type_len", ps, depth, &(rai->stub_type_len)); + prs_uint8 ("padding ", ps, depth, &(rai->padding )); + + prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ +} + /******************************************************************* creates an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ @@ -459,19 +536,10 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru creates an RPC_AUTH_VERIFIER structure. ********************************************************************/ void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, - uint8 auth_type, uint8 auth_level, - uint8 stub_type_len, char *signature, uint32 msg_type) { if (rav == NULL) return; - rav->auth_type = auth_type; /* nt lm ssp 0x0a */ - rav->auth_level = auth_level; /* 0x06 */ - rav->stub_type_len = stub_type_len; /* 0x00 */ - rav->padding = 0; /* padding 0x00 */ - - rav->ptr_0 = 0x0014a0c0; /* non-zero pointer to something */ - fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ } @@ -486,13 +554,6 @@ void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); depth++; - prs_uint8("auth_type ", ps, depth, &(rav->auth_type)); /* nt lm ssp 0x0a */ - prs_uint8("auth_level ", ps, depth, &(rav->auth_level));/* 0x06 */ - prs_uint8("stub_type_len", ps, depth, &(rav->stub_type_len)); - prs_uint8("padding ", ps, depth, &(rav->padding)); - - prs_uint32("ptr_0", ps, depth, &(rav->ptr_0 )); /* non-zero pointer to something */ - prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ } @@ -511,9 +572,7 @@ void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, chl->neg_flags = neg_flags; /* 0x0082b1 */ memcpy(chl->challenge, challenge, sizeof(chl->challenge)); -/* bzero (chl->reserved , sizeof(chl->reserved)); - */ } /******************************************************************* @@ -531,19 +590,22 @@ void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st prs_uint32("neg_flags", ps, depth, &(chl->neg_flags)); /* 0x0000 82b1 */ prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); -/* prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); - */ } /******************************************************************* creates an RPC_AUTH_NTLMSSP_RESP structure. + +*** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** +*** lkclXXXX the actual offset is at the start of the auth verifier *** + ********************************************************************/ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uchar lm_resp[24], uchar nt_resp[24], char *domain, char *user, char *wks, uint32 neg_flags) { + uint32 offset; int dom_len = strlen(domain) * 2; int wks_len = strlen(wks ) * 2; int usr_len = strlen(user ) * 2; @@ -552,12 +614,24 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (rsp == NULL) return; - make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, 1); - make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, 1); - make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, 1); - make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, 1); - make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, 1); - make_str_hdr(&rsp->hdr_sess_key, 0, 0, 1); + offset = 0x40; + + make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); + offset += lm_len * 2; + + make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); + offset += nt_len * 2; + + make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, offset); + offset += dom_len * 2; + + make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, offset); + offset += usr_len * 2; + + make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, offset); + offset += wks_len * 2; + + make_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); rsp->neg_flags = neg_flags; @@ -573,6 +647,10 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_RESP structure. + +*** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** +*** lkclXXXX the actual offset is at the start of the auth verifier *** + ********************************************************************/ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) { @@ -581,21 +659,71 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; - smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); - smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); - smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); - smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); - smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); - smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); - - prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - - prs_string("sess_key", ps, depth, rsp->sess_key, rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)); - prs_string("wks ", ps, depth, rsp->wks , rsp->hdr_wks .str_str_len, sizeof(rsp->wks )); - prs_string("user ", ps, depth, rsp->user , rsp->hdr_usr .str_str_len, sizeof(rsp->user )); - prs_string("domain ", ps, depth, rsp->domain , rsp->hdr_domain .str_str_len, sizeof(rsp->domain )); - prs_string("nt_resp ", ps, depth, rsp->nt_resp , rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )); - prs_string("lm_resp ", ps, depth, rsp->lm_resp , rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp )); + ZERO_STRUCTP(rsp); + + if (ps->io) + { + uint32 old_offset; + /* reading */ + smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); + smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); + smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); + smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); + smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); + smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); + + prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ + + old_offset = ps->offset; + + ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; + prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + old_offset += rsp->hdr_lm_resp .str_str_len; + + ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; + prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + old_offset += rsp->hdr_nt_resp .str_str_len; + + ps->offset = rsp->hdr_domain .buffer + 0x1c; + prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + old_offset += rsp->hdr_domain .str_str_len; + + ps->offset = rsp->hdr_usr .buffer + 0x1c; + prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + old_offset += rsp->hdr_usr .str_str_len; + + ps->offset = rsp->hdr_wks .buffer + 0x1c; + prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + old_offset += rsp->hdr_wks .str_str_len; + + if (rsp->hdr_sess_key.str_str_len != 0) + { + ps->offset = rsp->hdr_sess_key.buffer + 0x1c; + old_offset += rsp->hdr_sess_key.str_str_len; + prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + } + + ps->offset = old_offset; + } + else + { + /* writing */ + smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); + smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); + smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); + smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); + smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); + smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); + + prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ + + prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + } } #if 0 -- cgit From 6909350ed9b87875ee40191b2e636c6049749195 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 8 Oct 1998 23:57:46 +0000 Subject: dce/rpc (This used to be commit 62fdeef1b79c5c4c9bf0e860881651711bb80b9a) --- source3/rpc_parse/parse_rpc.c | 178 ++++++++++++++++++++++++++---------------- 1 file changed, 112 insertions(+), 66 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index a1773bb827..2204207440 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -375,13 +375,13 @@ void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) /******************************************************************* creates an RPC_HDR_REQ structure. ********************************************************************/ -void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 data_len, uint16 opnum) +void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) { if (hdr == NULL) return; - hdr->alloc_hint = data_len - 0x18; /* allocation hint */ - hdr->context_id = 0; /* presentation context identifier */ - hdr->opnum = opnum; /* opnum */ + hdr->alloc_hint = alloc_hint; /* allocation hint */ + hdr->context_id = 0; /* presentation context identifier */ + hdr->opnum = opnum; /* opnum */ } /******************************************************************* @@ -492,6 +492,32 @@ void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ } +/******************************************************************* +creates an RPC_AUTH_VERIFIER structure. +********************************************************************/ +void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, + char *signature, uint32 msg_type) +{ + if (rav == NULL) return; + + fstrcpy(rav->signature, signature); /* "NTLMSSP" */ + rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ +} + +/******************************************************************* +reads or writes an RPC_AUTH_VERIFIER structure. +********************************************************************/ +void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +{ + if (rav == NULL) return; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); + depth++; + + prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ + prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ +} + /******************************************************************* creates an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ @@ -506,8 +532,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 1); - make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 1); + make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); + make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname+1); fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); @@ -532,32 +558,6 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len, sizeof(neg->domain)); } -/******************************************************************* -creates an RPC_AUTH_VERIFIER structure. -********************************************************************/ -void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, - char *signature, uint32 msg_type) -{ - if (rav == NULL) return; - - fstrcpy(rav->signature, signature); /* "NTLMSSP" */ - rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ -} - -/******************************************************************* -reads or writes an RPC_AUTH_VERIFIER structure. -********************************************************************/ -void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) -{ - if (rav == NULL) return; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); - depth++; - - prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ - prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ -} - /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ @@ -606,30 +606,49 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uint32 neg_flags) { uint32 offset; - int dom_len = strlen(domain) * 2; - int wks_len = strlen(wks ) * 2; - int usr_len = strlen(user ) * 2; + int dom_len = strlen(domain); + int wks_len = strlen(wks ); + int usr_len = strlen(user ); int lm_len = lm_resp != NULL ? 24 : 0; int nt_len = nt_resp != NULL ? 24 : 0; + DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); + if (rsp == NULL) return; +#ifdef DEBUG_PASSWORD + DEBUG(100,("lm_resp\n")); + dump_data(100, lm_resp, 24); + DEBUG(100,("nt_resp\n")); + dump_data(100, nt_resp, 24); +#endif + + DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", + domain, user, wks, neg_flags)); + offset = 0x40; + if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) + { + dom_len *= 2; + wks_len *= 2; + usr_len *= 2; + } + make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); - offset += lm_len * 2; + offset += lm_len; make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); - offset += nt_len * 2; + offset += nt_len; make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, offset); - offset += dom_len * 2; + offset += dom_len; make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, offset); - offset += usr_len * 2; + offset += usr_len; make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, offset); - offset += wks_len * 2; + offset += wks_len; make_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); @@ -637,12 +656,20 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, memcpy(&rsp->lm_resp, lm_resp, 24); memcpy(&rsp->nt_resp, nt_resp, 24); - fstrcpy(rsp->domain, domain); - fstrcpy(rsp->user , user ); - fstrcpy(rsp->wks , wks ); - rsp->sess_key[0] = 0; - + if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) + { + struni2((uint16*)rsp->domain, domain); + struni2((uint16*)rsp->user , user ); + struni2((uint16*)rsp->wks , wks ); + } + else + { + fstrcpy(rsp->domain, domain); + fstrcpy(rsp->user , user ); + fstrcpy(rsp->wks , wks ); + } + rsp->sess_key[0] = 0; } /******************************************************************* @@ -659,12 +686,14 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; - ZERO_STRUCTP(rsp); - if (ps->io) { uint32 old_offset; + /* reading */ + + ZERO_STRUCTP(rsp); + smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); @@ -677,30 +706,30 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset = ps->offset; ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; - prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); old_offset += rsp->hdr_lm_resp .str_str_len; ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; - prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); old_offset += rsp->hdr_nt_resp .str_str_len; ps->offset = rsp->hdr_domain .buffer + 0x1c; - prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); old_offset += rsp->hdr_domain .str_str_len; ps->offset = rsp->hdr_usr .buffer + 0x1c; - prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); old_offset += rsp->hdr_usr .str_str_len; ps->offset = rsp->hdr_wks .buffer + 0x1c; - prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); old_offset += rsp->hdr_wks .str_str_len; if (rsp->hdr_sess_key.str_str_len != 0) { ps->offset = rsp->hdr_sess_key.buffer + 0x1c; old_offset += rsp->hdr_sess_key.str_str_len; - prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } ps->offset = old_offset; @@ -717,25 +746,42 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); - prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); - prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); - prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); - prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } } -#if 0 +/******************************************************************* +creates an RPC_AUTH_NTLMSSP_CHK structure. +********************************************************************/ +void make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, + uint32 ver, uint32 crc32, uint32 seq_num) +{ + if (chk == NULL) return; -/* attached to the end of encrypted rpc requests and responses */ -/* RPC_AUTH_NTLMSSP_CHK */ -typedef struct rpc_auth_ntlmssp_chk_info + chk->ver = ver ; + chk->reserved = 0x0; + chk->crc32 = crc32 ; + chk->seq_num = seq_num ; +} + +/******************************************************************* +reads or writes an RPC_AUTH_NTLMSSP_CHK structure. +********************************************************************/ +void smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) { - uint32 ver; /* 0x1 */ - uint8 data[12]; + if (chk == NULL) return; -} RPC_AUTH_NTLMSSP_CHK; + prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chk"); + depth++; -#endif /* 0 */ + prs_uint32("ver ", ps, depth, &(chk->ver )); + prs_uint32("reserved", ps, depth, &(chk->reserved)); + prs_uint32("crc32 ", ps, depth, &(chk->crc32 )); + prs_uint32("seq_num ", ps, depth, &(chk->seq_num )); +} -- cgit From 755986764f5a6b0ec25c7f20fde0a80eb4d121ba Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 9 Oct 1998 19:05:19 +0000 Subject: dce/rpc (This used to be commit 32d0f5e4a564686ad6b270dd24423ee49a81f223) --- source3/rpc_parse/parse_rpc.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 2204207440..43cb204681 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -554,8 +554,8 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len, sizeof(neg->myname)); prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len, sizeof(neg->domain)); + prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len, sizeof(neg->myname)); } /******************************************************************* @@ -635,12 +635,6 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, usr_len *= 2; } - make_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); - offset += lm_len; - - make_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); - offset += nt_len; - make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, offset); offset += dom_len; @@ -650,6 +644,12 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, offset); offset += wks_len; + make_str_hdr(&rsp->hdr_lm_resp, lm_len , lm_len , offset); + offset += lm_len; + + make_str_hdr(&rsp->hdr_nt_resp, nt_len , nt_len , offset); + offset += nt_len; + make_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); rsp->neg_flags = neg_flags; @@ -705,14 +705,6 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset = ps->offset; - ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; - prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - old_offset += rsp->hdr_lm_resp .str_str_len; - - ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; - prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); - old_offset += rsp->hdr_nt_resp .str_str_len; - ps->offset = rsp->hdr_domain .buffer + 0x1c; prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); old_offset += rsp->hdr_domain .str_str_len; @@ -725,6 +717,14 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); old_offset += rsp->hdr_wks .str_str_len; + ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; + prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + old_offset += rsp->hdr_lm_resp .str_str_len; + + ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; + prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + old_offset += rsp->hdr_nt_resp .str_str_len; + if (rsp->hdr_sess_key.str_str_len != 0) { ps->offset = rsp->hdr_sess_key.buffer + 0x1c; @@ -746,11 +746,11 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } } -- cgit From 8158620124504a1ece1f1191cb8f273709039bd2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 9 Oct 1998 20:17:11 +0000 Subject: dce/rpc. (This used to be commit e0445419b2d50ae6efef36f4f295ebcfdbf1ad82) --- source3/rpc_parse/parse_rpc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 43cb204681..213d694509 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -532,8 +532,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); - make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname+1); + make_str_hdr(&neg->hdr_myname, len_myname+1, len_myname+1, 0x20); + make_str_hdr(&neg->hdr_domain, len_domain+1, len_domain+1, 0x20 + len_myname+1); fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); @@ -554,8 +554,8 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len, sizeof(neg->domain)); - prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len, sizeof(neg->myname)); + prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len-1, sizeof(neg->domain)); + prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len-1, sizeof(neg->myname)); } /******************************************************************* -- cgit From abb67ee6deac030c4bc38e166cd3e3ab086ae285 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 9 Oct 1998 20:31:52 +0000 Subject: signed / unsigned issues spotted by herb (This used to be commit 0b90442021aa3adb5ae7f09c53c9e54c7655d8c5) --- source3/rpc_parse/parse_rpc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 213d694509..6b4deb00cf 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -746,12 +746,12 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - prs_uint8s(True , "domain ", ps, depth, rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); - prs_uint8s(True , "user ", ps, depth, rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); - prs_uint8s(True , "wks ", ps, depth, rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); - prs_uint8s(False, "lm_resp ", ps, depth, rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - prs_uint8s(False, "nt_resp ", ps, depth, rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); - prs_uint8s(False, "sess_key", ps, depth, rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); + prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); + prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); + prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); + prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); + prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } } -- cgit From 935dc98f6670ba630bd2086ef9eddcc94a0562e2 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 14 Oct 1998 06:29:20 +0000 Subject: dce/rpc (This used to be commit 69f5f9f88935de1f63ffc9aa19c0629b395e66e6) --- source3/rpc_parse/parse_rpc.c | 44 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6b4deb00cf..f9745da4b4 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -462,7 +462,8 @@ creates an RPC_HDR_AUTH structure. ********************************************************************/ void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, - uint8 stub_type_len) + uint8 stub_type_len, + uint32 ptr) { if (rai == NULL) return; @@ -471,7 +472,7 @@ void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, rai->stub_type_len = stub_type_len; /* 0x00 */ rai->padding = 0; /* padding 0x00 */ - rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ + rai->unknown = ptr; /* non-zero pointer to something */ } /******************************************************************* @@ -532,8 +533,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - make_str_hdr(&neg->hdr_myname, len_myname+1, len_myname+1, 0x20); - make_str_hdr(&neg->hdr_domain, len_domain+1, len_domain+1, 0x20 + len_myname+1); + make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname); + make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); @@ -551,11 +552,38 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru prs_uint32("neg_flgs ", ps, depth, &(neg->neg_flgs)); - smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); - smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); + if (ps->io) + { + uint32 old_offset; + + /* reading */ + + ZERO_STRUCTP(neg); + + smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); + smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); + + old_offset = ps->offset; + + ps->offset = neg->hdr_myname .buffer + 0x1c; + prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); + old_offset += neg->hdr_myname .str_str_len; + + ps->offset = neg->hdr_domain .buffer + 0x1c; + prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); + old_offset += neg->hdr_domain .str_str_len; + + ps->offset = old_offset; + } + else + { + /* writing */ + smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); + smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); - prs_string("domain", ps, depth, neg->domain, neg->hdr_domain.str_str_len-1, sizeof(neg->domain)); - prs_string("myname", ps, depth, neg->myname, neg->hdr_myname.str_str_len-1, sizeof(neg->myname)); + prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); + prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); + } } /******************************************************************* -- cgit From 01de6030843f5f402dee8bf72f564a91ae8437ca Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 19 Oct 1998 17:32:10 +0000 Subject: - dce/rpc code - removed debug info in struni2 and unistr2 (security risk) - rpc_pipe function was getting pointer to data then calling realloc *dur* - password check function, the start of "credential checking", user, wks, domain, pass as the credentials (not just user,pass which is incorrect in a domain context) - cli_write needs to return ssize_t not size_t, because total can be -1 if the write fails. - fixed signed / unsigned warnings (how come i don't get those any more when i compile with gcc???) - nt password change added in smbd. yes, jeremy, i verified that the SMBtrans2 version still works. (This used to be commit fcfb40d2b0fc565ee4f66b3a3761c246366a2ef3) --- source3/rpc_parse/parse_rpc.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index f9745da4b4..44f95c7e0c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -457,6 +457,14 @@ void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int de prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ } +/******************************************************************* +checks an RPC_HDR_AUTH structure. +********************************************************************/ +BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) +{ + return (rai->auth_type == 0x0a && rai->auth_level == 0x06); +} + /******************************************************************* creates an RPC_HDR_AUTH structure. ********************************************************************/ @@ -493,6 +501,15 @@ void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ } +/******************************************************************* +checks an RPC_AUTH_VERIFIER structure. +********************************************************************/ +BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, + char *signature, uint32 msg_type) +{ + return (strequal(rav->signature, signature) && rav->msg_type == msg_type); +} + /******************************************************************* creates an RPC_AUTH_VERIFIER structure. ********************************************************************/ @@ -783,6 +800,30 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st } } +/******************************************************************* +checks an RPC_AUTH_NTLMSSP_CHK structure. +********************************************************************/ +BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 *seq_num) +{ + if (chk == NULL || seq_num == NULL) + { + return False; + } + + if (chk->crc32 != crc32 || + chk->ver != NTLMSSP_SIGN_VERSION || + chk->seq_num != (*seq_num)) + { + DEBUG(5,("verify failed - crc %x ver %x seq %d\n", + crc32, NTLMSSP_SIGN_VERSION, (*seq_num)-1)); + DEBUG(5,("verify expect - crc %x ver %x seq %d\n", + chk->crc32, chk->ver, chk->seq_num)); + return False; + } + (*seq_num)++; + return True; +} + /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -- cgit From 9307940876a6c226969e9169d55c0408cd7ab032 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Wed, 21 Oct 1998 01:35:01 +0000 Subject: fixing smbd encrypted rpcs (data lens, alloc hints, sequence nums argh). put unicode strings after SAMLOGON query regardless of whether it's an NT mailslot or a non-NT mailslot, after having observed this behaviour out of NT machines. (This used to be commit c101113ec20ed0ba633e78e4ee45596cdccaf1b5) --- source3/rpc_parse/parse_rpc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 44f95c7e0c..6b5da0ef56 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -559,6 +559,9 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_NEG structure. + +*** lkclXXXX HACK ALERT! *** + ********************************************************************/ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { @@ -582,11 +585,11 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru old_offset = ps->offset; - ps->offset = neg->hdr_myname .buffer + 0x1c; + ps->offset = neg->hdr_myname .buffer + 0x50; /* lkclXXXX HACK! */ prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); old_offset += neg->hdr_myname .str_str_len; - ps->offset = neg->hdr_domain .buffer + 0x1c; + ps->offset = neg->hdr_domain .buffer + 0x50; /* lkclXXXX HACK! */ prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); old_offset += neg->hdr_domain .str_str_len; @@ -803,24 +806,23 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st /******************************************************************* checks an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 *seq_num) +BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_num) { - if (chk == NULL || seq_num == NULL) + if (chk == NULL) { return False; } if (chk->crc32 != crc32 || chk->ver != NTLMSSP_SIGN_VERSION || - chk->seq_num != (*seq_num)) + chk->seq_num != seq_num) { DEBUG(5,("verify failed - crc %x ver %x seq %d\n", - crc32, NTLMSSP_SIGN_VERSION, (*seq_num)-1)); + crc32, NTLMSSP_SIGN_VERSION, seq_num)); DEBUG(5,("verify expect - crc %x ver %x seq %d\n", chk->crc32, chk->ver, chk->seq_num)); return False; } - (*seq_num)++; return True; } -- cgit From 2db96e3047400be594e7c5ebf7d6fcedb77f6907 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 13 Nov 1998 03:37:01 +0000 Subject: fixes for OSF1 compilation (This used to be commit 5be3c37f50eac35cad3eadf0d24e7a4ee04c075e) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6b5da0ef56..3bf017d25e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -702,8 +702,8 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, rsp->neg_flags = neg_flags; - memcpy(&rsp->lm_resp, lm_resp, 24); - memcpy(&rsp->nt_resp, nt_resp, 24); + memcpy(rsp->lm_resp, lm_resp, 24); + memcpy(rsp->nt_resp, nt_resp, 24); if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { -- cgit From 74d539f5573a3ed3ff1b96c54752a389da4c3e14 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 17 Nov 1998 16:19:04 +0000 Subject: - group database API. oops and oh dear, the threat has been carried out: the pre-alpha "domain group" etc parameters have disappeared. - interactive debug detection - re-added mem_man (andrew's memory management, detects memory corruption) - american spellings of "initialise" replaced with english spelling of "initialise". - started on "lookup_name()" and "lookup_sid()" functions. proper ones. - moved lots of functions around. created some modules of commonly used code. e.g the password file locking code, which is used in groupfile.c and aliasfile.c and smbpass.c - moved RID_TYPE_MASK up another bit. this is really unfortunate, but there is no other "fast" way to identify users from groups from aliases. i do not believe that this code saves us anything (the multipliers) and puts us at a disadvantage (reduces the useable rid space). the designers of NT aren't silly: if they can get away with a user- interface-speed LsaLookupNames / LsaLookupSids, then so can we. i spoke with isaac at the cifs conference, the only time for example that they do a security context check is on file create. certainly not on individual file reads / writes, which would drastically hit their performance and ours, too. - renamed myworkgroup to global_sam_name, amongst other things, when used in the rpc code. there is also a global_member_name, as we are always responsible for a SAM database, the scope of which is limited by the role of the machine (e.g if a member of a workgroup, your SAM is for _local_ logins only, and its name is the name of your server. you even still have a SID. see LsaQueryInfoPolicy, levels 3 and 5). - updated functionality of groupname.c to be able to cope with names like DOMAIN\group and SERVER\alias. used this code to be able to do aliases as well as groups. this code may actually be better off being used in username mapping, too. - created a connect to serverlist function in clientgen.c and used it in password.c - initialisation in server.c depends on the role of the server. well, it does now. - rpctorture. smbtorture. EXERCISE EXTREME CAUTION. (This used to be commit 0d21e1e6090b933f396c764af535ca3388a562db) --- source3/rpc_parse/parse_rpc.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 3bf017d25e..5059ca222b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -122,17 +122,6 @@ interface/version dce/rpc pipe identification }, 0x00 \ } \ -/* pipe string names */ -#define PIPE_SRVSVC "\\PIPE\\srvsvc" -#define PIPE_SAMR "\\PIPE\\samr" -#define PIPE_WINREG "\\PIPE\\winreg" -#define PIPE_WKSSVC "\\PIPE\\wkssvc" -#define PIPE_NETLOGON "\\PIPE\\NETLOGON" -#define PIPE_NTLSA "\\PIPE\\ntlsa" -#define PIPE_NTSVCS "\\PIPE\\ntsvcs" -#define PIPE_LSASS "\\PIPE\\lsass" -#define PIPE_LSARPC "\\PIPE\\lsarpc" - struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ -- cgit From 8308c000b2022769644ed8ea1fc772776257c99b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 8 Dec 1998 00:25:04 +0000 Subject: adding srvsvc pipe. (This used to be commit d06d6369942828ec89e90f99bd0d0d3f91d61d13) --- source3/rpc_parse/parse_rpc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 5059ca222b..9ce83bea83 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -42,6 +42,16 @@ interface/version dce/rpc pipe identification }, 0x02 \ } \ +#define SYNT_SVCCTL_V2 \ +{ \ + { \ + 0x81, 0xbb, 0x7a, 0x36, \ + 0x44, 0x98, 0xf1, 0x35, \ + 0xad, 0x32, 0x98, 0xf0, \ + 0x38, 0x00, 0x10, 0x03 \ + }, 0x02 \ +} \ + #define SYNT_NETLOGON_V2 \ { \ { \ @@ -129,6 +139,7 @@ struct pipe_id_info pipe_names [] = { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } -- cgit From 99a9b0f7c4f85f46102457cf4707e8948b77fb3f Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 8 Feb 1999 23:40:49 +0000 Subject: UNICODE byte ordering issue: typecast to uint16* replaced with SSVAL() (This used to be commit 9084b7e33dfe717bd8d5604ee71d137e3baef0f5) --- source3/rpc_parse/parse_rpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 9ce83bea83..12e94ace77 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -707,9 +707,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { - struni2((uint16*)rsp->domain, domain); - struni2((uint16*)rsp->user , user ); - struni2((uint16*)rsp->wks , wks ); + struni2(rsp->domain, domain); + struni2(rsp->user , user ); + struni2(rsp->wks , wks ); } else { -- cgit From c6d16eea4394ff1c4d12cb435eebb0686b5ee736 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 11 Feb 1999 18:50:13 +0000 Subject: the UNICODE issue... (This used to be commit 73db80f34183324845407b00f58462ff2d7b47ea) --- source3/rpc_parse/parse_rpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 12e94ace77..63f738466b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -707,9 +707,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { - struni2(rsp->domain, domain); - struni2(rsp->user , user ); - struni2(rsp->wks , wks ); + str_to_unistr8(rsp->domain, domain); + str_to_unistr8(rsp->user , user ); + str_to_unistr8(rsp->wks , wks ); } else { -- cgit From fd96929ec1fa27e0affd4c4e9ba307c4ee30b978 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Fri, 12 Feb 1999 00:16:09 +0000 Subject: UNICODE cleanup (see lib/util_unistr.c). No more ugly static library buffers and all functions take a destination string length (especially unistrcpy was rather dangerous; we were only saved by the fact that datagrams are limited in size). (This used to be commit a1d39af1ce1d451b811dbd7c2ba391214851b87e) --- source3/rpc_parse/parse_rpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 63f738466b..c4a7e35895 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -707,9 +707,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { - str_to_unistr8(rsp->domain, domain); - str_to_unistr8(rsp->user , user ); - str_to_unistr8(rsp->wks , wks ); + ascii_to_unibuf(rsp->domain, domain, sizeof(rsp->domain)); + ascii_to_unibuf(rsp->user , user , sizeof(rsp->user )); + ascii_to_unibuf(rsp->wks , wks , sizeof(rsp->wks )); } else { -- cgit From 2737f26ad64ee32d6ef7365dcce0a3eb881f99db Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Mon, 15 Feb 1999 05:33:30 +0000 Subject: Always null-terminate strings. Also some string length and sizeof(pointer) corrections. (This used to be commit ce24191939b82985d09eabe945199f38b0fea486) --- source3/rpc_parse/parse_rpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index c4a7e35895..9716b35b78 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -707,9 +707,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { - ascii_to_unibuf(rsp->domain, domain, sizeof(rsp->domain)); - ascii_to_unibuf(rsp->user , user , sizeof(rsp->user )); - ascii_to_unibuf(rsp->wks , wks , sizeof(rsp->wks )); + ascii_to_unibuf(rsp->domain, domain, sizeof(rsp->domain)-2); + ascii_to_unibuf(rsp->user , user , sizeof(rsp->user )-2); + ascii_to_unibuf(rsp->wks , wks , sizeof(rsp->wks )-2); } else { -- cgit From 7fe5ba774b27b01b91f0d7cc25abf8383b9afca6 Mon Sep 17 00:00:00 2001 From: Matthew Chapman Date: Fri, 23 Apr 1999 14:47:45 +0000 Subject: Adding scheduler control pipe (\atsvc), client-side routines, and rpcclient command "at" (compatible with NT's "at" command - see rpcclient commit) - useful for remote NT administration. (This used to be commit cf30a472f702d7b50c3a85e2cf2f55b46a2bd452) --- source3/rpc_parse/parse_rpc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 9716b35b78..81e7ffa116 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -122,6 +122,16 @@ interface/version dce/rpc pipe identification }, 0x01 \ } \ +#define SYNT_ATSVC_V1 \ +{ \ + { \ + 0x82, 0x06, 0xf7, 0x1f, \ + 0x51, 0x0a, 0xe8, 0x30, \ + 0x07, 0x6d, 0x74, 0x0b, \ + 0xe8, 0xce, 0xe9, 0x8b \ + }, 0x01 \ +} \ + #define SYNT_NONE_V0 \ { \ { \ @@ -142,6 +152,7 @@ struct pipe_id_info pipe_names [] = { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, + { PIPE_ATSVC , SYNT_ATSVC_V1 , PIPE_ATSVC , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From be552ca3504ebd98da37e70bac1f10b248cf860b Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Tue, 27 Apr 1999 10:43:32 +0000 Subject: rpc_parse/parse_misc.c : defined a new BUFFER5 struct include/ntdomain.h : added rpc_spoolss.h include statement include/proto.h include/rpc_dce.h : added definition of RPC_ALTER_CONTEXT request & reply param/loadparm.c : 2 new options for NT printing support and some changes to initial values in the LPRNG case. rpc_parse/parse_prs.c : added prs_uint16s() rpc_parse/parse_rpc.c : added SYNT_SPOOLSS_V1 and code for the alter-context support. rpc_server/srv_pipe.c : alter-context support smbd/nttrans.c smbd/server.c include/rpc_misc.h Makefile.in include/smb.h Jean Francois (This used to be commit 4c515804b70254248e378a3f90f47e4c32639d29) --- source3/rpc_parse/parse_rpc.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 81e7ffa116..2f47f06e36 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -132,6 +132,16 @@ interface/version dce/rpc pipe identification }, 0x01 \ } \ +#define SYNT_SPOOLSS_V1 \ +{ \ + { \ + 0x78, 0x56, 0x34, 0x12, \ + 0x34, 0x12, 0xcd, 0xab, \ + 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xab \ + }, 0x01 \ +} \ + #define SYNT_NONE_V0 \ { \ { \ @@ -153,6 +163,7 @@ struct pipe_id_info pipe_names [] = { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_ATSVC , SYNT_ATSVC_V1 , PIPE_ATSVC , TRANS_SYNT_V2 }, + { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; @@ -212,13 +223,22 @@ static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int de /******************************************************************* creates an RPC_ADDR_STR structure. + +The name can be null (RPC Alter-Context) ********************************************************************/ static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) { - if (str == NULL || name == NULL) return; - - str->len = strlen(name) + 1; - fstrcpy(str->str, name); + if (str == NULL ) return; + if (name == NULL) + { + str->len = 1; + fstrcpy(str->str, ""); + } + else + { + str->len = strlen(name) + 1; + fstrcpy(str->str, name); + } } /******************************************************************* @@ -349,6 +369,7 @@ static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, in creates an RPC_HDR_BA structure. lkclXXXX only one reason at the moment! +jfm: nope two ! The pipe_addr can be NULL ! ********************************************************************/ void make_rpc_hdr_ba(RPC_HDR_BA *rpc, @@ -357,7 +378,7 @@ void make_rpc_hdr_ba(RPC_HDR_BA *rpc, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { - if (rpc == NULL || transfer == NULL || pipe_addr == NULL) return; + if (rpc == NULL || transfer == NULL) return; make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid); make_rpc_addr_str(&(rpc->addr), pipe_addr); -- cgit From 4e5bf481fba36655e8fc8e04f6f67ba17dcb9844 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 3 May 1999 22:04:02 +0000 Subject: last part of RPC api change. and of rpcclient eventlog funtion Jean Francois (This used to be commit 7fc8659e83bf0269df297016beac6793ff0bdf32) --- source3/rpc_parse/parse_rpc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 2f47f06e36..524c4201ad 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -152,6 +152,16 @@ interface/version dce/rpc pipe identification }, 0x00 \ } \ +#define SYNT_EVENTLOG_V0 \ +{ \ + { \ + 0xdc, 0x3f, 0x27, 0x82, \ + 0x2a, 0xe3, 0xc3, 0x18, \ + 0x3f, 0x78, 0x82, 0x79, \ + 0x29, 0xdc, 0x23, 0xea \ + }, 0x00 \ +} + \ struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ @@ -164,6 +174,7 @@ struct pipe_id_info pipe_names [] = { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_ATSVC , SYNT_ATSVC_V1 , PIPE_ATSVC , TRANS_SYNT_V2 }, { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, + { PIPE_EVENTLOG, SYNT_EVENTLOG_V0, PIPE_EVENTLOG , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 73891ca8e4f6cca6aa8bb0ae043f660a64baa056 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Tue, 29 Jun 1999 18:47:06 +0000 Subject: improving authentication code (tidyup). (This used to be commit ab1a6aa42db5217f025941fb5107436556bc23b7) --- source3/rpc_parse/parse_rpc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 524c4201ad..3066d94dec 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -692,7 +692,8 @@ creates an RPC_AUTH_NTLMSSP_RESP structure. ********************************************************************/ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, - uchar lm_resp[24], uchar nt_resp[24], + uchar lm_resp[24], + uchar *nt_resp, size_t nt_len, char *domain, char *user, char *wks, uint32 neg_flags) { @@ -701,7 +702,6 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, int wks_len = strlen(wks ); int usr_len = strlen(user ); int lm_len = lm_resp != NULL ? 24 : 0; - int nt_len = nt_resp != NULL ? 24 : 0; DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); @@ -709,9 +709,9 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, #ifdef DEBUG_PASSWORD DEBUG(100,("lm_resp\n")); - dump_data(100, lm_resp, 24); + dump_data(100, lm_resp, lm_len); DEBUG(100,("nt_resp\n")); - dump_data(100, nt_resp, 24); + dump_data(100, nt_resp, nt_len); #endif DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", @@ -745,8 +745,8 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, rsp->neg_flags = neg_flags; - memcpy(rsp->lm_resp, lm_resp, 24); - memcpy(rsp->nt_resp, nt_resp, 24); + memcpy(rsp->lm_resp, lm_resp, lm_len); + memcpy(rsp->nt_resp, nt_resp, nt_len); if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { -- cgit From f2e0bbffb5e40df4850b6bd0eae73a8fb0edc6d7 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 26 Jul 1999 21:47:23 +0000 Subject: renaming AUTH VERIFIER to AUTH NTLMSSP VERIFIER. ready for adding another RPC authentication system. (This used to be commit 1a211bafebad8c63d98b5ef275a6272013527c65) --- source3/rpc_parse/parse_rpc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 3066d94dec..138dbd90b1 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -505,7 +505,8 @@ checks an RPC_HDR_AUTH structure. ********************************************************************/ BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) { - return (rai->auth_type == 0x0a && rai->auth_level == 0x06); + return ((rai->auth_type == 0x0a || rai->auth_type == 0x44) && + rai->auth_level == 0x06); } /******************************************************************* @@ -545,18 +546,18 @@ void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept } /******************************************************************* -checks an RPC_AUTH_VERIFIER structure. +checks an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, +BOOL rpc_auth_ntlmssp_verifier_chk(RPC_AUTH_NTLMSSP_VERIFIER *rav, char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); } /******************************************************************* -creates an RPC_AUTH_VERIFIER structure. +creates an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, +void make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav, char *signature, uint32 msg_type) { if (rav == NULL) return; @@ -566,9 +567,9 @@ void make_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, } /******************************************************************* -reads or writes an RPC_AUTH_VERIFIER structure. +reads or writes an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -void smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +void smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return; -- cgit From cba7662da1fd9ed8bd9f9969417adf1fe5f0d33b Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Thu, 7 Oct 1999 22:10:29 +0000 Subject: - added rudimentary CAP_UNICODE support because i thought it was part of a problem i was having. - added rudimentary CAP_STATUS32 support for same reason. - added hard-coded, copy-the-same-data-from-over-the-wire version of CAP_EXTENDED_SECURITY, which is a security-blob to encapsulate GSSAPI which encodes SPNEGO which is used to negotiate Kerberos or NTLMSSP. i have implemented NTLMSSP which negotiates NTLMv1 or NTLMv2 and 40-bit or 128-bit etc. i have implemented NTLMv1 / 40-bit. *whew*. (This used to be commit e5b80bd2f76fda70e41e4a9007eb035dab92ed8e) --- source3/rpc_parse/parse_rpc.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 138dbd90b1..19cb4dfa4b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -702,7 +702,7 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, int dom_len = strlen(domain); int wks_len = strlen(wks ); int usr_len = strlen(user ); - int lm_len = lm_resp != NULL ? 24 : 0; + int lm_len = nt_len != 0 ? (lm_resp != NULL ? 24 : 0) : 1; DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); @@ -710,9 +710,15 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, #ifdef DEBUG_PASSWORD DEBUG(100,("lm_resp\n")); - dump_data(100, lm_resp, lm_len); + if (lm_resp != NULL) + { + dump_data(100, lm_resp, lm_len); + } DEBUG(100,("nt_resp\n")); - dump_data(100, nt_resp, nt_len); + if (nt_resp != NULL) + { + dump_data(100, nt_resp, nt_len); + } #endif DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", @@ -746,8 +752,22 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, rsp->neg_flags = neg_flags; - memcpy(rsp->lm_resp, lm_resp, lm_len); - memcpy(rsp->nt_resp, nt_resp, nt_len); + if (lm_resp != NULL && lm_len != 1) + { + memcpy(rsp->lm_resp, lm_resp, lm_len); + } + else + { + rsp->lm_resp[0] = 0; + } + if (nt_resp != NULL) + { + memcpy(rsp->nt_resp, nt_resp, nt_len); + } + else + { + rsp->nt_resp[0] = 0; + } if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { -- cgit From 896ecb48cab1d928224387f06ec63584bc6c6e99 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 15 Oct 1999 18:46:22 +0000 Subject: return results on prs_xxxxx() and all xxx_io_xxx() routines. the whole task is not complete, yet. xxx_io_xxx() routines that _call_ xxx_io_xxx() routines not done. prs_xxxx() covered by macros. considering doing xxx_io_xxxx in the same way. (This used to be commit 3b583f7be51434af98bc52b48dfa42c4602a3094) --- source3/rpc_parse/parse_rpc.c | 192 ++++++++++++++++++++++++++++-------------- 1 file changed, 129 insertions(+), 63 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 19cb4dfa4b..b902ee1414 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -3,9 +3,9 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1997, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, - * Copyright (C) Paul Ashton 1997. + * Copyright (C) Andrew Tridgell 1992-1999, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, + * Copyright (C) Paul Ashton 1997-1999. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -181,10 +181,10 @@ struct pipe_id_info pipe_names [] = /******************************************************************* creates an RPC_HDR structure. ********************************************************************/ -void make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, +BOOL make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, uint32 call_id, int data_len, int auth_len) { - if (hdr == NULL) return; + if (hdr == NULL) return False; hdr->major = 5; /* RPC version 5 */ hdr->minor = 0; /* minor version 0 */ @@ -194,14 +194,16 @@ void make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, hdr->frag_len = data_len; /* fragment length, fill in later */ hdr->auth_len = auth_len; /* authentication length */ hdr->call_id = call_id; /* call identifier - match incoming RPC */ + + return True; } /******************************************************************* reads or writes an RPC_HDR structure. ********************************************************************/ -void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr"); depth++; @@ -214,14 +216,16 @@ void smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) prs_uint16("frag_len ", ps, depth, &(rpc->frag_len)); prs_uint16("auth_len ", ps, depth, &(rpc->auth_len)); prs_uint32("call_id ", ps, depth, &(rpc->call_id)); + + return True; } /******************************************************************* reads or writes an RPC_IFACE structure. ********************************************************************/ -static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { - if (ifc == NULL) return; + if (ifc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; @@ -230,6 +234,8 @@ static void smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int de prs_uint8s (False, "data ", ps, depth, ifc->data, sizeof(ifc->data)); prs_uint32 ( "version", ps, depth, &(ifc->version)); + + return True; } /******************************************************************* @@ -237,9 +243,9 @@ creates an RPC_ADDR_STR structure. The name can be null (RPC Alter-Context) ********************************************************************/ -static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) +static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, char *name) { - if (str == NULL ) return; + if (str == NULL ) return False; if (name == NULL) { str->len = 1; @@ -250,14 +256,16 @@ static void make_rpc_addr_str(RPC_ADDR_STR *str, char *name) str->len = strlen(name) + 1; fstrcpy(str->str, name); } + + return True; } /******************************************************************* reads or writes an RPC_ADDR_STR structure. ********************************************************************/ -static void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +static BOOL smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { - if (str == NULL) return; + if (str == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_addr_str"); depth++; @@ -265,26 +273,30 @@ static void smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, prs_uint16 ( "len", ps, depth, &(str->len)); prs_uint8s (True, "str", ps, depth, (uchar*)str->str, str->len); + + return True; } /******************************************************************* creates an RPC_HDR_BBA structure. ********************************************************************/ -static void make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) +static BOOL make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) { - if (bba == NULL) return; + if (bba == NULL) return False; bba->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ bba->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ bba->assoc_gid = assoc_gid; /* associated group id (0x0) */ + + return True; } /******************************************************************* reads or writes an RPC_HDR_BBA structure. ********************************************************************/ -static void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_bba"); depth++; @@ -292,17 +304,19 @@ static void smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, in prs_uint16("max_tsize", ps, depth, &(rpc->max_tsize)); prs_uint16("max_rsize", ps, depth, &(rpc->max_rsize)); prs_uint32("assoc_gid", ps, depth, &(rpc->assoc_gid)); + + return True; } /******************************************************************* creates an RPC_HDR_RB structure. ********************************************************************/ -void make_rpc_hdr_rb(RPC_HDR_RB *rpc, +BOOL make_rpc_hdr_rb(RPC_HDR_RB *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, uint32 num_elements, uint16 context_id, uint8 num_syntaxes, RPC_IFACE *abstract, RPC_IFACE *transfer) { - if (rpc == NULL) return; + if (rpc == NULL) return False; make_rpc_hdr_bba(&(rpc->bba), max_tsize, max_rsize, assoc_gid); @@ -315,14 +329,16 @@ void make_rpc_hdr_rb(RPC_HDR_RB *rpc, /* num and vers. of interface to use for replies */ memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); + + return True; } /******************************************************************* reads or writes an RPC_HDR_RB structure. ********************************************************************/ -void smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rb"); depth++; @@ -335,6 +351,8 @@ void smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) smb_io_rpc_iface("", &(rpc->abstract), ps, depth); smb_io_rpc_iface("", &(rpc->transfer), ps, depth); + + return True; } /******************************************************************* @@ -343,14 +361,16 @@ creates an RPC_RESULTS structure. lkclXXXX only one reason at the moment! ********************************************************************/ -static void make_rpc_results(RPC_RESULTS *res, +static BOOL make_rpc_results(RPC_RESULTS *res, uint8 num_results, uint16 result, uint16 reason) { - if (res == NULL) return; + if (res == NULL) return False; res->num_results = num_results; /* the number of results (0x01) */ res->result = result ; /* result (0x00 = accept) */ res->reason = reason ; /* reason (0x00 = no reason specified) */ + + return True; } /******************************************************************* @@ -359,9 +379,9 @@ reads or writes an RPC_RESULTS structure. lkclXXXX only one reason at the moment! ********************************************************************/ -static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { - if (res == NULL) return; + if (res == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_results"); depth++; @@ -374,6 +394,8 @@ static void smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, in prs_uint16("result ", ps, depth, &(res->result )); prs_uint16("reason ", ps, depth, &(res->reason )); + + return True; } /******************************************************************* @@ -383,13 +405,13 @@ lkclXXXX only one reason at the moment! jfm: nope two ! The pipe_addr can be NULL ! ********************************************************************/ -void make_rpc_hdr_ba(RPC_HDR_BA *rpc, +BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { - if (rpc == NULL || transfer == NULL) return; + if (rpc == NULL || transfer == NULL) return False; make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid); make_rpc_addr_str(&(rpc->addr), pipe_addr); @@ -397,14 +419,16 @@ void make_rpc_hdr_ba(RPC_HDR_BA *rpc, /* the transfer syntax from the request */ memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); + + return True; } /******************************************************************* reads or writes an RPC_HDR_BA structure. ********************************************************************/ -void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_ba"); depth++; @@ -413,26 +437,30 @@ void smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) smb_io_rpc_addr_str("", &(rpc->addr) , ps, depth); smb_io_rpc_results ("", &(rpc->res) , ps, depth); smb_io_rpc_iface ("", &(rpc->transfer), ps, depth); + + return True; } /******************************************************************* creates an RPC_HDR_REQ structure. ********************************************************************/ -void make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) +BOOL make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) { - if (hdr == NULL) return; + if (hdr == NULL) return False; hdr->alloc_hint = alloc_hint; /* allocation hint */ hdr->context_id = 0; /* presentation context identifier */ hdr->opnum = opnum; /* opnum */ + + return True; } /******************************************************************* reads or writes an RPC_HDR_REQ structure. ********************************************************************/ -void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_req"); depth++; @@ -440,14 +468,16 @@ void smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); prs_uint16("context_id", ps, depth, &(rpc->context_id)); prs_uint16("opnum ", ps, depth, &(rpc->opnum)); + + return True; } /******************************************************************* reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return; + if (rpc == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_resp"); depth++; @@ -456,17 +486,19 @@ void smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dep prs_uint16("context_id", ps, depth, &(rpc->context_id)); prs_uint8 ("cancel_ct ", ps, depth, &(rpc->cancel_count)); prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); + + return True; } /******************************************************************* creates an RPC_HDR_AUTHA structure. ********************************************************************/ -void make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, +BOOL make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, uint16 max_tsize, uint16 max_rsize, uint8 auth_type, uint8 auth_level, uint8 stub_type_len) { - if (rai == NULL) return; + if (rai == NULL) return False; rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ @@ -477,14 +509,16 @@ void make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, rai->padding = 0; /* padding 0x00 */ rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ + + return True; } /******************************************************************* reads or writes an RPC_HDR_AUTHA structure. ********************************************************************/ -void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) { - if (rai == NULL) return; + if (rai == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); depth++; @@ -498,6 +532,8 @@ void smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int de prs_uint8 ("padding ", ps, depth, &(rai->padding )); prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ + + return True; } /******************************************************************* @@ -507,17 +543,19 @@ BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) { return ((rai->auth_type == 0x0a || rai->auth_type == 0x44) && rai->auth_level == 0x06); + + return True; } /******************************************************************* creates an RPC_HDR_AUTH structure. ********************************************************************/ -void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, +BOOL make_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, uint8 stub_type_len, uint32 ptr) { - if (rai == NULL) return; + if (rai == NULL) return False; rai->auth_type = auth_type; /* nt lm ssp 0x0a */ rai->auth_level = auth_level; /* 0x06 */ @@ -525,14 +563,16 @@ void make_rpc_hdr_auth(RPC_HDR_AUTH *rai, rai->padding = 0; /* padding 0x00 */ rai->unknown = ptr; /* non-zero pointer to something */ + + return True; } /******************************************************************* reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ -void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { - if (rai == NULL) return; + if (rai == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); depth++; @@ -543,6 +583,8 @@ void smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept prs_uint8 ("padding ", ps, depth, &(rai->padding )); prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ + + return True; } /******************************************************************* @@ -552,45 +594,51 @@ BOOL rpc_auth_ntlmssp_verifier_chk(RPC_AUTH_NTLMSSP_VERIFIER *rav, char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); + + return True; } /******************************************************************* creates an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav, +BOOL make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav, char *signature, uint32 msg_type) { - if (rav == NULL) return; + if (rav == NULL) return False; fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ + + return True; } /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_VERIFIER structure. ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth) { - if (rav == NULL) return; + if (rav == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); depth++; prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ + + return True; } /******************************************************************* creates an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, +BOOL make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, uint32 neg_flgs, fstring myname, fstring domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); - if (neg == NULL) return; + if (neg == NULL) return False; neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ @@ -599,6 +647,8 @@ void make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); + + return True; } /******************************************************************* @@ -607,9 +657,9 @@ reads or writes an RPC_AUTH_NTLMSSP_NEG structure. *** lkclXXXX HACK ALERT! *** ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { - if (neg == NULL) return; + if (neg == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_neg"); depth++; @@ -648,16 +698,18 @@ void smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); } + + return True; } /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, +BOOL make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, uint32 neg_flags, uint8 challenge[8]) { - if (chl == NULL) return; + if (chl == NULL) return False; chl->unknown_1 = 0x0; chl->unknown_2 = 0x00000028; @@ -665,14 +717,16 @@ void make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, memcpy(chl->challenge, challenge, sizeof(chl->challenge)); bzero (chl->reserved , sizeof(chl->reserved)); + + return True; } /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) { - if (chl == NULL) return; + if (chl == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chal"); depth++; @@ -683,6 +737,8 @@ void smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); + + return True; } /******************************************************************* @@ -692,7 +748,7 @@ creates an RPC_AUTH_NTLMSSP_RESP structure. *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ -void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, +BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uchar lm_resp[24], uchar *nt_resp, size_t nt_len, char *domain, char *user, char *wks, @@ -706,7 +762,7 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); - if (rsp == NULL) return; + if (rsp == NULL) return False; #ifdef DEBUG_PASSWORD DEBUG(100,("lm_resp\n")); @@ -782,6 +838,8 @@ void make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, fstrcpy(rsp->wks , wks ); } rsp->sess_key[0] = 0; + + return True; } /******************************************************************* @@ -791,9 +849,9 @@ reads or writes an RPC_AUTH_NTLMSSP_RESP structure. *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) { - if (rsp == NULL) return; + if (rsp == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; @@ -865,6 +923,8 @@ void smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); } + + return True; } /******************************************************************* @@ -888,28 +948,32 @@ BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_nu return False; } return True; + + return True; } /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -void make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, +BOOL make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 ver, uint32 crc32, uint32 seq_num) { - if (chk == NULL) return; + if (chk == NULL) return False; chk->ver = ver ; chk->reserved = 0x0; chk->crc32 = crc32 ; chk->seq_num = seq_num ; + + return True; } /******************************************************************* reads or writes an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -void smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) { - if (chk == NULL) return; + if (chk == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chk"); depth++; @@ -918,5 +982,7 @@ void smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_stru prs_uint32("reserved", ps, depth, &(chk->reserved)); prs_uint32("crc32 ", ps, depth, &(chk->crc32 )); prs_uint32("seq_num ", ps, depth, &(chk->seq_num )); + + return True; } -- cgit From b231d2fafaff8dc67ef2dbaec778f716524d4f6a Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 15 Nov 1999 22:11:10 +0000 Subject: - added DCE/RPC "fault" PDU support. - disabled (AGAIN) the GETDC "if (MAILSLOT\NTLOGON)" code that will get NT5rc2 to work but WILL break win95 (AGAIN). this needs _not_ to be re-enabled but to be replaced with a better mechanism. - added SMBwrite support (note: SMBwriteX already existed) as NT5rc2 is sending DCE/RPC over SMBwrite not SMBwriteX. (This used to be commit 25c70e3c984c4fed19763ed405741e83fe14f87e) --- source3/rpc_parse/parse_rpc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index b902ee1414..82b0be2802 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -220,6 +220,22 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) return True; } +/******************************************************************* +reads or writes an RPC_HDR_FAULT structure. +********************************************************************/ +BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); + depth++; + + prs_uint32("status ", ps, depth, &(rpc->status )); + prs_uint32("reserved", ps, depth, &(rpc->reserved)); + + return True; +} + /******************************************************************* reads or writes an RPC_IFACE structure. ********************************************************************/ -- cgit From 1c6c4e7e39bde99f8d312516ba530b905bc01da7 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Fri, 19 Nov 1999 00:12:16 +0000 Subject: added \PIPE\browser plus experimental brsinfo command. you wouldn't believe the XXXX that MIGHT be involved in getting nt5rc2 to join a samba domain... (This used to be commit 569babb3935950c1b64396955541abf276cc1d92) --- source3/rpc_parse/parse_rpc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 82b0be2802..819e441742 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -52,6 +52,16 @@ interface/version dce/rpc pipe identification }, 0x02 \ } \ +#define SYNT_BROWSER_V0 \ +{ \ + { \ + 0x98, 0xd0, 0xff, 0x6b, \ + 0x12, 0xa1, 0x10, 0x36, \ + 0x98, 0x33, 0x01, 0x28, \ + 0x92, 0x02, 0x01, 0x62 \ + }, 0x00 \ +} \ + #define SYNT_NETLOGON_V2 \ { \ { \ @@ -166,6 +176,7 @@ struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_BROWSER , SYNT_BROWSER_V0 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, -- cgit From 0ce128e3550794d4dbbd1def00e87c020f72c992 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Sun, 12 Dec 1999 01:25:49 +0000 Subject: delineation between smb and msrpc more marked. smbd now constructs pdus, and then feeds them over either a "local" function call or a "remote" function call to an msrpc service. the "remote" msrpc daemon, on the other side of a unix socket, then calls the same "local" function that smbd would, if the msrpc service were being run from inside smbd. this allows a transition from local msrpc services (inside the same smbd process) to remote (over a unix socket). removed reference to pipes_struct in msrpc services. all msrpc processing functions take rpcsrv_struct which is a structure containing state info for the msrpc functions to decode and create pdus. created become_vuser() which does everything not related to connection_struct that become_user() does. removed, as best i could, connection_struct dependencies from the nt spoolss printing code. todo: remove dcinfo from rpcsrv_struct because this stores NETLOGON-specific info on a per-connection basis, and if the connection dies then so does the info, and that's a fairly serious problem. had to put pretty much everything that is in user_struct into parse_creds.c to feed unix user info over to the msrpc daemons. why? because it's expensive to do unix password/group database lookups, and it's definitely expensive to do nt user profile lookups, not to mention pretty difficult and if you did either of these it would introduce a complication / unnecessary interdependency. so, send uid/gid/num_groups/gid_t* + SID+num_rids+domain_group_rids* + unix username + nt username + nt domain + user session key etc. this is the MINIMUM info identified so far that's actually implemented. missing bits include the called and calling netbios names etc. (basically, anything that can be loaded into standard_sub() and standard_sub_basic()...) (This used to be commit aa3c659a8dba0437c17c60055a6ed30fdfecdb6d) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 819e441742..ac6ea8ea7e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -270,7 +270,7 @@ creates an RPC_ADDR_STR structure. The name can be null (RPC Alter-Context) ********************************************************************/ -static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, char *name) +static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, const char *name) { if (str == NULL ) return False; if (name == NULL) @@ -434,7 +434,7 @@ jfm: nope two ! The pipe_addr can be NULL ! ********************************************************************/ BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - char *pipe_addr, + const char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { -- cgit From 3db52feb1f3b2c07ce0b06ad4a7099fa6efe3fc7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 13 Dec 1999 13:27:58 +0000 Subject: first pass at updating head branch to be to be the same as the SAMBA_2_0 branch (This used to be commit 453a822a76780063dff23526c35408866d0c0154) --- source3/rpc_parse/parse_rpc.c | 1084 +++++++++++++++++++++-------------------- 1 file changed, 565 insertions(+), 519 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ac6ea8ea7e..d4ea84628a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -3,9 +3,10 @@ * Unix SMB/Netbios implementation. * Version 1.9. * RPC Pipe client / server routines - * Copyright (C) Andrew Tridgell 1992-1999, - * Copyright (C) Luke Kenneth Casson Leighton 1996-1999, - * Copyright (C) Paul Ashton 1997-1999. + * Copyright (C) Andrew Tridgell 1992-1997, + * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, + * Copyright (C) Paul Ashton 1997. + * Copyright (C) Jeremy Allison 1999. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,501 +33,476 @@ extern int DEBUGLEVEL; interface/version dce/rpc pipe identification ********************************************************************/ -#define TRANS_SYNT_V2 \ -{ \ - { \ - 0x04, 0x5d, 0x88, 0x8a, \ - 0xeb, 0x1c, 0xc9, 0x11, \ - 0x9f, 0xe8, 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 \ - }, 0x02 \ -} \ - -#define SYNT_SVCCTL_V2 \ -{ \ - { \ - 0x81, 0xbb, 0x7a, 0x36, \ - 0x44, 0x98, 0xf1, 0x35, \ - 0xad, 0x32, 0x98, 0xf0, \ - 0x38, 0x00, 0x10, 0x03 \ - }, 0x02 \ -} \ - -#define SYNT_BROWSER_V0 \ -{ \ - { \ - 0x98, 0xd0, 0xff, 0x6b, \ - 0x12, 0xa1, 0x10, 0x36, \ - 0x98, 0x33, 0x01, 0x28, \ - 0x92, 0x02, 0x01, 0x62 \ - }, 0x00 \ -} \ - -#define SYNT_NETLOGON_V2 \ -{ \ - { \ - 0x04, 0x5d, 0x88, 0x8a, \ - 0xeb, 0x1c, 0xc9, 0x11, \ - 0x9f, 0xe8, 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 \ - }, 0x02 \ -} \ - -#define SYNT_WKSSVC_V1 \ -{ \ - { \ - 0x98, 0xd0, 0xff, 0x6b, \ - 0x12, 0xa1, 0x10, 0x36, \ - 0x98, 0x33, 0x46, 0xc3, \ - 0xf8, 0x7e, 0x34, 0x5a \ - }, 0x01 \ -} \ - -#define SYNT_SRVSVC_V3 \ -{ \ - { \ - 0xc8, 0x4f, 0x32, 0x4b, \ - 0x70, 0x16, 0xd3, 0x01, \ - 0x12, 0x78, 0x5a, 0x47, \ - 0xbf, 0x6e, 0xe1, 0x88 \ - }, 0x03 \ -} \ - -#define SYNT_LSARPC_V0 \ -{ \ - { \ - 0x78, 0x57, 0x34, 0x12, \ - 0x34, 0x12, 0xcd, 0xab, \ - 0xef, 0x00, 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab \ - }, 0x00 \ -} \ - -#define SYNT_SAMR_V1 \ -{ \ - { \ - 0x78, 0x57, 0x34, 0x12, \ - 0x34, 0x12, 0xcd, 0xab, \ - 0xef, 0x00, 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xac \ - }, 0x01 \ -} \ - -#define SYNT_NETLOGON_V1 \ -{ \ - { \ - 0x78, 0x56, 0x34, 0x12, \ - 0x34, 0x12, 0xcd, 0xab, \ - 0xef, 0x00, 0x01, 0x23, \ - 0x45, 0x67, 0xcf, 0xfb \ - }, 0x01 \ -} \ - -#define SYNT_WINREG_V1 \ -{ \ - { \ - 0x01, 0xd0, 0x8c, 0x33, \ - 0x44, 0x22, 0xf1, 0x31, \ - 0xaa, 0xaa, 0x90, 0x00, \ - 0x38, 0x00, 0x10, 0x03 \ - }, 0x01 \ -} \ - -#define SYNT_ATSVC_V1 \ -{ \ - { \ - 0x82, 0x06, 0xf7, 0x1f, \ - 0x51, 0x0a, 0xe8, 0x30, \ - 0x07, 0x6d, 0x74, 0x0b, \ - 0xe8, 0xce, 0xe9, 0x8b \ - }, 0x01 \ -} \ - -#define SYNT_SPOOLSS_V1 \ -{ \ - { \ - 0x78, 0x56, 0x34, 0x12, \ - 0x34, 0x12, 0xcd, 0xab, \ - 0xef, 0x00, 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab \ - }, 0x01 \ -} \ - -#define SYNT_NONE_V0 \ -{ \ - { \ - 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00 \ - }, 0x00 \ -} \ - -#define SYNT_EVENTLOG_V0 \ -{ \ - { \ - 0xdc, 0x3f, 0x27, 0x82, \ - 0x2a, 0xe3, 0xc3, 0x18, \ - 0x3f, 0x78, 0x82, 0x79, \ - 0x29, 0xdc, 0x23, 0xea \ - }, 0x00 \ -} - \ +#define TRANS_SYNT_V2 \ +{ \ + { \ + 0x8a885d04, 0x1ceb, 0x11c9, \ + { 0x9f, 0xe8, 0x08, 0x00, \ + 0x2b, 0x10, 0x48, 0x60 } \ + }, 0x02 \ +} + +#define SYNT_NETLOGON_V2 \ +{ \ + { \ + 0x8a885d04, 0x1ceb, 0x11c9, \ + { 0x9f, 0xe8, 0x08, 0x00, \ + 0x2b, 0x10, 0x48, 0x60 } \ + }, 0x02 \ +} + +#define SYNT_WKSSVC_V1 \ +{ \ + { \ + 0x6bffd098, 0xa112, 0x3610, \ + { 0x98, 0x33, 0x46, 0xc3, \ + 0xf8, 0x7e, 0x34, 0x5a } \ + }, 0x01 \ +} + +#define SYNT_SRVSVC_V3 \ +{ \ + { \ + 0x4b324fc8, 0x1670, 0x01d3, \ + { 0x12, 0x78, 0x5a, 0x47, \ + 0xbf, 0x6e, 0xe1, 0x88 } \ + }, 0x03 \ +} + +#define SYNT_LSARPC_V0 \ +{ \ + { \ + 0x12345778, 0x1234, 0xabcd, \ + { 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xab } \ + }, 0x00 \ +} + +#define SYNT_SAMR_V1 \ +{ \ + { \ + 0x12345778, 0x1234, 0xabcd, \ + { 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xac } \ + }, 0x01 \ +} + +#define SYNT_NETLOGON_V1 \ +{ \ + { \ + 0x12345678, 0x1234, 0xabcd, \ + { 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0xcf, 0xfb } \ + }, 0x01 \ +} + +#define SYNT_WINREG_V1 \ +{ \ + { \ + 0x338cd001, 0x2244, 0x31f1, \ + { 0xaa, 0xaa, 0x90, 0x00, \ + 0x38, 0x00, 0x10, 0x03 } \ + }, 0x01 \ +} + +#define SYNT_NONE_V0 \ +{ \ + { \ + 0x0, 0x0, 0x0, \ + { 0x00, 0x00, 0x00, 0x00, \ + 0x00, 0x00, 0x00, 0x00 } \ + }, 0x00 \ +} + +/* pipe string names */ +#define PIPE_SRVSVC "\\PIPE\\srvsvc" +#define PIPE_SAMR "\\PIPE\\samr" +#define PIPE_WINREG "\\PIPE\\winreg" +#define PIPE_WKSSVC "\\PIPE\\wkssvc" +#define PIPE_NETLOGON "\\PIPE\\NETLOGON" +#define PIPE_NTLSA "\\PIPE\\ntlsa" +#define PIPE_NTSVCS "\\PIPE\\ntsvcs" +#define PIPE_LSASS "\\PIPE\\lsass" +#define PIPE_LSARPC "\\PIPE\\lsarpc" + struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_BROWSER , SYNT_BROWSER_V0 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, - { PIPE_ATSVC , SYNT_ATSVC_V1 , PIPE_ATSVC , TRANS_SYNT_V2 }, - { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, - { PIPE_EVENTLOG, SYNT_EVENTLOG_V0, PIPE_EVENTLOG , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; /******************************************************************* -creates an RPC_HDR structure. + Inits an RPC_HDR structure. ********************************************************************/ -BOOL make_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, + +void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, uint32 call_id, int data_len, int auth_len) { - if (hdr == NULL) return False; - hdr->major = 5; /* RPC version 5 */ hdr->minor = 0; /* minor version 0 */ hdr->pkt_type = pkt_type; /* RPC packet type */ hdr->flags = flags; /* dce/rpc flags */ - hdr->pack_type = 0x10; /* packed data representation */ + hdr->pack_type[0] = 0x10; /* little-endian data representation */ + hdr->pack_type[1] = 0; /* packed data representation */ + hdr->pack_type[2] = 0; /* packed data representation */ + hdr->pack_type[3] = 0; /* packed data representation */ hdr->frag_len = data_len; /* fragment length, fill in later */ hdr->auth_len = auth_len; /* authentication length */ hdr->call_id = call_id; /* call identifier - match incoming RPC */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR structure. + Reads or writes an RPC_HDR structure. ********************************************************************/ + BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr"); depth++; - prs_uint8 ("major ", ps, depth, &(rpc->major)); - prs_uint8 ("minor ", ps, depth, &(rpc->minor)); - prs_uint8 ("pkt_type ", ps, depth, &(rpc->pkt_type)); - prs_uint8 ("flags ", ps, depth, &(rpc->flags)); - prs_uint32("pack_type ", ps, depth, &(rpc->pack_type)); - prs_uint16("frag_len ", ps, depth, &(rpc->frag_len)); - prs_uint16("auth_len ", ps, depth, &(rpc->auth_len)); - prs_uint32("call_id ", ps, depth, &(rpc->call_id)); - - return True; -} + if(!prs_uint8 ("major ", ps, depth, &rpc->major)) + return False; -/******************************************************************* -reads or writes an RPC_HDR_FAULT structure. -********************************************************************/ -BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) -{ - if (rpc == NULL) return False; + if(!prs_uint8 ("minor ", ps, depth, &rpc->minor)) + return False; + if(!prs_uint8 ("pkt_type ", ps, depth, &rpc->pkt_type)) + return False; + if(!prs_uint8 ("flags ", ps, depth, &rpc->flags)) + return False; + if(!prs_uint8("pack_type0", ps, depth, &rpc->pack_type[0])) + return False; + if(!prs_uint8("pack_type1", ps, depth, &rpc->pack_type[1])) + return False; + if(!prs_uint8("pack_type2", ps, depth, &rpc->pack_type[2])) + return False; + if(!prs_uint8("pack_type3", ps, depth, &rpc->pack_type[3])) + return False; - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); - depth++; + /* + * If reading and pack_type[0] == 0 then the data is in big-endian + * format. Set the flag in the prs_struct to specify reverse-endainness. + */ - prs_uint32("status ", ps, depth, &(rpc->status )); - prs_uint32("reserved", ps, depth, &(rpc->reserved)); + if (ps->io && rpc->pack_type[0] == 0) { + DEBUG(10,("smb_io_rpc_hdr: PDU data format is big-endian. Setting flag.\n")); + prs_set_bigendian_data(ps); + } + if(!prs_uint16("frag_len ", ps, depth, &rpc->frag_len)) + return False; + if(!prs_uint16("auth_len ", ps, depth, &rpc->auth_len)) + return False; + if(!prs_uint32("call_id ", ps, depth, &rpc->call_id)) + return False; return True; } /******************************************************************* -reads or writes an RPC_IFACE structure. + Reads or writes an RPC_IFACE structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) + +static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { - if (ifc == NULL) return False; + if (ifc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; + + if(!prs_uint32 ("data ", ps, depth, &ifc->uuid.time_low)) + return False; + if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_mid)) + return False; + if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_hi_and_version)) + return False; - prs_uint8s (False, "data ", ps, depth, ifc->data, sizeof(ifc->data)); - prs_uint32 ( "version", ps, depth, &(ifc->version)); + if(!prs_uint8s (False, "data ", ps, depth, ifc->uuid.remaining, sizeof(ifc->uuid.remaining))) + return False; + if(!prs_uint32 ( "version", ps, depth, &(ifc->version))) + return False; return True; } /******************************************************************* -creates an RPC_ADDR_STR structure. - -The name can be null (RPC Alter-Context) + Inits an RPC_ADDR_STR structure. ********************************************************************/ -static BOOL make_rpc_addr_str(RPC_ADDR_STR *str, const char *name) -{ - if (str == NULL ) return False; - if (name == NULL) - { - str->len = 1; - fstrcpy(str->str, ""); - } - else - { - str->len = strlen(name) + 1; - fstrcpy(str->str, name); - } - return True; +static void init_rpc_addr_str(RPC_ADDR_STR *str, char *name) +{ + str->len = strlen(name) + 1; + fstrcpy(str->str, name); } /******************************************************************* -reads or writes an RPC_ADDR_STR structure. + Reads or writes an RPC_ADDR_STR structure. ********************************************************************/ + static BOOL smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { - if (str == NULL) return False; + if (str == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_addr_str"); depth++; - prs_align(ps); - - prs_uint16 ( "len", ps, depth, &(str->len)); - prs_uint8s (True, "str", ps, depth, (uchar*)str->str, str->len); + if(!prs_align(ps)) + return False; + if(!prs_uint16 ( "len", ps, depth, &str->len)) + return False; + if(!prs_uint8s (True, "str", ps, depth, (uchar*)str->str, MIN(str->len, sizeof(str->str)) )) + return False; return True; } /******************************************************************* -creates an RPC_HDR_BBA structure. + Inits an RPC_HDR_BBA structure. ********************************************************************/ -static BOOL make_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) -{ - if (bba == NULL) return False; +static void init_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid) +{ bba->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ bba->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ bba->assoc_gid = assoc_gid; /* associated group id (0x0) */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR_BBA structure. + Reads or writes an RPC_HDR_BBA structure. ********************************************************************/ + static BOOL smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_bba"); depth++; - prs_uint16("max_tsize", ps, depth, &(rpc->max_tsize)); - prs_uint16("max_rsize", ps, depth, &(rpc->max_rsize)); - prs_uint32("assoc_gid", ps, depth, &(rpc->assoc_gid)); - + if(!prs_uint16("max_tsize", ps, depth, &rpc->max_tsize)) + return False; + if(!prs_uint16("max_rsize", ps, depth, &rpc->max_rsize)) + return False; + if(!prs_uint32("assoc_gid", ps, depth, &rpc->assoc_gid)) + return False; return True; } /******************************************************************* -creates an RPC_HDR_RB structure. + Inits an RPC_HDR_RB structure. ********************************************************************/ -BOOL make_rpc_hdr_rb(RPC_HDR_RB *rpc, + +void init_rpc_hdr_rb(RPC_HDR_RB *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, uint32 num_elements, uint16 context_id, uint8 num_syntaxes, RPC_IFACE *abstract, RPC_IFACE *transfer) { - if (rpc == NULL) return False; - - make_rpc_hdr_bba(&(rpc->bba), max_tsize, max_rsize, assoc_gid); + init_rpc_hdr_bba(&rpc->bba, max_tsize, max_rsize, assoc_gid); rpc->num_elements = num_elements ; /* the number of elements (0x1) */ rpc->context_id = context_id ; /* presentation context identifier (0x0) */ rpc->num_syntaxes = num_syntaxes ; /* the number of syntaxes (has always been 1?)(0x1) */ /* num and vers. of interface client is using */ - memcpy(&(rpc->abstract), abstract, sizeof(rpc->abstract)); + rpc->abstract = *abstract; /* num and vers. of interface to use for replies */ - memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); - - return True; + rpc->transfer = *transfer; } /******************************************************************* -reads or writes an RPC_HDR_RB structure. + Reads or writes an RPC_HDR_RB structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) + +BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_rb"); depth++; - smb_io_rpc_hdr_bba("", &(rpc->bba), ps, depth); + if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth)) + return False; - prs_uint32("num_elements", ps, depth, &(rpc->num_elements)); - prs_uint16("context_id ", ps, depth, &(rpc->context_id )); - prs_uint8 ("num_syntaxes", ps, depth, &(rpc->num_syntaxes)); + if(!prs_uint32("num_elements", ps, depth, &rpc->num_elements)) + return False; + if(!prs_uint16("context_id ", ps, depth, &rpc->context_id )) + return False; + if(!prs_uint8 ("num_syntaxes", ps, depth, &rpc->num_syntaxes)) + return False; - smb_io_rpc_iface("", &(rpc->abstract), ps, depth); - smb_io_rpc_iface("", &(rpc->transfer), ps, depth); + if(!smb_io_rpc_iface("", &rpc->abstract, ps, depth)) + return False; + if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth)) + return False; return True; } /******************************************************************* -creates an RPC_RESULTS structure. - -lkclXXXX only one reason at the moment! + Inits an RPC_RESULTS structure. + lkclXXXX only one reason at the moment! ********************************************************************/ -static BOOL make_rpc_results(RPC_RESULTS *res, + +static void init_rpc_results(RPC_RESULTS *res, uint8 num_results, uint16 result, uint16 reason) { - if (res == NULL) return False; - res->num_results = num_results; /* the number of results (0x01) */ res->result = result ; /* result (0x00 = accept) */ res->reason = reason ; /* reason (0x00 = no reason specified) */ - - return True; } /******************************************************************* -reads or writes an RPC_RESULTS structure. - -lkclXXXX only one reason at the moment! + Reads or writes an RPC_RESULTS structure. + lkclXXXX only one reason at the moment! ********************************************************************/ -static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) + +static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { - if (res == NULL) return False; + if (res == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_results"); depth++; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint8 ("num_results", ps, depth, &(res->num_results)); + if(!prs_uint8 ("num_results", ps, depth, &res->num_results)) + return False; - prs_align(ps); + if(!prs_align(ps)) + return False; - prs_uint16("result ", ps, depth, &(res->result )); - prs_uint16("reason ", ps, depth, &(res->reason )); - + if(!prs_uint16("result ", ps, depth, &res->result)) + return False; + if(!prs_uint16("reason ", ps, depth, &res->reason)) + return False; return True; } /******************************************************************* -creates an RPC_HDR_BA structure. + Init an RPC_HDR_BA structure. -lkclXXXX only one reason at the moment! -jfm: nope two ! The pipe_addr can be NULL ! + lkclXXXX only one reason at the moment! ********************************************************************/ -BOOL make_rpc_hdr_ba(RPC_HDR_BA *rpc, + +void init_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - const char *pipe_addr, + char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { - if (rpc == NULL || transfer == NULL) return False; - - make_rpc_hdr_bba (&(rpc->bba ), max_tsize, max_rsize, assoc_gid); - make_rpc_addr_str(&(rpc->addr), pipe_addr); - make_rpc_results (&(rpc->res ), num_results, result, reason); + init_rpc_hdr_bba (&rpc->bba, max_tsize, max_rsize, assoc_gid); + init_rpc_addr_str(&rpc->addr, pipe_addr); + init_rpc_results (&rpc->res, num_results, result, reason); /* the transfer syntax from the request */ - memcpy(&(rpc->transfer), transfer, sizeof(rpc->transfer)); - - return True; + memcpy(&rpc->transfer, transfer, sizeof(rpc->transfer)); } /******************************************************************* -reads or writes an RPC_HDR_BA structure. + Reads or writes an RPC_HDR_BA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) + +BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_ba"); depth++; - smb_io_rpc_hdr_bba ("", &(rpc->bba) , ps, depth); - smb_io_rpc_addr_str("", &(rpc->addr) , ps, depth); - smb_io_rpc_results ("", &(rpc->res) , ps, depth); - smb_io_rpc_iface ("", &(rpc->transfer), ps, depth); - + if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth)) + return False; + if(!smb_io_rpc_addr_str("", &rpc->addr, ps, depth)) + return False; + if(!smb_io_rpc_results("", &rpc->res, ps, depth)) + return False; + if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth)) + return False; return True; } /******************************************************************* -creates an RPC_HDR_REQ structure. + Init an RPC_HDR_REQ structure. ********************************************************************/ -BOOL make_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) -{ - if (hdr == NULL) return False; +void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) +{ hdr->alloc_hint = alloc_hint; /* allocation hint */ hdr->context_id = 0; /* presentation context identifier */ hdr->opnum = opnum; /* opnum */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR_REQ structure. + Reads or writes an RPC_HDR_REQ structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) + +BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_req"); depth++; - prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); - prs_uint16("context_id", ps, depth, &(rpc->context_id)); - prs_uint16("opnum ", ps, depth, &(rpc->opnum)); - + if(!prs_uint32("alloc_hint", ps, depth, &rpc->alloc_hint)) + return False; + if(!prs_uint16("context_id", ps, depth, &rpc->context_id)) + return False; + if(!prs_uint16("opnum ", ps, depth, &rpc->opnum)) + return False; return True; } /******************************************************************* -reads or writes an RPC_HDR_RESP structure. + Reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) + +BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { - if (rpc == NULL) return False; + if (rpc == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_resp"); depth++; - prs_uint32("alloc_hint", ps, depth, &(rpc->alloc_hint)); - prs_uint16("context_id", ps, depth, &(rpc->context_id)); - prs_uint8 ("cancel_ct ", ps, depth, &(rpc->cancel_count)); - prs_uint8 ("reserved ", ps, depth, &(rpc->reserved)); - + if(!prs_uint32("alloc_hint", ps, depth, &rpc->alloc_hint)) + return False; + if(!prs_uint16("context_id", ps, depth, &rpc->context_id)) + return False; + if(!prs_uint8 ("cancel_ct ", ps, depth, &rpc->cancel_count)) + return False; + if(!prs_uint8 ("reserved ", ps, depth, &rpc->reserved)) + return False; return True; } /******************************************************************* -creates an RPC_HDR_AUTHA structure. + Init an RPC_HDR_AUTHA structure. ********************************************************************/ -BOOL make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, + +void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, uint16 max_tsize, uint16 max_rsize, uint8 auth_type, uint8 auth_level, uint8 stub_type_len) { - if (rai == NULL) return False; - rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ @@ -536,194 +512,228 @@ BOOL make_rpc_hdr_autha(RPC_HDR_AUTHA *rai, rai->padding = 0; /* padding 0x00 */ rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR_AUTHA structure. + Reads or writes an RPC_HDR_AUTHA structure. ********************************************************************/ + BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) { - if (rai == NULL) return False; + if (rai == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); depth++; - prs_uint16("max_tsize ", ps, depth, &(rai->max_tsize)); - prs_uint16("max_rsize ", ps, depth, &(rai->max_rsize)); + if(!prs_uint16("max_tsize ", ps, depth, &rai->max_tsize)) + return False; + if(!prs_uint16("max_rsize ", ps, depth, &rai->max_rsize)) + return False; - prs_uint8 ("auth_type ", ps, depth, &(rai->auth_type )); /* 0x0a nt lm ssp */ - prs_uint8 ("auth_level ", ps, depth, &(rai->auth_level ));/* 0x06 */ - prs_uint8 ("stub_type_len", ps, depth, &(rai->stub_type_len)); - prs_uint8 ("padding ", ps, depth, &(rai->padding )); + if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ + return False; + if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ + return False; + if(!prs_uint8 ("stub_type_len", ps, depth, &rai->stub_type_len)) + return False; + if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) + return False; - prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ + if(!prs_uint32("unknown ", ps, depth, &rai->unknown)) /* 0x0014a0c0 */ + return False; return True; } /******************************************************************* -checks an RPC_HDR_AUTH structure. + Checks an RPC_HDR_AUTH structure. ********************************************************************/ + BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) { - return ((rai->auth_type == 0x0a || rai->auth_type == 0x44) && - rai->auth_level == 0x06); - - return True; + return (rai->auth_type == NTLMSSP_AUTH_TYPE && rai->auth_level == NTLMSSP_AUTH_LEVEL); } /******************************************************************* -creates an RPC_HDR_AUTH structure. + Inits an RPC_HDR_AUTH structure. ********************************************************************/ -BOOL make_rpc_hdr_auth(RPC_HDR_AUTH *rai, + +void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, uint8 stub_type_len, uint32 ptr) { - if (rai == NULL) return False; - rai->auth_type = auth_type; /* nt lm ssp 0x0a */ rai->auth_level = auth_level; /* 0x06 */ rai->stub_type_len = stub_type_len; /* 0x00 */ rai->padding = 0; /* padding 0x00 */ rai->unknown = ptr; /* non-zero pointer to something */ - - return True; } /******************************************************************* -reads or writes an RPC_HDR_AUTH structure. + Reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ + BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { - if (rai == NULL) return False; + if (rai == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); depth++; - prs_uint8 ("auth_type ", ps, depth, &(rai->auth_type )); /* 0x0a nt lm ssp */ - prs_uint8 ("auth_level ", ps, depth, &(rai->auth_level ));/* 0x06 */ - prs_uint8 ("stub_type_len", ps, depth, &(rai->stub_type_len)); - prs_uint8 ("padding ", ps, depth, &(rai->padding )); + if(!prs_align(ps)) + return False; + + if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ + return False; + if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ + return False; + if(!prs_uint8 ("stub_type_len", ps, depth, &rai->stub_type_len)) + return False; + if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) + return False; - prs_uint32("unknown ", ps, depth, &(rai->unknown )); /* 0x0014a0c0 */ + if(!prs_uint32("unknown ", ps, depth, &rai->unknown)) /* 0x0014a0c0 */ + return False; return True; } /******************************************************************* -checks an RPC_AUTH_NTLMSSP_VERIFIER structure. + Checks an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL rpc_auth_ntlmssp_verifier_chk(RPC_AUTH_NTLMSSP_VERIFIER *rav, + +BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); - - return True; } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_VERIFIER structure. + Inits an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_verifier(RPC_AUTH_NTLMSSP_VERIFIER *rav, + +void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, char *signature, uint32 msg_type) { - if (rav == NULL) return False; - fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ - - return True; } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_VERIFIER structure. + Reads or writes an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_verifier(char *desc, RPC_AUTH_NTLMSSP_VERIFIER *rav, prs_struct *ps, int depth) + +BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { - if (rav == NULL) return False; + if (rav == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); depth++; - prs_string("signature", ps, depth, rav->signature, 0, sizeof(rav->signature)); /* "NTLMSSP" */ - prs_uint32("msg_type ", ps, depth, &(rav->msg_type )); /* NTLMSSP_MESSAGE_TYPE */ + /* "NTLMSSP" */ + if(!prs_string("signature", ps, depth, rav->signature, strlen("NTLMSSP"), + sizeof(rav->signature))) + return False; + if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ + return False; return True; } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_NEG structure. + Inits an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, + +void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, uint32 neg_flgs, fstring myname, fstring domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); - if (neg == NULL) return False; - neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - make_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname); - make_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); + init_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname); + init_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); fstrcpy(neg->myname, myname); fstrcpy(neg->domain, domain); - - return True; } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_NEG structure. - -*** lkclXXXX HACK ALERT! *** + Reads or writes an RPC_AUTH_NTLMSSP_NEG structure. + *** lkclXXXX HACK ALERT! *** ********************************************************************/ + BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { - if (neg == NULL) return False; + if (neg == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_neg"); depth++; - prs_uint32("neg_flgs ", ps, depth, &(neg->neg_flgs)); + if(!prs_uint32("neg_flgs ", ps, depth, &neg->neg_flgs)) + return False; - if (ps->io) - { + if (ps->io) { uint32 old_offset; + uint32 old_neg_flags = neg->neg_flgs; /* reading */ ZERO_STRUCTP(neg); - smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); + neg->neg_flgs = old_neg_flags; + + if(!smb_io_strhdr("hdr_domain", &neg->hdr_domain, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_myname", &neg->hdr_myname, ps, depth)) + return False; + + old_offset = prs_offset(ps); - old_offset = ps->offset; + /* lkclXXXX HACK! */ + if(!prs_set_offset(ps, neg->hdr_myname.buffer + 0x50)) + return False; - ps->offset = neg->hdr_myname .buffer + 0x50; /* lkclXXXX HACK! */ - prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); - old_offset += neg->hdr_myname .str_str_len; + if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, + MIN(neg->hdr_myname.str_str_len, sizeof(neg->myname)))) + return False; + + old_offset += neg->hdr_myname.str_str_len; + + /* lkclXXXX HACK! */ + if(!prs_set_offset(ps, neg->hdr_domain.buffer + 0x50)) + return False; + + if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, + MIN(neg->hdr_domain.str_str_len, sizeof(neg->domain )))) + return False; - ps->offset = neg->hdr_domain .buffer + 0x50; /* lkclXXXX HACK! */ - prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); old_offset += neg->hdr_domain .str_str_len; - ps->offset = old_offset; - } - else - { + if(!prs_set_offset(ps, old_offset)) + return False; + } else { /* writing */ - smb_io_strhdr("hdr_domain", &(neg->hdr_domain), ps, depth); - smb_io_strhdr("hdr_myname", &(neg->hdr_myname), ps, depth); - - prs_uint8s(True , "myname", ps, depth, (uint8*)neg->myname , MIN(neg->hdr_myname .str_str_len, sizeof(neg->myname ))); - prs_uint8s(True , "domain", ps, depth, (uint8*)neg->domain , MIN(neg->hdr_domain .str_str_len, sizeof(neg->domain ))); + if(!smb_io_strhdr("hdr_domain", &neg->hdr_domain, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_myname", &neg->hdr_myname, ps, depth)) + return False; + + if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, + MIN(neg->hdr_myname.str_str_len, sizeof(neg->myname)))) + return False; + if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, + MIN(neg->hdr_domain.str_str_len, sizeof(neg->domain )))) + return False; } return True; @@ -732,76 +742,72 @@ BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru /******************************************************************* creates an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, + +void init_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, uint32 neg_flags, uint8 challenge[8]) { - if (chl == NULL) return False; - chl->unknown_1 = 0x0; chl->unknown_2 = 0x00000028; chl->neg_flags = neg_flags; /* 0x0082b1 */ memcpy(chl->challenge, challenge, sizeof(chl->challenge)); - bzero (chl->reserved , sizeof(chl->reserved)); - - return True; + memset((char *)chl->reserved , '\0', sizeof(chl->reserved)); } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. + Reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ + BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) { - if (chl == NULL) return False; + if (chl == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chal"); depth++; - prs_uint32("unknown_1", ps, depth, &(chl->unknown_1)); /* 0x0000 0000 */ - prs_uint32("unknown_2", ps, depth, &(chl->unknown_2)); /* 0x0000 b2b3 */ - prs_uint32("neg_flags", ps, depth, &(chl->neg_flags)); /* 0x0000 82b1 */ + if(!prs_uint32("unknown_1", ps, depth, &chl->unknown_1)) /* 0x0000 0000 */ + return False; + if(!prs_uint32("unknown_2", ps, depth, &chl->unknown_2)) /* 0x0000 b2b3 */ + return False; + if(!prs_uint32("neg_flags", ps, depth, &chl->neg_flags)) /* 0x0000 82b1 */ + return False; - prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge)); - prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved )); + if(!prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge))) + return False; + if(!prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved ))) + return False; return True; } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_RESP structure. - -*** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** -*** lkclXXXX the actual offset is at the start of the auth verifier *** + Inits an RPC_AUTH_NTLMSSP_RESP structure. + *** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** + *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, - uchar lm_resp[24], - uchar *nt_resp, size_t nt_len, + +void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, + uchar lm_resp[24], uchar nt_resp[24], char *domain, char *user, char *wks, uint32 neg_flags) { uint32 offset; int dom_len = strlen(domain); - int wks_len = strlen(wks ); - int usr_len = strlen(user ); - int lm_len = nt_len != 0 ? (lm_resp != NULL ? 24 : 0) : 1; + int wks_len = strlen(wks); + int usr_len = strlen(user); + int lm_len = (lm_resp != NULL) ? 24 : 0; + int nt_len = (nt_resp != NULL) ? 24 : 0; DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); - if (rsp == NULL) return False; - #ifdef DEBUG_PASSWORD DEBUG(100,("lm_resp\n")); - if (lm_resp != NULL) - { - dump_data(100, lm_resp, lm_len); - } + dump_data(100, (char *)lm_resp, 24); DEBUG(100,("nt_resp\n")); - if (nt_resp != NULL) - { - dump_data(100, nt_resp, nt_len); - } + dump_data(100, (char *)nt_resp, 24); #endif DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", @@ -816,153 +822,190 @@ BOOL make_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, usr_len *= 2; } - make_str_hdr(&rsp->hdr_domain , dom_len, dom_len, offset); + init_str_hdr(&rsp->hdr_domain, dom_len, dom_len, offset); offset += dom_len; - make_str_hdr(&rsp->hdr_usr , usr_len, usr_len, offset); + init_str_hdr(&rsp->hdr_usr, usr_len, usr_len, offset); offset += usr_len; - make_str_hdr(&rsp->hdr_wks , wks_len, wks_len, offset); + init_str_hdr(&rsp->hdr_wks, wks_len, wks_len, offset); offset += wks_len; - make_str_hdr(&rsp->hdr_lm_resp, lm_len , lm_len , offset); + init_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); offset += lm_len; - make_str_hdr(&rsp->hdr_nt_resp, nt_len , nt_len , offset); + init_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); offset += nt_len; - make_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); + init_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); rsp->neg_flags = neg_flags; - if (lm_resp != NULL && lm_len != 1) - { - memcpy(rsp->lm_resp, lm_resp, lm_len); - } - else - { - rsp->lm_resp[0] = 0; - } - if (nt_resp != NULL) - { - memcpy(rsp->nt_resp, nt_resp, nt_len); - } - else - { - rsp->nt_resp[0] = 0; - } + memcpy(rsp->lm_resp, lm_resp, 24); + memcpy(rsp->nt_resp, nt_resp, 24); - if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) - { - ascii_to_unibuf(rsp->domain, domain, sizeof(rsp->domain)-2); - ascii_to_unibuf(rsp->user , user , sizeof(rsp->user )-2); - ascii_to_unibuf(rsp->wks , wks , sizeof(rsp->wks )-2); - } - else - { + if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { + dos_struni2(rsp->domain, domain, sizeof(rsp->domain)); + dos_struni2(rsp->user, user, sizeof(rsp->user)); + dos_struni2(rsp->wks, wks, sizeof(rsp->wks)); + } else { fstrcpy(rsp->domain, domain); - fstrcpy(rsp->user , user ); - fstrcpy(rsp->wks , wks ); + fstrcpy(rsp->user, user); + fstrcpy(rsp->wks, wks); } rsp->sess_key[0] = 0; - - return True; } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_RESP structure. - -*** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** -*** lkclXXXX the actual offset is at the start of the auth verifier *** + Reads or writes an RPC_AUTH_NTLMSSP_RESP structure. + *** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** + *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ + BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) { - if (rsp == NULL) return False; + if (rsp == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); depth++; - if (ps->io) - { + if (ps->io) { uint32 old_offset; /* reading */ ZERO_STRUCTP(rsp); - smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); - smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); - smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); - smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); - smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); - smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); + if(!smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_domain ", &rsp->hdr_domain, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_user ", &rsp->hdr_usr, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_wks ", &rsp->hdr_wks, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth)) + return False; + + if(!prs_uint32("neg_flags", ps, depth, &rsp->neg_flags)) /* 0x0000 82b1 */ + return False; + + old_offset = prs_offset(ps); - prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ + if(!prs_set_offset(ps, rsp->hdr_domain.buffer + 0x1c)) + return False; - old_offset = ps->offset; + if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, + MIN(rsp->hdr_domain.str_str_len, sizeof(rsp->domain)))) + return False; - ps->offset = rsp->hdr_domain .buffer + 0x1c; - prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); - old_offset += rsp->hdr_domain .str_str_len; + old_offset += rsp->hdr_domain.str_str_len; - ps->offset = rsp->hdr_usr .buffer + 0x1c; - prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); - old_offset += rsp->hdr_usr .str_str_len; + if(!prs_set_offset(ps, rsp->hdr_usr.buffer + 0x1c)) + return False; - ps->offset = rsp->hdr_wks .buffer + 0x1c; - prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); - old_offset += rsp->hdr_wks .str_str_len; + if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, + MIN(rsp->hdr_usr.str_str_len, sizeof(rsp->user)))) + return False; - ps->offset = rsp->hdr_lm_resp .buffer + 0x1c; - prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - old_offset += rsp->hdr_lm_resp .str_str_len; + old_offset += rsp->hdr_usr.str_str_len; - ps->offset = rsp->hdr_nt_resp .buffer + 0x1c; - prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); - old_offset += rsp->hdr_nt_resp .str_str_len; + if(!prs_set_offset(ps, rsp->hdr_wks.buffer + 0x1c)) + return False; + + if(!prs_uint8s(True, "wks ", ps, depth, (uint8*)rsp->wks, + MIN(rsp->hdr_wks.str_str_len, sizeof(rsp->wks)))) + return False; + + old_offset += rsp->hdr_wks.str_str_len; + + if(!prs_set_offset(ps, rsp->hdr_lm_resp.buffer + 0x1c)) + return False; + + if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, + MIN(rsp->hdr_lm_resp.str_str_len, sizeof(rsp->lm_resp )))) + return False; + + old_offset += rsp->hdr_lm_resp.str_str_len; + + if(!prs_set_offset(ps, rsp->hdr_nt_resp.buffer + 0x1c)) + return False; + + if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, + MIN(rsp->hdr_nt_resp.str_str_len, sizeof(rsp->nt_resp )))) + return False; + + old_offset += rsp->hdr_nt_resp.str_str_len; + + if (rsp->hdr_sess_key.str_str_len != 0) { + + if(!prs_set_offset(ps, rsp->hdr_sess_key.buffer + 0x1c)) + return False; - if (rsp->hdr_sess_key.str_str_len != 0) - { - ps->offset = rsp->hdr_sess_key.buffer + 0x1c; old_offset += rsp->hdr_sess_key.str_str_len; - prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + + if(!prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, + MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)))) + return False; } - ps->offset = old_offset; - } - else - { + if(!prs_set_offset(ps, old_offset)) + return False; + } else { /* writing */ - smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp , ps, depth); - smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp , ps, depth); - smb_io_strhdr("hdr_domain ", &rsp->hdr_domain , ps, depth); - smb_io_strhdr("hdr_user ", &rsp->hdr_usr , ps, depth); - smb_io_strhdr("hdr_wks ", &rsp->hdr_wks , ps, depth); - smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth); - - prs_uint32("neg_flags", ps, depth, &(rsp->neg_flags)); /* 0x0000 82b1 */ - - prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain , MIN(rsp->hdr_domain .str_str_len, sizeof(rsp->domain ))); - prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user , MIN(rsp->hdr_usr .str_str_len, sizeof(rsp->user ))); - prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks , MIN(rsp->hdr_wks .str_str_len, sizeof(rsp->wks ))); - prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp , MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp ))); - prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp , MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp ))); - prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key))); + if(!smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_domain ", &rsp->hdr_domain, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_user ", &rsp->hdr_usr, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_wks ", &rsp->hdr_wks, ps, depth)) + return False; + if(!smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth)) + return False; + + if(!prs_uint32("neg_flags", ps, depth, &rsp->neg_flags)) /* 0x0000 82b1 */ + return False; + + if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, + MIN(rsp->hdr_domain.str_str_len, sizeof(rsp->domain)))) + return False; + + if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, + MIN(rsp->hdr_usr.str_str_len, sizeof(rsp->user)))) + return False; + + if(!prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks, + MIN(rsp->hdr_wks.str_str_len, sizeof(rsp->wks)))) + return False; + if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, + MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp)))) + return False; + if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, + MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )))) + return False; + if(!prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, + MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)))) + return False; } return True; } /******************************************************************* -checks an RPC_AUTH_NTLMSSP_CHK structure. + Checks an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ + BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_num) { if (chk == NULL) - { return False; - } if (chk->crc32 != crc32 || chk->ver != NTLMSSP_SIGN_VERSION || @@ -975,41 +1018,44 @@ BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_nu return False; } return True; - - return True; } /******************************************************************* -creates an RPC_AUTH_NTLMSSP_CHK structure. + Inits an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -BOOL make_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, + +void init_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 ver, uint32 crc32, uint32 seq_num) { - if (chk == NULL) return False; - - chk->ver = ver ; + chk->ver = ver; chk->reserved = 0x0; - chk->crc32 = crc32 ; - chk->seq_num = seq_num ; - - return True; + chk->crc32 = crc32; + chk->seq_num = seq_num; } /******************************************************************* -reads or writes an RPC_AUTH_NTLMSSP_CHK structure. + Reads or writes an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ + BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) { - if (chk == NULL) return False; + if (chk == NULL) + return False; prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chk"); depth++; - prs_uint32("ver ", ps, depth, &(chk->ver )); - prs_uint32("reserved", ps, depth, &(chk->reserved)); - prs_uint32("crc32 ", ps, depth, &(chk->crc32 )); - prs_uint32("seq_num ", ps, depth, &(chk->seq_num )); + if(!prs_align(ps)) + return False; + + if(!prs_uint32("ver ", ps, depth, &chk->ver)) + return False; + if(!prs_uint32("reserved", ps, depth, &chk->reserved)) + return False; + if(!prs_uint32("crc32 ", ps, depth, &chk->crc32)) + return False; + if(!prs_uint32("seq_num ", ps, depth, &chk->seq_num)) + return False; return True; } - -- cgit From 195e3d44daccc3b6457486018ba0322ac9d44566 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 7 Feb 2000 16:25:15 +0000 Subject: spoolss definitions. also added some prs_struct functions, 'cause I'm handling buffers as prs_struct. J.F. (This used to be commit 81e375bbbe0fb022a44a2aaaa3729a9518b7a854) --- source3/rpc_parse/parse_rpc.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index d4ea84628a..54d3eea74d 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -105,6 +105,15 @@ interface/version dce/rpc pipe identification }, 0x01 \ } +#define SYNT_SPOOLSS_V1 \ +{ \ + { \ + 0x12345678, 0x1234, 0xabcb, \ + { 0xef, 0x00, 0x01, 0x23, \ + 0x45, 0x67, 0x89, 0xab } \ + }, 0x01 \ +} + #define SYNT_NONE_V0 \ { \ { \ @@ -114,17 +123,6 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -/* pipe string names */ -#define PIPE_SRVSVC "\\PIPE\\srvsvc" -#define PIPE_SAMR "\\PIPE\\samr" -#define PIPE_WINREG "\\PIPE\\winreg" -#define PIPE_WKSSVC "\\PIPE\\wkssvc" -#define PIPE_NETLOGON "\\PIPE\\NETLOGON" -#define PIPE_NTLSA "\\PIPE\\ntlsa" -#define PIPE_NTSVCS "\\PIPE\\ntsvcs" -#define PIPE_LSASS "\\PIPE\\lsass" -#define PIPE_LSARPC "\\PIPE\\lsarpc" - struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ @@ -134,6 +132,7 @@ struct pipe_id_info pipe_names [] = { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, + { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 4fb014372e7bcf1b40396841f162a14cb58a086a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 29 Feb 2000 21:39:54 +0000 Subject: Fixes from Luke, back-ported from TNG to Win2k. Correctly return FAULT_PDU on unknown rpc calls. Win2k now correctly shows the owners of files. Jeremy. (This used to be commit 066898689f496dc655c3f0a553ac5e884e078022) --- source3/rpc_parse/parse_rpc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 54d3eea74d..48d64972bf 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -493,6 +493,26 @@ BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dept return True; } +/******************************************************************* + Reads or writes an RPC_HDR_FAULT structure. +********************************************************************/ + +BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) +{ + if (rpc == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); + depth++; + + if(!prs_uint32("status ", ps, depth, &rpc->status)) + return False; + if(!prs_uint32("reserved", ps, depth, &rpc->reserved)) + return False; + + return True; +} + /******************************************************************* Init an RPC_HDR_AUTHA structure. ********************************************************************/ -- cgit From 78d7ba5ca021518ec5c088eb492b36710e556c31 Mon Sep 17 00:00:00 2001 From: Jean-François Micouleau Date: Mon, 6 Mar 2000 11:13:40 +0000 Subject: changed prs_unistr to parse empty and non-empty strings the same way. fixed typo in SPOOLSS_SYNT some cleanup of unused functions wrote make_spoolss_enumprinter and make_spoolss_openprinterex for rpcclient as I'm trying to keep in sync the parsing code between HEAD and TNG. Will commit changes to TNG after lunch. J.F. (This used to be commit 025cdb345f6de287a41d4449b2662dbc5e762bf2) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 48d64972bf..90200312bd 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -108,7 +108,7 @@ interface/version dce/rpc pipe identification #define SYNT_SPOOLSS_V1 \ { \ { \ - 0x12345678, 0x1234, 0xabcb, \ + 0x12345678, 0x1234, 0xabcd, \ { 0xef, 0x00, 0x01, 0x23, \ 0x45, 0x67, 0x89, 0xab } \ }, 0x01 \ -- cgit From a130656fc090777ad8daec154bdfe1a0a84eef92 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 13 Apr 2000 18:38:00 +0000 Subject: rpc_parse/parse_rpc.c: Changes from TNG (thanks Luke) for NTLMSSP parsing. smbd/reply.c: Fixed typo in debug. Jeremy. (This used to be commit c2aa6d66b3ca2a1a6dde8e9a1f6e761d98be517a) --- source3/rpc_parse/parse_rpc.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 90200312bd..8d39b6e7c0 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -692,6 +692,7 @@ void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { + uint32 start_offset = prs_offset(ps); if (neg == NULL) return False; @@ -718,8 +719,7 @@ BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru old_offset = prs_offset(ps); - /* lkclXXXX HACK! */ - if(!prs_set_offset(ps, neg->hdr_myname.buffer + 0x50)) + if(!prs_set_offset(ps, neg->hdr_myname.buffer + start_offset - 12)) return False; if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, @@ -728,8 +728,7 @@ BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_stru old_offset += neg->hdr_myname.str_str_len; - /* lkclXXXX HACK! */ - if(!prs_set_offset(ps, neg->hdr_domain.buffer + 0x50)) + if(!prs_set_offset(ps, neg->hdr_domain.buffer + start_offset - 12)) return False; if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, @@ -915,7 +914,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset = prs_offset(ps); - if(!prs_set_offset(ps, rsp->hdr_domain.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_domain.buffer + 0xc)) return False; if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, @@ -924,7 +923,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset += rsp->hdr_domain.str_str_len; - if(!prs_set_offset(ps, rsp->hdr_usr.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_usr.buffer + 0xc)) return False; if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, @@ -933,7 +932,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset += rsp->hdr_usr.str_str_len; - if(!prs_set_offset(ps, rsp->hdr_wks.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_wks.buffer + 0xc)) return False; if(!prs_uint8s(True, "wks ", ps, depth, (uint8*)rsp->wks, @@ -942,7 +941,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset += rsp->hdr_wks.str_str_len; - if(!prs_set_offset(ps, rsp->hdr_lm_resp.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_lm_resp.buffer + 0xc)) return False; if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, @@ -951,7 +950,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st old_offset += rsp->hdr_lm_resp.str_str_len; - if(!prs_set_offset(ps, rsp->hdr_nt_resp.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_nt_resp.buffer + 0xc)) return False; if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, @@ -962,7 +961,7 @@ BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_st if (rsp->hdr_sess_key.str_str_len != 0) { - if(!prs_set_offset(ps, rsp->hdr_sess_key.buffer + 0x1c)) + if(!prs_set_offset(ps, rsp->hdr_sess_key.buffer + 0x10)) return False; old_offset += rsp->hdr_sess_key.str_str_len; -- cgit From 74d677ec591a715e28dba29a33ee40e1b1c2f830 Mon Sep 17 00:00:00 2001 From: Shirish Kalele Date: Thu, 18 May 2000 18:43:53 +0000 Subject: Added the NETDFS pipe to allow remote administration of the msdfs symlinks on the samba server. (This used to be commit 15e7d8f6c5cddf6ce409ee2505744250d181ec34) --- source3/rpc_parse/parse_rpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 8d39b6e7c0..af0569fd61 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -123,6 +123,15 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_NETDFS_V3 \ +{ \ + { \ + 0x4fc742e0, 0x4a10, 0x11cf, \ + { 0x82, 0x73, 0x00, 0xaa, \ + 0x00, 0x4a, 0xe6, 0x73 } \ + }, 0x03 \ +} + struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ @@ -133,6 +142,7 @@ struct pipe_id_info pipe_names [] = { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, + { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 7f36df301e28dc8ca0e5bfadc109d6e907d9ba2b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 1 Aug 2000 18:32:34 +0000 Subject: Tidyup removing many of the 0xC0000000 | NT_STATUS_XXX stuff (only need NT_STATUS_XXX). Removed IS_BITS_xxx macros as they were just reproducing "C" syntax in a more obscure way. Jeremy. (This used to be commit c55bcec817f47d6162466b193d533c877194124a) --- source3/rpc_parse/parse_rpc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index af0569fd61..c40de10445 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -843,8 +843,7 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, offset = 0x40; - if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) - { + if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { dom_len *= 2; wks_len *= 2; usr_len *= 2; @@ -872,7 +871,7 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, memcpy(rsp->lm_resp, lm_resp, 24); memcpy(rsp->nt_resp, nt_resp, 24); - if (IS_BITS_SET_ALL(neg_flags, NTLMSSP_NEGOTIATE_UNICODE)) { + if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { dos_struni2(rsp->domain, domain, sizeof(rsp->domain)); dos_struni2(rsp->user, user, sizeof(rsp->user)); dos_struni2(rsp->wks, wks, sizeof(rsp->wks)); -- cgit From 00ab9021b0cc5fe2667d383eb9cc2973072cdaaa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 9 Mar 2001 23:48:58 +0000 Subject: Serious (and I *mean* serious) attempt to fix little/bigendian RPC issues. We were reading the endainness in the RPC header and then never propagating it to the internal parse_structs used to parse the data. Also removed the "align" argument to prs_init as it was *always* set to 4, and if needed can be set differently on a case by case basis. Now ready for AS/U testing when Herb gets it set up :-). Jeremy. (This used to be commit 0cd37c831d79a12a10e479bf4fa89ffe64c1292a) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index c40de10445..9fe893d4be 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -203,7 +203,7 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) if (ps->io && rpc->pack_type[0] == 0) { DEBUG(10,("smb_io_rpc_hdr: PDU data format is big-endian. Setting flag.\n")); - prs_set_bigendian_data(ps); + prs_set_endian_data(ps, RPC_BIG_ENDIAN); } if(!prs_uint16("frag_len ", ps, depth, &rpc->frag_len)) @@ -239,7 +239,7 @@ static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int dep if(!prs_uint8s (False, "data ", ps, depth, ifc->uuid.remaining, sizeof(ifc->uuid.remaining))) return False; - if(!prs_uint32 ( "version", ps, depth, &(ifc->version))) + if(!prs_uint32 ( "version", ps, depth, &ifc->version)) return False; return True; -- cgit From ea35aae3bfad9c73a6768abcd76726b26b6c4f9a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 12 Mar 2001 21:09:55 +0000 Subject: We copy the RPC header directly from the incoming client - remember to set little-endian flag on marshalling. AS/U now correctly tries to join our domain ! Jeremy. (This used to be commit 0185f8159dbd30820d1ec9ce2aec8eb1cddcfc0b) --- source3/rpc_parse/parse_rpc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 9fe893d4be..f330c5947e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -187,6 +187,11 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) return False; if(!prs_uint8 ("flags ", ps, depth, &rpc->flags)) return False; + + /* We always marshall in little endian format. */ + if (MARSHALLING(ps)) + rpc->pack_type[0] = 0x10; + if(!prs_uint8("pack_type0", ps, depth, &rpc->pack_type[0])) return False; if(!prs_uint8("pack_type1", ps, depth, &rpc->pack_type[1])) @@ -201,7 +206,7 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) * format. Set the flag in the prs_struct to specify reverse-endainness. */ - if (ps->io && rpc->pack_type[0] == 0) { + if (UNMARSHALLING(ps) && rpc->pack_type[0] == 0) { DEBUG(10,("smb_io_rpc_hdr: PDU data format is big-endian. Setting flag.\n")); prs_set_endian_data(ps, RPC_BIG_ENDIAN); } -- cgit From 87fbb7092b8f8b2f0db0f361c3d625e19de57cd9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jul 2001 07:15:53 +0000 Subject: The big character set handling changeover! This commit gets rid of all our old codepage handling and replaces it with iconv. All internal strings in Samba are now in "unix" charset, which may be multi-byte. See internals.doc and my posting to samba-technical for a more complete explanation. (This used to be commit debb471267960e56005a741817ebd227ecfc512a) --- source3/rpc_parse/parse_rpc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index f330c5947e..a60bad0aa2 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -877,14 +877,15 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, memcpy(rsp->nt_resp, nt_resp, 24); if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { - dos_struni2(rsp->domain, domain, sizeof(rsp->domain)); - dos_struni2(rsp->user, user, sizeof(rsp->user)); - dos_struni2(rsp->wks, wks, sizeof(rsp->wks)); + rpcstr_push(rsp->domain, domain, sizeof(rsp->domain), 0); + rpcstr_push(rsp->user, user, sizeof(rsp->user), 0); + rpcstr_push(rsp->wks, wks, sizeof(rsp->wks), 0); } else { fstrcpy(rsp->domain, domain); fstrcpy(rsp->user, user); fstrcpy(rsp->wks, wks); } + rsp->sess_key[0] = 0; } -- cgit From 19fea3242cf6234786b6cbb60631e0071f31ff9f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 4 Sep 2001 07:13:01 +0000 Subject: the next stage in the NTSTATUS/WERROR change. smbd and nmbd now compile, but the client code still needs some work (This used to be commit dcd6e735f709a9231860ceb9682db40ff26c9a66) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index a60bad0aa2..e457b48bf9 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -520,7 +520,7 @@ BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int de prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); depth++; - if(!prs_uint32("status ", ps, depth, &rpc->status)) + if(!prs_ntstatus("status ", ps, depth, &rpc->status)) return False; if(!prs_uint32("reserved", ps, depth, &rpc->reserved)) return False; -- cgit From dc1fc3ee8ec2199bc73bb5d7ec711c6800f61d65 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Tue, 2 Oct 2001 04:29:50 +0000 Subject: Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. (This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e) --- source3/rpc_parse/parse_rpc.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index e457b48bf9..f4a84adee3 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1,4 +1,3 @@ - /* * Unix SMB/Netbios implementation. * Version 1.9. @@ -23,12 +22,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - #include "includes.h" -extern int DEBUGLEVEL; - - /******************************************************************* interface/version dce/rpc pipe identification ********************************************************************/ -- cgit From cd68afe31256ad60748b34f7318a180cfc2127cc Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 30 Jan 2002 06:08:46 +0000 Subject: Removed version number from file header. Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa) --- source3/rpc_parse/parse_rpc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index f4a84adee3..ee15d7cded 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1,6 +1,5 @@ /* - * Unix SMB/Netbios implementation. - * Version 1.9. + * Unix SMB/CIFS implementation. * RPC Pipe client / server routines * Copyright (C) Andrew Tridgell 1992-1997, * Copyright (C) Luke Kenneth Casson Leighton 1996-1997, -- cgit From e90b65284812aaa5ff9e9935ce9bbad7791cbbcd Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 15 Jul 2002 10:35:28 +0000 Subject: updated the 3.0 branch from the head branch - ready for alpha18 (This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce) --- source3/rpc_parse/parse_rpc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ee15d7cded..41e0b4cb5f 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -23,6 +23,9 @@ #include "includes.h" +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + /******************************************************************* interface/version dce/rpc pipe identification ********************************************************************/ -- cgit From 36ef82a52953384acedbd51f54ded9357fa8ca3e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Oct 2002 04:10:23 +0000 Subject: merge of new client side support the Win2k LSARPC UUID in rpcbind from APP_HEAD (This used to be commit 1cfd2ee433305e91e87804dd55d10e025d30a69e) --- source3/rpc_parse/parse_rpc.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 41e0b4cb5f..590268bed5 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -75,6 +75,15 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_LSARPC_V0_WIN2K \ +{ \ + { \ + 0x3919286a, 0xb10c, 0x11d0, \ + { 0x9b, 0xa8, 0x00, 0xc0, \ + 0x4f, 0xd9, 0x2e, 0xf5 } \ + }, 0x00 \ +} + #define SYNT_SAMR_V1 \ { \ { \ @@ -129,18 +138,24 @@ interface/version dce/rpc pipe identification }, 0x03 \ } +/* + * IMPORTANT!! If you update this structure, make sure to + * update the index #defines in smb.h. + */ + struct pipe_id_info pipe_names [] = { - /* client pipe , abstract syntax , server pipe , transfer syntax */ - { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_NETLOGON, SYNT_NETLOGON_V1, PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, - { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, - { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, - { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } + /* client pipe , abstract syntax , server pipe , transfer syntax */ + { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_LSARPC , SYNT_LSARPC_V0_WIN2K , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, + { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, + { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, + { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; /******************************************************************* -- cgit From 9c1b62c0fd06cc65853269db3c63b169daa90664 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 4 Oct 2002 19:33:41 +0000 Subject: merge of working dsrolegetprimdominfo() client code from APP_HEAD (This used to be commit 028477e35208e76fedbc7c743426fd9be94b7cf0) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 590268bed5..247c83aecd 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -75,7 +75,7 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -#define SYNT_LSARPC_V0_WIN2K \ +#define SYNT_LSARPC_V0_DS \ { \ { \ 0x3919286a, 0xb10c, 0x11d0, \ @@ -147,7 +147,7 @@ struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_LSARPC , SYNT_LSARPC_V0_WIN2K , PIPE_LSASS , TRANS_SYNT_V2 }, + { PIPE_LSARPC , SYNT_LSARPC_V0_DS , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, -- cgit From 2f194322d419350f35a48dff750066894d68eccf Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 12 Nov 2002 23:20:50 +0000 Subject: Removed global_myworkgroup, global_myname, global_myscope. Added liberal dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit f755711df8f74f9b8e8c1a2b0d07d02a931eeb89) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 247c83aecd..e8825a2e14 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -697,7 +697,7 @@ BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, uint32 neg_flgs, - fstring myname, fstring domain) + const char *myname, const char *domain) { int len_myname = strlen(myname); int len_domain = strlen(domain); @@ -836,7 +836,7 @@ BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_st void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, uchar lm_resp[24], uchar nt_resp[24], - char *domain, char *user, char *wks, + const char *domain, const char *user, const char *wks, uint32 neg_flags) { uint32 offset; -- cgit From 634c54310c92c48dd4eceec602e230a021bdcfc5 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 3 Jan 2003 08:28:12 +0000 Subject: Merge from HEAD - make Samba compile with -Wwrite-strings without additional warnings. (Adds a lot of const). Andrew Bartlett (This used to be commit 3a7458f9472432ef12c43008414925fd1ce8ea0c) --- source3/rpc_parse/parse_rpc.c | 44 +++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index e8825a2e14..fafbbb1965 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -143,7 +143,7 @@ interface/version dce/rpc pipe identification * update the index #defines in smb.h. */ -struct pipe_id_info pipe_names [] = +const struct pipe_id_info pipe_names [] = { /* client pipe , abstract syntax , server pipe , transfer syntax */ { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, @@ -182,7 +182,7 @@ void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, Reads or writes an RPC_HDR structure. ********************************************************************/ -BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -236,7 +236,7 @@ BOOL smb_io_rpc_hdr(char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) Reads or writes an RPC_IFACE structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { if (ifc == NULL) return False; @@ -266,7 +266,7 @@ static BOOL smb_io_rpc_iface(char *desc, RPC_IFACE *ifc, prs_struct *ps, int dep Inits an RPC_ADDR_STR structure. ********************************************************************/ -static void init_rpc_addr_str(RPC_ADDR_STR *str, char *name) +static void init_rpc_addr_str(RPC_ADDR_STR *str, const char *name) { str->len = strlen(name) + 1; fstrcpy(str->str, name); @@ -276,7 +276,7 @@ static void init_rpc_addr_str(RPC_ADDR_STR *str, char *name) Reads or writes an RPC_ADDR_STR structure. ********************************************************************/ -static BOOL smb_io_rpc_addr_str(char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +static BOOL smb_io_rpc_addr_str(const char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { if (str == NULL) return False; @@ -308,7 +308,7 @@ static void init_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsiz Reads or writes an RPC_HDR_BBA structure. ********************************************************************/ -static BOOL smb_io_rpc_hdr_bba(char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -351,7 +351,7 @@ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, Reads or writes an RPC_HDR_RB structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_rb(char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -397,7 +397,7 @@ static void init_rpc_results(RPC_RESULTS *res, lkclXXXX only one reason at the moment! ********************************************************************/ -static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +static BOOL smb_io_rpc_results(const char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { if (res == NULL) return False; @@ -430,7 +430,7 @@ static BOOL smb_io_rpc_results(char *desc, RPC_RESULTS *res, prs_struct *ps, int void init_rpc_hdr_ba(RPC_HDR_BA *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - char *pipe_addr, + const char *pipe_addr, uint8 num_results, uint16 result, uint16 reason, RPC_IFACE *transfer) { @@ -446,7 +446,7 @@ void init_rpc_hdr_ba(RPC_HDR_BA *rpc, Reads or writes an RPC_HDR_BA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_ba(char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -480,7 +480,7 @@ void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) Reads or writes an RPC_HDR_REQ structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -501,7 +501,7 @@ BOOL smb_io_rpc_hdr_req(char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) Reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -524,7 +524,7 @@ BOOL smb_io_rpc_hdr_resp(char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int dept Reads or writes an RPC_HDR_FAULT structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_fault(char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -564,7 +564,7 @@ void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, Reads or writes an RPC_HDR_AUTHA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_autha(char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; @@ -622,7 +622,7 @@ void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, Reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; @@ -653,7 +653,7 @@ BOOL smb_io_rpc_hdr_auth(char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int dept ********************************************************************/ BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, - char *signature, uint32 msg_type) + const char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); } @@ -663,7 +663,7 @@ BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, ********************************************************************/ void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, - char *signature, uint32 msg_type) + const char *signature, uint32 msg_type) { fstrcpy(rav->signature, signature); /* "NTLMSSP" */ rav->msg_type = msg_type; /* NTLMSSP_MESSAGE_TYPE */ @@ -673,7 +673,7 @@ void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, Reads or writes an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL smb_io_rpc_auth_verifier(char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return False; @@ -717,7 +717,7 @@ void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, *** lkclXXXX HACK ALERT! *** ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_neg(char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_neg(const char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) { uint32 start_offset = prs_offset(ps); if (neg == NULL) @@ -804,7 +804,7 @@ void init_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, Reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_chal(char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chal(const char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) { if (chl == NULL) return False; @@ -908,7 +908,7 @@ void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, *** lkclXXXX the actual offset is at the start of the auth verifier *** ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_resp(char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_resp(const char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) { if (rsp == NULL) return False; @@ -1082,7 +1082,7 @@ void init_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, Reads or writes an RPC_AUTH_NTLMSSP_CHK structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_chk(char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) +BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) { if (chk == NULL) return False; -- cgit From b4d0f208fb936382c7b313bd94c180b5cb708cea Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 6 Apr 2003 07:04:09 +0000 Subject: Merge the TNG netlogon schannel from HEAD. No more XP requiresignorseal anymore! Thanks again to Luke :-) Volker (This used to be commit 6b2b55901d66cab0c0c0c90bd0585c870be6e468) --- source3/rpc_parse/parse_rpc.c | 95 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index fafbbb1965..baa70ae137 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -691,6 +691,30 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru return True; } +/******************************************************************* + This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I thing + assuming "NTLMSSP" in sm_io_rpc_auth_verifier is somewhat wrong. + I have to look at that later... +********************************************************************/ + +BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +{ + if (rav == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); + depth++; + + /* "NTLMSSP" */ + if(!prs_string("signature", ps, depth, rav->signature, strlen(rav->signature), + sizeof(rav->signature))) + return False; + if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ + return False; + + return True; +} + /******************************************************************* Inits an RPC_AUTH_NTLMSSP_NEG structure. ********************************************************************/ @@ -1104,3 +1128,74 @@ BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, pr return True; } + +/******************************************************************* + Reads or writes an RPC_AUTH_NETSEC_NEG structure. +********************************************************************/ + +BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, + prs_struct *ps, int depth) +{ + if (neg == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_neg"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_uint32("unknown1", ps, depth, &neg->unknown1)) + return False; + if(!prs_uint32("unknown2", ps, depth, &neg->unknown2)) + return False; + if(!prs_string("domain ", ps, depth, neg->domain, + strlen(&ps->data_p[ps->data_offset]), sizeof(neg->domain))) + return False; + if(!prs_string("myname ", ps, depth, neg->myname, + strlen(&ps->data_p[ps->data_offset]), sizeof(neg->myname))) + return False; + + return True; +} + + +/******************************************************************* +creates an RPC_AUTH_NETSEC_CHK structure. +********************************************************************/ +BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, + const uchar sig[8], + const uchar data1[8], + const uchar data3[8], const uchar data8[8]) +{ + if (chk == NULL) + return False; + + memcpy(chk->sig, sig, sizeof(chk->sig)); + memcpy(chk->data1, data1, sizeof(chk->data1)); + memcpy(chk->data3, data3, sizeof(chk->data3)); + memcpy(chk->data8, data8, sizeof(chk->data8)); + + return True; +} + +/******************************************************************* +reads or writes an RPC_AUTH_NETSEC_CHK structure. +********************************************************************/ +BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, + prs_struct *ps, int depth) +{ + if (chk == NULL) + return False; + + prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_chk"); + depth++; + + prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); + prs_uint8s(False, "data3", ps, depth, chk->data3, sizeof(chk->data3)); + prs_uint8s(False, "data1", ps, depth, chk->data1, sizeof(chk->data1)); + prs_uint8s(False, "data8", ps, depth, chk->data8, sizeof(chk->data8)); + + return True; +} + -- cgit From 42c18d52993cd7aaf3d8c0ef04e44404f72b3ce5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 09:54:26 +0000 Subject: A little clarification in the rpc auth header struct. Volker (This used to be commit 36362c602ba03ae5e89956b16820d5dff580bee7) --- source3/rpc_parse/parse_rpc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index baa70ae137..700ce8cfd6 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -607,15 +607,15 @@ BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, - uint8 stub_type_len, + uint8 padding, uint32 ptr) { rai->auth_type = auth_type; /* nt lm ssp 0x0a */ rai->auth_level = auth_level; /* 0x06 */ - rai->stub_type_len = stub_type_len; /* 0x00 */ - rai->padding = 0; /* padding 0x00 */ + rai->padding = padding; + rai->reserved = 0; - rai->unknown = ptr; /* non-zero pointer to something */ + rai->auth_context = ptr; /* non-zero pointer to something */ } /******************************************************************* @@ -637,12 +637,11 @@ BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, in return False; if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ return False; - if(!prs_uint8 ("stub_type_len", ps, depth, &rai->stub_type_len)) - return False; if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) return False; - - if(!prs_uint32("unknown ", ps, depth, &rai->unknown)) /* 0x0014a0c0 */ + if(!prs_uint8 ("reserved ", ps, depth, &rai->reserved)) + return False; + if(!prs_uint32("auth_context ", ps, depth, &rai->auth_context)) return False; return True; -- cgit From 7238bf5f40e16360439e028fa7607a5a28e02965 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 9 Apr 2003 15:54:17 +0000 Subject: This is the netlogon schannel client code. Try a rpcclient -S pdc -U% -c "samlogon user password" and it should work with the schannel. Needs testing against platforms different from NT4SP6. Volker (This used to be commit eaef0d8aeff1aa5a067679be3f17e08d7434e1e8) --- source3/rpc_parse/parse_rpc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 700ce8cfd6..656082e05a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1128,6 +1128,18 @@ BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, pr return True; } +/******************************************************************* +creates an RPC_AUTH_NETSEC_NEG structure. +********************************************************************/ +void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, + const char *domain, const char *myname) +{ + neg->unknown1 = 0; + neg->unknown2 = 0x13; + fstrcpy(neg->domain, domain); + fstrcpy(neg->myname, myname); +} + /******************************************************************* Reads or writes an RPC_AUTH_NETSEC_NEG structure. ********************************************************************/ @@ -1148,11 +1160,11 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, return False; if(!prs_uint32("unknown2", ps, depth, &neg->unknown2)) return False; - if(!prs_string("domain ", ps, depth, neg->domain, - strlen(&ps->data_p[ps->data_offset]), sizeof(neg->domain))) - return False; if(!prs_string("myname ", ps, depth, neg->myname, - strlen(&ps->data_p[ps->data_offset]), sizeof(neg->myname))) + strlen(neg->myname), sizeof(neg->myname))) + return False; + if(!prs_string("domain ", ps, depth, neg->domain, + strlen(neg->domain), sizeof(neg->domain))) return False; return True; -- cgit From 3b865c73989e7f13e3a6453f9f9c9a7aca74b129 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Mon, 14 Apr 2003 02:08:03 +0000 Subject: Merge of rpcecho pipe for testing large dcerpc requests and responses. Only compiled in when --enable-developer argument passed to configure. (This used to be commit 017da9393bab276543d0d5c50df8c760780f2450) --- source3/rpc_parse/parse_rpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 656082e05a..30909c6910 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -138,6 +138,15 @@ interface/version dce/rpc pipe identification }, 0x03 \ } +#define SYNT_ECHO_V1 \ +{ \ + { \ + 0x60a15ec5, 0x4de8, 0x11d7, \ + { 0xa6, 0x37, 0x00, 0x50, \ + 0x56, 0xa2, 0x01, 0x82 } \ + }, 0x01 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -155,6 +164,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, + { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 09a50497d1360659eb8bd1b9f4be510680267bd2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Apr 2003 15:39:57 +0000 Subject: Fixes to make SCHANNEL work in 3.0 against a W2K DC. Still need to fix multi-PDU encode/decode with SCHANNEL. Also need to test against WNT DC. Jeremy. (This used to be commit ff66d4097088409205b6bad5124a78ef9946010d) --- source3/rpc_parse/parse_rpc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 30909c6910..dd75ea1f55 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1144,8 +1144,8 @@ creates an RPC_AUTH_NETSEC_NEG structure. void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, const char *domain, const char *myname) { - neg->unknown1 = 0; - neg->unknown2 = 0x13; + neg->type1 = 0; + neg->type2 = 0x3; fstrcpy(neg->domain, domain); fstrcpy(neg->myname, myname); } @@ -1166,16 +1166,16 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, if(!prs_align(ps)) return False; - if(!prs_uint32("unknown1", ps, depth, &neg->unknown1)) + if(!prs_uint32("type1", ps, depth, &neg->type1)) return False; - if(!prs_uint32("unknown2", ps, depth, &neg->unknown2)) - return False; - if(!prs_string("myname ", ps, depth, neg->myname, - strlen(neg->myname), sizeof(neg->myname))) + if(!prs_uint32("type2", ps, depth, &neg->type2)) return False; if(!prs_string("domain ", ps, depth, neg->domain, strlen(neg->domain), sizeof(neg->domain))) return False; + if(!prs_string("myname ", ps, depth, neg->myname, + strlen(neg->myname), sizeof(neg->myname))) + return False; return True; } -- cgit From e15dfd44c912bf9a567a13cbbec63c4ecbabaed4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 22 Apr 2003 15:54:36 +0000 Subject: parse_string is only used for the authentication negotiators. It can itself determine the length of the string it has to transfer. Andrew B., could you take a look at the length calculation? Is that safe? Thanks, Volker (This used to be commit 0ef69b586a8f1fa11a41a3900180ea2090b60bfd) --- source3/rpc_parse/parse_rpc.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index dd75ea1f55..be3a04e31c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -691,7 +691,7 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru depth++; /* "NTLMSSP" */ - if(!prs_string("signature", ps, depth, rav->signature, strlen("NTLMSSP"), + if(!prs_string("signature", ps, depth, rav->signature, sizeof(rav->signature))) return False; if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ @@ -701,7 +701,7 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru } /******************************************************************* - This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I thing + This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I think assuming "NTLMSSP" in sm_io_rpc_auth_verifier is somewhat wrong. I have to look at that later... ********************************************************************/ @@ -714,11 +714,9 @@ BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_st prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); depth++; - /* "NTLMSSP" */ - if(!prs_string("signature", ps, depth, rav->signature, strlen(rav->signature), - sizeof(rav->signature))) + if(!prs_string("signature", ps, depth, rav->signature, sizeof(rav->signature))) return False; - if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) /* NTLMSSP_MESSAGE_TYPE */ + if(!prs_uint32("msg_type ", ps, depth, &rav->msg_type)) return False; return True; @@ -1170,11 +1168,9 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, return False; if(!prs_uint32("type2", ps, depth, &neg->type2)) return False; - if(!prs_string("domain ", ps, depth, neg->domain, - strlen(neg->domain), sizeof(neg->domain))) + if(!prs_string("domain ", ps, depth, neg->domain, sizeof(neg->domain))) return False; - if(!prs_string("myname ", ps, depth, neg->myname, - strlen(neg->myname), sizeof(neg->myname))) + if(!prs_string("myname ", ps, depth, neg->myname, sizeof(neg->myname))) return False; return True; -- cgit From 456f51bcbe04ccbb37a27b6e115a851cc134adcd Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 14 Jul 2003 08:46:32 +0000 Subject: Jeremy requested that I get my NTLMSSP patch into CVS. He didn't request the schannel code, but I've included that anyway. :-) This patch revives the client-side NTLMSSP support for RPC named pipes in Samba, and cleans up the client and server schannel code. The use of the new code is enabled by the 'sign', 'seal' and 'schannel' commands in rpcclient. The aim was to prove that our separate NTLMSSP client library actually implements NTLMSSP signing and sealing as per Microsoft's NTLMv1 implementation, in the hope that knowing this will assist us in correctly implementing NTLMSSP signing for SMB packets. (Still not yet functional) This patch replaces the NTLMSSP implementation in rpc_client/cli_pipe.c with calls to libsmb/ntlmssp.c. In the process, we have gained the ability to use the more secure NT password, and the ability to sign-only, instead of having to seal the pipe connection. (Previously we were limited to sealing, and could only use the LM-password derived key). Our new client-side NTLMSSP code also needed alteration to cope with our comparatively simple server-side implementation. A future step is to replace it with calls to the same NTLMSSP library. Also included in this patch is the schannel 'sign only' patch I submitted to the team earlier. While not enabled (and not functional, at this stage) the work in this patch makes the code paths *much* easier to follow. I have also included similar hooks in rpccleint to allow the use of schannel on *any* pipe. rpcclient now defaults to not using schannel (or any other extra per-pipe authenticiation) for any connection. The 'schannel' command enables schannel for all pipes until disabled. This code is also much more secure than the previous code, as changes to our cli_pipe routines ensure that the authentication footer cannot be removed by an attacker, and more error states are correctly handled. (The same needs to be done to our server) Andrew Bartlett (This used to be commit 5472ddc9eaf4e79c5b2e1c8ee8c7f190dc285f19) --- source3/rpc_parse/parse_rpc.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index be3a04e31c..34ba62caa9 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -602,15 +602,6 @@ BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, return True; } -/******************************************************************* - Checks an RPC_HDR_AUTH structure. -********************************************************************/ - -BOOL rpc_hdr_auth_chk(RPC_HDR_AUTH *rai) -{ - return (rai->auth_type == NTLMSSP_AUTH_TYPE && rai->auth_level == NTLMSSP_AUTH_LEVEL); -} - /******************************************************************* Inits an RPC_HDR_AUTH structure. ********************************************************************/ @@ -1088,9 +1079,10 @@ BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_nu chk->seq_num != seq_num) { DEBUG(5,("verify failed - crc %x ver %x seq %d\n", - crc32, NTLMSSP_SIGN_VERSION, seq_num)); + chk->crc32, chk->ver, chk->seq_num)); + DEBUG(5,("verify expect - crc %x ver %x seq %d\n", - chk->crc32, chk->ver, chk->seq_num)); + crc32, NTLMSSP_SIGN_VERSION, seq_num)); return False; } return True; @@ -1182,15 +1174,15 @@ creates an RPC_AUTH_NETSEC_CHK structure. ********************************************************************/ BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, const uchar sig[8], - const uchar data1[8], - const uchar data3[8], const uchar data8[8]) + const uchar packet_digest[8], + const uchar seq_num[8], const uchar data8[8]) { if (chk == NULL) return False; memcpy(chk->sig, sig, sizeof(chk->sig)); - memcpy(chk->data1, data1, sizeof(chk->data1)); - memcpy(chk->data3, data3, sizeof(chk->data3)); + memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); + memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); memcpy(chk->data8, data8, sizeof(chk->data8)); return True; @@ -1209,8 +1201,8 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, depth++; prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); - prs_uint8s(False, "data3", ps, depth, chk->data3, sizeof(chk->data3)); - prs_uint8s(False, "data1", ps, depth, chk->data1, sizeof(chk->data1)); + prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); + prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); prs_uint8s(False, "data8", ps, depth, chk->data8, sizeof(chk->data8)); return True; -- cgit From cbe69f65f69b0c7b7c2d0d32005da488b50e52ba Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 1 Oct 2003 21:18:32 +0000 Subject: commit sign only patch from Andrew; bug 167; tested using 2k & XP clientspreviously joined to the Samba domain (This used to be commit 3802f5895ee18507c6f467bd11db0b1147a6fdfd) --- source3/rpc_parse/parse_rpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 34ba62caa9..558378548a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1175,7 +1175,7 @@ creates an RPC_AUTH_NETSEC_CHK structure. BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, const uchar sig[8], const uchar packet_digest[8], - const uchar seq_num[8], const uchar data8[8]) + const uchar seq_num[8], const uchar confounder[8]) { if (chk == NULL) return False; @@ -1183,7 +1183,7 @@ BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, memcpy(chk->sig, sig, sizeof(chk->sig)); memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); - memcpy(chk->data8, data8, sizeof(chk->data8)); + memcpy(chk->confounder, confounder, sizeof(chk->confounder)); return True; } @@ -1203,7 +1203,7 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); - prs_uint8s(False, "data8", ps, depth, chk->data8, sizeof(chk->data8)); + prs_uint8s(False, "data8", ps, depth, chk->confounder, sizeof(chk->confounder)); return True; } -- cgit From ad12b87aeb3b838a330633f151bacdd30fec0a1c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 1 Oct 2003 23:04:34 +0000 Subject: Remove duplicate function (now in rpc_parse/parse_prs.c) and fix a RPC debug (I renamed the element of the structure). Andrew Bartlett (This used to be commit 641652cad97b761ba11d4e89b7c9ad098c7dd1c2) --- source3/rpc_parse/parse_rpc.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 558378548a..1752e10114 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1168,26 +1168,6 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, return True; } - -/******************************************************************* -creates an RPC_AUTH_NETSEC_CHK structure. -********************************************************************/ -BOOL init_rpc_auth_netsec_chk(RPC_AUTH_NETSEC_CHK * chk, - const uchar sig[8], - const uchar packet_digest[8], - const uchar seq_num[8], const uchar confounder[8]) -{ - if (chk == NULL) - return False; - - memcpy(chk->sig, sig, sizeof(chk->sig)); - memcpy(chk->packet_digest, packet_digest, sizeof(chk->packet_digest)); - memcpy(chk->seq_num, seq_num, sizeof(chk->seq_num)); - memcpy(chk->confounder, confounder, sizeof(chk->confounder)); - - return True; -} - /******************************************************************* reads or writes an RPC_AUTH_NETSEC_CHK structure. ********************************************************************/ @@ -1203,7 +1183,7 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); - prs_uint8s(False, "data8", ps, depth, chk->confounder, sizeof(chk->confounder)); + prs_uint8s(False, "confounder", ps, depth, chk->confounder, sizeof(chk->confounder)); return True; } -- cgit From faca10b35d5a3a311f55301889dca9743ad0e176 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 3 Oct 2003 15:07:15 +0000 Subject: abstract UUID parsing code to an individual function; patch from Anthony (This used to be commit 9365c619d6feb15289d963e9e70e1f947b7f8c3f) --- source3/rpc_parse/parse_rpc.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 1752e10114..5b97c44d65 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -243,29 +243,48 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) } /******************************************************************* - Reads or writes an RPC_IFACE structure. + Reads or writes an RPC_UUID structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) { if (ifc == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_iface"); + prs_debug(ps, depth, desc, "smb_io_rpc_uuid"); depth++; if(!prs_align(ps)) return False; - if(!prs_uint32 ("data ", ps, depth, &ifc->uuid.time_low)) + if(!prs_uint32 ("data ", ps, depth, &uuid->time_low)) + return False; + if(!prs_uint16 ("data ", ps, depth, &uuid->time_mid)) + return False; + if(!prs_uint16 ("data ", ps, depth, &uuid->time_hi_and_version)) return False; - if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_mid)) + + if(!prs_uint8s (False, "data ", ps, depth, uuid->remaining, sizeof(uuid->remaining))) return False; - if(!prs_uint16 ("data ", ps, depth, &ifc->uuid.time_hi_and_version)) + + return true; +} + +/******************************************************************* + Reads or writes an RPC_IFACE structure. +********************************************************************/ + +static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +{ + if (ifc == NULL) return False; - if(!prs_uint8s (False, "data ", ps, depth, ifc->uuid.remaining, sizeof(ifc->uuid.remaining))) + prs_debug(ps, depth, desc, "smb_io_rpc_iface"); + depth++; + + if (!smb_io_rpc_uuid( "uuid", ps, depth, &ifc->uuid)) return False; + if(!prs_uint32 ( "version", ps, depth, &ifc->version)) return False; -- cgit From c81c09d66ff4ed5c524312f73540862ded3335d2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 3 Oct 2003 20:13:11 +0000 Subject: Grrr. compile patches before you apply ! Jeremy. (This used to be commit dfbde4be7191895d79762855b21f5c62d53d5267) --- source3/rpc_parse/parse_rpc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 5b97c44d65..1ea59feaed 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -248,7 +248,7 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) { - if (ifc == NULL) + if (uuid == NULL) return False; prs_debug(ps, depth, desc, "smb_io_rpc_uuid"); @@ -267,7 +267,7 @@ static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, in if(!prs_uint8s (False, "data ", ps, depth, uuid->remaining, sizeof(uuid->remaining))) return False; - return true; + return True; } /******************************************************************* @@ -282,10 +282,10 @@ static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, i prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; - if (!smb_io_rpc_uuid( "uuid", ps, depth, &ifc->uuid)) + if (!smb_io_rpc_uuid( "uuid", &ifc->uuid, ps, depth)) return False; - if(!prs_uint32 ( "version", ps, depth, &ifc->version)) + if(!prs_uint32 ("version", ps, depth, &ifc->version)) return False; return True; -- cgit From 3d8e3f314b9f1ad3966afd5ad217a63b109de0f9 Mon Sep 17 00:00:00 2001 From: Jim McDonough Date: Fri, 24 Oct 2003 13:49:29 +0000 Subject: Add initshutdown pipe commands to rpcclient. Second part of fix to bug #534 (This used to be commit 4e86243ea1d4bbe96720caaaf02300f5e15bee5a) --- source3/rpc_parse/parse_rpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 1ea59feaed..e2781b2008 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -147,6 +147,15 @@ interface/version dce/rpc pipe identification }, 0x01 \ } +#define SYNT_SHUTDOWN_V1 \ +{ \ + { \ + 0x894de0c0, 0x0d55, 0x11d3, \ + { 0xa3, 0x22, 0x00, 0xc0, \ + 0x4f, 0xa3, 0x21, 0xa1 } \ + }, 0x01 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -165,6 +174,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, + { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 8ad3d8c9b065f3a2040beff801bdc9dceac868a8 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 13 Apr 2004 14:39:48 +0000 Subject: r196: merging struct uuid from trunk (This used to be commit 911a28361b9d8dd50597627f245ebfb57c6294fb) --- source3/rpc_parse/parse_rpc.c | 75 ++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 43 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index e2781b2008..69262b6d0c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -34,7 +34,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8, 0x08, 0x00, \ + { 0x9f, 0xe8 }, \ + { 0x08, 0x00, \ 0x2b, 0x10, 0x48, 0x60 } \ }, 0x02 \ } @@ -43,7 +44,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8, 0x08, 0x00, \ + { 0x9f, 0xe8 }, \ + { 0x08, 0x00, \ 0x2b, 0x10, 0x48, 0x60 } \ }, 0x02 \ } @@ -52,7 +54,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x6bffd098, 0xa112, 0x3610, \ - { 0x98, 0x33, 0x46, 0xc3, \ + { 0x98, 0x33 }, \ + { 0x46, 0xc3, \ 0xf8, 0x7e, 0x34, 0x5a } \ }, 0x01 \ } @@ -61,7 +64,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x4b324fc8, 0x1670, 0x01d3, \ - { 0x12, 0x78, 0x5a, 0x47, \ + { 0x12, 0x78 }, \ + { 0x5a, 0x47, \ 0xbf, 0x6e, 0xe1, 0x88 } \ }, 0x03 \ } @@ -70,7 +74,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00, 0x01, 0x23, \ + { 0xef, 0x00 }, \ + { 0x01, 0x23, \ 0x45, 0x67, 0x89, 0xab } \ }, 0x00 \ } @@ -79,7 +84,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x3919286a, 0xb10c, 0x11d0, \ - { 0x9b, 0xa8, 0x00, 0xc0, \ + { 0x9b, 0xa8 }, \ + { 0x00, 0xc0, \ 0x4f, 0xd9, 0x2e, 0xf5 } \ }, 0x00 \ } @@ -88,7 +94,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00, 0x01, 0x23, \ + { 0xef, 0x00 }, \ + { 0x01, 0x23, \ 0x45, 0x67, 0x89, 0xac } \ }, 0x01 \ } @@ -97,7 +104,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00, 0x01, 0x23, \ + { 0xef, 0x00 }, \ + { 0x01, 0x23, \ 0x45, 0x67, 0xcf, 0xfb } \ }, 0x01 \ } @@ -106,7 +114,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x338cd001, 0x2244, 0x31f1, \ - { 0xaa, 0xaa, 0x90, 0x00, \ + { 0xaa, 0xaa }, \ + { 0x90, 0x00, \ 0x38, 0x00, 0x10, 0x03 } \ }, 0x01 \ } @@ -115,7 +124,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00, 0x01, 0x23, \ + { 0xef, 0x00 }, \ + { 0x01, 0x23, \ 0x45, 0x67, 0x89, 0xab } \ }, 0x01 \ } @@ -124,7 +134,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x0, 0x0, 0x0, \ - { 0x00, 0x00, 0x00, 0x00, \ + { 0x00, 0x00 }, \ + { 0x00, 0x00, \ 0x00, 0x00, 0x00, 0x00 } \ }, 0x00 \ } @@ -133,7 +144,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x4fc742e0, 0x4a10, 0x11cf, \ - { 0x82, 0x73, 0x00, 0xaa, \ + { 0x82, 0x73 }, \ + { 0x00, 0xaa, \ 0x00, 0x4a, 0xe6, 0x73 } \ }, 0x03 \ } @@ -142,7 +154,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x60a15ec5, 0x4de8, 0x11d7, \ - { 0xa6, 0x37, 0x00, 0x50, \ + { 0xa6, 0x37 }, \ + { 0x00, 0x50, \ 0x56, 0xa2, 0x01, 0x82 } \ }, 0x01 \ } @@ -151,7 +164,8 @@ interface/version dce/rpc pipe identification { \ { \ 0x894de0c0, 0x0d55, 0x11d3, \ - { 0xa3, 0x22, 0x00, 0xc0, \ + { 0xa3, 0x22 }, \ + { 0x00, 0xc0, \ 0x4f, 0xa3, 0x21, 0xa1 } \ }, 0x01 \ } @@ -252,34 +266,6 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) return True; } -/******************************************************************* - Reads or writes an RPC_UUID structure. -********************************************************************/ - -static BOOL smb_io_rpc_uuid(const char *desc, RPC_UUID *uuid, prs_struct *ps, int depth) -{ - if (uuid == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_uuid"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32 ("data ", ps, depth, &uuid->time_low)) - return False; - if(!prs_uint16 ("data ", ps, depth, &uuid->time_mid)) - return False; - if(!prs_uint16 ("data ", ps, depth, &uuid->time_hi_and_version)) - return False; - - if(!prs_uint8s (False, "data ", ps, depth, uuid->remaining, sizeof(uuid->remaining))) - return False; - - return True; -} - /******************************************************************* Reads or writes an RPC_IFACE structure. ********************************************************************/ @@ -292,7 +278,10 @@ static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, i prs_debug(ps, depth, desc, "smb_io_rpc_iface"); depth++; - if (!smb_io_rpc_uuid( "uuid", &ifc->uuid, ps, depth)) + if (!prs_align(ps)) + return False; + + if (!smb_io_uuid( "uuid", &ifc->uuid, ps, depth)) return False; if(!prs_uint32 ("version", ps, depth, &ifc->version)) -- cgit From 41db2016adc464691ea2c3497aedca55fcf004ed Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Thu, 13 May 2004 20:32:21 +0000 Subject: r704: BUG 1315: fix for schannel client connections to server's that don't support 128 bit encryption (This used to be commit 316ba5ad89ddfa445d44d28141c5901fc64aec90) --- source3/rpc_parse/parse_rpc.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 69262b6d0c..f4ffcba1bd 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -1189,7 +1189,8 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, /******************************************************************* reads or writes an RPC_AUTH_NETSEC_CHK structure. ********************************************************************/ -BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, +BOOL smb_io_rpc_auth_netsec_chk(const char *desc, int auth_len, + RPC_AUTH_NETSEC_CHK * chk, prs_struct *ps, int depth) { if (chk == NULL) @@ -1198,10 +1199,19 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, RPC_AUTH_NETSEC_CHK * chk, prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_chk"); depth++; - prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)); - prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)); - prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)); - prs_uint8s(False, "confounder", ps, depth, chk->confounder, sizeof(chk->confounder)); + if ( !prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)) ) + return False; + + if ( !prs_uint8s(False, "seq_num", ps, depth, chk->seq_num, sizeof(chk->seq_num)) ) + return False; + + if ( !prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)) ) + return False; + + if ( auth_len == RPC_AUTH_NETSEC_SIGN_OR_SEAL_CHK_LEN ) { + if ( !prs_uint8s(False, "confounder", ps, depth, chk->confounder, sizeof(chk->confounder)) ) + return False; + } return True; } -- cgit From 5d1cb8e79edea9e8581d3c2c9dd297310cd9a98c Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 23 Mar 2005 23:26:33 +0000 Subject: r6014: rather large change set.... pulling back all recent rpc changes from trunk into 3.0. I've tested a compile and so don't think I've missed any files. But if so, just mail me and I'll clean backup in a couple of hours. Changes include \winreg, \eventlog, \svcctl, and general parse_misc.c updates. I am planning on bracketing the event code with an #ifdef ENABLE_EVENTLOG until I finish merging Marcin's changes (very soon). (This used to be commit 4e0ac63c36527cd8c52ef720cae17e84f67e7221) --- source3/rpc_parse/parse_rpc.c | 45 ++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index f4ffcba1bd..823e0e8d2a 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -36,7 +36,7 @@ interface/version dce/rpc pipe identification 0x8a885d04, 0x1ceb, 0x11c9, \ { 0x9f, 0xe8 }, \ { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ + 0x2b, 0x10, 0x48, 0x60 } \ }, 0x02 \ } @@ -46,7 +46,7 @@ interface/version dce/rpc pipe identification 0x8a885d04, 0x1ceb, 0x11c9, \ { 0x9f, 0xe8 }, \ { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ + 0x2b, 0x10, 0x48, 0x60 } \ }, 0x02 \ } @@ -56,7 +56,7 @@ interface/version dce/rpc pipe identification 0x6bffd098, 0xa112, 0x3610, \ { 0x98, 0x33 }, \ { 0x46, 0xc3, \ - 0xf8, 0x7e, 0x34, 0x5a } \ + 0xf8, 0x7e, 0x34, 0x5a } \ }, 0x01 \ } @@ -66,7 +66,7 @@ interface/version dce/rpc pipe identification 0x4b324fc8, 0x1670, 0x01d3, \ { 0x12, 0x78 }, \ { 0x5a, 0x47, \ - 0xbf, 0x6e, 0xe1, 0x88 } \ + 0xbf, 0x6e, 0xe1, 0x88 } \ }, 0x03 \ } @@ -76,7 +76,7 @@ interface/version dce/rpc pipe identification 0x12345778, 0x1234, 0xabcd, \ { 0xef, 0x00 }, \ { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ + 0x45, 0x67, 0x89, 0xab } \ }, 0x00 \ } @@ -86,7 +86,7 @@ interface/version dce/rpc pipe identification 0x3919286a, 0xb10c, 0x11d0, \ { 0x9b, 0xa8 }, \ { 0x00, 0xc0, \ - 0x4f, 0xd9, 0x2e, 0xf5 } \ + 0x4f, 0xd9, 0x2e, 0xf5 } \ }, 0x00 \ } @@ -96,7 +96,7 @@ interface/version dce/rpc pipe identification 0x12345778, 0x1234, 0xabcd, \ { 0xef, 0x00 }, \ { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xac } \ + 0x45, 0x67, 0x89, 0xac } \ }, 0x01 \ } @@ -106,7 +106,7 @@ interface/version dce/rpc pipe identification 0x12345678, 0x1234, 0xabcd, \ { 0xef, 0x00 }, \ { 0x01, 0x23, \ - 0x45, 0x67, 0xcf, 0xfb } \ + 0x45, 0x67, 0xcf, 0xfb } \ }, 0x01 \ } @@ -116,7 +116,7 @@ interface/version dce/rpc pipe identification 0x338cd001, 0x2244, 0x31f1, \ { 0xaa, 0xaa }, \ { 0x90, 0x00, \ - 0x38, 0x00, 0x10, 0x03 } \ + 0x38, 0x00, 0x10, 0x03 } \ }, 0x01 \ } @@ -126,7 +126,7 @@ interface/version dce/rpc pipe identification 0x12345678, 0x1234, 0xabcd, \ { 0xef, 0x00 }, \ { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ + 0x45, 0x67, 0x89, 0xab } \ }, 0x01 \ } @@ -136,7 +136,7 @@ interface/version dce/rpc pipe identification 0x0, 0x0, 0x0, \ { 0x00, 0x00 }, \ { 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00 } \ + 0x00, 0x00, 0x00, 0x00 } \ }, 0x00 \ } @@ -170,6 +170,27 @@ interface/version dce/rpc pipe identification }, 0x01 \ } +#define SYNT_SVCCTL_V2 \ +{ \ + { \ + 0x367abb81, 0x9844, 0x35f1, \ + { 0xad, 0x32 }, \ + { 0x98, 0xf0, \ + 0x38, 0x00, 0x10, 0x03 } \ + }, 0x02 \ +} + + +#define SYNT_EVENTLOG_V0 \ +{ \ + { \ + 0x82273fdc, 0xe32a, 0x18c3, \ + { 0x3f, 0x78 }, \ + { 0x82, 0x79, \ + 0x29, 0xdc, 0x23, 0xea } \ + }, 0x00 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -189,6 +210,8 @@ const struct pipe_id_info pipe_names [] = { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, + { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 14ce1ed40c9c6b7a4ac55ae56c247c66c46fe546 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 8 Apr 2005 04:13:19 +0000 Subject: r6243: Yes. I *will* hate myself in the morning for this one. I need to gather some more information to know if these extra context id's may be used later. But for now, pw changes via CTL+ALT+DEL from win2k3sp1 clients work. (This used to be commit e7189a4e4b2211ce396944559d38056fa5b57f65) --- source3/rpc_parse/parse_rpc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 823e0e8d2a..6bdab2e437 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -404,6 +404,9 @@ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { + RPC_HDR_RB rpc2; + int i; + if (rpc == NULL) return False; @@ -424,6 +427,20 @@ BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int de return False; if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth)) return False; + + /* just chew through extra context id's for now */ + + for ( i=1; inum_elements; i++ ) { + if(!prs_uint16("context_id ", ps, depth, &rpc2.context_id )) + return False; + if(!prs_uint8 ("num_syntaxes", ps, depth, &rpc2.num_syntaxes)) + return False; + + if(!smb_io_rpc_iface("", &rpc2.abstract, ps, depth)) + return False; + if(!smb_io_rpc_iface("", &rpc2.transfer, ps, depth)) + return False; + } return True; } -- cgit From 04e07e8cc9d6615381e0501cd36cf7d78aeed189 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Jun 2005 03:48:40 +0000 Subject: r7385: Rewrite the RPC bind parsing functions to follow the spec. I haven't yet tested this so I may have screwed this up - however it now follows the DCE spec. valgrinded tests to follow.... Jeremy. (This used to be commit 877e0a61f5821c89149b1403d08675dd7db8039e) --- source3/rpc_parse/parse_rpc.c | 101 +++++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 30 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6bdab2e437..ef5c230d2d 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -376,27 +376,75 @@ static BOOL smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct * return True; } +/******************************************************************* + Inits an RPC_CONTEXT structure. + Note the transfer pointer must remain valid until this is marshalled. +********************************************************************/ + +void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, RPC_IFACE *abstract, RPC_IFACE *transfer) +{ + rpc_ctx->context_id = context_id ; /* presentation context identifier (0x0) */ + rpc_ctx->num_transfer_syntaxes = 1 ; /* the number of syntaxes (has always been 1?)(0x1) */ + + /* num and vers. of interface client is using */ + rpc_ctx->abstract = *abstract; + + /* vers. of interface to use for replies */ + rpc_ctx->transfer = transfer; +} + /******************************************************************* Inits an RPC_HDR_RB structure. + Note the context pointer must remain valid until this is marshalled. ********************************************************************/ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, uint16 max_tsize, uint16 max_rsize, uint32 assoc_gid, - uint32 num_elements, uint16 context_id, uint8 num_syntaxes, - RPC_IFACE *abstract, RPC_IFACE *transfer) + RPC_CONTEXT *context) { init_rpc_hdr_bba(&rpc->bba, max_tsize, max_rsize, assoc_gid); - rpc->num_elements = num_elements ; /* the number of elements (0x1) */ - rpc->context_id = context_id ; /* presentation context identifier (0x0) */ - rpc->num_syntaxes = num_syntaxes ; /* the number of syntaxes (has always been 1?)(0x1) */ + rpc->num_contexts = 1; + rpc->rpc_context = context; +} - /* num and vers. of interface client is using */ - rpc->abstract = *abstract; +/******************************************************************* + Reads or writes an RPC_CONTEXT structure. +********************************************************************/ - /* num and vers. of interface to use for replies */ - rpc->transfer = *transfer; -} +BOOL smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth) +{ + int i; + + if (rpc_ctx == NULL) + return False; + + if(!prs_align(ps)) + return False; + if(!prs_uint16("context_id ", ps, depth, &rpc_ctx->context_id )) + return False; + if(!prs_uint8 ("num_transfer_syntaxes", ps, depth, &rpc_ctx->num_transfer_syntaxes)) + return False; + + /* num_transfer_syntaxes must not be zero. */ + if (rpc_ctx->num_transfer_syntaxes == 0) + return False; + + if(!smb_io_rpc_iface("", &rpc_ctx->abstract, ps, depth)) + return False; + + if (UNMARSHALLING(ps)) { + if (!(rpc_ctx->transfer = PRS_ALLOC_MEM(ps, RPC_IFACE, rpc_ctx->num_transfer_syntaxes))) { + return False; + } + } + + for (i = 0; i < rpc_ctx->num_transfer_syntaxes; i++ ) { + if (!smb_io_rpc_iface("", &rpc_ctx->transfer[i], ps, depth)) + return False; + } + return True; +} /******************************************************************* Reads or writes an RPC_HDR_RB structure. @@ -404,7 +452,6 @@ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { - RPC_HDR_RB rpc2; int i; if (rpc == NULL) @@ -416,31 +463,25 @@ BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int de if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth)) return False; - if(!prs_uint32("num_elements", ps, depth, &rpc->num_elements)) - return False; - if(!prs_uint16("context_id ", ps, depth, &rpc->context_id )) - return False; - if(!prs_uint8 ("num_syntaxes", ps, depth, &rpc->num_syntaxes)) + if(!prs_uint32("num_contexts", ps, depth, &rpc->num_contexts)) return False; - if(!smb_io_rpc_iface("", &rpc->abstract, ps, depth)) - return False; - if(!smb_io_rpc_iface("", &rpc->transfer, ps, depth)) + rpc->num_contexts &= 0xff; /* Actually a 1 byte field.. */ + + /* num_contexts must not be zero. */ + if (rpc->num_contexts == 0) return False; - - /* just chew through extra context id's for now */ - - for ( i=1; inum_elements; i++ ) { - if(!prs_uint16("context_id ", ps, depth, &rpc2.context_id )) - return False; - if(!prs_uint8 ("num_syntaxes", ps, depth, &rpc2.num_syntaxes)) - return False; - if(!smb_io_rpc_iface("", &rpc2.abstract, ps, depth)) + if (UNMARSHALLING(ps)) { + if (!(rpc->rpc_context = PRS_ALLOC_MEM(ps, RPC_CONTEXT, rpc->num_contexts))) { return False; - if(!smb_io_rpc_iface("", &rpc2.transfer, ps, depth)) + } + } + + for (i = 0; i < rpc->num_contexts; i++ ) { + if (!smb_io_rpc_context("", &rpc->rpc_context[i], ps, depth)) return False; - } + } return True; } -- cgit From 5c9963c287e20a4a4b8bbaa088328438eb4f942c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 17 Jun 2005 18:05:46 +0000 Subject: r7696: Don't try and be clever and read an 8 byte int and 3 pad bytes as a uint32 - you'll just get it wrong (as I did :-). Second attempt to fix the Apple client issues. Jeremy. (This used to be commit d2aa5bc7aaa9fe11fa4748f99e4ba49be08aa639) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ef5c230d2d..3c10975876 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -463,10 +463,10 @@ BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int de if(!smb_io_rpc_hdr_bba("", &rpc->bba, ps, depth)) return False; - if(!prs_uint32("num_contexts", ps, depth, &rpc->num_contexts)) + if(!prs_uint8("num_contexts", ps, depth, &rpc->num_contexts)) return False; - rpc->num_contexts &= 0xff; /* Actually a 1 byte field.. */ + /* 3 pad bytes following - will be mopped up by the prs_align in smb_io_rpc_context(). */ /* num_contexts must not be zero. */ if (rpc->num_contexts == 0) -- cgit From 8b2b177a8e07e3a0cb00fbd7fdbafc8aeba5b204 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 27 Jul 2005 20:25:04 +0000 Subject: r8805: Merge a duplicate struct. Get ready to support SPNEGO rpc binds. Jeremy. (This used to be commit fd6e342746edfda2f25df1ae0067d359b756e0cd) --- source3/rpc_parse/parse_rpc.c | 74 +++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 45 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 3c10975876..ce081b92e8 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -650,98 +650,82 @@ BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, } /******************************************************************* - Init an RPC_HDR_AUTHA structure. + Inits an RPC_HDR_AUTH structure. ********************************************************************/ -void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, - uint16 max_tsize, uint16 max_rsize, +void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_type, uint8 auth_level, - uint8 stub_type_len) + uint8 auth_pad_len, + uint32 auth_context_id) { - rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ - rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ - rai->auth_type = auth_type; /* nt lm ssp 0x0a */ rai->auth_level = auth_level; /* 0x06 */ - rai->stub_type_len = stub_type_len; /* 0x00 */ - rai->padding = 0; /* padding 0x00 */ - - rai->unknown = 0x0014a0c0; /* non-zero pointer to something */ + rai->auth_pad_len = auth_pad_len; + rai->auth_reserved = 0; + rai->auth_context_id = auth_context_id; } /******************************************************************* - Reads or writes an RPC_HDR_AUTHA structure. + Reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); depth++; - if(!prs_uint16("max_tsize ", ps, depth, &rai->max_tsize)) - return False; - if(!prs_uint16("max_rsize ", ps, depth, &rai->max_rsize)) + if(!prs_align(ps)) return False; if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ return False; if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ return False; - if(!prs_uint8 ("stub_type_len", ps, depth, &rai->stub_type_len)) + if(!prs_uint8 ("auth_pad_len ", ps, depth, &rai->auth_pad_len)) return False; - if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) + if(!prs_uint8 ("auth_reserved", ps, depth, &rai->auth_reserved)) return False; - - if(!prs_uint32("unknown ", ps, depth, &rai->unknown)) /* 0x0014a0c0 */ + if(!prs_uint32("auth_context_id", ps, depth, &rai->auth_context_id)) return False; return True; } + /******************************************************************* - Inits an RPC_HDR_AUTH structure. + Init an RPC_HDR_AUTHA structure. ********************************************************************/ -void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, - uint8 auth_type, uint8 auth_level, - uint8 padding, - uint32 ptr) +void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, + uint16 max_tsize, uint16 max_rsize, + RPC_HDR_AUTH *auth) { - rai->auth_type = auth_type; /* nt lm ssp 0x0a */ - rai->auth_level = auth_level; /* 0x06 */ - rai->padding = padding; - rai->reserved = 0; - - rai->auth_context = ptr; /* non-zero pointer to something */ + rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ + rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ + rai->auth = *auth; } /******************************************************************* - Reads or writes an RPC_HDR_AUTH structure. + Reads or writes an RPC_HDR_AUTHA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_auth"); + prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); depth++; - if(!prs_align(ps)) - return False; - - if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ - return False; - if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ - return False; - if(!prs_uint8 ("padding ", ps, depth, &rai->padding)) + if(!prs_uint16("max_tsize ", ps, depth, &rai->max_tsize)) return False; - if(!prs_uint8 ("reserved ", ps, depth, &rai->reserved)) + if(!prs_uint16("max_rsize ", ps, depth, &rai->max_rsize)) return False; - if(!prs_uint32("auth_context ", ps, depth, &rai->auth_context)) + + if(!smb_io_rpc_hdr_auth("auth", &rai->auth, ps, depth)) return False; return True; -- cgit From 54abd2aa66069e6baf7769c496f46d9dba18db39 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 30 Sep 2005 17:13:37 +0000 Subject: r10656: BIG merge from trunk. Features not copied over * \PIPE\unixinfo * winbindd's {group,alias}membership new functions * winbindd's lookupsids() functionality * swat (trunk changes to be reverted as per discussion with Deryck) (This used to be commit 939c3cb5d78e3a2236209b296aa8aba8bdce32d3) --- source3/rpc_parse/parse_rpc.c | 518 ++++-------------------------------------- 1 file changed, 48 insertions(+), 470 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ce081b92e8..ea4ec2c863 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -191,6 +191,26 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_UNIXINFO_V0 \ +{ \ + { \ + 0x9c54e310, 0xa955, 0x4885, \ + { 0xbd, 0x31 }, \ + { 0x78, 0x78, \ + 0x71, 0x47, 0xdf, 0xa6 } \ + }, 0x00 \ +} + +#define SYNT_NTSVCS_V1 \ +{ \ + { \ + 0x8d9f4e40, 0xa03d, 0x11ce, \ + { 0x8f, 0x69}, \ + { 0x08, 0x00, \ + 0x3e, 0x30, 0x05, 0x1b } \ + }, 0x01 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -212,9 +232,19 @@ const struct pipe_id_info pipe_names [] = { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, + { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; +/**************************************************************************** + Return the pipe name from the index. + ****************************************************************************/ + +const char *cli_get_pipe_name(int pipe_idx) +{ + return &pipe_names[pipe_idx].client_pipe[5]; +} + /******************************************************************* Inits an RPC_HDR structure. ********************************************************************/ @@ -658,8 +688,8 @@ void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, uint8 auth_pad_len, uint32 auth_context_id) { - rai->auth_type = auth_type; /* nt lm ssp 0x0a */ - rai->auth_level = auth_level; /* 0x06 */ + rai->auth_type = auth_type; + rai->auth_level = auth_level; rai->auth_pad_len = auth_pad_len; rai->auth_reserved = 0; rai->auth_context_id = auth_context_id; @@ -680,9 +710,9 @@ BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, in if(!prs_align(ps)) return False; - if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) /* 0x0a nt lm ssp */ + if(!prs_uint8 ("auth_type ", ps, depth, &rai->auth_type)) return False; - if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) /* 0x06 */ + if(!prs_uint8 ("auth_level ", ps, depth, &rai->auth_level)) return False; if(!prs_uint8 ("auth_pad_len ", ps, depth, &rai->auth_pad_len)) return False; @@ -694,43 +724,6 @@ BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, in return True; } - -/******************************************************************* - Init an RPC_HDR_AUTHA structure. -********************************************************************/ - -void init_rpc_hdr_autha(RPC_HDR_AUTHA *rai, - uint16 max_tsize, uint16 max_rsize, - RPC_HDR_AUTH *auth) -{ - rai->max_tsize = max_tsize; /* maximum transmission fragment size (0x1630) */ - rai->max_rsize = max_rsize; /* max receive fragment size (0x1630) */ - rai->auth = *auth; -} - -/******************************************************************* - Reads or writes an RPC_HDR_AUTHA structure. -********************************************************************/ - -BOOL smb_io_rpc_hdr_autha(const char *desc, RPC_HDR_AUTHA *rai, prs_struct *ps, int depth) -{ - if (rai == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_hdr_autha"); - depth++; - - if(!prs_uint16("max_tsize ", ps, depth, &rai->max_tsize)) - return False; - if(!prs_uint16("max_rsize ", ps, depth, &rai->max_rsize)) - return False; - - if(!smb_io_rpc_hdr_auth("auth", &rai->auth, ps, depth)) - return False; - - return True; -} - /******************************************************************* Checks an RPC_AUTH_VERIFIER structure. ********************************************************************/ @@ -775,17 +768,15 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru } /******************************************************************* - This parses an RPC_AUTH_VERIFIER for NETLOGON schannel. I think - assuming "NTLMSSP" in sm_io_rpc_auth_verifier is somewhat wrong. - I have to look at that later... + This parses an RPC_AUTH_VERIFIER for schannel. I think ********************************************************************/ -BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +BOOL smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_auth_verifier"); + prs_debug(ps, depth, desc, "smb_io_rpc_schannel_verifier"); depth++; if(!prs_string("signature", ps, depth, rav->signature, sizeof(rav->signature))) @@ -797,424 +788,10 @@ BOOL smb_io_rpc_netsec_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_st } /******************************************************************* - Inits an RPC_AUTH_NTLMSSP_NEG structure. -********************************************************************/ - -void init_rpc_auth_ntlmssp_neg(RPC_AUTH_NTLMSSP_NEG *neg, - uint32 neg_flgs, - const char *myname, const char *domain) -{ - int len_myname = strlen(myname); - int len_domain = strlen(domain); - - neg->neg_flgs = neg_flgs ; /* 0x00b2b3 */ - - init_str_hdr(&neg->hdr_domain, len_domain, len_domain, 0x20 + len_myname); - init_str_hdr(&neg->hdr_myname, len_myname, len_myname, 0x20); - - fstrcpy(neg->myname, myname); - fstrcpy(neg->domain, domain); -} - -/******************************************************************* - Reads or writes an RPC_AUTH_NTLMSSP_NEG structure. - - *** lkclXXXX HACK ALERT! *** -********************************************************************/ - -BOOL smb_io_rpc_auth_ntlmssp_neg(const char *desc, RPC_AUTH_NTLMSSP_NEG *neg, prs_struct *ps, int depth) -{ - uint32 start_offset = prs_offset(ps); - if (neg == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_neg"); - depth++; - - if(!prs_uint32("neg_flgs ", ps, depth, &neg->neg_flgs)) - return False; - - if (ps->io) { - uint32 old_offset; - uint32 old_neg_flags = neg->neg_flgs; - - /* reading */ - - ZERO_STRUCTP(neg); - - neg->neg_flgs = old_neg_flags; - - if(!smb_io_strhdr("hdr_domain", &neg->hdr_domain, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_myname", &neg->hdr_myname, ps, depth)) - return False; - - old_offset = prs_offset(ps); - - if(!prs_set_offset(ps, neg->hdr_myname.buffer + start_offset - 12)) - return False; - - if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, - MIN(neg->hdr_myname.str_str_len, sizeof(neg->myname)))) - return False; - - old_offset += neg->hdr_myname.str_str_len; - - if(!prs_set_offset(ps, neg->hdr_domain.buffer + start_offset - 12)) - return False; - - if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, - MIN(neg->hdr_domain.str_str_len, sizeof(neg->domain )))) - return False; - - old_offset += neg->hdr_domain .str_str_len; - - if(!prs_set_offset(ps, old_offset)) - return False; - } else { - /* writing */ - if(!smb_io_strhdr("hdr_domain", &neg->hdr_domain, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_myname", &neg->hdr_myname, ps, depth)) - return False; - - if(!prs_uint8s(True, "myname", ps, depth, (uint8*)neg->myname, - MIN(neg->hdr_myname.str_str_len, sizeof(neg->myname)))) - return False; - if(!prs_uint8s(True, "domain", ps, depth, (uint8*)neg->domain, - MIN(neg->hdr_domain.str_str_len, sizeof(neg->domain )))) - return False; - } - - return True; -} - -/******************************************************************* -creates an RPC_AUTH_NTLMSSP_CHAL structure. -********************************************************************/ - -void init_rpc_auth_ntlmssp_chal(RPC_AUTH_NTLMSSP_CHAL *chl, - uint32 neg_flags, - uint8 challenge[8]) -{ - chl->unknown_1 = 0x0; - chl->unknown_2 = 0x00000028; - chl->neg_flags = neg_flags; /* 0x0082b1 */ - - memcpy(chl->challenge, challenge, sizeof(chl->challenge)); - memset((char *)chl->reserved , '\0', sizeof(chl->reserved)); -} - -/******************************************************************* - Reads or writes an RPC_AUTH_NTLMSSP_CHAL structure. -********************************************************************/ - -BOOL smb_io_rpc_auth_ntlmssp_chal(const char *desc, RPC_AUTH_NTLMSSP_CHAL *chl, prs_struct *ps, int depth) -{ - if (chl == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chal"); - depth++; - - if(!prs_uint32("unknown_1", ps, depth, &chl->unknown_1)) /* 0x0000 0000 */ - return False; - if(!prs_uint32("unknown_2", ps, depth, &chl->unknown_2)) /* 0x0000 b2b3 */ - return False; - if(!prs_uint32("neg_flags", ps, depth, &chl->neg_flags)) /* 0x0000 82b1 */ - return False; - - if(!prs_uint8s (False, "challenge", ps, depth, chl->challenge, sizeof(chl->challenge))) - return False; - if(!prs_uint8s (False, "reserved ", ps, depth, chl->reserved , sizeof(chl->reserved ))) - return False; - - return True; -} - -/******************************************************************* - Inits an RPC_AUTH_NTLMSSP_RESP structure. - - *** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** - *** lkclXXXX the actual offset is at the start of the auth verifier *** -********************************************************************/ - -void init_rpc_auth_ntlmssp_resp(RPC_AUTH_NTLMSSP_RESP *rsp, - uchar lm_resp[24], uchar nt_resp[24], - const char *domain, const char *user, const char *wks, - uint32 neg_flags) -{ - uint32 offset; - int dom_len = strlen(domain); - int wks_len = strlen(wks); - int usr_len = strlen(user); - int lm_len = (lm_resp != NULL) ? 24 : 0; - int nt_len = (nt_resp != NULL) ? 24 : 0; - - DEBUG(5,("make_rpc_auth_ntlmssp_resp\n")); - -#ifdef DEBUG_PASSWORD - DEBUG(100,("lm_resp\n")); - dump_data(100, (char *)lm_resp, 24); - DEBUG(100,("nt_resp\n")); - dump_data(100, (char *)nt_resp, 24); -#endif - - DEBUG(6,("dom: %s user: %s wks: %s neg_flgs: 0x%x\n", - domain, user, wks, neg_flags)); - - offset = 0x40; - - if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { - dom_len *= 2; - wks_len *= 2; - usr_len *= 2; - } - - init_str_hdr(&rsp->hdr_domain, dom_len, dom_len, offset); - offset += dom_len; - - init_str_hdr(&rsp->hdr_usr, usr_len, usr_len, offset); - offset += usr_len; - - init_str_hdr(&rsp->hdr_wks, wks_len, wks_len, offset); - offset += wks_len; - - init_str_hdr(&rsp->hdr_lm_resp, lm_len, lm_len, offset); - offset += lm_len; - - init_str_hdr(&rsp->hdr_nt_resp, nt_len, nt_len, offset); - offset += nt_len; - - init_str_hdr(&rsp->hdr_sess_key, 0, 0, offset); - - rsp->neg_flags = neg_flags; - - memcpy(rsp->lm_resp, lm_resp, 24); - memcpy(rsp->nt_resp, nt_resp, 24); - - if (neg_flags & NTLMSSP_NEGOTIATE_UNICODE) { - rpcstr_push(rsp->domain, domain, sizeof(rsp->domain), 0); - rpcstr_push(rsp->user, user, sizeof(rsp->user), 0); - rpcstr_push(rsp->wks, wks, sizeof(rsp->wks), 0); - } else { - fstrcpy(rsp->domain, domain); - fstrcpy(rsp->user, user); - fstrcpy(rsp->wks, wks); - } - - rsp->sess_key[0] = 0; -} - -/******************************************************************* - Reads or writes an RPC_AUTH_NTLMSSP_RESP structure. - - *** lkclXXXX FUDGE! HAVE TO MANUALLY SPECIFY OFFSET HERE (0x1c bytes) *** - *** lkclXXXX the actual offset is at the start of the auth verifier *** -********************************************************************/ - -BOOL smb_io_rpc_auth_ntlmssp_resp(const char *desc, RPC_AUTH_NTLMSSP_RESP *rsp, prs_struct *ps, int depth) -{ - if (rsp == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_resp"); - depth++; - - if (ps->io) { - uint32 old_offset; - - /* reading */ - - ZERO_STRUCTP(rsp); - - if(!smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_domain ", &rsp->hdr_domain, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_user ", &rsp->hdr_usr, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_wks ", &rsp->hdr_wks, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth)) - return False; - - if(!prs_uint32("neg_flags", ps, depth, &rsp->neg_flags)) /* 0x0000 82b1 */ - return False; - - old_offset = prs_offset(ps); - - if(!prs_set_offset(ps, rsp->hdr_domain.buffer + 0xc)) - return False; - - if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, - MIN(rsp->hdr_domain.str_str_len, sizeof(rsp->domain)))) - return False; - - old_offset += rsp->hdr_domain.str_str_len; - - if(!prs_set_offset(ps, rsp->hdr_usr.buffer + 0xc)) - return False; - - if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, - MIN(rsp->hdr_usr.str_str_len, sizeof(rsp->user)))) - return False; - - old_offset += rsp->hdr_usr.str_str_len; - - if(!prs_set_offset(ps, rsp->hdr_wks.buffer + 0xc)) - return False; - - if(!prs_uint8s(True, "wks ", ps, depth, (uint8*)rsp->wks, - MIN(rsp->hdr_wks.str_str_len, sizeof(rsp->wks)))) - return False; - - old_offset += rsp->hdr_wks.str_str_len; - - if(!prs_set_offset(ps, rsp->hdr_lm_resp.buffer + 0xc)) - return False; - - if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, - MIN(rsp->hdr_lm_resp.str_str_len, sizeof(rsp->lm_resp )))) - return False; - - old_offset += rsp->hdr_lm_resp.str_str_len; - - if(!prs_set_offset(ps, rsp->hdr_nt_resp.buffer + 0xc)) - return False; - - if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, - MIN(rsp->hdr_nt_resp.str_str_len, sizeof(rsp->nt_resp )))) - return False; - - old_offset += rsp->hdr_nt_resp.str_str_len; - - if (rsp->hdr_sess_key.str_str_len != 0) { - - if(!prs_set_offset(ps, rsp->hdr_sess_key.buffer + 0x10)) - return False; - - old_offset += rsp->hdr_sess_key.str_str_len; - - if(!prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, - MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)))) - return False; - } - - if(!prs_set_offset(ps, old_offset)) - return False; - } else { - /* writing */ - if(!smb_io_strhdr("hdr_lm_resp ", &rsp->hdr_lm_resp, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_nt_resp ", &rsp->hdr_nt_resp, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_domain ", &rsp->hdr_domain, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_user ", &rsp->hdr_usr, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_wks ", &rsp->hdr_wks, ps, depth)) - return False; - if(!smb_io_strhdr("hdr_sess_key", &rsp->hdr_sess_key, ps, depth)) - return False; - - if(!prs_uint32("neg_flags", ps, depth, &rsp->neg_flags)) /* 0x0000 82b1 */ - return False; - - if(!prs_uint8s(True , "domain ", ps, depth, (uint8*)rsp->domain, - MIN(rsp->hdr_domain.str_str_len, sizeof(rsp->domain)))) - return False; - - if(!prs_uint8s(True , "user ", ps, depth, (uint8*)rsp->user, - MIN(rsp->hdr_usr.str_str_len, sizeof(rsp->user)))) - return False; - - if(!prs_uint8s(True , "wks ", ps, depth, (uint8*)rsp->wks, - MIN(rsp->hdr_wks.str_str_len, sizeof(rsp->wks)))) - return False; - if(!prs_uint8s(False, "lm_resp ", ps, depth, (uint8*)rsp->lm_resp, - MIN(rsp->hdr_lm_resp .str_str_len, sizeof(rsp->lm_resp)))) - return False; - if(!prs_uint8s(False, "nt_resp ", ps, depth, (uint8*)rsp->nt_resp, - MIN(rsp->hdr_nt_resp .str_str_len, sizeof(rsp->nt_resp )))) - return False; - if(!prs_uint8s(False, "sess_key", ps, depth, (uint8*)rsp->sess_key, - MIN(rsp->hdr_sess_key.str_str_len, sizeof(rsp->sess_key)))) - return False; - } - - return True; -} - -/******************************************************************* - Checks an RPC_AUTH_NTLMSSP_CHK structure. -********************************************************************/ - -BOOL rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, uint32 crc32, uint32 seq_num) -{ - if (chk == NULL) - return False; - - if (chk->crc32 != crc32 || - chk->ver != NTLMSSP_SIGN_VERSION || - chk->seq_num != seq_num) - { - DEBUG(5,("verify failed - crc %x ver %x seq %d\n", - chk->crc32, chk->ver, chk->seq_num)); - - DEBUG(5,("verify expect - crc %x ver %x seq %d\n", - crc32, NTLMSSP_SIGN_VERSION, seq_num)); - return False; - } - return True; -} - -/******************************************************************* - Inits an RPC_AUTH_NTLMSSP_CHK structure. -********************************************************************/ - -void init_rpc_auth_ntlmssp_chk(RPC_AUTH_NTLMSSP_CHK *chk, - uint32 ver, uint32 crc32, uint32 seq_num) -{ - chk->ver = ver; - chk->reserved = 0x0; - chk->crc32 = crc32; - chk->seq_num = seq_num; -} - -/******************************************************************* - Reads or writes an RPC_AUTH_NTLMSSP_CHK structure. +creates an RPC_AUTH_SCHANNEL_NEG structure. ********************************************************************/ -BOOL smb_io_rpc_auth_ntlmssp_chk(const char *desc, RPC_AUTH_NTLMSSP_CHK *chk, prs_struct *ps, int depth) -{ - if (chk == NULL) - return False; - - prs_debug(ps, depth, desc, "smb_io_rpc_auth_ntlmssp_chk"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ver ", ps, depth, &chk->ver)) - return False; - if(!prs_uint32("reserved", ps, depth, &chk->reserved)) - return False; - if(!prs_uint32("crc32 ", ps, depth, &chk->crc32)) - return False; - if(!prs_uint32("seq_num ", ps, depth, &chk->seq_num)) - return False; - - return True; -} - -/******************************************************************* -creates an RPC_AUTH_NETSEC_NEG structure. -********************************************************************/ -void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, +void init_rpc_auth_schannel_neg(RPC_AUTH_SCHANNEL_NEG *neg, const char *domain, const char *myname) { neg->type1 = 0; @@ -1224,16 +801,16 @@ void init_rpc_auth_netsec_neg(RPC_AUTH_NETSEC_NEG *neg, } /******************************************************************* - Reads or writes an RPC_AUTH_NETSEC_NEG structure. + Reads or writes an RPC_AUTH_SCHANNEL_NEG structure. ********************************************************************/ -BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, +BOOL smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg, prs_struct *ps, int depth) { if (neg == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_neg"); + prs_debug(ps, depth, desc, "smb_io_rpc_auth_schannel_neg"); depth++; if(!prs_align(ps)) @@ -1252,16 +829,17 @@ BOOL smb_io_rpc_auth_netsec_neg(const char *desc, RPC_AUTH_NETSEC_NEG *neg, } /******************************************************************* -reads or writes an RPC_AUTH_NETSEC_CHK structure. +reads or writes an RPC_AUTH_SCHANNEL_CHK structure. ********************************************************************/ -BOOL smb_io_rpc_auth_netsec_chk(const char *desc, int auth_len, - RPC_AUTH_NETSEC_CHK * chk, + +BOOL smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, + RPC_AUTH_SCHANNEL_CHK * chk, prs_struct *ps, int depth) { if (chk == NULL) return False; - prs_debug(ps, depth, desc, "smb_io_rpc_auth_netsec_chk"); + prs_debug(ps, depth, desc, "smb_io_rpc_auth_schannel_chk"); depth++; if ( !prs_uint8s(False, "sig ", ps, depth, chk->sig, sizeof(chk->sig)) ) @@ -1273,7 +851,7 @@ BOOL smb_io_rpc_auth_netsec_chk(const char *desc, int auth_len, if ( !prs_uint8s(False, "packet_digest", ps, depth, chk->packet_digest, sizeof(chk->packet_digest)) ) return False; - if ( auth_len == RPC_AUTH_NETSEC_SIGN_OR_SEAL_CHK_LEN ) { + if ( auth_len == RPC_AUTH_SCHANNEL_SIGN_OR_SEAL_CHK_LEN ) { if ( !prs_uint8s(False, "confounder", ps, depth, chk->confounder, sizeof(chk->confounder)) ) return False; } -- cgit From 0af1500fc0bafe61019f1b2ab1d9e1d369221240 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Fri, 3 Feb 2006 22:19:41 +0000 Subject: r13316: Let the carnage begin.... Sync with trunk as off r13315 (This used to be commit 17e63ac4ed8325c0d44fe62b2442449f3298559f) --- source3/rpc_parse/parse_rpc.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ea4ec2c863..544d139acb 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -191,16 +191,6 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -#define SYNT_UNIXINFO_V0 \ -{ \ - { \ - 0x9c54e310, 0xa955, 0x4885, \ - { 0xbd, 0x31 }, \ - { 0x78, 0x78, \ - 0x71, 0x47, 0xdf, 0xa6 } \ - }, 0x00 \ -} - #define SYNT_NTSVCS_V1 \ { \ { \ -- cgit From ad8b47a2ba4e81420bc2272e8438a727cc2223ee Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 9 Feb 2006 07:03:23 +0000 Subject: r13407: Change the credentials code to be more like the Samba4 structure, makes fixes much easier to port. Fix the size of dc->sess_key to be 16 bytes, not 8 bytes - only store 8 bytes in the inter-smbd store in secrets.tdb though. Should fix some uses of the dc->sess_key where we where assuming we could read 16 bytes. Jeremy. (This used to be commit 5b3c2e63c73fee8949108abe19ac7a448a033a7f) --- source3/rpc_parse/parse_rpc.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 544d139acb..79dfc05e43 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -848,4 +848,3 @@ BOOL smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, return True; } - -- cgit From 6e17934ee614f5f129b69898be7eceb09486a48f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 22 Mar 2006 14:41:07 +0000 Subject: r14643: Merge dcerpc_errstr from Samba 4. Might need to rework prs_dcerpc_status(). Guenther (This used to be commit 38b18f428ba941f4d9a14fa2de45cb0cd793a754) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 79dfc05e43..2d166c773b 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -661,7 +661,7 @@ BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, prs_debug(ps, depth, desc, "smb_io_rpc_hdr_fault"); depth++; - if(!prs_ntstatus("status ", ps, depth, &rpc->status)) + if(!prs_dcerpc_status("status ", ps, depth, &rpc->status)) return False; if(!prs_uint32("reserved", ps, depth, &rpc->reserved)) return False; -- cgit From fbdcf2663b56007a438ac4f0d8d82436b1bfe688 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Jul 2006 18:01:26 +0000 Subject: r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8) --- source3/rpc_parse/parse_rpc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 2d166c773b..240cac886c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -191,6 +191,16 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_UNIXINFO_V0 \ +{ \ + { \ + 0x9c54e310, 0xa955, 0x4885, \ + { 0xbd, 0x31 }, \ + { 0x78, 0x78, \ + 0x71, 0x47, 0xdf, 0xa6 } \ + }, 0x00 \ +} + #define SYNT_NTSVCS_V1 \ { \ { \ @@ -222,6 +232,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, + { PIPE_UNIXINFO, SYNT_UNIXINFO_V0 , PIPE_UNIXINFO , TRANS_SYNT_V2 }, { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 0389cad7c492eda5aee590d0396748c7da9b44ff Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Apr 2007 12:28:40 +0000 Subject: r22055: Port the endpoint mapper (and functions it requires) to Samba 3. (This used to be commit ad981261877e6a2dce0c4f4e71fd9127aa31538a) --- source3/rpc_parse/parse_rpc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 240cac886c..39156d5ef8 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -211,6 +211,16 @@ interface/version dce/rpc pipe identification }, 0x01 \ } +#define SYNT_EPMAPPER_V3 \ +{ \ + { \ + 0xe1af8308, 0x5d1f,0x11c9, \ + { 0x91,0xa4}, \ + {0x08,0x00, \ + 0x2b,0x14,0xa0,0xfa} \ + }, 0x03 \ +} + /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -234,6 +244,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, { PIPE_UNIXINFO, SYNT_UNIXINFO_V0 , PIPE_UNIXINFO , TRANS_SYNT_V2 }, { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, + { PIPE_EPMAPPER, SYNT_EPMAPPER_V3 , PIPE_EPMAPPER , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 39156d5ef8..6fd3ef764d 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -8,7 +8,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, -- cgit From 153cfb9c83534b09f15cc16205d7adb19b394928 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 05:23:25 +0000 Subject: r23801: The FSF has moved around a lot. This fixes their Mass Ave address. (This used to be commit 87c91e4362c51819032bfbebbb273c52e203b227) --- source3/rpc_parse/parse_rpc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6fd3ef764d..6b2a9f4d38 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -17,8 +17,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, see . */ #include "includes.h" -- cgit From e5a951325a6cac8567af3a66de6d2df577508ae4 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Wed, 10 Oct 2007 15:34:30 -0500 Subject: [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch. (This used to be commit 5c6c8e1fe93f340005110a7833946191659d88ab) --- source3/rpc_parse/parse_rpc.c | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6b2a9f4d38..d1f7ad3e85 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -190,16 +190,6 @@ interface/version dce/rpc pipe identification }, 0x00 \ } -#define SYNT_UNIXINFO_V0 \ -{ \ - { \ - 0x9c54e310, 0xa955, 0x4885, \ - { 0xbd, 0x31 }, \ - { 0x78, 0x78, \ - 0x71, 0x47, 0xdf, 0xa6 } \ - }, 0x00 \ -} - #define SYNT_NTSVCS_V1 \ { \ { \ @@ -210,16 +200,6 @@ interface/version dce/rpc pipe identification }, 0x01 \ } -#define SYNT_EPMAPPER_V3 \ -{ \ - { \ - 0xe1af8308, 0x5d1f,0x11c9, \ - { 0x91,0xa4}, \ - {0x08,0x00, \ - 0x2b,0x14,0xa0,0xfa} \ - }, 0x03 \ -} - /* * IMPORTANT!! If you update this structure, make sure to * update the index #defines in smb.h. @@ -241,9 +221,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, - { PIPE_UNIXINFO, SYNT_UNIXINFO_V0 , PIPE_UNIXINFO , TRANS_SYNT_V2 }, { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_EPMAPPER, SYNT_EPMAPPER_V3 , PIPE_EPMAPPER , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/rpc_parse/parse_rpc.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index d1f7ad3e85..b696080aef 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -258,7 +258,7 @@ void init_rpc_hdr(RPC_HDR *hdr, enum RPC_PKT_TYPE pkt_type, uint8 flags, Reads or writes an RPC_HDR structure. ********************************************************************/ -BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -312,7 +312,7 @@ BOOL smb_io_rpc_hdr(const char *desc, RPC_HDR *rpc, prs_struct *ps, int depth) Reads or writes an RPC_IFACE structure. ********************************************************************/ -static BOOL smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) +static bool smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, int depth) { if (ifc == NULL) return False; @@ -346,7 +346,7 @@ static void init_rpc_addr_str(RPC_ADDR_STR *str, const char *name) Reads or writes an RPC_ADDR_STR structure. ********************************************************************/ -static BOOL smb_io_rpc_addr_str(const char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) +static bool smb_io_rpc_addr_str(const char *desc, RPC_ADDR_STR *str, prs_struct *ps, int depth) { if (str == NULL) return False; @@ -378,7 +378,7 @@ static void init_rpc_hdr_bba(RPC_HDR_BBA *bba, uint16 max_tsize, uint16 max_rsiz Reads or writes an RPC_HDR_BBA structure. ********************************************************************/ -static BOOL smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) +static bool smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -431,7 +431,7 @@ void init_rpc_hdr_rb(RPC_HDR_RB *rpc, Reads or writes an RPC_CONTEXT structure. ********************************************************************/ -BOOL smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth) +bool smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, int depth) { int i; @@ -469,7 +469,7 @@ BOOL smb_io_rpc_context(const char *desc, RPC_CONTEXT *rpc_ctx, prs_struct *ps, Reads or writes an RPC_HDR_RB structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_rb(const char *desc, RPC_HDR_RB *rpc, prs_struct *ps, int depth) { int i; @@ -525,7 +525,7 @@ static void init_rpc_results(RPC_RESULTS *res, lkclXXXX only one reason at the moment! ********************************************************************/ -static BOOL smb_io_rpc_results(const char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) +static bool smb_io_rpc_results(const char *desc, RPC_RESULTS *res, prs_struct *ps, int depth) { if (res == NULL) return False; @@ -574,7 +574,7 @@ void init_rpc_hdr_ba(RPC_HDR_BA *rpc, Reads or writes an RPC_HDR_BA structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_ba(const char *desc, RPC_HDR_BA *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -608,7 +608,7 @@ void init_rpc_hdr_req(RPC_HDR_REQ *hdr, uint32 alloc_hint, uint16 opnum) Reads or writes an RPC_HDR_REQ structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -629,7 +629,7 @@ BOOL smb_io_rpc_hdr_req(const char *desc, RPC_HDR_REQ *rpc, prs_struct *ps, int Reads or writes an RPC_HDR_RESP structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -652,7 +652,7 @@ BOOL smb_io_rpc_hdr_resp(const char *desc, RPC_HDR_RESP *rpc, prs_struct *ps, in Reads or writes an RPC_HDR_FAULT structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_fault(const char *desc, RPC_HDR_FAULT *rpc, prs_struct *ps, int depth) { if (rpc == NULL) return False; @@ -688,7 +688,7 @@ void init_rpc_hdr_auth(RPC_HDR_AUTH *rai, Reads or writes an RPC_HDR_AUTH structure. ********************************************************************/ -BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) +bool smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, int depth) { if (rai == NULL) return False; @@ -717,7 +717,7 @@ BOOL smb_io_rpc_hdr_auth(const char *desc, RPC_HDR_AUTH *rai, prs_struct *ps, in Checks an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, +bool rpc_auth_verifier_chk(RPC_AUTH_VERIFIER *rav, const char *signature, uint32 msg_type) { return (strequal(rav->signature, signature) && rav->msg_type == msg_type); @@ -738,7 +738,7 @@ void init_rpc_auth_verifier(RPC_AUTH_VERIFIER *rav, Reads or writes an RPC_AUTH_VERIFIER structure. ********************************************************************/ -BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +bool smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return False; @@ -760,7 +760,7 @@ BOOL smb_io_rpc_auth_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_stru This parses an RPC_AUTH_VERIFIER for schannel. I think ********************************************************************/ -BOOL smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) +bool smb_io_rpc_schannel_verifier(const char *desc, RPC_AUTH_VERIFIER *rav, prs_struct *ps, int depth) { if (rav == NULL) return False; @@ -793,7 +793,7 @@ void init_rpc_auth_schannel_neg(RPC_AUTH_SCHANNEL_NEG *neg, Reads or writes an RPC_AUTH_SCHANNEL_NEG structure. ********************************************************************/ -BOOL smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg, +bool smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg, prs_struct *ps, int depth) { if (neg == NULL) @@ -821,7 +821,7 @@ BOOL smb_io_rpc_auth_schannel_neg(const char *desc, RPC_AUTH_SCHANNEL_NEG *neg, reads or writes an RPC_AUTH_SCHANNEL_CHK structure. ********************************************************************/ -BOOL smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, +bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, RPC_AUTH_SCHANNEL_CHK * chk, prs_struct *ps, int depth) { -- cgit From 28fd4f6fcb101fc0274c43611a59d22072fb7891 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 20:26:52 +0200 Subject: Reconcile ndr_syntax_id used by pidl-generated code and Samba3's RFC_IFACE. (This used to be commit 7bea00dca1ee08ef731dfa73110ef9c190a29919) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index b696080aef..268bee7e51 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -326,7 +326,7 @@ static bool smb_io_rpc_iface(const char *desc, RPC_IFACE *ifc, prs_struct *ps, i if (!smb_io_uuid( "uuid", &ifc->uuid, ps, depth)) return False; - if(!prs_uint32 ("version", ps, depth, &ifc->version)) + if(!prs_uint32 ("version", ps, depth, &ifc->if_version)) return False; return True; -- cgit From e3246e8720c74bb62a2b86b21f6147ea6f050054 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 15 Apr 2008 18:24:11 +0200 Subject: Actually connect to RPC. (This used to be commit 3082534454ff936ac0b78b5a2c72c9b060e21244) --- source3/rpc_parse/parse_rpc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 268bee7e51..9eeae176c7 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -234,6 +234,21 @@ const char *cli_get_pipe_name(int pipe_idx) return &pipe_names[pipe_idx].client_pipe[5]; } +/**************************************************************************** + Return the pipe idx from the syntax. + ****************************************************************************/ +int cli_get_pipe_idx(const RPC_IFACE *syntax) +{ + int i; + for (i = 0; pipe_names[i].client_pipe; i++) { + if (GUID_equal(&pipe_names[i].abstr_syntax.uuid, &syntax->uuid) && + pipe_names[i].abstr_syntax.version == syntax->version) + return i; + } + + return -1; +} + /******************************************************************* Inits an RPC_HDR structure. ********************************************************************/ -- cgit From f303547e1f34de0b12f1341c6e234112aa37b9f0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 13:46:13 +0200 Subject: Remove copying of interface syntax id. (This used to be commit 0012dfbe1fcf17486a24366b939054b5637646e3) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 9eeae176c7..7de6998c9d 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -242,7 +242,7 @@ int cli_get_pipe_idx(const RPC_IFACE *syntax) int i; for (i = 0; pipe_names[i].client_pipe; i++) { if (GUID_equal(&pipe_names[i].abstr_syntax.uuid, &syntax->uuid) && - pipe_names[i].abstr_syntax.version == syntax->version) + pipe_names[i].abstr_syntax.if_version == syntax->if_version) return i; } -- cgit From a4c60b2696962c7f83e033e00d97e4b1dacc05c9 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 17:44:40 +0200 Subject: rpc_parse: Use UUIDs from librpc/gen_ndr/ when possible to reduce duplication. (This used to be commit 428654b473ba44b2f5340eefef0d4fcd51aff558) --- source3/rpc_parse/parse_rpc.c | 213 +++++------------------------------------- 1 file changed, 25 insertions(+), 188 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 7de6998c9d..6b6e1424e0 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -29,176 +29,14 @@ interface/version dce/rpc pipe identification ********************************************************************/ -#define TRANS_SYNT_V2 \ -{ \ - { \ - 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8 }, \ - { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ - }, 0x02 \ -} - -#define SYNT_NETLOGON_V2 \ -{ \ - { \ - 0x8a885d04, 0x1ceb, 0x11c9, \ - { 0x9f, 0xe8 }, \ - { 0x08, 0x00, \ - 0x2b, 0x10, 0x48, 0x60 } \ - }, 0x02 \ -} - -#define SYNT_WKSSVC_V1 \ -{ \ - { \ - 0x6bffd098, 0xa112, 0x3610, \ - { 0x98, 0x33 }, \ - { 0x46, 0xc3, \ - 0xf8, 0x7e, 0x34, 0x5a } \ - }, 0x01 \ -} - -#define SYNT_SRVSVC_V3 \ -{ \ - { \ - 0x4b324fc8, 0x1670, 0x01d3, \ - { 0x12, 0x78 }, \ - { 0x5a, 0x47, \ - 0xbf, 0x6e, 0xe1, 0x88 } \ - }, 0x03 \ -} - -#define SYNT_LSARPC_V0 \ -{ \ - { \ - 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ - }, 0x00 \ -} - -#define SYNT_LSARPC_V0_DS \ -{ \ - { \ - 0x3919286a, 0xb10c, 0x11d0, \ - { 0x9b, 0xa8 }, \ - { 0x00, 0xc0, \ - 0x4f, 0xd9, 0x2e, 0xf5 } \ - }, 0x00 \ -} - -#define SYNT_SAMR_V1 \ -{ \ - { \ - 0x12345778, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xac } \ - }, 0x01 \ -} - -#define SYNT_NETLOGON_V1 \ -{ \ - { \ - 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0xcf, 0xfb } \ - }, 0x01 \ -} - -#define SYNT_WINREG_V1 \ -{ \ - { \ - 0x338cd001, 0x2244, 0x31f1, \ - { 0xaa, 0xaa }, \ - { 0x90, 0x00, \ - 0x38, 0x00, 0x10, 0x03 } \ - }, 0x01 \ -} - -#define SYNT_SPOOLSS_V1 \ -{ \ - { \ - 0x12345678, 0x1234, 0xabcd, \ - { 0xef, 0x00 }, \ - { 0x01, 0x23, \ - 0x45, 0x67, 0x89, 0xab } \ - }, 0x01 \ -} - -#define SYNT_NONE_V0 \ -{ \ - { \ - 0x0, 0x0, 0x0, \ - { 0x00, 0x00 }, \ - { 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00 } \ - }, 0x00 \ -} - -#define SYNT_NETDFS_V3 \ -{ \ - { \ - 0x4fc742e0, 0x4a10, 0x11cf, \ - { 0x82, 0x73 }, \ - { 0x00, 0xaa, \ - 0x00, 0x4a, 0xe6, 0x73 } \ - }, 0x03 \ -} - -#define SYNT_ECHO_V1 \ -{ \ - { \ - 0x60a15ec5, 0x4de8, 0x11d7, \ - { 0xa6, 0x37 }, \ - { 0x00, 0x50, \ - 0x56, 0xa2, 0x01, 0x82 } \ - }, 0x01 \ -} - -#define SYNT_SHUTDOWN_V1 \ -{ \ - { \ - 0x894de0c0, 0x0d55, 0x11d3, \ - { 0xa3, 0x22 }, \ - { 0x00, 0xc0, \ - 0x4f, 0xa3, 0x21, 0xa1 } \ - }, 0x01 \ -} - -#define SYNT_SVCCTL_V2 \ -{ \ - { \ - 0x367abb81, 0x9844, 0x35f1, \ - { 0xad, 0x32 }, \ - { 0x98, 0xf0, \ - 0x38, 0x00, 0x10, 0x03 } \ - }, 0x02 \ -} - - -#define SYNT_EVENTLOG_V0 \ -{ \ - { \ - 0x82273fdc, 0xe32a, 0x18c3, \ - { 0x3f, 0x78 }, \ - { 0x82, 0x79, \ - 0x29, 0xdc, 0x23, 0xea } \ - }, 0x00 \ -} - -#define SYNT_NTSVCS_V1 \ -{ \ - { \ - 0x8d9f4e40, 0xa03d, 0x11ce, \ - { 0x8f, 0x69}, \ - { 0x08, 0x00, \ - 0x3e, 0x30, 0x05, 0x1b } \ - }, 0x01 \ -} +const struct ndr_syntax_id syntax_spoolss = { + { + 0x12345678, 0x1234, 0xabcd, + { 0xef, 0x00 }, + { 0x01, 0x23, + 0x45, 0x67, 0x89, 0xab } + }, 0x01 +}; /* * IMPORTANT!! If you update this structure, make sure to @@ -207,22 +45,21 @@ interface/version dce/rpc pipe identification const struct pipe_id_info pipe_names [] = { - /* client pipe , abstract syntax , server pipe , transfer syntax */ - { PIPE_LSARPC , SYNT_LSARPC_V0 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_LSARPC , SYNT_LSARPC_V0_DS , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SAMR , SYNT_SAMR_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_NETLOGON, SYNT_NETLOGON_V1 , PIPE_LSASS , TRANS_SYNT_V2 }, - { PIPE_SRVSVC , SYNT_SRVSVC_V3 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WKSSVC , SYNT_WKSSVC_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_WINREG , SYNT_WINREG_V1 , PIPE_WINREG , TRANS_SYNT_V2 }, - { PIPE_SPOOLSS , SYNT_SPOOLSS_V1 , PIPE_SPOOLSS , TRANS_SYNT_V2 }, - { PIPE_NETDFS , SYNT_NETDFS_V3 , PIPE_NETDFS , TRANS_SYNT_V2 }, - { PIPE_ECHO , SYNT_ECHO_V1 , PIPE_ECHO , TRANS_SYNT_V2 }, - { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, - { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, - { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, - { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } + { PIPE_LSARPC , &ndr_table_lsarpc.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, + { PIPE_LSARPC , &ndr_table_dssetup.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, + { PIPE_SAMR , &ndr_table_samr.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, + { PIPE_NETLOGON, &ndr_table_netlogon.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, + { PIPE_SRVSVC , &ndr_table_srvsvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { PIPE_WKSSVC , &ndr_table_wkssvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { PIPE_WINREG , &ndr_table_winreg.syntax_id, PIPE_WINREG , &ndr_transfer_syntax }, + { PIPE_SPOOLSS , &syntax_spoolss , PIPE_SPOOLSS , &ndr_transfer_syntax }, + { PIPE_NETDFS , &ndr_table_netdfs.syntax_id, PIPE_NETDFS , &ndr_transfer_syntax }, + { PIPE_ECHO , &ndr_table_rpcecho.syntax_id, PIPE_ECHO , &ndr_transfer_syntax }, + { PIPE_SHUTDOWN, &ndr_table_initshutdown.syntax_id, PIPE_SHUTDOWN , &ndr_transfer_syntax }, + { PIPE_SVCCTL , &ndr_table_svcctl.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, PIPE_EVENTLOG , &ndr_transfer_syntax }, + { PIPE_NTSVCS , &ndr_table_ntsvcs.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { NULL , NULL , NULL , NULL } }; /**************************************************************************** @@ -241,8 +78,8 @@ int cli_get_pipe_idx(const RPC_IFACE *syntax) { int i; for (i = 0; pipe_names[i].client_pipe; i++) { - if (GUID_equal(&pipe_names[i].abstr_syntax.uuid, &syntax->uuid) && - pipe_names[i].abstr_syntax.if_version == syntax->if_version) + if (GUID_equal(&pipe_names[i].abstr_syntax->uuid, &syntax->uuid) && + pipe_names[i].abstr_syntax->if_version == syntax->if_version) return i; } -- cgit From f56eedb95c64593ceff0ef91b99729c5071aa7ac Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Apr 2008 11:45:41 +0200 Subject: Remove the pipe_idx variable from rpc_pipe_client (This used to be commit 4840febcd481563c3d9b2fabc1fe1b2ae5a76cf6) --- source3/rpc_parse/parse_rpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 6b6e1424e0..893eb57808 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -252,7 +252,8 @@ static bool smb_io_rpc_hdr_bba(const char *desc, RPC_HDR_BBA *rpc, prs_struct * Note the transfer pointer must remain valid until this is marshalled. ********************************************************************/ -void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, RPC_IFACE *abstract, RPC_IFACE *transfer) +void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, + const RPC_IFACE *abstract, const RPC_IFACE *transfer) { rpc_ctx->context_id = context_id ; /* presentation context identifier (0x0) */ rpc_ctx->num_transfer_syntaxes = 1 ; /* the number of syntaxes (has always been 1?)(0x1) */ -- cgit From 166efed281599ba331c379e474120ce5b46271f0 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 20 Apr 2008 22:06:37 +0200 Subject: rpc_parse: fix "assignment discards qualifier" warning by using CONST_DISCARD. Michael (This used to be commit 0de001a5446545b928eb88e1916b4fe674017424) --- source3/rpc_parse/parse_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 893eb57808..d0be83bd4e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -262,7 +262,7 @@ void init_rpc_context(RPC_CONTEXT *rpc_ctx, uint16 context_id, rpc_ctx->abstract = *abstract; /* vers. of interface to use for replies */ - rpc_ctx->transfer = transfer; + rpc_ctx->transfer = CONST_DISCARD(RPC_IFACE *, transfer); } /******************************************************************* -- cgit From 44fbd895e83cb92b462782b73954b4294d46428b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 24 Apr 2008 22:45:28 +0200 Subject: Compile endpoint mapper pidl output (This used to be commit fe8f9e427af3eb42d63fde96c4fe20a255facb95) --- source3/rpc_parse/parse_rpc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index d0be83bd4e..81719512ae 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -59,6 +59,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SVCCTL , &ndr_table_svcctl.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, PIPE_EVENTLOG , &ndr_transfer_syntax }, { PIPE_NTSVCS , &ndr_table_ntsvcs.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, + { PIPE_EPMAPPER , &ndr_table_epmapper.syntax_id, PIPE_EPMAPPER , &ndr_transfer_syntax }, { NULL , NULL , NULL , NULL } }; -- cgit From 6b3bcb3724eed0ddff26dd7af638b606502081ad Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 23 May 2008 23:56:21 +0200 Subject: drsuapi: add all code required for our drsuapi rpc client. Guenther (This used to be commit 7c93190843e77764be4d0f6d4f0b93061c192c98) --- source3/rpc_parse/parse_rpc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 81719512ae..fbdc3ed483 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -60,6 +60,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, PIPE_EVENTLOG , &ndr_transfer_syntax }, { PIPE_NTSVCS , &ndr_table_ntsvcs.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, { PIPE_EPMAPPER , &ndr_table_epmapper.syntax_id, PIPE_EPMAPPER , &ndr_transfer_syntax }, + { PIPE_DRSUAPI , &ndr_table_drsuapi.syntax_id, PIPE_DRSUAPI , &ndr_transfer_syntax }, { NULL , NULL , NULL , NULL } }; -- cgit From 6fd4fedb3f81dbc256da57a0e943018d3a489d83 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jul 2008 19:53:01 +0200 Subject: Make use of ndr_syntax_id_equal (This used to be commit 3ab3f2610500107c9cff677746365bba143ca9de) --- source3/rpc_parse/parse_rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index fbdc3ed483..ac5483dfd1 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -80,9 +80,9 @@ int cli_get_pipe_idx(const RPC_IFACE *syntax) { int i; for (i = 0; pipe_names[i].client_pipe; i++) { - if (GUID_equal(&pipe_names[i].abstr_syntax->uuid, &syntax->uuid) && - pipe_names[i].abstr_syntax->if_version == syntax->if_version) + if (ndr_syntax_id_equal(pipe_names[i].abstr_syntax, syntax)) { return i; + } } return -1; -- cgit From bf6c11fea3e28532bd8ebc503e9d4d8dfb68e0e0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Jul 2008 20:40:27 +0200 Subject: Make the pipe_names[] array static to cli_pipe.c (This used to be commit ab7ab350591bf16717744a0c252d3a9d185bcb77) --- source3/rpc_parse/parse_rpc.c | 63 ------------------------------------------- 1 file changed, 63 deletions(-) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index ac5483dfd1..14a4effbf0 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -25,69 +25,6 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_PARSE -/******************************************************************* -interface/version dce/rpc pipe identification -********************************************************************/ - -const struct ndr_syntax_id syntax_spoolss = { - { - 0x12345678, 0x1234, 0xabcd, - { 0xef, 0x00 }, - { 0x01, 0x23, - 0x45, 0x67, 0x89, 0xab } - }, 0x01 -}; - -/* - * IMPORTANT!! If you update this structure, make sure to - * update the index #defines in smb.h. - */ - -const struct pipe_id_info pipe_names [] = -{ - { PIPE_LSARPC , &ndr_table_lsarpc.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_LSARPC , &ndr_table_dssetup.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_SAMR , &ndr_table_samr.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_NETLOGON, &ndr_table_netlogon.syntax_id, PIPE_LSASS , &ndr_transfer_syntax }, - { PIPE_SRVSVC , &ndr_table_srvsvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_WKSSVC , &ndr_table_wkssvc.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_WINREG , &ndr_table_winreg.syntax_id, PIPE_WINREG , &ndr_transfer_syntax }, - { PIPE_SPOOLSS , &syntax_spoolss , PIPE_SPOOLSS , &ndr_transfer_syntax }, - { PIPE_NETDFS , &ndr_table_netdfs.syntax_id, PIPE_NETDFS , &ndr_transfer_syntax }, - { PIPE_ECHO , &ndr_table_rpcecho.syntax_id, PIPE_ECHO , &ndr_transfer_syntax }, - { PIPE_SHUTDOWN, &ndr_table_initshutdown.syntax_id, PIPE_SHUTDOWN , &ndr_transfer_syntax }, - { PIPE_SVCCTL , &ndr_table_svcctl.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_EVENTLOG, &ndr_table_eventlog.syntax_id, PIPE_EVENTLOG , &ndr_transfer_syntax }, - { PIPE_NTSVCS , &ndr_table_ntsvcs.syntax_id, PIPE_NTSVCS , &ndr_transfer_syntax }, - { PIPE_EPMAPPER , &ndr_table_epmapper.syntax_id, PIPE_EPMAPPER , &ndr_transfer_syntax }, - { PIPE_DRSUAPI , &ndr_table_drsuapi.syntax_id, PIPE_DRSUAPI , &ndr_transfer_syntax }, - { NULL , NULL , NULL , NULL } -}; - -/**************************************************************************** - Return the pipe name from the index. - ****************************************************************************/ - -const char *cli_get_pipe_name(int pipe_idx) -{ - return &pipe_names[pipe_idx].client_pipe[5]; -} - -/**************************************************************************** - Return the pipe idx from the syntax. - ****************************************************************************/ -int cli_get_pipe_idx(const RPC_IFACE *syntax) -{ - int i; - for (i = 0; pipe_names[i].client_pipe; i++) { - if (ndr_syntax_id_equal(pipe_names[i].abstr_syntax, syntax)) { - return i; - } - } - - return -1; -} - /******************************************************************* Inits an RPC_HDR structure. ********************************************************************/ -- cgit From 1335da2a7cc639310e5d389e8e8dbe67c4e7ca25 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jul 2008 11:04:31 +0200 Subject: Refactoring: Change calling conventions for cli_rpc_pipe_open_noauth Pass in ndr_syntax_id instead of pipe_idx, return NTSTATUS (This used to be commit 9abc9dc4dc13bd3e42f98eff64eacf24b51f5779) --- source3/rpc_parse/parse_rpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source3/rpc_parse/parse_rpc.c') diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 14a4effbf0..1477a4c81e 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -639,3 +639,13 @@ bool smb_io_rpc_auth_schannel_chk(const char *desc, int auth_len, return True; } + +const struct ndr_syntax_id syntax_spoolss = { + { + 0x12345678, 0x1234, 0xabcd, + { 0xef, 0x00 }, + { 0x01, 0x23, + 0x45, 0x67, 0x89, 0xab } + }, 0x01 +}; + -- cgit