[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Wed Mar 2 00:05:04 UTC 2016


The branch, master has been updated
       via  6af7ebf passdb: Avoid a "ret == true"
       via  bebd35f netlogon_creds_cli: use dbwrap_purge instead of dbwrap_delete where appropriate
       via  8f158ba s3:registry: use dbwrap_purge_bystring instead of dbwrap_delete_bystring
       via  366b51a dbwrap: add dbwrap_purge[_bystring]
       via  d4408c4 dbwrap_util: improve a debug message in dbwrap_delete_action()
      from  1570ae0 lib: Fix 1354521 Unchecked return value

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


- Log -----------------------------------------------------------------
commit 6af7ebf3364f274e3ae7d4cd818e51424100b6d4
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Mar 1 16:57:45 2016 +0100

    passdb: Avoid a "ret == true"
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Wed Mar  2 01:04:14 CET 2016 on sn-devel-144

commit bebd35f439229b9363dfc2f4ae5744103ba80740
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 25 16:15:04 2016 +0100

    netlogon_creds_cli: use dbwrap_purge instead of dbwrap_delete where appropriate
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 8f158bab9f8dbdbdb460258a08a15d0d6c41cbac
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 25 00:58:50 2016 +0100

    s3:registry: use dbwrap_purge_bystring instead of dbwrap_delete_bystring
    
    where appropriate
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 366b51a8ff30132185ff126e2cdd51801b07e6f4
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 25 00:56:14 2016 +0100

    dbwrap: add dbwrap_purge[_bystring]
    
    Variants of dbrwap_delete[_bysrting] that treats NOT FOUND
    as success.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit d4408c495be851c684e7b4b5ff56e5eb82f16c06
Author: Michael Adam <obnox at samba.org>
Date:   Thu Feb 25 16:02:36 2016 +0100

    dbwrap_util: improve a debug message in dbwrap_delete_action()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

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

Summary of changes:
 lib/dbwrap/dbwrap.h               |  2 ++
 lib/dbwrap/dbwrap_util.c          | 20 +++++++++++++++++++-
 libcli/auth/netlogon_creds_cli.c  | 14 ++++----------
 source3/passdb/pdb_interface.c    |  2 +-
 source3/registry/reg_backend_db.c |  7 +------
 5 files changed, 27 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h
index 5e13a59..2eded04 100644
--- a/lib/dbwrap/dbwrap.h
+++ b/lib/dbwrap/dbwrap.h
@@ -94,6 +94,8 @@ const char *dbwrap_name(struct db_context *db);
 
 /* The following definitions come from lib/dbwrap_util.c  */
 
+NTSTATUS dbwrap_purge(struct db_context *db, TDB_DATA key);
+NTSTATUS dbwrap_purge_bystring(struct db_context *db, const char *key);
 NTSTATUS dbwrap_delete_bystring(struct db_context *db, const char *key);
 NTSTATUS dbwrap_store_bystring(struct db_context *db, const char *key,
 			       TDB_DATA data, int flags);
diff --git a/lib/dbwrap/dbwrap_util.c b/lib/dbwrap/dbwrap_util.c
index 901ef56..22f910d 100644
--- a/lib/dbwrap/dbwrap_util.c
+++ b/lib/dbwrap/dbwrap_util.c
@@ -412,7 +412,8 @@ static NTSTATUS dbwrap_delete_action(struct db_context * db, void *private_data)
 
 	status = dbwrap_record_delete(rec);
 	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(5, ("delete_rec returned %s\n", nt_errstr(status)));
+		DBG_INFO("dbwrap_record_delete returned %s\n",
+			 nt_errstr(status));
 	}
 
 	talloc_free(rec);
@@ -527,6 +528,23 @@ NTSTATUS dbwrap_trans_traverse(struct db_context *db,
 	return dbwrap_trans_do(db, dbwrap_trans_traverse_action, &ctx);
 }
 
+NTSTATUS dbwrap_purge(struct db_context *db, TDB_DATA key)
+{
+	NTSTATUS status;
+
+	status = dbwrap_delete(db, key);
+	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
+		status = NT_STATUS_OK;
+	}
+
+	return status;
+}
+
+NTSTATUS dbwrap_purge_bystring(struct db_context *db, const char *key)
+{
+	return dbwrap_purge(db, string_term_tdb_data(key));
+}
+
 NTSTATUS dbwrap_delete_bystring(struct db_context *db, const char *key)
 {
 	return dbwrap_delete(db, string_term_tdb_data(key));
diff --git a/libcli/auth/netlogon_creds_cli.c b/libcli/auth/netlogon_creds_cli.c
index 7c867cf..38b1351 100644
--- a/libcli/auth/netlogon_creds_cli.c
+++ b/libcli/auth/netlogon_creds_cli.c
@@ -1031,11 +1031,8 @@ struct tevent_req *netlogon_creds_cli_auth_send(TALLOC_CTX *mem_ctx,
 		return req;
 	}
 
-	status = dbwrap_delete(state->context->db.ctx,
-			       state->context->db.key_data);
-	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
-		status = NT_STATUS_OK;
-	}
+	status = dbwrap_purge(state->context->db.ctx,
+			      state->context->db.key_data);
 	if (tevent_req_nterror(req, status)) {
 		return tevent_req_post(req, ev);
 	}
@@ -1065,11 +1062,8 @@ static void netlogon_creds_cli_auth_locked(struct tevent_req *subreq)
 	}
 	state->locked_state->is_glocked = true;
 
-	status = dbwrap_delete(state->context->db.ctx,
-			       state->context->db.key_data);
-	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
-		status = NT_STATUS_OK;
-	}
+	status = dbwrap_purge(state->context->db.ctx,
+			      state->context->db.key_data);
 	if (tevent_req_nterror(req, status)) {
 		return;
 	}
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index d67e04e..6b6b106 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -1219,7 +1219,7 @@ bool pdb_id_to_sid(struct unixid *id, struct dom_sid *sid)
 
 	ret = pdb->id_to_sid(pdb, id, sid);
 
-	if (ret == true) {
+	if (ret) {
 		idmap_cache_set_sid2unixid(sid, id);
 	}
 
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 7b3391d..bdfe7d2 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -966,12 +966,7 @@ static WERROR regdb_delete_key_with_prefix(struct db_context *db,
 		goto done;
 	}
 
-	werr = ntstatus_to_werror(dbwrap_delete_bystring(db, path));
-
-	/* treat "not found" as ok */
-	if (W_ERROR_EQUAL(werr, WERR_NOT_FOUND)) {
-		werr = WERR_OK;
-	}
+	werr = ntstatus_to_werror(dbwrap_purge_bystring(db, path));
 
 done:
 	talloc_free(mem_ctx);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list