[PATCH] Approve dom_sid_str_buf directly in DBG_ messages
Volker Lendecke
Volker.Lendecke at SerNet.DE
Wed Nov 21 15:02:07 UTC 2018
Hi!
Review appreciated!
Thanks, Volker
--
Besuchen Sie die verinice.XP 2019 in Berlin!
Anwenderkonferenz für Informationssicherheit
26.-28. Februar 2019 - im Hotel Radisson Blu
Info & Anmeldung hier: http://veriniceXP.org
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 55adbeb30631f5b30ccb739ca709af0ff4406bf2 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Wed, 21 Nov 2018 15:58:21 +0100
Subject: [PATCH] README.Coding: Approve DBG statements using dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl at samba.org>
---
README.Coding | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/README.Coding b/README.Coding
index 65d72d6fb73..ac9bcd43065 100644
--- a/README.Coding
+++ b/README.Coding
@@ -432,6 +432,22 @@ an iterator style:
... do something with opt ...
}
+Another exception: DBG messages for example printing a SID or a GUID:
+Here we don't expect any surprise from the printing functions, and the
+main reason of this guideline is to make debugging easier. That reason
+rarely exists for this particular use case, and we gain some
+efficiency because the DBG_ macros don't evaluate their arguments if
+the debuglevel is not high enough.
+
+ if (!NT_STATUS_IS_OK(status)) {
+ struct dom_sid_buf sid_buf;
+ struct GUID_txt_buf guid_buf;
+ DBG_WARNING(
+ "objectSID [%s] for GUID [%s] invalid\n",
+ dom_sid_str_buf(objectsid, &sid_buf),
+ GUID_buf_string(&cache->entries[idx], &guid_buf));
+ }
+
But in general, please try to avoid this pattern.
--
2.11.0
More information about the samba-technical
mailing list