applying login updates from jim@oxfordcc.co.uk, sent in by
authorSamba Release Account <samba-bugs@samba.org>
Fri, 9 Aug 1996 18:05:34 +0000 (18:05 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Fri, 9 Aug 1996 18:05:34 +0000 (18:05 +0000)
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

source/lib/interface.c
source/nameelect.c
source/namelogon.c
source/nmbd/nmbd.c
source/smbd/ipc.c
source/smbd/server.c

index 3a532140b396fd1ae062d62897448bcb509d3a31..061ac08c7b41769cfab773734cbf05595cae5741 100644 (file)
@@ -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)));
index 8c93de03a8510eeb68f3440769fdfad63738b95b..38b4d5d80e741e5541fec73e5b496bf7b8a51ab9 100644 (file)
@@ -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;
index 8a7fe87965c98cac328363ac18b1146fe115e378..24bb984247462dd49024460ef4407111f0010e79 100644 (file)
@@ -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;
   
index e2a4bdeb67ff62e8fd45eb930fc3d30a44794f81..5c3be920f5f72ea3ef6ef9556496f47c15032827 100644 (file)
@@ -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);
       }
        }
index 415c939bf38c2b72a4e1fa3e0fda6c516ab29f40..f4f1807922560fff9490b080bd984ac54e173774 100644 (file)
@@ -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));
index e582ea735ab0b5b80a332858bd73ed4244c4e1fd..d15ca9336ec54882f4c356dab582069c830f255c 100644 (file)
@@ -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");
            }
          }