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;
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)));
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)))
{
}
}
}
+#endif
}
}
/****************************************************************************
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];
}
int outsize = 0;
int uid = SVAL(inbuf,smb_uid);
int vuid;
- int pwlen;
+ int pwlen=0;
*service = *user = *password = *dev = 0;
int uid = SVAL(inbuf,smb_uid);
int vuid;
int passlen = SVAL(inbuf,smb_vwv3);
+ BOOL doencrypt = SMBENCRYPT();
*service = *user = *password = *devicename = 0;
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,'\\');
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;
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;
}
/* 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);
}