[PATCH] avoid sid lookup in a debug print

Uri Simchoni uri at samba.org
Thu Dec 1 04:53:29 UTC 2016


Oops, wrong patch. Attached is the correct one.

On 12/01/2016 06:48 AM, Uri Simchoni wrote:
> Hi,
> 
> 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
> necessary.
> 
> Review appreciated,
> Uri.
> 

-------------- next part --------------
From ddd76176274f8a8cc6cd32ad6c3963cdb1e3f603 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 v2] 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..f7829fe 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);
 	} 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);
 	} else
 		dbgtext( "other ");
 	switch (pace->type) {
-- 
2.9.3



More information about the samba-technical mailing list