smbd/password.c: Added *SMBSERVER fix is name is too long.
[samba.git] / source / smbd / password.c
index 9011b9b95e1e3f02cad07578c5836c719d9d9e8c..683303ff8742996d3398a994a3d242f9879e6239 100644 (file)
@@ -1000,7 +1000,15 @@ struct cli_state *server_cryptkey(void)
        }
 
        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))
        {