svn commit: samba r13192 - in branches/SAMBA_3_0/source: locking smbd

jra at samba.org jra at samba.org
Fri Jan 27 19:54:39 GMT 2006


Author: jra
Date: 2006-01-27 19:54:39 +0000 (Fri, 27 Jan 2006)
New Revision: 13192

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

Log:
Fix up alignment issues when printing share mode
entries. Add paranioa to debug so we know when an
entry is unused.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/locking/locking.c
   branches/SAMBA_3_0/source/smbd/oplock.c


Changeset:
Modified: branches/SAMBA_3_0/source/locking/locking.c
===================================================================
--- branches/SAMBA_3_0/source/locking/locking.c	2006-01-27 19:25:06 UTC (rev 13191)
+++ branches/SAMBA_3_0/source/locking/locking.c	2006-01-27 19:54:39 UTC (rev 13192)
@@ -384,11 +384,13 @@
 {
 	static pstring share_str;
 
-	slprintf(share_str, sizeof(share_str)-1, "share_mode_entry[%d]: "
+	slprintf(share_str, sizeof(share_str)-1, "share_mode_entry[%d]: %s "
 		 "pid = %s, share_access = 0x%x, private_options = 0x%x, "
 		 "access_mask = 0x%x, mid = 0x%x, type= 0x%x, file_id = %lu, "
 		 "dev = 0x%x, inode = %.0f",
-		 num, procid_str_static(&e->pid),
+		 num,
+		 e->op_type == UNUSED_SHARE_MODE_ENTRY ? "UNUSED" : "",
+		 procid_str_static(&e->pid),
 		 e->share_access, e->private_options,
 		 e->access_mask, e->op_mid, e->op_type, e->share_file_id,
 		 (unsigned int)e->dev, (double)e->inode );
@@ -408,9 +410,11 @@
 	int i;
 
 	for (i = 0; i < num_share_modes; i++) {
-		struct share_mode_entry *entry_p = &shares[i];
+		struct share_mode_entry entry;
+
+		memcpy(&entry, &shares[i], sizeof(struct share_mode_entry));
 		DEBUG(10,("print_share_mode_table: %s\n",
-			  share_mode_str(i, entry_p)));
+			  share_mode_str(i, &entry)));
 	}
 }
 

Modified: branches/SAMBA_3_0/source/smbd/oplock.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/oplock.c	2006-01-27 19:25:06 UTC (rev 13191)
+++ branches/SAMBA_3_0/source/smbd/oplock.c	2006-01-27 19:54:39 UTC (rev 13192)
@@ -684,6 +684,11 @@
 		   don't have to do anything */
 		for (i=0; i<lck->num_share_modes; i++) {
 			struct share_mode_entry *e = &lck->share_modes[i];
+
+			if (!is_valid_share_mode_entry(e)) {
+				continue;
+			}
+
 			if ((e->op_type == NO_OPLOCK) &&
 			    (e->share_file_id == fsp->file_id) &&
 			    (e->dev == fsp->dev) &&
@@ -701,6 +706,10 @@
 		struct share_mode_entry *share_entry = &lck->share_modes[i];
 		char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
 
+		if (!is_valid_share_mode_entry(share_entry)) {
+			continue;
+		}
+
 		/*
 		 * As there could have been multiple writes waiting at the
 		 * lock_share_entry gate we may not be the first to



More information about the samba-cvs mailing list