[PATCH] avoid sid lookup in a debug print

Uri Simchoni uri at samba.org
Thu Dec 1 04:48:21 UTC 2016


The attached patch removes some sid->user/group name lookups from debug
printing code.

Here's the thing - a user is experiencing service issues, maybe due to
some network connectivity, and raises the debug level to understand them
better, and that makes the issues worse. In the specific case here, the
extra debug prints are made while obtaining the object ACL, which is
something done all the time when you browse a folder with Windows explorer.

The extra debug information is convenient, but IMHO not absolutely

Review appreciated,
-------------- next part --------------
From 6310e9dc57979c1476ef4cdbef6243358175d479 Mon Sep 17 00:00:00 2001
From: Uri Simchoni <uri at samba.org>
Date: Thu, 1 Dec 2016 06:29:34 +0200
Subject: [PATCH] smbd: avoid extra churn on a debug print

Remove the user / group name in debug-printing of a
POSIX-ACL-derived ACE.

Obtaining the user name might result an extra lookup
to the domain. In a typical case, a user raises logging
level to 10 to troubleshoot an issue, so connectivity
problems are likely to exist. In that case we won't want
the extra debug printing to create more issues.

Signed-off-by: Uri Simchoni <uri at samba.org>
 source3/smbd/posix_acls.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index e8e819c..355f0e5 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -802,11 +802,9 @@ static void print_canon_ace(canon_ace *pace, int num)
 	dbgtext( "canon_ace index %d. Type = %s ", num, pace->attr == ALLOW_ACE ? "allow" : "deny" );
 	dbgtext( "SID = %s ", sid_string_dbg(&pace->trustee));
 	if (pace->owner_type == UID_ACE) {
-		const char *u_name = uidtoname(pace->unix_ug.id);
-		dbgtext( "uid %u (%s) ", (unsigned int)pace->unix_ug.id, u_name );
+		dbgtext( "uid %u ", (unsigned int)pace->unix_ug.id, u_name );
 	} else if (pace->owner_type == GID_ACE) {
-		char *g_name = gidtoname(pace->unix_ug.id);
-		dbgtext( "gid %u (%s) ", (unsigned int)pace->unix_ug.id, g_name );
+		dbgtext( "gid %u ", (unsigned int)pace->unix_ug.id, g_name );
 	} else
 		dbgtext( "other ");
 	switch (pace->type) {

More information about the samba-technical mailing list