summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-10-28 06:07:07 +0000
committerAndrew Tridgell <tridge@samba.org>1997-10-28 06:07:07 +0000
commit7c20ee083f6820a4c8776cefae3e0477f79ea934 (patch)
treead7446e08bc2afe458184f62c8c48d706e6c4def /source3
parentaee261e784915df4283e3bffaadac54ee36ec49e (diff)
downloadsamba-7c20ee083f6820a4c8776cefae3e0477f79ea934.tar.gz
samba-7c20ee083f6820a4c8776cefae3e0477f79ea934.tar.bz2
samba-7c20ee083f6820a4c8776cefae3e0477f79ea934.zip
refuse pathworks type R connect (patch from Stephen Tweedie)
(This used to be commit c63fee2b282c8b53f87e63995384602b66a805a6)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/reply.c63
1 files changed, 39 insertions, 24 deletions
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 9e261a1bd5..9484f3b85f 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -74,42 +74,57 @@ int reply_special(char *inbuf,char *outbuf)
extern fstring remote_machine;
extern fstring local_machine;
char *p;
+ int len;
+ char name_type = 0;
*name1 = *name2 = 0;
smb_setlen(outbuf,0);
switch (msg_type) {
- case 0x81: /* session request */
- CVAL(outbuf,0) = 0x82;
- CVAL(outbuf,3) = 0;
- if (name_len(inbuf+4) > 50 || name_len(inbuf+4 + name_len(inbuf + 4)) > 50) {
- DEBUG(0,("Invalid name length in session request\n"));
- return(0);
- }
- name_extract(inbuf,4,name1);
- name_extract(inbuf,4 + name_len(inbuf + 4),name2);
+ case 0x81: /* session request */
+ CVAL(outbuf,0) = 0x82;
+ CVAL(outbuf,3) = 0;
+ if (name_len(inbuf+4) > 50 ||
+ name_len(inbuf+4 + name_len(inbuf + 4)) > 50) {
+ DEBUG(0,("Invalid name length in session request\n"));
+ return(0);
+ }
+ name_extract(inbuf,4,name1);
+ name_extract(inbuf,4 + name_len(inbuf + 4),name2);
DEBUG(2,("netbios connect: name1=%s name2=%s\n",
name1,name2));
- fstrcpy(remote_machine,name2);
- trim_string(remote_machine," "," ");
- p = strchr(remote_machine,' ');
- strlower(remote_machine);
- if (p) *p = 0;
-
- fstrcpy(local_machine,name1);
- trim_string(local_machine," "," ");
- p = strchr(local_machine,' ');
- strlower(local_machine);
- if (p) *p = 0;
+ fstrcpy(remote_machine,name2);
+ trim_string(remote_machine," "," ");
+ p = strchr(remote_machine,' ');
+ strlower(remote_machine);
+ if (p) *p = 0;
+
+ fstrcpy(local_machine,name1);
+ trim_string(local_machine," "," ");
+ len = strlen(local_machine);
+ if (len == 16) {
+ name_type = local_machine[15];
+ local_machine[15] = 0;
+ }
+ p = strchr(local_machine,' ');
+ strlower(local_machine);
+ if (p) *p = 0;
+
+ if (name_type == 'R') {
+ /* We are being asked for a pathworks session ---
+ no thanks! */
+ CVAL(outbuf, 0) = 0x83;
+ break;
+ }
- add_session_user(remote_machine);
+ add_session_user(remote_machine);
- reload_services(True);
- reopen_logs();
+ reload_services(True);
+ reopen_logs();
- break;
+ break;
case 0x89: /* session keepalive request
(some old clients produce this?) */