PERFORCE change 30313 for review

Dag-Erling Smorgrav des at FreeBSD.org
Thu May 1 09:18:50 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=30313

Change 30313 by des at 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;


More information about the p4-projects mailing list