In security=user mode we must allow cli_connect_serverlist to connect to our
[samba.git] / source3 / libsmb / clientgen.c
index 99d868e216a8b6fc45a7e42b5a54c29083c6cb42..e269011402d07cbc968a76f9061a28fa512cc256 100644 (file)
@@ -345,7 +345,7 @@ static BOOL cli_receive_trans(struct cli_state *cli,int trans,
        }
 
        /* DOS error "more data" is an acceptable error code */
-       if (cli_error(cli, &eclass, &num) && eclass != ERRDOS && num != ERRmoredata)
+       if (cli_error(cli, &eclass, &num) && !(eclass == ERRDOS && num == ERRmoredata))
        {
                return(False);
        }
@@ -2728,7 +2728,7 @@ BOOL cli_connect_serverlist(struct cli_state *cli, char *p)
        extern pstring scope;
        fstring remote_machine;
        struct in_addr dest_ip;
-       struct nmb_name calling, called;
+       struct nmb_name calling, called, stupid_smbserver_called;
        BOOL connected_ok = False;
 
        /*
@@ -2755,7 +2755,7 @@ BOOL cli_connect_serverlist(struct cli_state *cli, char *p)
                        continue;
                }   
 
-               if (ismyip(dest_ip))
+               if ((lp_security() != SEC_USER) && (ismyip(dest_ip)))
                {
                        DEBUG(1,("cli_connect_serverlist: Password server loop - not using password server %s\n", remote_machine));
                        continue;
@@ -2763,19 +2763,28 @@ BOOL cli_connect_serverlist(struct cli_state *cli, char *p)
 
                make_nmb_name(&calling, global_myname , 0x0 , scope);
                make_nmb_name(&called , remote_machine, 0x20, scope);
+               /* stupid microsoft destruction of the ability of netbios
+                * to provide multiple netbios servers on one host.
+                */
+               make_nmb_name(&stupid_smbserver_called , "*SMBSERVER", 0x20, scope);
 
                pwd_set_nullpwd(&cli->pwd);
 
                if (!cli_establish_connection(cli, remote_machine, &dest_ip,
                                              &calling, &called,
                                              "IPC$", "IPC", 
+                                             False, True) &&
+                   !cli_establish_connection(cli, remote_machine, &dest_ip,
+                                             &calling, &stupid_smbserver_called,
+                                             "IPC$", "IPC", 
                                              False, True))
                {
                        cli_shutdown(cli);
                        continue;
                }      
 
-               if (!IS_BITS_SET_ALL(cli->sec_mode, 1))
+               if (cli->protocol < PROTOCOL_LANMAN2 ||
+                   !IS_BITS_SET_ALL(cli->sec_mode, 1))
                {
                        DEBUG(1,("cli_connect_serverlist: machine %s isn't in user level security mode\n",
                                  remote_machine));