Author: vlendec
Date: 2005-09-04 09:00:47 +0000 (Sun, 04 Sep 2005)
New Revision: 10023

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

Log:
Fix some uninitialized variables, and in validate_my_share_entries the check
for deferred opens is different.

Volker

Modified:
   branches/tmp/vl-cluster/source/locking/locking.c
   branches/tmp/vl-cluster/source/smbd/open.c


Changeset:
Modified: branches/tmp/vl-cluster/source/locking/locking.c
===================================================================
--- branches/tmp/vl-cluster/source/locking/locking.c    2005-09-04 08:17:24 UTC 
(rev 10022)
+++ branches/tmp/vl-cluster/source/locking/locking.c    2005-09-04 09:00:47 UTC 
(rev 10023)
@@ -495,6 +495,7 @@
        }
 
        data = (struct locking_data *)result.dptr;
+       ZERO_STRUCTP(data);
        data->u.s.num_share_mode_entries = lck->num_share_modes;
        data->u.s.delete_on_close = lck->delete_on_close;
        memcpy(result.dptr + sizeof(*data), lck->share_modes,
@@ -560,7 +561,9 @@
                return NULL;
        }
 
+       lck->delete_on_close = False;
        lck->num_share_modes = 0;
+       lck->share_modes = NULL;
        lck->modified = False;
 
        data = tdb_fetch(tdb, key);

Modified: branches/tmp/vl-cluster/source/smbd/open.c
===================================================================
--- branches/tmp/vl-cluster/source/smbd/open.c  2005-09-04 08:17:24 UTC (rev 
10022)
+++ branches/tmp/vl-cluster/source/smbd/open.c  2005-09-04 09:00:47 UTC (rev 
10023)
@@ -478,12 +478,23 @@
                                      struct share_mode_entry *share_entry)
 {
        files_struct *fsp;
-       int num_props = 0;
 
        if (!procid_is_me(&share_entry->pid)) {
                return;
        }
 
+       if (is_deferred_open_entry(share_entry) &&
+           !open_was_deferred(share_entry->op_mid)) {
+               pstring str;
+               DEBUG(0, ("Got a deferred entry without a request: "
+                         "PANIC: %s\n", share_mode_str(num, share_entry)));
+               smb_panic(str);
+       }
+
+       if (!is_valid_share_mode_entry(share_entry)) {
+               return;
+       }
+
        fsp = file_find_dif(share_entry->dev, share_entry->inode,
                            share_entry->share_file_id);
        if (!fsp) {
@@ -493,11 +504,8 @@
                          "share entry with an open file\n");
        }
 
-       num_props += is_valid_share_mode_entry(share_entry) ? 1 : 0;
-       num_props += is_deferred_open_entry(share_entry) ? 1 : 0;
-       num_props += is_unused_share_mode_entry(share_entry) ? 1 : 0;
-
-       if (num_props != 1) {
+       if (is_deferred_open_entry(share_entry) ||
+           is_unused_share_mode_entry(share_entry)) {
                goto panic;
        }
 

Reply via email to