[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3662-g0e51f10

Karolin Seeger kseeger at samba.org
Thu Oct 1 06:26:29 MDT 2009


The branch, v3-2-test has been updated
       via  0e51f10a96acb5389a1326b4a85646b1cbac705d (commit)
       via  4e25072de62595b491acf3f5003b309f8b22a78b (commit)
       via  22225e412b4feac1654845dee93cdc140a8567f8 (commit)
       via  cead8716520ed395b997259e4c430aa05bf98001 (commit)
       via  3ea466e1b8e69d59736bf5b4452769014b17f0f3 (commit)
       via  9f8352264abca4e3a659a911c091a15b590b020f (commit)
       via  46195a158ed6f79bb11d92b276a6ae041023fca9 (commit)
      from  58ec19243e59e05e0356760115c394b3a0158a63 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 0e51f10a96acb5389a1326b4a85646b1cbac705d
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Sep 30 14:24:50 2009 +0200

    Fix for CVE-2009-2906.
    
    Summary:
    Specially crafted SMB requests on
    authenticated SMB connections can send smbd
    into a 100% CPU loop, causing a DoS on the
    Samba server.
    (cherry picked from commit e2dff319a6d5c0c54acdba3d4fec05477ca60f11)

commit 4e25072de62595b491acf3f5003b309f8b22a78b
Author: Karolin Seeger <kseeger at samba.org>
Date:   Wed Sep 30 13:55:33 2009 +0200

    WHATSNEW: Update release notes.
    
    Karolin
    (cherry picked from commit 802d964da98628b1d243fdd766cf0c86ae287713)

commit 22225e412b4feac1654845dee93cdc140a8567f8
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Sep 28 13:52:57 2009 +0200

    Fix for CVE-2009-2813.
    
    ===========================================================
    == Subject:     Misconfigured /etc/passwd file may share folders unexpectedly
    ==
    == CVE ID#:     CVE-2009-2813
    ==
    == Versions:    All versions of Samba later than 3.0.11
    ==
    == Summary:     If a user in /etc/passwd is misconfigured to have
    ==              an empty home directory then connecting to the home
    ==              share of this user will use the root of the filesystem
    ==              as the home directory.
    ===========================================================
    (cherry picked from commit 6fd272875d27c6974a194d0cb2cde39a98ca4af2)

commit cead8716520ed395b997259e4c430aa05bf98001
Author: Jeff Layton <jlayton at redhat.com>
Date:   Fri Sep 25 07:03:44 2009 -0400

    mount.cifs: don't leak passwords with verbose option
    
    When running mount.cifs with the --verbose option, it'll print out the
    option string that it passes to the kernel...including the mount
    password if there is one. Print a placeholder string instead to help
    ensure that this info can't be used for nefarious purposes.
    
    Also, the --verbose option printed the option string before it was
    completely assembled anyway. This patch should also make sure that
    the complete option string is printed out.
    
    Finally, strndup passwords passed in on the command line to ensure that
    they aren't shown by --verbose as well. Passwords used this way can
    never be truly kept private from other users on the machine of course,
    but it's simple enough to do it this way for completeness sake.
    
    Reported-by: Ronald Volgers <r.c.volgers at student.utwente.nl>
    Signed-off-by: Jeff Layton <jlayton at redhat.com>
    Acked-by: Steve French <sfrench at us.ibm.com>
    
    Part 2/2 of a fix for CVE-2009-2948.
    (cherry picked from commit acfc9978afbde87dde3b70daccdbfd7e0a1d52e4)

commit 3ea466e1b8e69d59736bf5b4452769014b17f0f3
Author: Jeff Layton <jlayton at redhat.com>
Date:   Fri Sep 25 07:03:44 2009 -0400

    mount.cifs: check access of credential files before opening
    
    It's possible for an unprivileged user to pass a setuid mount.cifs a
    credential or password file to which he does not have access. This can cause
    mount.cifs to open the file on his behalf and possibly leak the info in the
    first few lines of the file.
    
    Check the access permissions of the file before opening it.
    
    Reported-by: Ronald Volgers <r.c.volgers at student.utwente.nl>
    Signed-off-by: Jeff Layton <jlayton at redhat.com>
    Acked-by: Steve French <sfrench at us.ibm.com>
    
    Part 1/2 of a fix for CVE-2009-2948.
    (cherry picked from commit b656deb5d7e97176c32b61b7659258846db16887)

commit 9f8352264abca4e3a659a911c091a15b590b020f
Author: Karolin Seeger <kseeger at samba.org>
Date:   Mon Sep 28 13:49:14 2009 +0200

    WHATSNEW: Prepare release notes for 3.2.15.
    
    Karolin
    (cherry picked from commit fb513bdacaeaef7e3edb49d5b77661adf3a912bb)

commit 46195a158ed6f79bb11d92b276a6ae041023fca9
Author: Karolin Seeger <kseeger at samba.org>
Date:   Thu Sep 24 14:28:08 2009 +0200

    Raise version number up to 3.2.15.
    
    Karolin
    (cherry picked from commit ab4af60c8311b0f60f18390b670f01e1296c5141)

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

Summary of changes:
 WHATSNEW.txt               |   70 ++++++++++++++++++++++++++++++++++++++++++-
 source/VERSION             |    2 +-
 source/client/mount.cifs.c |   65 ++++++++++++++++++++++++++++------------
 source/include/smb.h       |    1 +
 source/param/loadparm.c    |    7 ++++-
 source/smbd/process.c      |   28 +++++++++++++++--
 source/smbd/service.c      |    6 +++-
 7 files changed, 151 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 631e1d6..50acbbc 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,70 @@
                    ==============================
+                   Release Notes for Samba 3.2.15
+			   October 1, 2009
+                   ==============================
+
+
+This is a security release in order to address CVE-2009-2813, CVE-2009-2948
+and CVE-2009-2906.
+
+   o CVE-2009-2813:
+     In all versions of Samba later than 3.0.11, connecting to the home
+     share of a user will use the root of the filesystem
+     as the home directory if this user is misconfigured to have
+     an empty home directory in /etc/passwd.
+
+   o CVE-2009-2948:
+     If mount.cifs is installed as a setuid program, a user can pass it a
+     credential or password path to which he or she does not have access and
+     then use the --verbose option to view the first line of that file.
+     All known Samba versions are affected.
+
+   o CVE-2009-2906:
+     Specially crafted SMB requests on authenticated SMB connections can
+     send smbd into a 100% CPU loop, causing a DoS on the Samba server.
+
+
+######################################################################
+Changes
+#######
+
+Changes since 3.2.14
+--------------------
+
+
+o   Jeremy Allison <jra at samba.org>
+    * BUG 6763: Fix for CVE-2009-2813.
+    * BUG 6768: Fix for CVE-2009-2906.
+
+
+o   Jeff Layton <jlayton at redhat.com>
+    * Fix for CVE-2009-2948.
+
+
+######################################################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the Samba 3.2 product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
+                   ==============================
                    Release Notes for Samba 3.2.14
 			  August 12, 2009
                    ==============================
@@ -130,8 +196,8 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
 
                    ==============================
                    Release Notes for Samba 3.2.13
diff --git a/source/VERSION b/source/VERSION
index 5597ecc..de58d60 100644
--- a/source/VERSION
+++ b/source/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=3
 SAMBA_VERSION_MINOR=2
-SAMBA_VERSION_RELEASE=14
+SAMBA_VERSION_RELEASE=15
 
 ########################################################
 # Bug fix releases use a letter for the patch revision #
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index d05115b..a947dd1 100644
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -199,6 +199,11 @@ static int open_cred_file(char * file_name)
 	char * temp_val;
 	FILE * fs;
 	int i, length;
+
+	i = access(file_name, R_OK);
+	if (i)
+		return i;
+
 	fs = fopen(file_name,"r");
 	if(fs == NULL)
 		return errno;
@@ -321,6 +326,12 @@ static int get_password_from_file(int file_descript, char * filename)
 	}
 
 	if(filename != NULL) {
+		rc = access(filename, R_OK);
+		if (rc) {
+			fprintf(stderr, "mount.cifs failed: access check of %s failed: %s\n",
+					filename, strerror(errno));
+			exit(EX_SYSERR);
+		}
 		file_descript = open(filename, O_RDONLY);
 		if(file_descript < 0) {
 			printf("mount.cifs failed. %s attempting to open password file %s\n",
@@ -380,9 +391,6 @@ static int parse_options(char ** optionsp, int * filesys_flags)
 		return 1;
 	data = *optionsp;
 
-	if(verboseflag)
-		printf("parsing options: %s\n", data);
-
 	/* BB fixme check for separator override BB */
 
 	if (getuid()) {
@@ -471,18 +479,27 @@ static int parse_options(char ** optionsp, int * filesys_flags)
 		} else if (strncmp(data, "pass", 4) == 0) {
 			if (!value || !*value) {
 				if(got_password) {
-					printf("\npassword specified twice, ignoring second\n");
+					fprintf(stderr, "\npassword specified twice, ignoring second\n");
 				} else
 					got_password = 1;
-			} else if (strnlen(value, 17) < 17) {
-				if(got_password)
-					printf("\nmount.cifs warning - password specified twice\n");
-				got_password = 1;
+			} else if (strnlen(value, MOUNT_PASSWD_SIZE) < MOUNT_PASSWD_SIZE) {
+				if (got_password) {
+					fprintf(stderr, "\nmount.cifs warning - password specified twice\n");
+				} else {
+					mountpassword = strndup(value, MOUNT_PASSWD_SIZE);
+					if (!mountpassword) {
+						fprintf(stderr, "mount.cifs error: %s", strerror(ENOMEM));
+						SAFE_FREE(out);
+						return 1;
+					}
+					got_password = 1;
+				}
 			} else {
-				printf("password too long\n");
+				fprintf(stderr, "password too long\n");
 				SAFE_FREE(out);
 				return 1;
 			}
+			goto nocopy;
 		} else if (strncmp(data, "sec", 3) == 0) {
 			if (value) {
 				if (!strncmp(value, "none", 4) ||
@@ -1370,15 +1387,6 @@ mount_retry:
 			strlcat(options,domain_name,options_size);
 		}
 	}
-	if(mountpassword) {
-		/* Commas have to be doubled, or else they will
-		look like the parameter separator */
-/*		if(sep is not set)*/
-		if(retry == 0)
-			check_for_comma(&mountpassword);
-		strlcat(options,",pass=",options_size);
-		strlcat(options,mountpassword,options_size);
-	}
 
 	strlcat(options,",ver=",options_size);
 	strlcat(options,MOUNT_CIFS_VERSION_MAJOR,options_size);
@@ -1391,8 +1399,6 @@ mount_retry:
 		strlcat(options,",prefixpath=",options_size);
 		strlcat(options,prefixpath,options_size); /* no need to cat the / */
 	}
-	if(verboseflag)
-		printf("\nmount.cifs kernel mount options %s \n",options);
 
 	/* convert all '\\' to '/' in share portion so that /proc/mounts looks pretty */
 	replace_char(dev_name, '\\', '/', strlen(share_name));
@@ -1424,6 +1430,25 @@ mount_retry:
 		}
 	}
 
+	if(verboseflag)
+		fprintf(stderr, "\nmount.cifs kernel mount options: %s", options);
+
+	if (mountpassword) {
+		/*
+		 * Commas have to be doubled, or else they will
+		 * look like the parameter separator
+		 */
+		if(retry == 0)
+			check_for_comma(&mountpassword);
+		strlcat(options,",pass=",options_size);
+		strlcat(options,mountpassword,options_size);
+		if (verboseflag)
+			fprintf(stderr, ",pass=********");
+	}
+
+	if (verboseflag)
+		fprintf(stderr, "\n");
+
 	if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
 		switch (errno) {
 		case ECONNREFUSED:
diff --git a/source/include/smb.h b/source/include/smb.h
index dc346d8..960984f 100644
--- a/source/include/smb.h
+++ b/source/include/smb.h
@@ -759,6 +759,7 @@ struct pending_message_list {
 	struct timeval request_time; /* When was this first issued? */
 	struct timeval end_time; /* When does this time out? */
 	bool encrypted;
+	bool processed;
 	DATA_BLOB buf;
 	DATA_BLOB private_data;
 };
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index 4556d0b..6df94e1 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -5827,6 +5827,11 @@ bool lp_add_home(const char *pszHomename, int iDefaultService,
 {
 	int i;
 
+	if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
+			pszHomedir[0] == '\0') {
+		return false;
+	}
+
 	i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
 
 	if (i < 0)
@@ -7777,7 +7782,7 @@ static void lp_add_auto_services(char *str)
 
 		home = get_user_home_dir(talloc_tos(), p);
 
-		if (home && homes >= 0)
+		if (home && home[0] && homes >= 0)
 			lp_add_home(p, homes, p, home);
 
 		TALLOC_FREE(home);
diff --git a/source/smbd/process.c b/source/smbd/process.c
index ad01a52..c53bfda 100644
--- a/source/smbd/process.c
+++ b/source/smbd/process.c
@@ -434,6 +434,7 @@ static bool push_queued_message(struct smb_request *req,
 	msg->request_time = request_time;
 	msg->end_time = end_time;
 	msg->encrypted = req->encrypted;
+	msg->processed = false;
 
 	if (private_data) {
 		msg->private_data = data_blob_talloc(msg, private_data,
@@ -489,6 +490,16 @@ void schedule_deferred_open_smb_message(uint16 mid)
 		DEBUG(10,("schedule_deferred_open_smb_message: [%d] msg_mid = %u\n", i++,
 			(unsigned int)msg_mid ));
 		if (mid == msg_mid) {
+
+			if (pml->processed) {
+				/* A processed message should not be
+				 * rescheduled. */
+				DEBUG(0,("schedule_deferred_open_smb_message: LOGIC ERROR "
+					"message mid %u was already processed\n",
+					(unsigned int)msg_mid ));
+				continue;
+			}
+
 			DEBUG(10,("schedule_deferred_open_smb_message: scheduling mid %u\n",
 				mid ));
 			pml->end_time.tv_sec = 0;
@@ -503,7 +514,7 @@ void schedule_deferred_open_smb_message(uint16 mid)
 }
 
 /****************************************************************************
- Return true if this mid is on the deferred queue.
+ Return true if this mid is on the deferred queue and was not yet processed.
 ****************************************************************************/
 
 bool open_was_deferred(uint16 mid)
@@ -511,7 +522,7 @@ bool open_was_deferred(uint16 mid)
 	struct pending_message_list *pml;
 
 	for (pml = deferred_open_queue; pml; pml = pml->next) {
-		if (SVAL(pml->buf.data,smb_mid) == mid) {
+		if (SVAL(pml->buf.data,smb_mid) == mid && !pml->processed) {
 			return True;
 		}
 	}
@@ -778,6 +789,10 @@ static NTSTATUS receive_message_or_smb(TALLOC_CTX *mem_ctx, char **buffer,
 			/* We leave this message on the queue so the open code can
 			   know this is a retry. */
 			DEBUG(5,("receive_message_or_smb: returning deferred open smb message.\n"));
+
+			/* Mark the message as processed so this is not
+			 * re-processed in error. */
+			msg->processed = true;
 			return NT_STATUS_OK;
 		}
 	}
@@ -1405,7 +1420,6 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
 
 		if (!change_to_user(conn,session_tag)) {
 			reply_nterror(req, NT_STATUS_DOS(ERRSRV, ERRbaduid));
-			remove_deferred_open_smb_message(req->mid);
 			return conn;
 		}
 
@@ -1470,6 +1484,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
 
 static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool encrypted)
 {
+	struct pending_message_list *pml = NULL;
 	uint8 type = CVAL(inbuf,smb_com);
 	connection_struct *conn;
 	struct smb_request *req;
@@ -1485,6 +1500,13 @@ static void construct_reply(char *inbuf, int size, size_t unread_bytes, bool enc
 
 	conn = switch_message(type, req, size);
 
+	/* If this was a deferred message and it's still there and
+	 * was processed, remove it. */
+	pml = get_open_deferred_message(req->mid);
+	if (pml && pml->processed) {
+		remove_deferred_open_smb_message(req->mid);
+	}
+
 	if (req->unread_bytes) {
 		/* writeX failed. drain socket. */
 		if (drain_socket(smbd_server_fd(), req->unread_bytes) !=
diff --git a/source/smbd/service.c b/source/smbd/service.c
index 1c8ffbd..5d9b9df 100644
--- a/source/smbd/service.c
+++ b/source/smbd/service.c
@@ -55,6 +55,10 @@ bool set_conn_connectpath(connection_struct *conn, const char *connectpath)
 	const char *s = connectpath;
         bool start_of_name_component = true;
 
+	if (connectpath == NULL || connectpath[0] == '\0') {
+		return false;
+	}
+
 	destname = SMB_STRDUP(connectpath);
 	if (!destname) {
 		return false;
@@ -327,7 +331,7 @@ int add_home_service(const char *service, const char *username, const char *home
 {
 	int iHomeService;
 
-	if (!service || !homedir)
+	if (!service || !homedir || homedir[0] == '\0')
 		return -1;
 
 	if ((iHomeService = lp_servicenumber(HOMES_NAME)) < 0) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list