[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun May 29 05:58:01 MDT 2011


The branch, master has been updated
       via  0969c33 s3: Use the correct guest_login field in auth_server
       via  01386ff s3: Extract the guest_login field in sesssetup
       via  4ec00fd s3: Fix wct check in cli_sesssetup_blob_done
       via  8c1bb9b s3: Use cli_connect_nb in auth_server
       via  c05802f s3: Fix a type-punned warning
       via  a036dcd s3: Check password server loop earlier
      from  edfa62f s3: Use cli_connect_nb in do_message_op

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0969c3398e73e66c9e004740127da7c29e951050
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 29 10:58:46 2011 +0200

    s3: Use the correct guest_login field in auth_server
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Sun May 29 13:57:21 CEST 2011 on sn-devel-104

commit 01386ff3132ff5c786e83fc24328a80661de6bb7
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 29 10:58:05 2011 +0200

    s3: Extract the guest_login field in sesssetup

commit 4ec00fd621e944ff979e9f0a20773202d8c66472
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 29 10:56:39 2011 +0200

    s3: Fix wct check in cli_sesssetup_blob_done

commit 8c1bb9b210fe8e7f27cfc57f7b097d9e4d3ba470
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 29 09:21:03 2011 +0200

    s3: Use cli_connect_nb in auth_server

commit c05802f5a0f854377a3136e0709b2f79b4f20254
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 29 09:20:49 2011 +0200

    s3: Fix a type-punned warning

commit a036dcd8f0551a5eda013b1371f95f0b8b93c409
Author: Volker Lendecke <vl at samba.org>
Date:   Sun May 29 09:16:32 2011 +0200

    s3: Check password server loop earlier
    
    We do that in the loop for the ip address anyway

-----------------------------------------------------------------------

Summary of changes:
 source3/auth/auth_server.c  |   34 ++++++++++++----------------------
 source3/include/client.h    |    1 +
 source3/libsmb/cliconnect.c |   23 ++++++++++++++++++-----
 3 files changed, 31 insertions(+), 27 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/auth/auth_server.c b/source3/auth/auth_server.c
index 3334fde..d6538b6 100644
--- a/source3/auth/auth_server.c
+++ b/source3/auth/auth_server.c
@@ -44,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;
 
@@ -64,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;
 		}
@@ -81,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,
+					global_myname(), Undefined, &cli);
 		if (NT_STATUS_IS_OK(status)) {
 			DEBUG(3,("connected to password server %s\n",desthost));
 			connected_ok = True;
@@ -98,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"));
 
@@ -427,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;
 	}
diff --git a/source3/include/client.h b/source3/include/client.h
index b51da90..7d66bf9 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -109,6 +109,7 @@ struct cli_state {
 	int initialised;
 	int win95;
 	bool is_samba;
+	bool is_guestlogin;
 	uint32 capabilities;
 	/* What the server offered. */
 	uint32_t server_posix_capabilities;
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 3921fbc..bc22028 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -260,8 +260,10 @@ static void cli_session_setup_lanman2_done(struct tevent_req *subreq)
 	uint8_t *p;
 	NTSTATUS status;
 	ssize_t ret;
+	uint8_t wct;
+	uint16_t *vwv;
 
-	status = cli_smb_recv(subreq, state, &in, 0, NULL, NULL,
+	status = cli_smb_recv(subreq, state, &in, 3, &wct, &vwv,
 			      &num_bytes, &bytes);
 	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -273,6 +275,7 @@ static void cli_session_setup_lanman2_done(struct tevent_req *subreq)
 	p = bytes;
 
 	cli->vuid = SVAL(inbuf, smb_uid);
+	cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
 
 	status = smb_bytes_talloc_string(cli,
 					inbuf,
@@ -485,8 +488,10 @@ static void cli_session_setup_guest_done(struct tevent_req *subreq)
 	uint8_t *p;
 	NTSTATUS status;
 	ssize_t ret;
+	uint8_t wct;
+	uint16_t *vwv;
 
-	status = cli_smb_recv(subreq, state, &in, 0, NULL, NULL,
+	status = cli_smb_recv(subreq, state, &in, 3, &wct, &vwv,
 			      &num_bytes, &bytes);
 	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -498,6 +503,7 @@ static void cli_session_setup_guest_done(struct tevent_req *subreq)
 	p = bytes;
 
 	cli->vuid = SVAL(inbuf, smb_uid);
+	cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
 
 	status = smb_bytes_talloc_string(cli,
 					inbuf,
@@ -690,8 +696,10 @@ static void cli_session_setup_plain_done(struct tevent_req *subreq)
 	uint8_t *p;
 	NTSTATUS status;
 	ssize_t ret;
+	uint8_t wct;
+	uint16_t *vwv;
 
-	status = cli_smb_recv(subreq, state, &in, 0, NULL, NULL,
+	status = cli_smb_recv(subreq, state, &in, 3, &wct, &vwv,
 			      &num_bytes, &bytes);
 	TALLOC_FREE(subreq);
 	if (tevent_req_nterror(req, status)) {
@@ -702,6 +710,7 @@ static void cli_session_setup_plain_done(struct tevent_req *subreq)
 	p = bytes;
 
 	cli->vuid = SVAL(inbuf, smb_uid);
+	cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
 
 	status = smb_bytes_talloc_string(cli,
 					inbuf,
@@ -1043,8 +1052,10 @@ static void cli_session_setup_nt1_done(struct tevent_req *subreq)
 	uint8_t *p;
 	NTSTATUS status;
 	ssize_t ret;
+	uint8_t wct;
+	uint16_t *vwv;
 
-	status = cli_smb_recv(subreq, state, &in, 0, NULL, NULL,
+	status = cli_smb_recv(subreq, state, &in, 3, &wct, &vwv,
 			      &num_bytes, &bytes);
 	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -1056,6 +1067,7 @@ static void cli_session_setup_nt1_done(struct tevent_req *subreq)
 	p = bytes;
 
 	cli->vuid = SVAL(inbuf, smb_uid);
+	cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
 
 	status = smb_bytes_talloc_string(cli,
 					inbuf,
@@ -1280,7 +1292,7 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
 	uint8_t *inbuf;
 	ssize_t ret;
 
-	status = cli_smb_recv(subreq, state, &inbuf, 1, &wct, &vwv,
+	status = cli_smb_recv(subreq, state, &inbuf, 4, &wct, &vwv,
 			      &num_bytes, &bytes);
 	TALLOC_FREE(subreq);
 	if (!NT_STATUS_IS_OK(status)
@@ -1294,6 +1306,7 @@ static void cli_sesssetup_blob_done(struct tevent_req *subreq)
 
 	state->inbuf = (char *)inbuf;
 	cli->vuid = SVAL(state->inbuf, smb_uid);
+	cli->is_guestlogin = ((SVAL(vwv+2, 0) & 1) != 0);
 
 	blob_length = SVAL(vwv+3, 0);
 	if (blob_length > num_bytes) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list