r26224: Remove another use of global_loadparm.
[jelmer/samba4-debian.git] / source / auth / auth_server.c
index e5fe02efe7f9b6c9e97874d476c288a5cd75108e..36637edd57bd481b46766029b66f77b9357ace38 100644 (file)
@@ -6,7 +6,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -15,8 +15,7 @@
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
@@ -29,16 +28,16 @@ static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
 {
        struct smbcli_state *cli = NULL;
        fstring desthost;
-       struct ipv4_addr dest_ip;
+       struct in_addr dest_ip;
        const char *p;
        char *pserver;
-       BOOL connected_ok = False;
+       bool connected_ok = false;
 
        if (!(cli = smbcli_initialise(cli)))
                return NULL;
 
        /* security = server just can't function with spnego */
-       cli->use_spnego = False;
+       cli->use_spnego = false;
 
         pserver = talloc_strdup(mem_ctx, lp_passwordserver());
        p = pserver;
@@ -67,7 +66,7 @@ static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
 
                if (smbcli_connect(cli, desthost, &dest_ip)) {
                        DEBUG(3,("connected to password server %s\n",desthost));
-                       connected_ok = True;
+                       connected_ok = true;
                        break;
                }
        }
@@ -93,7 +92,7 @@ static struct smbcli_state *server_cryptkey(TALLOC_CTX *mem_ctx)
        
        DEBUG(3,("got session\n"));
 
-       if (!smbcli_negprot(cli)) {
+       if (!smbcli_negprot(cli, lp_cli_maxprotocol(global_loadparm))) {
                DEBUG(1,("%s rejected the negprot\n",desthost));
                release_server_mutex();
                talloc_free(cli);
@@ -196,10 +195,10 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
        struct smbcli_state *cli;
        static uint8_t badpass[24];
        static fstring baduser; 
-       static BOOL tested_password_server = False;
-       static BOOL bad_password_server = False;
+       static bool tested_password_server = false;
+       static bool bad_password_server = false;
        NTSTATUS nt_status = NT_STATUS_LOGON_FAILURE;
-       BOOL locally_made_cli = False;
+       bool locally_made_cli = false;
 
        /* 
         * Check that the requested domain is not our own machine name.
@@ -207,7 +206,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
         * password file.
         */
 
-       if(is_myname(user_info->domain.str)) {
+       if (lp_is_myname(global_loadparm, user_info->domain.str)) {
                DEBUG(3,("check_smbserver_security: Requested domain was for this machine.\n"));
                return NT_STATUS_LOGON_FAILURE;
        }
@@ -217,7 +216,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
        if (cli) {
        } else {
                cli = server_cryptkey(mem_ctx);
-               locally_made_cli = True;
+               locally_made_cli = true;
        }
 
        if (!cli || !cli->initialised) {
@@ -274,7 +273,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context
                         * We connected to the password server so we
                         * can say we've tested it.
                         */
-                       tested_password_server = True;
+                       tested_password_server = true;
 
                        if ((SVAL(cli->inbuf,smb_vwv2) & 1) == 0) {
                                DEBUG(0,("server_validate: password server %s allows users as non-guest \
@@ -286,7 +285,7 @@ use this machine as the password server.\n"));
                                /*
                                 * Password server has the bug.
                                 */
-                               bad_password_server = True;
+                               bad_password_server = true;
                                return NT_STATUS_LOGON_FAILURE;
                        }
                        smbcli_ulogoff(cli);