summaryrefslogtreecommitdiffstats
path: root/source/libsmb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1999-01-11 22:24:27 +0000
committerJeremy Allison <jra@samba.org>1999-01-11 22:24:27 +0000
commit8cf6a8903faa85df60a681327d3ba8a64b5e4cd8 (patch)
treeb70212ff4ca2a31267c0669238bdc230a0b19c44 /source/libsmb
parentc9924c1bb3388de469e15afb8fad2a01c39dc256 (diff)
downloadsamba-8cf6a8903faa85df60a681327d3ba8a64b5e4cd8.tar.gz
samba-8cf6a8903faa85df60a681327d3ba8a64b5e4cd8.tar.xz
samba-8cf6a8903faa85df60a681327d3ba8a64b5e4cd8.zip
libsmb/nmblib.c: Fixed bug where odd byte count could cause nmbd to
do too many iterations. nmbd/nmbd.c: Fixed SIGHUP handling to act the same as smbd. smbd/reply.c: Added code to map 64-bit lock ranges where possible on 32-bit systems. smbd/server.c: Fixed comment. Jeremy.
Diffstat (limited to 'source/libsmb')
-rw-r--r--source/libsmb/nmblib.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/source/libsmb/nmblib.c b/source/libsmb/nmblib.c
index 06ef935e167..fdbb50fab1f 100644
--- a/source/libsmb/nmblib.c
+++ b/source/libsmb/nmblib.c
@@ -180,26 +180,32 @@ static int parse_nmb_name(char *inbuf,int offset,int length, struct nmb_name *na
int ret = 0;
BOOL got_pointer=False;
- if (length - offset < 2) return(0);
+ if (length - offset < 2)
+ return(0);
/* handle initial name pointers */
- if (!handle_name_ptrs(ubuf,&offset,length,&got_pointer,&ret)) return(0);
+ if (!handle_name_ptrs(ubuf,&offset,length,&got_pointer,&ret))
+ return(0);
m = ubuf[offset];
- if (!m) return(0);
- if ((m & 0xC0) || offset+m+2 > length) return(0);
+ if (!m)
+ return(0);
+ if ((m & 0xC0) || offset+m+2 > length)
+ return(0);
memset((char *)name,'\0',sizeof(*name));
/* the "compressed" part */
- if (!got_pointer) ret += m + 2;
+ if (!got_pointer)
+ ret += m + 2;
offset++;
- while (m) {
+ while (m > 0) {
unsigned char c1,c2;
c1 = ubuf[offset++]-'A';
c2 = ubuf[offset++]-'A';
- if ((c1 & 0xF0) || (c2 & 0xF0) || (n > sizeof(name->name)-1)) return(0);
+ if ((c1 & 0xF0) || (c2 & 0xF0) || (n > sizeof(name->name)-1))
+ return(0);
name->name[n++] = (c1<<4) | c2;
m -= 2;
}
@@ -213,21 +219,27 @@ static int parse_nmb_name(char *inbuf,int offset,int length, struct nmb_name *na
/* remove trailing spaces */
name->name[15] = 0;
n = 14;
- while (n && name->name[n]==' ') name->name[n--] = 0;
+ while (n && name->name[n]==' ')
+ name->name[n--] = 0;
}
/* now the domain parts (if any) */
n = 0;
while (ubuf[offset]) {
/* we can have pointers within the domain part as well */
- if (!handle_name_ptrs(ubuf,&offset,length,&got_pointer,&ret)) return(0);
+ if (!handle_name_ptrs(ubuf,&offset,length,&got_pointer,&ret))
+ return(0);
m = ubuf[offset];
- if (!got_pointer) ret += m+1;
- if (n) name->scope[n++] = '.';
- if (m+2+offset>length || n+m+1>sizeof(name->scope)) return(0);
+ if (!got_pointer)
+ ret += m+1;
+ if (n)
+ name->scope[n++] = '.';
+ if (m+2+offset>length || n+m+1>sizeof(name->scope))
+ return(0);
offset++;
- while (m--) name->scope[n++] = (char)ubuf[offset++];
+ while (m--)
+ name->scope[n++] = (char)ubuf[offset++];
}
name->scope[n++] = 0;