Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 May 2003 09:18:47 -0700 (PDT)
From:      Dag-Erling Smorgrav <des@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 30313 for review
Message-ID:  <200305011618.h41GIllO068872@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=30313

Change 30313 by des@des.at.des.thinksec.com on 2003/05/01 09:18:06

	Add a global variable controlling the output of debugging messages.
	This allows modules etc. to emit PAM_LOG_DEBUG messages independently
	of whether libpam was compiled with -DDEBUG.

Affected files ...

.. //depot/projects/openpam/lib/openpam_impl.h#21 edit
.. //depot/projects/openpam/lib/openpam_log.c#18 edit

Differences ...

==== //depot/projects/openpam/lib/openpam_impl.h#21 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/openpam/lib/openpam_impl.h#20 $
+ * $P4: //depot/projects/openpam/lib/openpam_impl.h#21 $
  */
 
 #ifndef _OPENPAM_IMPL_H_INCLUDED
@@ -44,6 +44,8 @@
 extern const char *_pam_err_name[PAM_NUM_ERRORS];
 extern const char *_pam_item_name[PAM_NUM_ITEMS];
 
+extern int _openpam_debug;
+
 /*
  * Control flags
  */

==== //depot/projects/openpam/lib/openpam_log.c#18 (text+ko) ====

@@ -31,7 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $P4: //depot/projects/openpam/lib/openpam_log.c#17 $
+ * $P4: //depot/projects/openpam/lib/openpam_log.c#18 $
  */
 
 #include <ctype.h>
@@ -45,6 +45,8 @@
 
 #include "openpam_impl.h"
 
+int _openpam_debug = 0;
+
 #if defined(openpam_log)
 
 /*
@@ -62,12 +64,10 @@
 
 	switch (level) {
 	case PAM_LOG_DEBUG:
-#ifndef DEBUG
-		return;
-#else
+		if (!_openpam_debug)
+			return;
 		priority = LOG_DEBUG;
 		break;
-#endif
 	case PAM_LOG_VERBOSE:
 		priority = LOG_INFO;
 		break;
@@ -108,12 +108,10 @@
 
 	switch (level) {
 	case PAM_LOG_DEBUG:
-#ifndef DEBUG
-		return;
-#else
+		if (!_openpam_debug)
+			return;
 		priority = LOG_DEBUG;
 		break;
-#endif
 	case PAM_LOG_VERBOSE:
 		priority = LOG_INFO;
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305011618.h41GIllO068872>