summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2000-04-30 15:13:15 +0000
committerAndrew Tridgell <tridge@samba.org>2000-04-30 15:13:15 +0000
commit05cb3464f972d336dcb82ca332bf9b2617646070 (patch)
treea4c9a392804b36234f9b459b7c3c0c2d03de8fb2 /source3
parent29ba16f7925bddb96e2a51cc87e6e509608f8ce7 (diff)
downloadsamba-05cb3464f972d336dcb82ca332bf9b2617646070.tar.gz
samba-05cb3464f972d336dcb82ca332bf9b2617646070.tar.bz2
samba-05cb3464f972d336dcb82ca332bf9b2617646070.zip
- added some error checking
- removed the VTP hook in smbd (This used to be commit 09355fcd50e6c9c0c81e5f70ab9b7ff88aa897bf)
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util_file.c2
-rw-r--r--source3/libsmb/clirap.c130
-rw-r--r--source3/smbd/process.c8
3 files changed, 67 insertions, 73 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c
index c3b444ffa1..194fb7ae49 100644
--- a/source3/lib/util_file.c
+++ b/source3/lib/util_file.c
@@ -353,7 +353,7 @@ char *file_pload(char *syscmd, size_t *size)
memcpy(p+total, buf, n);
total += n;
}
- p[total] = 0;
+ if (p) p[total] = 0;
sys_pclose(fd);
diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c
index d918dcff55..5e7e9427f6 100644
--- a/source3/libsmb/clirap.c
+++ b/source3/libsmb/clirap.c
@@ -115,7 +115,7 @@ BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char *workstation)
&rparam, &rprcnt, /* return params, return size */
&rdata, &rdrcnt /* return data, return size */
)) {
- cli->rap_error = SVAL(rparam,0);
+ cli->rap_error = rparam? SVAL(rparam,0) : -1;
p = rdata;
if (cli->rap_error == 0) {
@@ -139,65 +139,66 @@ call a NetShareEnum - try and browse available connections on a host
****************************************************************************/
int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *, uint32, const char *))
{
- char *rparam = NULL;
- char *rdata = NULL;
- char *p;
- int rdrcnt,rprcnt;
- pstring param;
- int count = -1;
-
- /* now send a SMBtrans command with api RNetShareEnum */
- p = param;
- SSVAL(p,0,0); /* api number */
- p += 2;
- pstrcpy(p,"WrLeh");
- p = skip_string(p,1);
- pstrcpy(p,"B13BWz");
- p = skip_string(p,1);
- SSVAL(p,0,1);
- /*
- * Win2k needs a *smaller* buffer than 0xFFFF here -
- * it returns "out of server memory" with 0xFFFF !!! JRA.
- */
- SSVAL(p,2,0xFFE0);
- p += 4;
-
- if (cli_api(cli,
- param, PTR_DIFF(p,param), 1024, /* Param, length, maxlen */
- NULL, 0, 0xFFE0, /* data, length, maxlen - Win2k needs a small buffer here too ! */
- &rparam, &rprcnt, /* return params, length */
- &rdata, &rdrcnt)) /* return data, length */
- {
- int res = SVAL(rparam,0);
- int converter=SVAL(rparam,2);
- int i;
-
- if (res == 0 || res == ERRmoredata) {
- count=SVAL(rparam,4);
- p = rdata;
-
- for (i=0;i<count;i++,p+=20) {
- char *sname = p;
- int type = SVAL(p,14);
- int comment_offset = IVAL(p,16) & 0xFFFF;
- char *cmnt = comment_offset?(rdata+comment_offset-converter):"";
- dos_to_unix(sname,True);
- dos_to_unix(cmnt,True);
- fn(sname, type, cmnt);
- }
- } else {
- DEBUG(4,("NetShareEnum res=%d\n", res));
- }
- } else {
- DEBUG(4,("NetShareEnum failed\n"));
- }
-
- if (rparam)
- free(rparam);
- if (rdata)
- free(rdata);
+ char *rparam = NULL;
+ char *rdata = NULL;
+ char *p;
+ int rdrcnt,rprcnt;
+ pstring param;
+ int count = -1;
- return count;
+ /* now send a SMBtrans command with api RNetShareEnum */
+ p = param;
+ SSVAL(p,0,0); /* api number */
+ p += 2;
+ pstrcpy(p,"WrLeh");
+ p = skip_string(p,1);
+ pstrcpy(p,"B13BWz");
+ p = skip_string(p,1);
+ SSVAL(p,0,1);
+ /*
+ * Win2k needs a *smaller* buffer than 0xFFFF here -
+ * it returns "out of server memory" with 0xFFFF !!! JRA.
+ */
+ SSVAL(p,2,0xFFE0);
+ p += 4;
+
+ if (cli_api(cli,
+ param, PTR_DIFF(p,param), 1024, /* Param, length, maxlen */
+ NULL, 0, 0xFFE0, /* data, length, maxlen - Win2k needs a small buffer here too ! */
+ &rparam, &rprcnt, /* return params, length */
+ &rdata, &rdrcnt)) /* return data, length */
+ {
+ int res = rparam? SVAL(rparam,0) : -1;
+
+ if (res == 0 || res == ERRmoredata) {
+ int converter=SVAL(rparam,2);
+ int i;
+
+ count=SVAL(rparam,4);
+ p = rdata;
+
+ for (i=0;i<count;i++,p+=20) {
+ char *sname = p;
+ int type = SVAL(p,14);
+ int comment_offset = IVAL(p,16) & 0xFFFF;
+ char *cmnt = comment_offset?(rdata+comment_offset-converter):"";
+ dos_to_unix(sname,True);
+ dos_to_unix(cmnt,True);
+ fn(sname, type, cmnt);
+ }
+ } else {
+ DEBUG(4,("NetShareEnum res=%d\n", res));
+ }
+ } else {
+ DEBUG(4,("NetShareEnum failed\n"));
+ }
+
+ if (rparam)
+ free(rparam);
+ if (rdata)
+ free(rdata);
+
+ return count;
}
@@ -244,11 +245,12 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
&rparam, &rprcnt, /* return params, return size */
&rdata, &rdrcnt /* return data, return size */
)) {
- int res = SVAL(rparam,0);
- int converter=SVAL(rparam,2);
- int i;
+ int res = rparam? SVAL(rparam,0) : -1;
if (res == 0 || res == ERRmoredata) {
+ int i;
+ int converter=SVAL(rparam,2);
+
count=SVAL(rparam,4);
p = rdata;
@@ -268,9 +270,9 @@ BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32 stype,
}
if (rparam)
- free(rparam);
+ free(rparam);
if (rdata)
- free(rdata);
+ free(rdata);
return(count > 0);
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index f378550282..b81e831133 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -631,14 +631,6 @@ void process_smb(char *inbuf, char *outbuf)
}
#endif /* WITH_SSL */
-#ifdef WITH_VTP
- if(trans_num == 1 && VT_Check(inbuf))
- {
- VT_Process();
- return;
- }
-#endif
-
if (msg_type == 0)
show_msg(inbuf);
else if(msg_type == 0x85)