try to use *SMBSERVER to connect to password server if the first
[samba.git] / source3 / smbd / password.c
index 0c8eb124ff5d6b854b5f92494c82f10c5db11042..8b73ff4518d8e6c4a8e0bf479c817b8a2189b333 100644 (file)
@@ -813,7 +813,7 @@ static BOOL check_user_equiv(char *user, char *remote, char *equiv_file)
   int plus_allowed = 1;
   char *file_host;
   char *file_user;
-  FILE *fp = fopen(equiv_file, "r");
+  FILE *fp = sys_fopen(equiv_file, "r");
   DEBUG(5, ("check_user_equiv %s %s %s\n", user, remote, equiv_file));
   if (! fp) return False;
   while(fgets(buf, sizeof(buf), fp)) 
@@ -1002,11 +1002,17 @@ struct cli_state *server_cryptkey(void)
        make_nmb_name(&calling, local_machine, 0x0 , scope);
        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);
-               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"));