2 Unix SMB/Netbios implementation.
4 Pipe SMB reply routines - srvsvc pipe
5 Copyright (C) Andrew Tridgell 1992-1997,
6 Copyright (C) Luke Kenneth Casson Leighton 1996-1997.
7 Copyright (C) Paul Ashton 1997.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 extern int DEBUGLEVEL;
32 BOOL api_srvsvcTNP(int cnum,int uid, char *param,char *data,
33 int mdrcnt,int mprcnt,
34 char **rdata,char **rparam,
35 int *rdata_len,int *rparam_len)
40 extern pstring myname;
44 opnum = SVAL(data,22);
46 pkttype = CVAL(data, 2);
47 if (pkttype == 0x0b) /* RPC BIND */
49 DEBUG(4,("srvsvc rpc bind %x\n",pkttype));
50 LsarpcTNP1(data,rdata,rdata_len);
54 DEBUG(4,("srvsvc TransactNamedPipe op %x\n",opnum));
55 initrpcreply(data, *rdata);
56 DEBUG(4,("srvsvc LINE %d\n",__LINE__));
57 get_myname(myname,NULL);
64 q = skip_unicode_string(servername,1);
65 if (strlen(unistr(servername)) % 2 == 0)
67 level = IVAL(q, 0); q += 4;
68 /* ignore the rest for the moment */
70 SIVAL(q, 0, level); q += 4;
71 SIVAL(q, 0, 1); q += 4; /* switch value */
72 SIVAL(q, 0, 2); q += 4;
73 SIVAL(q, 0, 2); q += 4; /* number of entries */
74 SIVAL(q, 0, 2); q += 4;
75 endrpcreply(data, *rdata, q-*rdata, 0, rdata_len);
78 case NETSERVERGETINFO:
83 q = skip_unicode_string(servername,1);
84 if (strlen(unistr(servername)) % 2 == 0)
86 level = IVAL(q, 0); q += 4;
87 /* ignore the rest for the moment */
89 SIVAL(q, 0, 101); q += 4; /* switch value */
90 SIVAL(q, 0, 2); q += 4; /* bufptr */
91 SIVAL(q, 0, 0x1f4); q += 4; /* platform id */
92 SIVAL(q, 0, 2); q += 4; /* bufptr for name */
93 SIVAL(q, 0, 5); q += 4; /* major version */
94 SIVAL(q, 0, 4); q += 4; /* minor version == 5.4 */
95 SIVAL(q, 0, 0x4100B); q += 4; /* type */
96 SIVAL(q, 0, 2); q += 4; /* comment */
97 make_unistr2(&uni_str, myname, strlen(myname));
98 q = smb_io_unistr2(False, &uni_str, q, *rdata, 4, 0);
100 make_unistr2(&uni_str, lp_serverstring(), strlen(lp_serverstring()));
101 q = smb_io_unistr2(False, &uni_str, q, *rdata, 4, 0);
103 q = align_offset(q, *rdata, 4);
105 endrpcreply(data, *rdata, q-*rdata, 0, rdata_len);
109 DEBUG(4, ("srvsvc, unknown code: %lx\n", opnum));