Fix from Frank Varnavas <varnavas@ny.ubs.com>.
authorJeremy Allison <jra@samba.org>
Thu, 4 Sep 1997 21:23:27 +0000 (21:23 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 4 Sep 1997 21:23:27 +0000 (21:23 +0000)
We cannot use the same name as the client to
the NT password server, as NT will drop client
connections if the same client name connects
twice. Instead, synthesize a name from our pid.
and the remote machine name.
Jeremy (jallison@whistle.com)

source/smbd/password.c

index 2740304cc4faaffbcfd9ccb45f9d0d39a995e5da..ed79d658a66d6cebe2befeb62b9190f4ec8d0b70 100644 (file)
@@ -1576,11 +1576,25 @@ BOOL server_cryptkey(char *buf)
   p = outbuf+len;
   name_mangle(desthost,p,' ');
   len += name_len(p);
+  p = outbuf+len;
 
   /* and my name */
-  p = outbuf+len;
-  name_mangle(remote_machine,p,' ');
-  len += name_len(p);
+  /* Fix from Frank Varnavas <varnavas@ny.ubs.com>.
+     We cannot use the same name as the client to 
+     the NT password server, as NT will drop client
+     connections if the same client name connects
+     twice. Instead, synthesize a name from our pid.
+     and the remote machine name.
+   */
+  {
+    char buf[32]; /* create name as PIDname */
+    sprintf(buf,"%d", getpid());
+    strncpy(&buf[strlen(buf)], remote_machine, 31 - strlen(buf));
+    buf[31] = '\0';
+    DEBUG(1,("negprot w/password server as %s\n",buf));
+    name_mangle(buf,p,' ');
+    len += name_len(p);
+  }
 
   _smb_setlen(outbuf,len);
   CVAL(outbuf,0) = 0x81;