From 02b98a8965a60a7c3394835ff01074fc88ffbb89 Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Fri, 9 Aug 1996 18:05:34 +0000 Subject: applying login updates from jim@oxfordcc.co.uk, sent in by lewis2@server.uwindsor.ca. rest of this patch to follow. bug in interface.c - uninitialised pointer. nmbd has 0x20 as well as 0x0 NetBIOS name when lmhosts entry is added. lkcl (This used to be commit 2b9475cc5fda4b272f19c4f168d3f00363c8042b) --- source3/lib/interface.c | 1 + source3/nameelect.c | 2 +- source3/namelogon.c | 34 ++++++++++++++++++++++++++++++---- source3/nmbd/nmbd.c | 1 + source3/smbd/ipc.c | 22 ++++++++++++++-------- source3/smbd/server.c | 4 ++-- 6 files changed, 49 insertions(+), 15 deletions(-) diff --git a/source3/lib/interface.c b/source3/lib/interface.c index 3a532140b3..061ac08c7b 100644 --- a/source3/lib/interface.c +++ b/source3/lib/interface.c @@ -334,6 +334,7 @@ static void interpret_interfaces(char *s, struct interface **interfaces, DEBUG(2,("Warning: inconsistant interface %s\n",inet_ntoa(iface->ip))); } + iface->next = NULL; (*interfaces) = last_iface = iface; DEBUG(1,("Added interface ip=%s ",inet_ntoa(iface->ip))); diff --git a/source3/nameelect.c b/source3/nameelect.c index 8c93de03a8..38b4d5d80e 100644 --- a/source3/nameelect.c +++ b/source3/nameelect.c @@ -376,7 +376,7 @@ void become_master(struct subnet_record *d, struct work_record *work) if (lp_domain_logons()) { - update_type |= SV_TYPE_DOMAIN_CTRL; + update_type |= SV_TYPE_DOMAIN_CTRL|SV_TYPE_SERVER_UNIX; } work->ServerType |= update_type; diff --git a/source3/namelogon.c b/source3/namelogon.c index 8a7fe87965..24bb984247 100644 --- a/source3/namelogon.c +++ b/source3/namelogon.c @@ -38,6 +38,10 @@ extern pstring myname; /**************************************************************************** process a domain logon packet + + 08aug96 lkcl@pires.co.uk + reply_code == 0xC courtesy of jim@oxfordcc.co.uk forwarded by + lewis2@server.uwindsor.ca **************************************************************************/ void process_logon_packet(struct packet_struct *p,char *buf,int len) { @@ -87,11 +91,11 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len) reply_code = 7; reply_name = lp_domain_controller(); if (!*reply_name) { - DEBUG(3,("No domain controller configured\n")); - return; + reply_name = myname; + reply_code = 0xC; } - DEBUG(3,("GETDC request from %s(%s)\n", - machine,inet_ntoa(p->ip))); + DEBUG(3,("GETDC request from %s(%s), reporting %s 0x%2x\n", + machine,inet_ntoa(p->ip), reply_name, reply_code)); } break; default: @@ -110,6 +114,28 @@ void process_logon_packet(struct packet_struct *p,char *buf,int len) StrnCpy(q,reply_name,16); strupper(q); q = skip_string(q,1); + + if (reply_code == 0xC) + { + if ( PTR_DIFF (q,outbuf) & 1 ) + { + q++; + } + + StrnCpy(q,reply_name,16); + strupper(q); + q = skip_string(q,1); + + StrnCpy(q,lp_workgroup(),16); + strupper(q); + q = skip_string(q,1); + + SIVAL(q,0,1); + q += 4; + SSVAL(q,0,0xFFFF); + q += 2; + } + SSVAL(q,0,0xFFFF); q += 2; diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index e2a4bdeb67..5c3be920f5 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -296,6 +296,7 @@ static void load_hosts_file(char *fname) struct subnet_record *d = find_subnet(ipaddr); if (d) { + add_netbios_entry(d,name,0x00,NB_ACTIVE,0,source,ipaddr,True,True); add_netbios_entry(d,name,0x20,NB_ACTIVE,0,source,ipaddr,True,True); } } diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 415c939bf3..f4f1807922 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -59,6 +59,9 @@ extern fstring local_machine; #define SNLEN 15 /* service name length */ #define QNLEN 12 /* queue name maximum length */ +#define MAJOR_VERSION 2 +#define MINOR_VERSION 0 + extern int Client; static int CopyExpanded(int cnum, int snum, char** dst, char* src, int* n) @@ -1406,14 +1409,16 @@ static BOOL api_SetUserPassword(int cnum,int uid, char *param,char *data, *rdata_len = 0; - SSVAL(*rparam,0,NERR_Success); + SSVAL(*rparam,0,NERR_badpass); SSVAL(*rparam,2,0); /* converter word */ DEBUG(3,("Set password for <%s>\n",user)); - if (!password_ok(user,pass1,strlen(pass1),NULL,False) || - !chgpasswd(user,pass1,pass2)) - SSVAL(*rparam,0,NERR_badpass); + if (password_ok(user,pass1,strlen(pass1),NULL,False) && + chgpasswd(user,pass1,pass2)) + { + SSVAL(*rparam,0,NERR_Success); + } bzero(pass1,sizeof(fstring)); bzero(pass2,sizeof(fstring)); @@ -1740,9 +1745,10 @@ static BOOL api_RNetServerGetInfo(int cnum,int uid, char *param,char *data, } if (servers) free(servers); - SCVAL(p,0,2); /* version_major */ - SCVAL(p,1,0); /* version_minor */ + SCVAL(p,0,MAJOR_VERSION); + SCVAL(p,1,MINOR_VERSION); SIVAL(p,2,servertype); + if (mdrcnt == struct_len) { SIVAL(p,6,0); } else { @@ -1817,8 +1823,8 @@ static BOOL api_NetWkstaGetInfo(int cnum,int uid, char *param,char *data, p2 = skip_string(p2,1); p += 4; - SCVAL(p,0,2); /* major version?? */ - SCVAL(p,1,1); /* minor version?? */ + SCVAL(p,0,MAJOR_VERSION); + SCVAL(p,1,MINOR_VERSION); p += 2; SIVAL(p,0,PTR_DIFF(p2,*rdata)); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index e582ea735a..d15ca9336e 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -3454,11 +3454,11 @@ static void process(void) */ static int error_count=0; static time_t error_time=0; - if (error_count==0) { + if (error_count++==0) { error_time = t; } else if (error_time != t) { error_count = 0; - } else if (error_count++ > 2) { + } else if (error_count > 2) { exit_server("looping in process()\n"); } } -- cgit