[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Oct 21 20:28:03 UTC 2020


The branch, master has been updated
       via  a01dfc29c1f lib: Add tevent_req_received() to messaging_filtered_read_recv()
       via  d845e90e0e3 libsmb: Simplify cli_resolve_path()
       via  d93e0f09786 libsmb: Factor out cli_conn_have_dfs() from cli_resolve_path()
       via  f05020df6b8 includes: nt_printing.h does not need client.h
       via  4ad0e4d210b libsmb: Fix a typo
       via  7ce22e2f574 libsmb: Use a direct struct initialization to avoid a memset
       via  41c78d1888b libsmb: Use ZERO_STRUCTP
       via  8a61f0eb2b5 libsmb: Use "struct" in self-references
       via  1cca034c7ec smbcacls: Use direct struct initialization
       via  f11ef354d27 smbcacls: Use ISDOT[DOT] instead of strequal
       via  2ae42bebe38 libcli: Align integer types
       via  ad7e2cf6260 smbd: Modernize DBG statements in notify_msg.c
       via  c71d52b9f5e notifyd: Modernize DBG statements
       via  051967d9435 smbd: Remove an unused anonymous struct definition
       via  b64949d544e libsmb: Fix a typo
       via  ac20617c87b smbd: Fix a typo
      from  7223f6453b1 s4:dsdb:acl_read: Implement "List Object" mode feature

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


- Log -----------------------------------------------------------------
commit a01dfc29c1f5e7ebc34d5e0e5db725ab9c4a0393
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Oct 15 16:31:46 2020 +0200

    lib: Add tevent_req_received() to messaging_filtered_read_recv()
    
    Early talloc_free() for the msg_rec if it's not picked up
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Oct 21 20:27:57 UTC 2020 on sn-devel-184

commit d845e90e0e30d6a0fcee320abf2e8dc49951acff
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 14 07:09:13 2020 +0200

    libsmb: Simplify cli_resolve_path()
    
    The additional conditions in cli_dfs_check_error() were covered
    earlier in cli_resolve_path() via cli_conn_have_dfs(). Without those
    it's more obvious to directly call NT_STATUS_EQUAL here.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d93e0f0978685f4d2b133a470345888105ce29a5
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Oct 14 07:06:15 2020 +0200

    libsmb: Factor out cli_conn_have_dfs() from cli_resolve_path()
    
    This also does the checks from cli_dfs_check_error(), which can be
    removed in the next step.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f05020df6b854632b3727ccce2dc0828e0627993
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 18 18:31:17 2020 +0200

    includes: nt_printing.h does not need client.h
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4ad0e4d210b4be59195d73760f31e07c38b71a3f
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 18 17:40:30 2020 +0200

    libsmb: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7ce22e2f57489bff26bb1e5e379d5081d46710f2
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 18 22:43:41 2020 +0200

    libsmb: Use a direct struct initialization to avoid a memset
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 41c78d1888b059db12c5116b23fc300c69c0e535
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 18 22:43:24 2020 +0200

    libsmb: Use ZERO_STRUCTP
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8a61f0eb2b5e9ed3f589eb8a35562036888ca00e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Oct 18 22:42:39 2020 +0200

    libsmb: Use "struct" in self-references
    
    Don't go via the typedefs for next and prev pointers
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1cca034c7ece4c9e4ccd8664beaacc35620fa2c6
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 20 09:24:06 2020 +0200

    smbcacls: Use direct struct initialization
    
    Use implicit NULL/false initialization
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f11ef354d274d10c2931856c1c8c6d5a42521465
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 20 09:07:29 2020 +0200

    smbcacls: Use ISDOT[DOT] instead of strequal
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2ae42bebe388e8a5871e04a46c3bb70768a30f3d
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Oct 16 14:21:16 2020 +0200

    libcli: Align integer types
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ad7e2cf6260efa99f0fdbebdb03165c79af13afc
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Oct 16 14:01:54 2020 +0200

    smbd: Modernize DBG statements in notify_msg.c
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c71d52b9f5e84fb0b5383c2d49aaf9244c95fd72
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 6 17:04:05 2020 +0200

    notifyd: Modernize DBG statements
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 051967d9435b3f6ae1e40ed8aa98f55de9439238
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 13 13:02:27 2020 +0200

    smbd: Remove an unused anonymous struct definition
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b64949d544ec02ec7de9087c3316476f35b6e30f
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 13 08:49:45 2020 +0200

    libsmb: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ac20617c87bfa29fb163cc0a434ff82fd1215441
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 13 11:38:49 2020 +0200

    smbd: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 source3/include/libsmb_internal.h        |   4 +-
 source3/include/nt_printing.h            |   1 -
 source3/include/smb.h                    |   1 -
 source3/lib/messages.c                   |   1 +
 source3/libsmb/clidfs.c                  |  67 +++++-----
 source3/libsmb/clifile.c                 |   3 +-
 source3/libsmb/libsmb_stat.c             |   2 +-
 source3/smbd/files.c                     |   2 +-
 source3/smbd/notify_msg.c                |  54 ++++----
 source3/smbd/notifyd/notifyd.c           | 218 +++++++++++++++----------------
 source3/utils/smbcacls.c                 |  19 ++-
 source4/libcli/smb_composite/appendacl.c |   2 +-
 12 files changed, 185 insertions(+), 189 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index ba9936a0eba..8ab427a9f63 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -81,7 +81,7 @@ struct _SMBCSRV {
         struct policy_handle pol;
 	time_t last_echo_time;
 
-	SMBCSRV *next, *prev;
+	struct _SMBCSRV *next, *prev;
 };
 
 /*
@@ -116,7 +116,7 @@ struct _SMBCFILE {
 	struct smbc_dirplus_list *dirplus_list, *dirplus_end, *dirplus_next;
 	int dir_type, dir_error;
 
-	SMBCFILE *next, *prev;
+	struct _SMBCFILE *next, *prev;
 };
 
 
diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h
index bd94821a29c..7af43eb5c6f 100644
--- a/source3/include/nt_printing.h
+++ b/source3/include/nt_printing.h
@@ -22,7 +22,6 @@
 #ifndef NT_PRINTING_H_
 #define NT_PRINTING_H_
 
-#include "client.h"
 #include "../librpc/gen_ndr/spoolss.h"
 
 #ifndef SAMBA_PRINTER_PORT_NAME
diff --git a/source3/include/smb.h b/source3/include/smb.h
index b871b0f80ab..b703dc5d8f3 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -134,7 +134,6 @@ struct notify_mid_map;
 struct notify_db_entry;
 struct notify_event;
 struct notify_change_request;
-struct sys_notify_backend;
 struct sys_notify_context {
 	struct tevent_context *ev;
 	void *private_data; 	/* For use by the system backend */
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index c63b027c617..b63e277115f 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -1163,6 +1163,7 @@ int messaging_filtered_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
 	if (presult != NULL) {
 		*presult = talloc_move(mem_ctx, &state->rec);
 	}
+	tevent_req_received(req);
 	return 0;
 }
 
diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
index ee5becf76a6..081de18ac76 100644
--- a/source3/libsmb/clidfs.c
+++ b/source3/libsmb/clidfs.c
@@ -603,27 +603,6 @@ static char *cli_dfs_make_full_path(TALLOC_CTX *ctx,
 			dir);
 }
 
-/********************************************************************
- check for dfs referral
-********************************************************************/
-
-static bool cli_dfs_check_error(struct cli_state *cli, NTSTATUS expected,
-				NTSTATUS status)
-{
-	/* only deal with DS when we negotiated NT_STATUS codes and UNICODE */
-
-	if (!(smbXcli_conn_use_unicode(cli->conn))) {
-		return false;
-	}
-	if (!(smb1cli_conn_capabilities(cli->conn) & CAP_STATUS32)) {
-		return false;
-	}
-	if (NT_STATUS_EQUAL(status, expected)) {
-		return true;
-	}
-	return false;
-}
-
 /********************************************************************
  Get the dfs referral link.
 ********************************************************************/
@@ -840,6 +819,31 @@ NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx,
 				consumed);
 }
 
+static bool cli_conn_have_dfs(struct cli_state *cli)
+{
+	struct smbXcli_conn *conn = cli->conn;
+	struct smbXcli_tcon *tcon = NULL;
+	bool ok;
+
+	if (smbXcli_conn_protocol(conn) < PROTOCOL_SMB2_02) {
+		uint32_t capabilities = smb1cli_conn_capabilities(conn);
+
+		if ((capabilities & CAP_STATUS32) == 0) {
+			return false;
+		}
+		if ((capabilities & CAP_UNICODE) == 0) {
+			return false;
+		}
+
+		tcon = cli->smb1.tcon;
+	} else {
+		tcon = cli->smb2.tcon;
+	}
+
+	ok = smbXcli_tcon_is_dfs_share(tcon);
+	return ok;
+}
+
 /********************************************************************
 ********************************************************************/
 struct cli_dfs_path_split {
@@ -873,22 +877,14 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 	SMB_STRUCT_STAT sbuf;
 	uint32_t attributes;
 	NTSTATUS status;
-	struct smbXcli_tcon *root_tcon = NULL;
 	struct smbXcli_tcon *target_tcon = NULL;
 	struct cli_dfs_path_split *dfs_refs = NULL;
+	bool ok;
 
 	if ( !rootcli || !path || !targetcli ) {
 		return NT_STATUS_INVALID_PARAMETER;
 	}
 
-	/* Don't do anything if this is not a DFS root. */
-
-	if (smbXcli_conn_protocol(rootcli->conn) >= PROTOCOL_SMB2_02) {
-		root_tcon = rootcli->smb2.tcon;
-	} else {
-		root_tcon = rootcli->smb1.tcon;
-	}
-
 	/*
 	 * Avoid more than one leading directory separator
 	 */
@@ -896,7 +892,8 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 		path++;
 	}
 
-	if (!smbXcli_tcon_is_dfs_share(root_tcon)) {
+	ok = cli_conn_have_dfs(rootcli);
+	if (!ok) {
 		*targetcli = rootcli;
 		*pp_targetpath = talloc_strdup(ctx, path);
 		if (!*pp_targetpath) {
@@ -932,8 +929,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 
 	/* Special case where client asked for a path that does not exist */
 
-	if (cli_dfs_check_error(rootcli, NT_STATUS_OBJECT_NAME_NOT_FOUND,
-				status)) {
+	if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
 		*targetcli = rootcli;
 		*pp_targetpath = talloc_strdup(ctx, path);
 		if (!*pp_targetpath) {
@@ -944,8 +940,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 
 	/* We got an error, check for DFS referral. */
 
-	if (!cli_dfs_check_error(rootcli, NT_STATUS_PATH_NOT_COVERED,
-				 status)) {
+	if (!NT_STATUS_EQUAL(status, NT_STATUS_PATH_NOT_COVERED)) {
 		return status;
 	}
 
@@ -1057,7 +1052,7 @@ NTSTATUS cli_resolve_path(TALLOC_CTX *ctx,
 
 	if (extrapath && strlen(extrapath) > 0) {
 		/* EMC Celerra NAS version 5.6.50 (at least) doesn't appear to */
-		/* put the trailing \ on the path, so to be save we put one in if needed */
+		/* put the trailing \ on the path, so to be safe we put one in if needed */
 		if (extrapath[strlen(extrapath)-1] != '\\' && **pp_targetpath != '\\') {
 			*pp_targetpath = talloc_asprintf(ctx,
 						  "%s\\%s",
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 42b964dbabe..6f6ede24152 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -5205,7 +5205,7 @@ NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
 			 const char *ea_name, const char *ea_val,
 			 size_t ea_len)
 {
-	uint8_t param[6];
+	uint8_t param[6] = { 0, };
 
 	if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
 		return cli_smb2_set_ea_fnum(cli,
@@ -5215,7 +5215,6 @@ NTSTATUS cli_set_ea_fnum(struct cli_state *cli, uint16_t fnum,
 					ea_len);
 	}
 
-	memset(param, 0, 6);
 	SSVAL(param,0,fnum);
 	SSVAL(param,2,SMB_INFO_SET_EA);
 
diff --git a/source3/libsmb/libsmb_stat.c b/source3/libsmb/libsmb_stat.c
index de3ca530cd0..136f3dddcc9 100644
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -414,7 +414,7 @@ SMBC_fstatvfs_ctx(SMBCCTX *context,
 	}
 
         /* Initialize all fields (at least until we actually use them) */
-        memset(st, 0, sizeof(*st));
+	ZERO_STRUCTP(st);
 
         /*
          * The state of each flag is such that the same bits are unset as
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 999100a9e6c..d7def972d0e 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -876,7 +876,7 @@ size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen)
 	/*
 	 * Don't pass NULL buffer to snprintf (to satisfy static checker)
 	 * Some callers will call this function with NULL for buf and
-	 * 0 for buflen in order to get length of fullbasepatch (without
+	 * 0 for buflen in order to get length of fullbasepath (without
 	 * needing to allocate or write to buf)
 	 */
 	if (buf == NULL) {
diff --git a/source3/smbd/notify_msg.c b/source3/smbd/notify_msg.c
index ff38b964914..7238cff6828 100644
--- a/source3/smbd/notify_msg.c
+++ b/source3/smbd/notify_msg.c
@@ -69,7 +69,7 @@ struct notify_context *notify_init(
 	names_db = messaging_names_db(msg);
 	if (!server_id_db_lookup_one(names_db, "notify-daemon",
 				     &ctx->notifyd)) {
-		DEBUG(1, ("No notify daemon around\n"));
+		DBG_WARNING("No notify daemon around\n");
 		TALLOC_FREE(ctx);
 		return NULL;
 	}
@@ -84,8 +84,8 @@ struct notify_context *notify_init(
 		status = messaging_register(msg, ctx, MSG_PVFS_NOTIFY,
 					    notify_handler);
 		if (!NT_STATUS_IS_OK(status)) {
-			DEBUG(1, ("messaging_register failed: %s\n",
-				  nt_errstr(status)));
+			DBG_WARNING("messaging_register failed: %s\n",
+				    nt_errstr(status));
 			TALLOC_FREE(ctx);
 			return NULL;
 		}
@@ -115,11 +115,11 @@ static void notify_handler(struct messaging_context *msg, void *private_data,
 	struct notify_event event;
 
 	if (data->length < offsetof(struct notify_event_msg, path) + 1) {
-		DEBUG(1, ("message too short: %u\n", (unsigned)data->length));
+		DBG_WARNING("message too short: %zu\n", data->length);
 		return;
 	}
 	if (data->data[data->length-1] != 0) {
-		DEBUG(1, ("%s: path not 0-terminated\n", __func__));
+		DBG_WARNING("path not 0-terminated\n");
 		return;
 	}
 
@@ -129,9 +129,11 @@ static void notify_handler(struct messaging_context *msg, void *private_data,
 	event.path = event_msg->path;
 	event.private_data = event_msg->private_data;
 
-	DEBUG(10, ("%s: Got notify_event action=%u, private_data=%p, "
-		   "path=%s\n", __func__, (unsigned)event.action,
-		   event.private_data, event.path));
+	DBG_DEBUG("Got notify_event action=%"PRIu32", private_data=%p, "
+		   "path=%s\n",
+		  event.action,
+		  event.private_data,
+		  event.path);
 
 	ctx->callback(ctx->sconn, event.private_data, event_msg->when, &event);
 }
@@ -149,9 +151,12 @@ NTSTATUS notify_add(struct notify_context *ctx,
 		return NT_STATUS_NOT_IMPLEMENTED;
 	}
 
-	DEBUG(10, ("%s: path=[%s], filter=%u, subdir_filter=%u, "
-		   "private_data=%p\n", __func__, path, (unsigned)filter,
-		   (unsigned)subdir_filter, private_data));
+	DBG_DEBUG("path=[%s], filter=%"PRIu32", subdir_filter=%"PRIu32", "
+		  "private_data=%p\n",
+		  path,
+		  filter,
+		  subdir_filter,
+		  private_data);
 
 	pathlen = strlen(path)+1;
 
@@ -170,8 +175,8 @@ NTSTATUS notify_add(struct notify_context *ctx,
 		iov, ARRAY_SIZE(iov), NULL, 0);
 
 	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(10, ("messaging_send_iov returned %s\n",
-			   nt_errstr(status)));
+		DBG_DEBUG("messaging_send_iov returned %s\n",
+			  nt_errstr(status));
 		return status;
 	}
 
@@ -212,9 +217,12 @@ void notify_trigger(struct notify_context *ctx,
 	struct iovec iov[4];
 	char slash = '/';
 
-	DEBUG(10, ("notify_trigger called action=0x%x, filter=0x%x, "
-		   "dir=%s, name=%s\n", (unsigned)action, (unsigned)filter,
-		   dir, name));
+	DBG_DEBUG("notify_trigger called action=0x%"PRIx32", "
+		  "filter=0x%"PRIx32", dir=%s, name=%s\n",
+		  action,
+		  filter,
+		  dir,
+		  name);
 
 	if (ctx == NULL) {
 		return;
@@ -272,23 +280,23 @@ NTSTATUS notify_walk(struct notify_context *notify,
 	status = messaging_send_buf(notify->msg_ctx, notify->notifyd,
 				    MSG_SMB_NOTIFY_GET_DB, NULL, 0);
 	if (!NT_STATUS_IS_OK(status)) {
-		DEBUG(10, ("%s: messaging_send_buf failed\n",
-			   nt_errstr(status)));
+		DBG_DEBUG("messaging_send_buf failed: %s\n",
+			  nt_errstr(status));
 		TALLOC_FREE(ev);
 		return status;
 	}
 
 	ok = tevent_req_poll(req, ev);
 	if (!ok) {
-		DEBUG(10, ("%s: tevent_req_poll failed\n", __func__));
+		DBG_DEBUG("tevent_req_poll failed\n");
 		TALLOC_FREE(ev);
 		return NT_STATUS_INTERNAL_ERROR;
 	}
 
 	ret = messaging_read_recv(req, ev, &rec);
 	if (ret != 0) {
-		DEBUG(10, ("%s: messaging_read_recv failed: %s\n",
-			   __func__, strerror(ret)));
+		DBG_DEBUG("messaging_read_recv failed: %s\n",
+			  strerror(ret));
 		TALLOC_FREE(ev);
 		return map_nt_error_from_unix(ret);
 	}
@@ -296,8 +304,8 @@ NTSTATUS notify_walk(struct notify_context *notify,
 	ret = notifyd_parse_db(rec->buf.data, rec->buf.length, &log_idx,
 			       fn, private_data);
 	if (ret != 0) {
-		DEBUG(10, ("%s: notifyd_parse_db failed: %s\n",
-			   __func__, strerror(ret)));
+		DBG_DEBUG("notifyd_parse_db failed: %s\n",
+			  strerror(ret));
 		TALLOC_FREE(ev);
 		return map_nt_error_from_unix(ret);
 	}
diff --git a/source3/smbd/notifyd/notifyd.c b/source3/smbd/notifyd/notifyd.c
index 6ff1de5b5fe..ba030fa1ecc 100644
--- a/source3/smbd/notifyd/notifyd.c
+++ b/source3/smbd/notifyd/notifyd.c
@@ -243,8 +243,8 @@ struct tevent_req *notifyd_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 
 	ret = server_id_db_set_exclusive(names_db, "notify-daemon");
 	if (ret != 0) {
-		DEBUG(10, ("%s: server_id_db_add failed: %s\n",
-			   __func__, strerror(ret)));
+		DBG_DEBUG("server_id_db_add failed: %s\n",
+			  strerror(ret));
 		tevent_req_error(req, ret);
 		goto deregister_get_db;
 	}
@@ -351,8 +351,7 @@ static bool notifyd_parse_entry(uint8_t *buf, size_t buflen,
 				size_t *num_instances)
 {
 	if ((buflen % sizeof(struct notifyd_instance)) != 0) {
-		DEBUG(1, ("%s: invalid buffer size: %u\n",
-			  __func__, (unsigned)buflen));
+		DBG_WARNING("invalid buffer size: %zu\n", buflen);
 		return false;
 	}
 
@@ -384,25 +383,27 @@ static bool notifyd_apply_rec_change(
 	bool ok = false;
 
 	if (pathlen == 0) {
-		DEBUG(1, ("%s: pathlen==0\n", __func__));
+		DBG_WARNING("pathlen==0\n");
 		return false;
 	}
 	if (path[pathlen-1] != '\0') {
-		DEBUG(1, ("%s: path not 0-terminated\n", __func__));
+		DBG_WARNING("path not 0-terminated\n");
 		return false;
 	}
 
-	DEBUG(10, ("%s: path=%s, filter=%u, subdir_filter=%u, "
-		   "private_data=%p\n", __func__, path,
-		   (unsigned)chg->filter, (unsigned)chg->subdir_filter,
-		   chg->private_data));
+	DBG_DEBUG("path=%s, filter=%"PRIu32", subdir_filter=%"PRIu32", "
+		  "private_data=%p\n",
+		  path,
+		  chg->filter,
+		  chg->subdir_filter,
+		  chg->private_data);
 
 	rec = dbwrap_fetch_locked(
 		entries, entries,
 		make_tdb_data((const uint8_t *)path, pathlen-1));
 
 	if (rec == NULL) {
-		DEBUG(1, ("%s: dbwrap_fetch_locked failed\n", __func__));
+		DBG_WARNING("dbwrap_fetch_locked failed\n");
 		goto fail;
 	}
 
@@ -422,7 +423,7 @@ static bool notifyd_apply_rec_change(
 	instances = talloc_array(rec, struct notifyd_instance,
 				 num_instances + 1);
 	if (instances == NULL) {
-		DEBUG(1, ("%s: talloc failed\n", __func__));
+		DBG_WARNING("talloc failed\n");
 		goto fail;
 	}
 
@@ -482,14 +483,13 @@ static bool notifyd_apply_rec_change(
 		num_instances -= 1;
 	}
 
-	DEBUG(10, ("%s: %s has %u instances\n", __func__,
-		   path, (unsigned)num_instances));
+	DBG_DEBUG("%s has %zu instances\n", path, num_instances);
 
 	if (num_instances == 0) {
 		status = dbwrap_record_delete(rec);
 		if (!NT_STATUS_IS_OK(status)) {
-			DEBUG(1, ("%s: dbwrap_record_delete returned %s\n",
-				  __func__, nt_errstr(status)));
+			DBG_WARNING("dbwrap_record_delete returned %s\n",
+				    nt_errstr(status));
 			goto fail;
 		}
 	} else {
@@ -499,8 +499,8 @@ static bool notifyd_apply_rec_change(
 
 		status = dbwrap_record_store(rec, value, 0);
 		if (!NT_STATUS_IS_OK(status)) {
-			DEBUG(1, ("%s: dbwrap_record_store returned %s\n",
-				  __func__, nt_errstr(status)));
+			DBG_WARNING("dbwrap_record_store returned %s\n",
+				    nt_errstr(status));
 			goto fail;
 		}
 	}
@@ -548,19 +548,20 @@ static bool notifyd_parse_rec_change(uint8_t *buf, size_t bufsize,
 	struct notify_rec_change_msg *msg;
 
 	if (bufsize < offsetof(struct notify_rec_change_msg, path) + 1) {
-		DEBUG(1, ("%s: message too short, ignoring: %u\n", __func__,
-			  (unsigned)bufsize));
+		DBG_WARNING("message too short, ignoring: %zu\n", bufsize);
 		return false;
 	}
 
 	*pmsg = msg = (struct notify_rec_change_msg *)buf;
 	*pathlen = bufsize - offsetof(struct notify_rec_change_msg, path);
 
-	DEBUG(10, ("%s: Got rec_change_msg filter=%u, subdir_filter=%u, "
-		   "private_data=%p, path=%.*s\n",
-		   __func__, (unsigned)msg->instance.filter,
-		   (unsigned)msg->instance.subdir_filter,
-		   msg->instance.private_data, (int)(*pathlen), msg->path));
+	DBG_DEBUG("Got rec_change_msg filter=%"PRIu32", "
+		  "subdir_filter=%"PRIu32", private_data=%p, path=%.*s\n",
+		  msg->instance.filter,
+		  msg->instance.subdir_filter,
+		  msg->instance.private_data,
+		  (int)(*pathlen),
+		  msg->path);
 
 	return true;
 }
@@ -593,8 +594,7 @@ static void notifyd_rec_change(struct messaging_context *msg_ctx,
 		state->entries, state->sys_notify_watch, state->sys_notify_ctx,
 		state->msg_ctx);
 	if (!ok) {
-		DEBUG(1, ("%s: notifyd_apply_rec_change failed, ignoring\n",
-			  __func__));


-- 
Samba Shared Repository



More information about the samba-cvs mailing list