[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Fri Sep 14 08:49:02 UTC 2018


The branch, master has been updated
       via  f8df3f3 mdssvc: Move a variable declaration closer to its use
       via  98cf04c7 mdssvc: Move a variable declaration closer to its use
       via  71c7060 mdssvc: Move a variable declaration closer to its use
       via  92d3e3a mdssvc: Simplify sl_unpack_loop
       via  aca0f2a streams_xattr: Make error handling more obvious
       via  36055db streams_xattr: Make error handling more obvious
       via  50adbbe smbd: Simplify parse_share_modes
       via  9e515f7 smbd: Simplify share_mode_lock.c
       via  89e500d smbd: Fix a false comment
       via  92b01ad tevent: Fix a docu typo
       via  aa30fd5 smbd: Remove "file_sync_all" function
       via  41f2d1d smbd: Avoid casts in DEBUG statements
       via  e4498de smbd: Avoid casts in DEBUG statements
       via  551f854 smbd: Add a paranoia check for leases
       via  b6b7c15 dbwrap_tdb: Avoid double-call to talloc_get_type_abort
       via  5e4f34e smbd: Add some structure protection for durable reconnect
      from  93d72bc wafsamba: Only use $DESTDIR in INSTALL_DIR() if it is set

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


- Log -----------------------------------------------------------------
commit f8df3f3499fd7421260fbe532bd6947d3c0ea8bd
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 3 12:45:59 2018 +0200

    mdssvc: Move a variable declaration closer to its use
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Fri Sep 14 10:48:47 CEST 2018 on sn-devel-144

commit 98cf04c7d140a015fdd4d9cc5d90eb445bd9c58c
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 3 12:44:31 2018 +0200

    mdssvc: Move a variable declaration closer to its use
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 71c70607982981338252e529c39c13b94b9eb497
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 3 12:43:37 2018 +0200

    mdssvc: Move a variable declaration closer to its use
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 92d3e3a81094f69d1de9a09c8d75bf6a797facb3
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 3 12:38:47 2018 +0200

    mdssvc: Simplify sl_unpack_loop
    
    Move a variable declaration closer to its use, avoid a redundant
    ?true:false;
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit aca0f2a18bf39e703a5cf8383ff2089fa0e97221
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 8 14:20:58 2018 +0200

    streams_xattr: Make error handling more obvious
    
    Do the NULL check right after the alloc call
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 36055dbb660a1a1086e06b3849e4deb93f2a99ef
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 8 14:20:58 2018 +0200

    streams_xattr: Make error handling more obvious
    
    Do the NULL check right after the alloc call
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 50adbbe0c841360f6d29f66dcdffdaa872c7780d
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 10 15:14:00 2018 +0200

    smbd: Simplify parse_share_modes
    
    Since 823bc4c07ad pidl initializes the [skip] entries
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 9e515f7c66d950be0ad3839c50fff1329aebc002
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 10 14:50:40 2018 +0200

    smbd: Simplify share_mode_lock.c
    
    "the_lock_id" is not required here. The share mode data carry the file
    id, so use that.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 89e500d8ad75d29ab7242947f7b869488ba76192
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 10 12:20:10 2018 +0200

    smbd: Fix a false comment
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 92b01adf0933d6940126ad94d2334d214efde39c
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Oct 22 13:59:12 2016 +0200

    tevent: Fix a docu typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit aa30fd54a22db8535b661563cab1adb15826239d
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Sep 13 06:21:37 2018 +0200

    smbd: Remove "file_sync_all" function
    
    Replace with a call to files_forall. Why? I just came across this
    function that only has one pretty obscure user. This does not justify
    a full library function, IMHO at least.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 41f2d1d1bdf51699cab774e103fcf00a32bc7071
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 10 12:55:48 2018 +0200

    smbd: Avoid casts in DEBUG statements
    
    Some indentation changed, best viewed with "git show -w"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e4498de16341fc049c50e3df13690dddc9efcdd6
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Sep 13 19:36:47 2018 +0200

    smbd: Avoid casts in DEBUG statements
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 551f85464bbd6275a1d645a06089f4c7db55b866
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Sep 13 18:56:54 2018 +0200

    smbd: Add a paranoia check for leases
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit b6b7c157583dae815e57781cbc4f66bd8d71e201
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Aug 16 13:18:14 2018 +0200

    dbwrap_tdb: Avoid double-call to talloc_get_type_abort
    
    We've already retrieved "ctx" in the callers of db_tdb_fetch_locked_internal().
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 5e4f34e707709ba84be30cd271b10033989b0cbb
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Sep 10 14:53:37 2018 +0200

    smbd: Add some structure protection for durable reconnect
    
    We should consume all data, and the ndr_pull function fills in all
    fields. Thus the ZERO_STRUCT(cookie) is not required.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

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

Summary of changes:
 lib/dbwrap/dbwrap_tdb.c                 |  11 +--
 lib/tevent/doc/tevent_request.dox       |   2 +-
 source3/locking/locking.c               |  32 ++++----
 source3/locking/share_mode_lock.c       | 137 +++++++++++++-------------------
 source3/modules/vfs_streams_xattr.c     |  30 ++++---
 source3/rpc_server/mdssvc/marshalling.c |  22 +++--
 source3/smbd/durable.c                  |   9 ++-
 source3/smbd/files.c                    |  16 ----
 source3/smbd/oplock.c                   |   6 ++
 source3/smbd/proto.h                    |   1 -
 source3/smbd/reply.c                    |  19 ++++-
 11 files changed, 145 insertions(+), 140 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c
index d695f3b..00d283c 100644
--- a/lib/dbwrap/dbwrap_tdb.c
+++ b/lib/dbwrap/dbwrap_tdb.c
@@ -111,10 +111,11 @@ static int db_tdb_fetchlock_parse(TDB_DATA key, TDB_DATA data,
 }
 
 static struct db_record *db_tdb_fetch_locked_internal(
-	struct db_context *db, TALLOC_CTX *mem_ctx, TDB_DATA key)
+	struct db_context *db,
+	struct db_tdb_ctx *ctx,
+	TALLOC_CTX *mem_ctx,
+	TDB_DATA key)
 {
-	struct db_tdb_ctx *ctx = talloc_get_type_abort(db->private_data,
-						       struct db_tdb_ctx);
 	struct tdb_fetch_locked_state state;
 	int ret;
 
@@ -162,7 +163,7 @@ static struct db_record *db_tdb_fetch_locked(
 		DEBUG(3, ("tdb_chainlock failed\n"));
 		return NULL;
 	}
-	return db_tdb_fetch_locked_internal(db, mem_ctx, key);
+	return db_tdb_fetch_locked_internal(db, ctx, mem_ctx, key);
 }
 
 static struct db_record *db_tdb_try_fetch_locked(
@@ -176,7 +177,7 @@ static struct db_record *db_tdb_try_fetch_locked(
 		DEBUG(3, ("tdb_chainlock_nonblock failed\n"));
 		return NULL;
 	}
-	return db_tdb_fetch_locked_internal(db, mem_ctx, key);
+	return db_tdb_fetch_locked_internal(db, ctx, mem_ctx, key);
 }
 
 static NTSTATUS db_tdb_do_locked(struct db_context *db, TDB_DATA key,
diff --git a/lib/tevent/doc/tevent_request.dox b/lib/tevent/doc/tevent_request.dox
index 7fcfb55..e1e45b1 100644
--- a/lib/tevent/doc/tevent_request.dox
+++ b/lib/tevent/doc/tevent_request.dox
@@ -4,7 +4,7 @@
 
 A specific feature of the library is the tevent request API that provides for
 asynchronous computation and allows much more interconnected working and
-cooperation among func- tions and events. When working with tevent request it
+cooperation among functions and events. When working with tevent request it
 is possible to nest one event under another and handle them bit by bit. This
 enables the creation of sequences of steps, and provides an opportunity to
 prepare for all problems which may unexpectedly happen within the different
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 91e32ce..8ee9237 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -879,8 +879,7 @@ struct share_mode_entry *find_share_mode_entry(
 }
 
 /*******************************************************************
- Del the share mode of a file for this process. Return the number of
- entries left.
+ Del the share mode of a file for this process.
 ********************************************************************/
 
 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp)
@@ -998,8 +997,9 @@ NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
 	l = &d->leases[i];
 
 	if (!l->breaking) {
-		DEBUG(1, ("Attempt to break from %d to %d - but we're not in breaking state\n",
-			   (int)l->current_state, (int)new_lease_state));
+		DBG_WARNING("Attempt to break from %"PRIu32" to %"PRIu32" - "
+			    "but we're not in breaking state\n",
+			    l->current_state, new_lease_state);
 		return NT_STATUS_UNSUCCESSFUL;
 	}
 
@@ -1008,9 +1008,10 @@ NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
 	 * must be a strict bitwise superset of new_lease_state
 	 */
 	if ((new_lease_state & l->breaking_to_requested) != new_lease_state) {
-		DEBUG(1, ("Attempt to upgrade from %d to %d - expected %d\n",
-			   (int)l->current_state, (int)new_lease_state,
-			   (int)l->breaking_to_requested));
+		DBG_WARNING("Attempt to upgrade from %"PRIu32" to %"PRIu32" "
+			    "- expected %"PRIu32"\n",
+			    l->current_state, new_lease_state,
+			    l->breaking_to_requested);
 		return NT_STATUS_REQUEST_NOT_ACCEPTED;
 	}
 
@@ -1020,10 +1021,11 @@ NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
 	}
 
 	if ((new_lease_state & ~l->breaking_to_required) != 0) {
-		DEBUG(5, ("lease state %d not fully broken from %d to %d\n",
-			   (int)new_lease_state,
-			   (int)l->current_state,
-			   (int)l->breaking_to_required));
+		DBG_INFO("lease state %"PRIu32" not fully broken from "
+			 "%"PRIu32" to %"PRIu32"\n",
+			 new_lease_state,
+			 l->current_state,
+			 l->breaking_to_required);
 		l->breaking_to_requested = l->breaking_to_required;
 		if (l->current_state & (~SMB2_LEASE_READ)) {
 			/*
@@ -1037,9 +1039,11 @@ NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn,
 		return NT_STATUS_OPLOCK_BREAK_IN_PROGRESS;
 	}
 
-	DEBUG(10, ("breaking from %d to %d - expected %d\n",
-		   (int)l->current_state, (int)new_lease_state,
-		   (int)l->breaking_to_requested));
+	DBG_DEBUG("breaking from %"PRIu32" to %"PRIu32" - "
+		  "expected %"PRIu32"\n",
+		  l->current_state,
+		  new_lease_state,
+		  l->breaking_to_requested);
 
 	l->breaking_to_requested = 0;
 	l->breaking_to_required = 0;
diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c
index 5596dfb..919e74c 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -151,10 +151,10 @@ static void share_mode_memcache_delete(struct share_mode_data *d)
 {
 	const DATA_BLOB key = memcache_key(&d->id);
 
-	DEBUG(10,("deleting entry for file %s seq 0x%llu key %s\n",
-		d->base_name,
-		(unsigned long long) d->sequence_number,
-		file_id_string(talloc_tos(), &d->id)));
+	DBG_DEBUG("deleting entry for file %s seq %"PRIx64" key %s\n",
+		  d->base_name,
+		  d->sequence_number,
+		  file_id_string(talloc_tos(), &d->id));
 
 	memcache_delete(NULL,
 			SHARE_MODE_LOCK_CACHE,
@@ -165,10 +165,10 @@ static void share_mode_memcache_store(struct share_mode_data *d)
 {
 	const DATA_BLOB key = memcache_key(&d->id);
 
-	DEBUG(10,("stored entry for file %s seq 0x%llu key %s\n",
-		d->base_name,
-		(unsigned long long) d->sequence_number,
-		file_id_string(talloc_tos(), &d->id)));
+	DBG_DEBUG("stored entry for file %s seq %"PRIx64" key %s\n",
+		  d->base_name,
+		  d->sequence_number,
+		  file_id_string(talloc_tos(), &d->id));
 
 	/* Ensure everything stored in the cache is pristine. */
 	d->modified = false;
@@ -250,11 +250,11 @@ static struct share_mode_data *share_mode_memcache_fetch(TALLOC_CTX *mem_ctx,
 
 	d = (struct share_mode_data *)ptr;
 	if (d->sequence_number != sequence_number) {
-		DEBUG(10,("seq changed (cached 0x%llu) (new 0x%llu) "
-			"for key %s\n",
-			(unsigned long long)d->sequence_number,
-			(unsigned long long)sequence_number,
-			file_id_string(mem_ctx, &id)));
+		DBG_DEBUG("seq changed (cached %"PRIx64") (new %"PRIx64") "
+			  "for key %s\n",
+			  d->sequence_number,
+			  sequence_number,
+			  file_id_string(mem_ctx, &id));
 		/* Cache out of date. Remove entry. */
 		memcache_delete(NULL,
 			SHARE_MODE_LOCK_CACHE,
@@ -279,10 +279,10 @@ static struct share_mode_data *share_mode_memcache_fetch(TALLOC_CTX *mem_ctx,
 	/* And reset the destructor to none. */
 	talloc_set_destructor(d, NULL);
 
-	DEBUG(10,("fetched entry for file %s seq 0x%llu key %s\n",
-		d->base_name,
-		(unsigned long long)d->sequence_number,
-		file_id_string(mem_ctx, &id)));
+	DBG_DEBUG("fetched entry for file %s seq %"PRIx64" key %s\n",
+		  d->base_name,
+		  d->sequence_number,
+		  file_id_string(mem_ctx, &id));
 
 	return d;
 }
@@ -297,7 +297,6 @@ static struct share_mode_data *parse_share_modes(TALLOC_CTX *mem_ctx,
 {
 	struct share_mode_data *d;
 	enum ndr_err_code ndr_err;
-	uint32_t i;
 	DATA_BLOB blob;
 
 	blob.data = dbuf.dptr;
@@ -323,17 +322,6 @@ static struct share_mode_data *parse_share_modes(TALLOC_CTX *mem_ctx,
 		goto fail;
 	}
 
-	/*
-	 * Initialize the values that are [skip] or [ignore]
-	 * in the idl. The NDR code does not initialize them.
-	 */
-
-	for (i=0; i<d->num_share_modes; i++) {
-		d->share_modes[i].stale = false;
-	}
-	d->modified = false;
-	d->fresh = false;
-
 	if (DEBUGLEVEL >= 10) {
 		DEBUG(10, ("parse_share_modes:\n"));
 		NDR_PRINT_DEBUG(share_mode_data, d);
@@ -560,12 +548,10 @@ static struct share_mode_lock *get_share_mode_lock_internal(
  * talloc_reference.
  */
 static struct share_mode_lock *the_lock;
-static struct file_id the_lock_id;
 
 static int the_lock_destructor(struct share_mode_lock *l)
 {
 	the_lock = NULL;
-	ZERO_STRUCT(the_lock_id);
 	return 0;
 }
 
@@ -595,9 +581,8 @@ struct share_mode_lock *get_share_mode_lock(
 			goto fail;
 		}
 		talloc_set_destructor(the_lock, the_lock_destructor);
-		the_lock_id = id;
 	} else {
-		if (!file_id_equal(&the_lock_id, &id)) {
+		if (!file_id_equal(&the_lock->data->id, &id)) {
 			DEBUG(1, ("Can not lock two share modes "
 				  "simultaneously\n"));
 			goto fail;
@@ -789,7 +774,6 @@ static int share_mode_traverse_fn(struct db_record *rec, void *_state)
 {
 	struct share_mode_forall_state *state =
 		(struct share_mode_forall_state *)_state;
-	uint32_t i;
 	TDB_DATA key;
 	TDB_DATA value;
 	DATA_BLOB blob;
@@ -822,10 +806,6 @@ static int share_mode_traverse_fn(struct db_record *rec, void *_state)
 		return 0;
 	}
 
-	for (i=0; i<d->num_share_modes; i++) {
-		d->share_modes[i].stale = false;
-	}
-
 	if (DEBUGLEVEL > 10) {
 		DEBUG(11, ("parse_share_modes:\n"));
 		NDR_PRINT_DEBUG(share_mode_data, d);
@@ -948,21 +928,20 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
 			goto done;
 		}
 		if (open_persistent_id != entry->share_file_id) {
-			DEBUG(5, ("share_mode_cleanup_disconnected: "
-				  "entry for file "
-				  "(file-id='%s', servicepath='%s', "
-				  "base_name='%s%s%s') "
-				  "has share_file_id %llu but expected %llu"
-				  "==> do not cleanup\n",
-				  file_id_string(frame, &fid),
-				  data->servicepath,
-				  data->base_name,
-				  (data->stream_name == NULL)
-				  ? "" : "', stream_name='",
-				  (data->stream_name == NULL)
-				  ? "" : data->stream_name,
-				  (unsigned long long)entry->share_file_id,
-				  (unsigned long long)open_persistent_id));
+			DBG_INFO("entry for file "
+				 "(file-id='%s', servicepath='%s', "
+				 "base_name='%s%s%s') "
+				 "has share_file_id %"PRIu64" but expected "
+				 "%"PRIu64"==> do not cleanup\n",
+				 file_id_string(frame, &fid),
+				 data->servicepath,
+				 data->base_name,
+				 (data->stream_name == NULL)
+				 ? "" : "', stream_name='",
+				 (data->stream_name == NULL)
+				 ? "" : data->stream_name,
+				 entry->share_file_id,
+				 open_persistent_id);
 			goto done;
 		}
 	}
@@ -979,36 +958,34 @@ bool share_mode_cleanup_disconnected(struct file_id fid,
 
 	ok = brl_cleanup_disconnected(fid, open_persistent_id);
 	if (!ok) {
-		DEBUG(10, ("share_mode_cleanup_disconnected: "
-			   "failed to clean up byte range locks associated "
-			   "with file (file-id='%s', servicepath='%s', "
-			   "base_name='%s%s%s') and open_persistent_id %llu "
-			   "==> do not cleanup\n",
-			   file_id_string(frame, &fid),
-			   data->servicepath,
-			   data->base_name,
-			   (data->stream_name == NULL)
-			   ? "" : "', stream_name='",
-			   (data->stream_name == NULL)
-			   ? "" : data->stream_name,
-			   (unsigned long long)open_persistent_id));
+		DBG_DEBUG("failed to clean up byte range locks associated "
+			  "with file (file-id='%s', servicepath='%s', "
+			  "base_name='%s%s%s') and open_persistent_id %"PRIu64" "
+			  "==> do not cleanup\n",
+			  file_id_string(frame, &fid),
+			  data->servicepath,
+			  data->base_name,
+			  (data->stream_name == NULL)
+			  ? "" : "', stream_name='",
+			  (data->stream_name == NULL)
+			  ? "" : data->stream_name,
+			  open_persistent_id);
 		goto done;
 	}
 
-	DEBUG(10, ("share_mode_cleanup_disconnected: "
-		   "cleaning up %u entries for file "
-		   "(file-id='%s', servicepath='%s', "
-		   "base_name='%s%s%s') "
-		   "from open_persistent_id %llu\n",
-		   data->num_share_modes,
-		   file_id_string(frame, &fid),
-		   data->servicepath,
-		   data->base_name,
-		   (data->stream_name == NULL)
-		   ? "" : "', stream_name='",
-		   (data->stream_name == NULL)
-		   ? "" : data->stream_name,
-		   (unsigned long long)open_persistent_id));
+	DBG_DEBUG("cleaning up %u entries for file "
+		  "(file-id='%s', servicepath='%s', "
+		  "base_name='%s%s%s') "
+		  "from open_persistent_id %"PRIu64"\n",
+		  data->num_share_modes,
+		  file_id_string(frame, &fid),
+		  data->servicepath,
+		  data->base_name,
+		  (data->stream_name == NULL)
+		  ? "" : "', stream_name='",
+		  (data->stream_name == NULL)
+		  ? "" : data->stream_name,
+		  open_persistent_id);
 
 	data->num_share_modes = 0;
 	data->num_leases = 0;
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 8714007..30459fe 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -190,16 +190,21 @@ static bool streams_xattr_recheck(struct stream_io *sio)
 	TALLOC_FREE(sio->base);
 	sio->xattr_name = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp),
 					xattr_name);
-        sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp),
-                                  sio->fsp->fsp_name->base_name);
-	sio->fsp_name_ptr = sio->fsp->fsp_name;
-
+	if (sio->xattr_name == NULL) {
+		DBG_DEBUG("sio->xattr_name==NULL\n");
+		return false;
+	}
 	TALLOC_FREE(xattr_name);
 
-	if ((sio->xattr_name == NULL) || (sio->base == NULL)) {
+	sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp),
+				  sio->fsp->fsp_name->base_name);
+	if (sio->base == NULL) {
+		DBG_DEBUG("sio->base==NULL\n");
 		return false;
 	}
 
+	sio->fsp_name_ptr = sio->fsp->fsp_name;
+
 	return true;
 }
 
@@ -503,6 +508,11 @@ static int streams_xattr_open(vfs_handle_struct *handle,
 
         sio->xattr_name = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle, fsp),
 					xattr_name);
+	if (sio->xattr_name == NULL) {
+		errno = ENOMEM;
+		goto fail;
+	}
+
 	/*
 	 * so->base needs to be a copy of fsp->fsp_name->base_name,
 	 * making it identical to streams_xattr_recheck(). If the
@@ -512,15 +522,15 @@ static int streams_xattr_open(vfs_handle_struct *handle,
 	 */
         sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(handle, fsp),
 				  fsp->fsp_name->base_name);
-	sio->fsp_name_ptr = fsp->fsp_name;
-	sio->handle = handle;
-	sio->fsp = fsp;
-
-	if ((sio->xattr_name == NULL) || (sio->base == NULL)) {
+	if (sio->base == NULL) {
 		errno = ENOMEM;
 		goto fail;
 	}
 
+	sio->fsp_name_ptr = fsp->fsp_name;
+	sio->handle = handle;
+	sio->fsp = fsp;
+
 	return fakefd;
 
  fail:
diff --git a/source3/rpc_server/mdssvc/marshalling.c b/source3/rpc_server/mdssvc/marshalling.c
index 976702c..b5931c7 100644
--- a/source3/rpc_server/mdssvc/marshalling.c
+++ b/source3/rpc_server/mdssvc/marshalling.c
@@ -1057,11 +1057,10 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
 {
 	int i, toc_index, subcount;
 	uint64_t result;
-	sl_nil_t nil;
-	sl_bool_t b;
-	struct sl_tag tag, cpx_tag;
 
 	while (count > 0) {
+		struct sl_tag tag;
+
 		if (offset >= toc_offset) {
 			return -1;
 		}
@@ -1072,7 +1071,9 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
 		}
 
 		switch (tag.type) {
-		case SQ_TYPE_COMPLEX:
+		case SQ_TYPE_COMPLEX: {
+			struct sl_tag cpx_tag;
+
 			if (tag.count < 1) {
 				DEBUG(1,("%s: invalid tag.count: %d\n",
 					 __func__, tag.count));
@@ -1102,13 +1103,15 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
 			 */
 			count--;
 			break;
+		}
+
+		case SQ_TYPE_NULL: {
+			sl_nil_t nil = 0;
 
-		case SQ_TYPE_NULL:
 			subcount = tag.count;
 			if (subcount > count) {
 				return -1;
 			}
-			nil = 0;
 			for (i = 0; i < subcount; i++) {
 				result = dalloc_add_copy(query, &nil, sl_nil_t);
 				if (result != 0) {
@@ -1118,9 +1121,11 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
 			offset += tag.size;
 			count -= subcount;
 			break;
+		}
+
+		case SQ_TYPE_BOOL: {
+			sl_bool_t b = (tag.count != 0);
 
-		case SQ_TYPE_BOOL:
-			b = tag.count != 0 ? true : false;
 			result = dalloc_add_copy(query, &b, sl_bool_t);
 			if (result != 0) {
 				return -1;
@@ -1128,6 +1133,7 @@ static ssize_t sl_unpack_loop(DALLOC_CTX *query,
 			offset += tag.size;
 			count--;
 			break;
+		}
 
 		case SQ_TYPE_INT64:
 			subcount = sl_unpack_ints(query, buf, offset, bufsize, encoding);
diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c
index 80392e2..1f6113e 100644
--- a/source3/smbd/durable.c
+++ b/source3/smbd/durable.c
@@ -546,10 +546,11 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
 	 * call below.
 	 */
 
-	ZERO_STRUCT(cookie);
-
-	ndr_err = ndr_pull_struct_blob(&old_cookie, talloc_tos(), &cookie,
-			(ndr_pull_flags_fn_t)ndr_pull_vfs_default_durable_cookie);
+	ndr_err = ndr_pull_struct_blob_all(


-- 
Samba Shared Repository



More information about the samba-cvs mailing list