diff options
author | Luke Leighton <lkcl@samba.org> | 1997-10-15 16:51:03 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1997-10-15 16:51:03 +0000 |
commit | df4afea583a8b53aca46e15dcc75bba1af731f9f (patch) | |
tree | b87924a58fae9b8263d861caaf2032a750bdf77b /source3 | |
parent | 1860d62d0d6be42c7770e010ea2066db312c874b (diff) | |
download | samba-df4afea583a8b53aca46e15dcc75bba1af731f9f.tar.gz samba-df4afea583a8b53aca46e15dcc75bba1af731f9f.tar.bz2 samba-df4afea583a8b53aca46e15dcc75bba1af731f9f.zip |
added srvsvc basic pipe, straight from paul's code. does NETSHAREENUM
and NETSERVERGETINFO.
(This used to be commit 96b17b829fc787c15cd366eca604c09d68b5b900)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/include/smb.h | 3 | ||||
-rw-r--r-- | source3/smbd/ipc.c | 2 | ||||
-rw-r--r-- | source3/smbd/pipes.c | 82 |
4 files changed, 91 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 1ed8539ab5..6baa945e8b 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -654,6 +654,10 @@ BOOL api_LsarpcTNP(int cnum,int uid, char *param,char *data, int mdrcnt,int mprcnt, char **rdata,char **rparam, int *rdata_len,int *rparam_len); +BOOL api_srvsvcTNP(int cnum,int uid, char *param,char *data, + int mdrcnt,int mprcnt, + char **rdata,char **rparam, + int *rdata_len,int *rparam_len); /*The following definitions come from pipeutil.c */ diff --git a/source3/include/smb.h b/source3/include/smb.h index 8e34b06359..c733f29521 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -293,6 +293,9 @@ typedef fstring string; #define LSA_LOOKUPNAMES 0xFD #define LSA_SAMLOGOFF 0xFC +/* srvsvc pipe */ +#define NETSERVERGETINFO 0x15 +#define NETSHAREENUM 0x0f /* 32 bit time (sec) since 01jan1970 - cifs6.txt, section 3.5, page 30 */ typedef struct time_info diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 468d34e157..c29e8656b1 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -2764,8 +2764,10 @@ struct { #ifdef NTDOMAIN { "SetNmdPpHndState", "lsarpc", 1, api_LsarpcSNPHS }, + { "SetNmdPpHndState", "srvsvc", 1, api_LsarpcSNPHS }, { "SetNmdPpHndState", "NETLOGON", 1, api_LsarpcSNPHS }, { "TransactNmPipe", "lsarpc", 0x26, api_ntLsarpcTNP }, + { "TransactNmPipe", "srvsvc", 0x26, api_srvsvcTNP }, { "TransactNmPipe", "NETLOGON", 0x26, api_netlogrpcTNP }, #else { "SetNmdPpHndState", "lsarpc", 1, api_LsarpcSNPHS }, diff --git a/source3/smbd/pipes.c b/source3/smbd/pipes.c index 91ca69c022..bf53fa84bc 100644 --- a/source3/smbd/pipes.c +++ b/source3/smbd/pipes.c @@ -55,6 +55,7 @@ char * known_pipes [] = "lsarpc", #if NTDOMAIN "NETLOGON", + "srvsvc", #endif NULL }; @@ -362,3 +363,84 @@ BOOL api_LsarpcTNP(int cnum,int uid, char *param,char *data, } return(True); } + +BOOL api_srvsvcTNP(int cnum,int uid, char *param,char *data, + int mdrcnt,int mprcnt, + char **rdata,char **rparam, + int *rdata_len,int *rparam_len) +{ + uint16 opnum; + char *q; + int pkttype; + extern pstring myname; + char *servername; + uint32 level; + + opnum = SVAL(data,22); + + pkttype = CVAL(data, 2); + if (pkttype == 0x0b) /* RPC BIND */ + { + DEBUG(4,("srvsvc rpc bind %x\n",pkttype)); + LsarpcTNP1(data,rdata,rdata_len); + return True; + } + + DEBUG(4,("srvsvc TransactNamedPipe op %x\n",opnum)); + initrpcreply(data, *rdata); + DEBUG(4,("srvsvc LINE %d\n",__LINE__)); + get_myname(myname,NULL); + switch (opnum) + { + case NETSHAREENUM: + q = data + 0x18; + servername = q + 16; + q = skip_unicode_string(servername,1); + if (strlen(unistr(servername)) % 2 == 0) + q += 2; + level = IVAL(q, 0); q += 4; + /* ignore the rest for the moment */ + q = *rdata + 0x18; + SIVAL(q, 0, level); q += 4; + SIVAL(q, 0, 1); q += 4; /* switch value */ + SIVAL(q, 0, 2); q += 4; + SIVAL(q, 0, 2); q += 4; /* number of entries */ + SIVAL(q, 0, 2); q += 4; + endrpcreply(data, *rdata, q-*rdata, 0, rdata_len); + break; + case NETSERVERGETINFO: + { + UNISTR2 uni_str; + q = data + 0x18; + servername = q + 16; + q = skip_unicode_string(servername,1); + if (strlen(unistr(servername)) % 2 == 0) + q += 2; + level = IVAL(q, 0); q += 4; + /* ignore the rest for the moment */ + q = *rdata + 0x18; + SIVAL(q, 0, 101); q += 4; /* switch value */ + SIVAL(q, 0, 2); q += 4; /* bufptr */ + SIVAL(q, 0, 0x1f4); q += 4; /* platform id */ + SIVAL(q, 0, 2); q += 4; /* bufptr for name */ + SIVAL(q, 0, 5); q += 4; /* major version */ + SIVAL(q, 0, 4); q += 4; /* minor version == 5.4 */ + SIVAL(q, 0, 0x4100B); q += 4; /* type */ + SIVAL(q, 0, 2); q += 4; /* comment */ + make_unistr2(&uni_str, myname, strlen(myname)); + q = smb_io_unistr2(False, &uni_str, q, *rdata, 4, 0); + + make_unistr2(&uni_str, lp_serverstring(), strlen(lp_serverstring())); + q = smb_io_unistr2(False, &uni_str, q, *rdata, 4, 0); + + q = align_offset(q, *rdata, 4); + + endrpcreply(data, *rdata, q-*rdata, 0, rdata_len); + break; + } + default: + DEBUG(4, ("srvsvc, unknown code: %lx\n", opnum)); + } + return(True); +} + |