try to use *SMBSERVER to connect to password server if the first
authorAndrew Tridgell <tridge@samba.org>
Sat, 21 Nov 1998 01:28:15 +0000 (01:28 +0000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 21 Nov 1998 01:28:15 +0000 (01:28 +0000)
session_request fails.

source/smbd/password.c

index 683303ff8742996d3398a994a3d242f9879e6239..8b73ff4518d8e6c4a8e0bf479c817b8a2189b333 100644 (file)
@@ -1000,21 +1000,19 @@ struct cli_state *server_cryptkey(void)
        }
 
        make_nmb_name(&calling, local_machine, 0x0 , scope);
        }
 
        make_nmb_name(&calling, local_machine, 0x0 , scope);
+       make_nmb_name(&called , desthost     , 0x20, scope);
 
 
-    if(strlen(desthost) > 15)
-       {
-               DEBUG(1,("server_cryptkey: %s is too long for a password server NetBIOS \
-name, using *SMBSERVER for the connection.\n", desthost ));
-               make_nmb_name(&called , "*SMBSERVER", 0x20, scope);
-       }
-       else
-               make_nmb_name(&called , desthost     , 0x20, scope);
-
-       if (!cli_session_request(cli, &calling, &called))
-       {
-               DEBUG(1,("%s rejected the session\n",desthost));
+       if (!cli_session_request(cli, &calling, &called)) {
+               /* try with *SMBSERVER if the first name fails */
                cli_shutdown(cli);
                cli_shutdown(cli);
-               return NULL;
+               make_nmb_name(&called , "*SMBSERVER", 0x20, scope);
+               if (!cli_initialise(cli) ||
+                   !cli_connect(cli, desthost, &dest_ip) ||
+                   !cli_session_request(cli, &calling, &called)) {
+                       DEBUG(1,("%s rejected the session\n",desthost));
+                       cli_shutdown(cli);
+                       return NULL;
+               }
        }
 
        DEBUG(3,("got session\n"));
        }
 
        DEBUG(3,("got session\n"));