svn commit: samba r15144 - in branches/SAMBA_3_0_RELEASE: . source/client source/param source/smbd source/utils

jerry at samba.org jerry at samba.org
Thu Apr 20 01:59:21 GMT 2006


Author: jerry
Date: 2006-04-20 01:59:17 +0000 (Thu, 20 Apr 2006)
New Revision: 15144

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15144

Log:
final code changes for 3.0.23pre1 (SAMBA_3_0 r15141)
Modified:
   branches/SAMBA_3_0_RELEASE/WHATSNEW.txt
   branches/SAMBA_3_0_RELEASE/source/client/clitar.c
   branches/SAMBA_3_0_RELEASE/source/param/loadparm.c
   branches/SAMBA_3_0_RELEASE/source/smbd/open.c
   branches/SAMBA_3_0_RELEASE/source/smbd/server.c
   branches/SAMBA_3_0_RELEASE/source/utils/net_ads.c
   branches/SAMBA_3_0_RELEASE/source/utils/net_rpc.c


Changeset:
Modified: branches/SAMBA_3_0_RELEASE/WHATSNEW.txt
===================================================================
--- branches/SAMBA_3_0_RELEASE/WHATSNEW.txt	2006-04-20 01:16:04 UTC (rev 15143)
+++ branches/SAMBA_3_0_RELEASE/WHATSNEW.txt	2006-04-20 01:59:17 UTC (rev 15144)
@@ -20,13 +20,25 @@
 	http://news.samba.org/#coverity_zero_bugs 
 	http://news.samba.org/#zdnet_quick_response
 
+New features introduced in 3.0.23pre1 include:
 
+  o New offline mode in winbindd.
+  o New kerberos support for pam_winbind.so.
+  o New handling of unmapped users and groups. 
+  o New non-root share management tools.
+  o Improved support for local and BUILTIN groups.
 
-Common bugs fixed in 3.0.23pre1 include:
 
-New features introduced in 3.0.23pre1 include:
+User and Group changes
+======================
 
+The user and group internal management routines have been rewritten
+to prevent overlaps of assigned Relative Identifiers (RIDs).  
+Unmapped users are assigned a SID in the S-1-22-1 domain now and
+unmapped groups are assigned a SID in the S-1-22-2 domain.
 
+
+
 ######################################################################
 Changes
 #######
@@ -100,9 +112,12 @@
     * Fix error return on session setup. Ensure no data blob is 
       added if the logon call failed so that Windows clients 
       interpret the NT_STATUS code correctly.
+    * Teach Samba the difference between exclusive and batch 
+      oplocks.
+    * BUG 3592: Ignore a file in a smbtar output if the first 
+      read fails (inspired by Justin Best).
 
 
-
 o   Alexander Bokovoy <ab at samba.org>
     * Fix 'smbcontrol shutdown' messages for nmbd and winbindd.
 
@@ -215,7 +230,6 @@
       in /etc/security/pam_winbind.conf.
 
 
-
 o   Mathias Dietz <MDIETZ at de.ibm.com>
     * EPERM can be a valid return from getting an xattr. 
       Don't disable if we get it.
@@ -261,6 +275,8 @@
       the SAMBA_4_0 tree.
     * Unsure that the global SAM SID is initialized before any
       dependent routines are called.
+    * Enhance consistency checks on local configuration when joining
+      a domain.
 
 
 o   Derrell Lipman <derrell at samba.org>

Modified: branches/SAMBA_3_0_RELEASE/source/client/clitar.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/client/clitar.c	2006-04-20 01:16:04 UTC (rev 15143)
+++ branches/SAMBA_3_0_RELEASE/source/client/clitar.c	2006-04-20 01:59:17 UTC (rev 15144)
@@ -561,15 +561,15 @@
 	return True;
 }
 
-static int padit(char *buf, int bufsize, int padsize)
+static int padit(char *buf, SMB_BIG_UINT bufsize, SMB_BIG_UINT padsize)
 {
 	int berr= 0;
 	int bytestowrite;
   
-	DEBUG(5, ("Padding with %d zeros\n", padsize));
-	memset(buf, 0, bufsize);
+	DEBUG(5, ("Padding with %0.f zeros\n", (double)padsize));
+	memset(buf, 0, (size_t)bufsize);
 	while( !berr && padsize > 0 ) {
-		bytestowrite= MIN(bufsize, padsize);
+		bytestowrite= (int)MIN(bufsize, padsize);
 		berr = dotarbuf(tarhandle, buf, bytestowrite) != bytestowrite;
 		padsize -= bytestowrite;
 	}
@@ -682,12 +682,11 @@
 		DEBUG(4, ("skipping %s - hidden bit is set\n", finfo.name));
 		shallitime=0;
 	} else {
+		BOOL wrote_tar_header = False;
+
 		DEBUG(3,("getting file %s of size %.0f bytes as a tar file %s",
 			finfo.name, (double)finfo.size, lname));
       
-		/* write a tar header, don't bother with mode - just set to 100644 */
-		writetarheader(tarhandle, rname, finfo.size, finfo.mtime, "100644 \0", ftype);
-
 		while (nread < finfo.size && !close_done) {
 	      
 			DEBUG(3,("nread=%.0f\n",(double)nread));
@@ -701,6 +700,13 @@
 	      
 			nread += datalen;
 
+			/* Only if the first read succeeds, write out the tar header. */
+			if (!wrote_tar_header) {
+				/* write a tar header, don't bother with mode - just set to 100644 */
+				writetarheader(tarhandle, rname, finfo.size, finfo.mtime, "100644 \0", ftype);
+				wrote_tar_header = True;
+			}
+
 			/* if file size has increased since we made file size query, truncate
 				read so tar header for this file will be correct.
 			*/
@@ -727,20 +733,25 @@
 			datalen=0;
 		}
 
-		/* pad tar file with zero's if we couldn't get entire file */
-		if (nread < finfo.size) {
-			DEBUG(0, ("Didn't get entire file. size=%.0f, nread=%d\n",
-						(double)finfo.size, (int)nread));
-			if (padit(data, sizeof(data), finfo.size - nread))
-				DEBUG(0,("Error writing tar file - %s\n", strerror(errno)));
-		}
+		if (wrote_tar_header) {
+			/* pad tar file with zero's if we couldn't get entire file */
+			if (nread < finfo.size) {
+				DEBUG(0, ("Didn't get entire file. size=%.0f, nread=%d\n",
+							(double)finfo.size, (int)nread));
+				if (padit(data, (SMB_BIG_UINT)sizeof(data), finfo.size - nread))
+					DEBUG(0,("Error writing tar file - %s\n", strerror(errno)));
+			}
 
-		/* round tar file to nearest block */
-		if (finfo.size % TBLOCK)
-			dozerobuf(tarhandle, TBLOCK - (finfo.size % TBLOCK));
+			/* round tar file to nearest block */
+			if (finfo.size % TBLOCK)
+				dozerobuf(tarhandle, TBLOCK - (finfo.size % TBLOCK));
       
-		ttarf+=finfo.size + TBLOCK - (finfo.size % TBLOCK);
-		ntarf++;
+			ttarf+=finfo.size + TBLOCK - (finfo.size % TBLOCK);
+			ntarf++;
+		} else {
+			DEBUG(4, ("skipping %s - initial read failed (file was locked ?)\n", finfo.name));
+			shallitime=0;
+		}
 	}
   
 	cli_close(cli, fnum);

Modified: branches/SAMBA_3_0_RELEASE/source/param/loadparm.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/param/loadparm.c	2006-04-20 01:16:04 UTC (rev 15143)
+++ branches/SAMBA_3_0_RELEASE/source/param/loadparm.c	2006-04-20 01:59:17 UTC (rev 15144)
@@ -54,7 +54,6 @@
 #include "includes.h"
 
 BOOL in_client = False;		/* Not in the client by default */
-BOOL in_server = False;		/* Not in the server by default */
 BOOL bLoaded = False;
 
 extern userdom_struct current_user_info;

Modified: branches/SAMBA_3_0_RELEASE/source/smbd/open.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/smbd/open.c	2006-04-20 01:16:04 UTC (rev 15143)
+++ branches/SAMBA_3_0_RELEASE/source/smbd/open.c	2006-04-20 01:59:17 UTC (rev 15144)
@@ -608,7 +608,7 @@
  * 3) Only level2 around: Grant level2 and do nothing else.
  */
 
-static BOOL delay_for_oplocks(struct share_mode_lock *lck, files_struct *fsp)
+static BOOL delay_for_oplocks(struct share_mode_lock *lck, files_struct *fsp, int pass_number)
 {
 	int i;
 	struct share_mode_entry *exclusive = NULL;
@@ -630,9 +630,16 @@
 		/* At least one entry is not an invalid or deferred entry. */
 		valid_entry = True;
 
-		if (EXCLUSIVE_OPLOCK_TYPE(lck->share_modes[i].op_type)) {
-			SMB_ASSERT(exclusive == NULL);			
-			exclusive = &lck->share_modes[i];
+		if (pass_number == 1) {
+			if (BATCH_OPLOCK_TYPE(lck->share_modes[i].op_type)) {
+				SMB_ASSERT(exclusive == NULL);			
+				exclusive = &lck->share_modes[i];
+			}
+		} else {
+			if (EXCLUSIVE_OPLOCK_TYPE(lck->share_modes[i].op_type)) {
+				SMB_ASSERT(exclusive == NULL);			
+				exclusive = &lck->share_modes[i];
+			}
 		}
 
 		if (lck->share_modes[i].op_type == LEVEL_II_OPLOCK) {
@@ -1024,6 +1031,42 @@
 
 }
 
+static void schedule_defer_open(struct share_mode_lock *lck, struct timeval request_time)
+{
+	struct deferred_open_record state;
+
+	/* This is a relative time, added to the absolute
+	   request_time value to get the absolute timeout time.
+	   Note that if this is the second or greater time we enter
+	   this codepath for this particular request mid then
+	   request_time is left as the absolute time of the *first*
+	   time this request mid was processed. This is what allows
+	   the request to eventually time out. */
+
+	struct timeval timeout;
+
+	/* Normally the smbd we asked should respond within
+	 * OPLOCK_BREAK_TIMEOUT seconds regardless of whether
+	 * the client did, give twice the timeout as a safety
+	 * measure here in case the other smbd is stuck
+	 * somewhere else. */
+
+	timeout = timeval_set(OPLOCK_BREAK_TIMEOUT*2, 0);
+
+	/* Nothing actually uses state.delayed_for_oplocks
+	   but it's handy to differentiate in debug messages
+	   between a 30 second delay due to oplock break, and
+	   a 1 second delay for share mode conflicts. */
+
+	state.delayed_for_oplocks = True;
+	state.dev = lck->dev;
+	state.inode = lck->ino;
+
+	if (!request_timed_out(request_time, timeout)) {
+		defer_open(lck, request_time, timeout, &state);
+	}
+}
+
 /****************************************************************************
  Open a file with a share mode.
 ****************************************************************************/
@@ -1310,7 +1353,6 @@
 	}
 
 	if (file_existed) {
-
 		dev = psbuf->st_dev;
 		inode = psbuf->st_ino;
 
@@ -1324,41 +1366,9 @@
 			return NULL;
 		}
 
-		if (delay_for_oplocks(lck, fsp)) {
-			struct deferred_open_record state;
-
-			/* This is a relative time, added to the absolute
-			   request_time value to get the absolute timeout time.
-			   Note that if this is the second or greater time we enter
-			   this codepath for this particular request mid then
-			   request_time is left as the absolute time of the *first*
-			   time this request mid was processed. This is what allows
-			   the request to eventually time out. */
-
-			struct timeval timeout;
-
-			/* Normally the smbd we asked should respond within
-			 * OPLOCK_BREAK_TIMEOUT seconds regardless of whether
-			 * the client did, give twice the timeout as a safety
-			 * measure here in case the other smbd is stuck
-			 * somewhere else. */
-
-			timeout = timeval_set(OPLOCK_BREAK_TIMEOUT*2, 0);
-
-			/* Nothing actually uses state.delayed_for_oplocks
-			   but it's handy to differentiate in debug messages
-			   between a 30 second delay due to oplock break, and
-			   a 1 second delay for share mode conflicts. */
-
-			state.delayed_for_oplocks = True;
-			state.dev = dev;
-			state.inode = inode;
-
-			if (!request_timed_out(request_time, timeout)) {
-				defer_open(lck, request_time, timeout,
-					   &state);
-			}
-
+		/* First pass - send break only on batch oplocks. */
+		if (delay_for_oplocks(lck, fsp, 1)) {
+			schedule_defer_open(lck, request_time);
 			TALLOC_FREE(lck);
 			return NULL;
 		}
@@ -1367,6 +1377,16 @@
 					 access_mask, share_access,
 					 create_options, &file_existed);
 
+		if (NT_STATUS_IS_OK(status)) {
+			/* We might be going to allow this open. Check oplock status again. */
+			/* Second pass - send break for both batch or exclusive oplocks. */
+			if (delay_for_oplocks(lck, fsp, 2)) {
+				schedule_defer_open(lck, request_time);
+				TALLOC_FREE(lck);
+				return NULL;
+			}
+		}
+
 		if (NT_STATUS_EQUAL(status, NT_STATUS_DELETE_PENDING)) {
 			/* DELETE_PENDING is not deferred for a second */
 			set_saved_ntstatus(status);

Modified: branches/SAMBA_3_0_RELEASE/source/smbd/server.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/smbd/server.c	2006-04-20 01:16:04 UTC (rev 15143)
+++ branches/SAMBA_3_0_RELEASE/source/smbd/server.c	2006-04-20 01:59:17 UTC (rev 15144)
@@ -731,7 +731,6 @@
 
  int main(int argc,const char *argv[])
 {
-	extern BOOL in_server;
 	/* shall I run as a daemon */
 	static BOOL is_daemon = False;
 	static BOOL interactive = False;
@@ -755,8 +754,6 @@
 	{ NULL }
 	};
 
-	in_server = True;
-
 	load_case_tables();
 
 #ifdef HAVE_SET_AUTH_PARAMETERS

Modified: branches/SAMBA_3_0_RELEASE/source/utils/net_ads.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/utils/net_ads.c	2006-04-20 01:16:04 UTC (rev 15143)
+++ branches/SAMBA_3_0_RELEASE/source/utils/net_ads.c	2006-04-20 01:59:17 UTC (rev 15144)
@@ -721,12 +721,18 @@
 	const char *short_domain_name = NULL;
 	TALLOC_CTX *ctx = NULL;
 
-	if ((lp_server_role() != ROLE_DOMAIN_MEMBER) || 
+	if ((lp_server_role() != ROLE_DOMAIN_MEMBER) &&
 	    (lp_server_role() != ROLE_DOMAIN_BDC)) {
 		d_printf("can only join as domain member or as BDC\n");
 		return -1;
 	}
 
+	if (strlen(global_myname()) > 15) {
+		d_printf("Our netbios name can only be 15 chars long, \"%s\""
+			 " is %d chars long\n",
+			 global_myname(), strlen(global_myname()));
+		return -1;
+	}
 
 	if (argc > 0) {
 		org_unit = argv[0];

Modified: branches/SAMBA_3_0_RELEASE/source/utils/net_rpc.c
===================================================================
--- branches/SAMBA_3_0_RELEASE/source/utils/net_rpc.c	2006-04-20 01:16:04 UTC (rev 15143)
+++ branches/SAMBA_3_0_RELEASE/source/utils/net_rpc.c	2006-04-20 01:59:17 UTC (rev 15144)
@@ -389,12 +389,19 @@
 
 int net_rpc_join(int argc, const char **argv) 
 {
-	if ((lp_server_role() != ROLE_DOMAIN_MEMBER) || 
+	if ((lp_server_role() != ROLE_DOMAIN_MEMBER) &&
 	    (lp_server_role() != ROLE_DOMAIN_BDC)) {
 		d_printf("can only join as domain member or as BDC\n");
 		return -1;
 	}
 
+	if (strlen(global_myname()) > 15) {
+		d_printf("Our netbios name can only be 15 chars long, \"%s\""
+			 " is %d chars long\n",
+			 global_myname(), strlen(global_myname()));
+		return -1;
+	}
+
 	if ((net_rpc_perform_oldjoin(argc, argv) == 0))
 		return 0;
 	



More information about the samba-cvs mailing list