diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-24 16:26:23 +1000 |
commit | 6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch) | |
tree | 850c71039563c16a5d563c47e7ba2ab645baf198 /source3/auth/auth_server.c | |
parent | 6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff) | |
parent | 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff) | |
download | samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.gz samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.tar.bz2 samba-6da26870e0ae5acd6ff49a30ec2f6886b44d095e.zip |
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
Diffstat (limited to 'source3/auth/auth_server.c')
-rw-r--r-- | source3/auth/auth_server.c | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c index 5dc8ea7f04..da380db01a 100644 --- a/source3/auth/auth_server.c +++ b/source3/auth/auth_server.c @@ -22,6 +22,7 @@ #include "auth.h" #include "system/passwd.h" #include "smbd/smbd.h" +#include "libsmb/libsmb.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_AUTH @@ -43,12 +44,6 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx) struct named_mutex *mutex = NULL; NTSTATUS status; - if (!(cli = cli_initialise())) - return NULL; - - /* security = server just can't function with spnego */ - cli->use_spnego = False; - pserver = talloc_strdup(mem_ctx, lp_passwordserver()); p = pserver; @@ -63,12 +58,18 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx) } strupper_m(desthost); + if (strequal(desthost, myhostname())) { + DEBUG(1,("Password server loop - disabling " + "password server %s\n", desthost)); + continue; + } + if(!resolve_name( desthost, &dest_ss, 0x20, false)) { DEBUG(1,("server_cryptkey: Can't resolve address for %s\n",desthost)); continue; } - if (ismyaddr((struct sockaddr *)&dest_ss)) { + if (ismyaddr((struct sockaddr *)(void *)&dest_ss)) { DEBUG(1,("Password server loop - disabling password server %s\n",desthost)); continue; } @@ -80,11 +81,11 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx) mutex = grab_named_mutex(talloc_tos(), desthost, 10); if (mutex == NULL) { - cli_shutdown(cli); return NULL; } - status = cli_connect(cli, desthost, &dest_ss); + status = cli_connect_nb(desthost, &dest_ss, 0, 0x20, + lp_netbios_name(), Undefined, &cli); if (NT_STATUS_IS_OK(status)) { DEBUG(3,("connected to password server %s\n",desthost)); connected_ok = True; @@ -97,21 +98,11 @@ static struct cli_state *server_cryptkey(TALLOC_CTX *mem_ctx) if (!connected_ok) { DEBUG(0,("password server not available\n")); - cli_shutdown(cli); return NULL; } - if (!attempt_netbios_session_request(&cli, global_myname(), - desthost, &dest_ss)) { - TALLOC_FREE(mutex); - DEBUG(1,("password server fails session request\n")); - cli_shutdown(cli); - return NULL; - } - - if (strequal(desthost,myhostname())) { - exit_server_cleanly("Password server loop!"); - } + /* security = server just can't function with spnego */ + cli->use_spnego = False; DEBUG(3,("got session\n")); @@ -258,7 +249,7 @@ static DATA_BLOB auth_get_challenge_server(const struct auth_context *auth_conte /* The return must be allocated on the caller's mem_ctx, as our own will be destoyed just after the call. */ - return data_blob_talloc((TALLOC_CTX *)auth_context, cli->secblob.data,8); + return data_blob_talloc(discard_const_p(TALLOC_CTX, auth_context), cli->secblob.data,8); } else { return data_blob_null; } @@ -341,7 +332,7 @@ static NTSTATUS check_smbserver_security(const struct auth_context *auth_context baduser = talloc_asprintf(mem_ctx, "%s%s", INVALID_USER_PREFIX, - global_myname()); + lp_netbios_name()); if (!baduser) { return NT_STATUS_NO_MEMORY; } @@ -426,7 +417,7 @@ use this machine as the password server.\n")); } /* if logged in as guest then reject */ - if ((SVAL(cli->inbuf,smb_vwv2) & 1) != 0) { + if (cli->is_guestlogin) { DEBUG(1,("password server %s gave us guest only\n", cli->desthost)); nt_status = NT_STATUS_LOGON_FAILURE; } @@ -461,7 +452,7 @@ static NTSTATUS auth_init_smbserver(struct auth_context *auth_context, const cha { struct auth_methods *result; - result = TALLOC_ZERO_P(auth_context, struct auth_methods); + result = talloc_zero(auth_context, struct auth_methods); if (result == NULL) { return NT_STATUS_NO_MEMORY; } |