[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-965-gf75934e

Stefan Metzmacher metze at samba.org
Wed Aug 12 05:28:42 MDT 2009


The branch, master has been updated
       via  f75934e2dc95d99dfbbc80f26eb3d1d1efe08604 (commit)
       via  7229e9a4762f1fee15708ac20de9c40ce75f85a2 (commit)
       via  fedac72dfc4c220f653dd243de221dad56650bac (commit)
       via  d30b1c9fa9d03246124dc7db8bb583c260adb0d1 (commit)
       via  14888c21acaf34da047937b29833d7788bafe11d (commit)
       via  91d13b68be55728a85b3832e2da9267dbf4f2464 (commit)
      from  e96338bf2b9ff6767a54c6127cdda34591b98c0d (commit)

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


- Log -----------------------------------------------------------------
commit f75934e2dc95d99dfbbc80f26eb3d1d1efe08604
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 11 18:31:27 2009 +0200

    s3:smbd: as check_path_syntax() changes the string, we need to copy the string before
    
    metze

commit 7229e9a4762f1fee15708ac20de9c40ce75f85a2
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 11 18:29:06 2009 +0200

    s3:smbd: avoid 'goto out' in smbd_smb2_create_send()
    
    metze

commit fedac72dfc4c220f653dd243de221dad56650bac
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 11 18:09:05 2009 +0200

    s3:smbd: make sure we don't call conn_free() with a NULL pointer for SMB2
    
    metze

commit d30b1c9fa9d03246124dc7db8bb583c260adb0d1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 11 18:08:26 2009 +0200

    s3:smbd: correctly invalidate vuids when SMB2 is used
    
    metze

commit 14888c21acaf34da047937b29833d7788bafe11d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 11 13:52:07 2009 +0200

    s3:lib: map ECONNRESET to NT_STATUS_CONNECTION_RESET
    
    metze

commit 91d13b68be55728a85b3832e2da9267dbf4f2464
Author: Matt Kraai <mkraai at beckman.com>
Date:   Wed Aug 12 08:49:24 2009 +0200

    libreplace: undef AI_ADDRCONFIG on QNX 6.3.0 (fix bug #6630)
    
    Some of the functions in source3/lib/util_sock.c use AI_ADDRCONFIG.  On QNX
    6.3.0, this macro is defined but, if it's used, getaddrinfo will fail.  This
    prevents smbd from opening any sockets.
    
    If I undefine AI_ADDRCONFIG on such systems and allow
    lib/replace/system/network.h to define it to be 0, this works around the issue.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 lib/replace/system/network.h  |   14 +++++++++++++
 source3/lib/errmap_unix.c     |    3 ++
 source3/smbd/password.c       |    4 +++
 source3/smbd/smb2_create.c    |   43 +++++++++++++++++++++--------------------
 source3/smbd/smb2_sesssetup.c |    1 +
 source3/smbd/smb2_tcon.c      |    4 ++-
 6 files changed, 47 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/replace/system/network.h b/lib/replace/system/network.h
index c836410..1f51035 100644
--- a/lib/replace/system/network.h
+++ b/lib/replace/system/network.h
@@ -195,6 +195,20 @@ int rep_socketpair(int d, int type, int protocol, int sv[2]);
 #endif
 #endif
 
+/*
+ * Some of the functions in source3/lib/util_sock.c use AI_ADDRCONFIG. On QNX
+ * 6.3.0, this macro is defined but, if it's used, getaddrinfo will fail. This
+ * prevents smbd from opening any sockets.
+ *
+ * If I undefine AI_ADDRCONFIG on such systems and define it to be 0,
+ * this works around the issue.
+ */
+#ifdef __QNX__
+#include <sys/neutrino.h>
+#if _NTO_VERSION == 630
+#undef AI_ADDRCONFIG
+#endif
+#endif
 #ifndef AI_ADDRCONFIG
 /*
  * logic copied from AI_NUMERICHOST
diff --git a/source3/lib/errmap_unix.c b/source3/lib/errmap_unix.c
index 00c5475..d43598b 100644
--- a/source3/lib/errmap_unix.c
+++ b/source3/lib/errmap_unix.c
@@ -87,6 +87,9 @@ const struct unix_error_map unix_dos_nt_errmap[] = {
 #ifdef ECONNABORTED
 	{ ECONNABORTED, ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_ABORTED},
 #endif
+#ifdef ECONNRESET
+	{ ECONNRESET, ERRHRD, ERRgeneral, NT_STATUS_CONNECTION_RESET},
+#endif
 #ifdef ENODEV
 	{ ENODEV, ERRDOS, 55, NT_STATUS_DEVICE_DOES_NOT_EXIST},
 #endif
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index b1a7497..4c1cef4 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -128,6 +128,10 @@ void invalidate_vuid(struct smbd_server_connection *sconn, uint16 vuid)
 
 void invalidate_all_vuids(struct smbd_server_connection *sconn)
 {
+	if (sconn->allow_smb2) {
+		return;
+	}
+
 	while (sconn->smb1.sessions.validated_users != NULL) {
 		invalidate_vuid(sconn,
 				sconn->smb1.sessions.validated_users->vuid);
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 1517ab8..fe414bb 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -272,7 +272,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 
 	smbreq = smbd_smb2_fake_smb_request(smb2req);
 	if (tevent_req_nomem(smbreq, req)) {
-		goto out;
+		return tevent_req_post(req, ev);
 	}
 
 	if (IS_IPC(smbreq->conn)) {
@@ -280,7 +280,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 
 		if (!lp_nt_pipe_support()) {
 			tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED);
-			goto out;
+			return tevent_req_post(req, ev);
 		}
 
 		/* Strip \\ off the name. */
@@ -291,7 +291,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 		status = open_np_file(smbreq, pipe_name, &result);
 		if (!NT_STATUS_IS_OK(status)) {
 			tevent_req_nterror(req, status);
-			goto out;
+			return tevent_req_post(req, ev);
 		}
 		info = FILE_WAS_OPENED;
 		ZERO_STRUCT(sbuf);
@@ -299,7 +299,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 		status = file_new(smbreq, smbreq->conn, &result);
 		if(!NT_STATUS_IS_OK(status)) {
 			tevent_req_nterror(req, status);
-			goto out;
+			return tevent_req_post(req, ev);
 		}
 
 		status = print_fsp_open(smbreq,
@@ -311,35 +311,39 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 		if (!NT_STATUS_IS_OK(status)) {
 			file_free(smbreq, result);
 			tevent_req_nterror(req, status);
-			goto out;
+			return tevent_req_post(req, ev);
 		}
 		info = FILE_WAS_CREATED;
 	} else {
+		char *fname;
 		struct smb_filename *smb_fname = NULL;
 
 		/* these are ignored for SMB2 */
 		in_create_options &= ~(0x10);/* NTCREATEX_OPTIONS_SYNC_ALERT */
 		in_create_options &= ~(0x20);/* NTCREATEX_OPTIONS_ASYNC_ALERT */
 
+		fname = talloc_strdup(state, in_name);
+		if (tevent_req_nomem(fname, req)) {
+			return tevent_req_post(req, ev);
+		}
+
 		/* convert '\\' into '/' */
-		status = check_path_syntax(in_name);
+		status = check_path_syntax(fname);
 		if (!NT_STATUS_IS_OK(status)) {
 			tevent_req_nterror(req, status);
-			TALLOC_FREE(smb_fname);
-			goto out;
+			return tevent_req_post(req, ev);
 		}
 
-		status = filename_convert(talloc_tos(),
-					smbreq->conn,
-					smbreq->flags2 & FLAGS2_DFS_PATHNAMES,
-					in_name,
-					0,
-					NULL,
-					&smb_fname);
+		status = filename_convert(req,
+					  smbreq->conn,
+					  smbreq->flags2 & FLAGS2_DFS_PATHNAMES,
+					  fname,
+					  0,
+					  NULL,
+					  &smb_fname);
 		if (!NT_STATUS_IS_OK(status)) {
 			tevent_req_nterror(req, status);
-			TALLOC_FREE(smb_fname);
-			goto out;
+			return tevent_req_post(req, ev);
 		}
 
 		status = SMB_VFS_CREATE_FILE(smbreq->conn,
@@ -359,11 +363,9 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 					     &info);
 		if (!NT_STATUS_IS_OK(status)) {
 			tevent_req_nterror(req, status);
-			TALLOC_FREE(smb_fname);
-			goto out;
+			return tevent_req_post(req, ev);
 		}
 		sbuf = smb_fname->st;
-		TALLOC_FREE(smb_fname);
 	}
 
 	smb2req->compat_chain_fsp = smbreq->chain_fsp;
@@ -389,7 +391,6 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx,
 	state->out_file_id_volatile = result->fnum;
 
 	tevent_req_done(req);
- out:
 	return tevent_req_post(req, ev);
 }
 
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index eae26ed..9b1dc8c 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -131,6 +131,7 @@ static int smbd_smb2_session_destructor(struct smbd_smb2_session *session)
 
 	idr_remove(session->sconn->smb2.sessions.idtree, session->vuid);
 	DLIST_REMOVE(session->sconn->smb2.sessions.list, session);
+	invalidate_vuid(session->sconn, session->vuid);
 
 	session->vuid = 0;
 	session->status = NT_STATUS_USER_SESSION_DELETED;
diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c
index 5137f5c..4ed3fb5 100644
--- a/source3/smbd/smb2_tcon.c
+++ b/source3/smbd/smb2_tcon.c
@@ -127,7 +127,9 @@ static int smbd_smb2_tcon_destructor(struct smbd_smb2_tcon *tcon)
 	idr_remove(tcon->session->tcons.idtree, tcon->tid);
 	DLIST_REMOVE(tcon->session->tcons.list, tcon);
 
-	conn_free(tcon->compat_conn);
+	if (tcon->compat_conn) {
+		conn_free(tcon->compat_conn);
+	}
 
 	tcon->compat_conn = NULL;
 	tcon->tid = 0;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list