summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1996-10-05 13:13:31 +0000
committerAndrew Tridgell <tridge@samba.org>1996-10-05 13:13:31 +0000
commitf3c79936d7fc21d3257432962b23764ca00b0cbb (patch)
tree8f942150cf4c7b549ea5e7aa3175ee6e1f61df98
parentf6153293603e8413933e8d539df4f2c0b18a6a4c (diff)
downloadsamba-f3c79936d7fc21d3257432962b23764ca00b0cbb.tar.gz
samba-f3c79936d7fc21d3257432962b23764ca00b0cbb.tar.bz2
samba-f3c79936d7fc21d3257432962b23764ca00b0cbb.zip
- replace the base36 function with one that works on more systems
(compiler bugs were the problem) - minor password cleanups (catch WfWG bug where it sets the password to a space instead of a NULL) - fix printing problem for kanji users - minor cleanups (This used to be commit 92566ecc315c29da6e9aaa67ddae33e64f5bcc67)
-rw-r--r--source3/lib/access.c2
-rw-r--r--source3/namedbname.c4
-rw-r--r--source3/namework.c6
-rw-r--r--source3/smbd/mangle.c9
-rw-r--r--source3/smbd/reply.c32
-rw-r--r--source3/smbd/server.c2
6 files changed, 35 insertions, 20 deletions
diff --git a/source3/lib/access.c b/source3/lib/access.c
index 3b3f236c91..31a48d09d3 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -239,7 +239,7 @@ static int string_match(char *tok,char *s)
if (netgroup_ok) return(YES);
#else
- DEBUG(0,("access: netgroup support is not configured"));
+ DEBUG(0,("access: netgroup support is not configured\n"));
return (NO);
#endif
} else if (strcasecmp(tok, "ALL") == 0) { /* all: match any */
diff --git a/source3/namedbname.c b/source3/namedbname.c
index 833a870c6c..6cd89df523 100644
--- a/source3/namedbname.c
+++ b/source3/namedbname.c
@@ -513,12 +513,12 @@ void expire_names(time_t t)
reply to a name query
****************************************************************************/
struct name_record *search_for_name(struct subnet_record **d,
- struct nmb_name *question,
+ struct nmb_name *question,
struct in_addr ip, int Time, int search)
{
int name_type = question->name_type;
char *qname = question->name;
- BOOL dns_type = name_type == 0x20 || name_type == 0;
+ BOOL dns_type = (name_type == 0x20 || name_type == 0);
struct name_record *n;
diff --git a/source3/namework.c b/source3/namework.c
index 0380c1460a..80183dac84 100644
--- a/source3/namework.c
+++ b/source3/namework.c
@@ -333,7 +333,7 @@ static void process_rcv_backup_list(struct packet_struct *p,char *buf)
for (buf1 = buf+5; *buf1 && count; buf1 = skip_string(buf1, 1), --count)
{
struct in_addr back_ip;
- struct subnet_record *d;
+ /* struct subnet_record *d; */
DEBUG(4,("Searching for backup browser %s at %s...\n",
buf1, inet_ntoa(ip)));
@@ -352,8 +352,9 @@ static void process_rcv_backup_list(struct packet_struct *p,char *buf)
DEBUG(4,("Found browser server at %s\n", inet_ntoa(back_ip)));
DEBUG(4,("END THIS LOOP: CODE NEEDS UPDATING\n"));
+#if 0
/* XXXX function needs work */
- continue;
+ continue;
if ((d = find_subnet(back_ip)))
{
@@ -374,6 +375,7 @@ static void process_rcv_backup_list(struct packet_struct *p,char *buf)
}
}
}
+#endif
}
}
diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c
index 177a34c975..6d98d9e39c 100644
--- a/source3/smbd/mangle.c
+++ b/source3/smbd/mangle.c
@@ -383,13 +383,10 @@ BOOL is_mangled(char *s)
/****************************************************************************
return a base 36 character. v must be from 0 to 35.
****************************************************************************/
-static char base36(int v)
+static char base36(unsigned int v)
{
- v = v % 36;
- if (v < 10)
- return('0'+v);
- else /* needed to work around a DEC C compiler bug */
- return('A' + (v-10));
+ static char basechars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ return basechars[v % 36];
}
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 7b8f4a502f..89b07f1b9e 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -181,7 +181,7 @@ int reply_tcon(char *inbuf,char *outbuf)
int outsize = 0;
int uid = SVAL(inbuf,smb_uid);
int vuid;
- int pwlen;
+ int pwlen=0;
*service = *user = *password = *dev = 0;
@@ -218,6 +218,7 @@ int reply_tcon_and_X(char *inbuf,char *outbuf,int length,int bufsize)
int uid = SVAL(inbuf,smb_uid);
int vuid;
int passlen = SVAL(inbuf,smb_vwv3);
+ BOOL doencrypt = SMBENCRYPT();
*service = *user = *password = *devicename = 0;
@@ -231,8 +232,15 @@ int reply_tcon_and_X(char *inbuf,char *outbuf,int length,int bufsize)
char *path;
char *p;
memcpy(password,smb_buf(inbuf),passlen);
- password[passlen]=0;
+ password[passlen]=0;
path = smb_buf(inbuf) + passlen;
+
+ if (!doencrypt || passlen != 24) {
+ if (strequal(password," "))
+ *password = 0;
+ passlen = strlen(password);
+ }
+
DEBUG(4,("parsing net-path %s, passlen=%d\n",path,passlen));
strcpy(service,path+2);
p = strchr(service,'\\');
@@ -315,7 +323,7 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
int smb_mpxmax;
int smb_vc_num;
uint32 smb_sesskey;
- int smb_apasslen;
+ int smb_apasslen = 0;
pstring smb_apasswd;
int smb_ntpasslen = 0;
pstring smb_ntpasswd;
@@ -343,6 +351,9 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
BOOL doencrypt = SMBENCRYPT();
char *p = smb_buf(inbuf);
+ if (passlen1 != 24 && passlen2 != 24)
+ doencrypt = False;
+
if(doencrypt) {
/* Save the lanman2 password and the NT md4 password. */
smb_apasslen = passlen1;
@@ -366,17 +377,22 @@ int reply_sesssetup_and_X(char *inbuf,char *outbuf,int length,int bufsize)
}
/* we use the first password that they gave */
smb_apasslen = passlen1;
- StrnCpy(smb_apasswd,p,smb_apasslen);
+ StrnCpy(smb_apasswd,p,smb_apasslen);
+
+ /* trim the password */
+ smb_apasslen = strlen(smb_apasswd);
+
+ /* wfwg sometimes uses a space instead of a null */
+ if (strequal(smb_apasswd," ")) {
+ smb_apasslen = 0;
+ *smb_apasswd = 0;
+ }
}
p += passlen1 + passlen2;
strcpy(user,p); p = skip_string(p,1);
DEBUG(3,("Domain=[%s] NativeOS=[%s] NativeLanMan=[%s]\n",
p,skip_string(p,1),skip_string(p,2)));
-
- /* now work around the Win95 bug */
- if(!doencrypt && smb_apasslen==24)
- smb_apasslen = strlen(smb_apasswd);
}
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index e0e9838a74..5db62426ca 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -841,7 +841,7 @@ void open_file(int fnum,int cnum,char *fname1,int flags,int mode)
Files[fnum].print_file = Connections[cnum].printer;
Files[fnum].modified = False;
Files[fnum].cnum = cnum;
- string_set(&Files[fnum].name,fname);
+ string_set(&Files[fnum].name,dos_to_unix(fname,False));
Files[fnum].wbmpx_ptr = NULL;
/*