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

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

Change 30314 by des@des.at.des.thinksec.com on 2003/05/01 09:20:03

	If compiled with -DDEBUG, enable debugging right before calling a
	module which has the "debug" option, and disable it upon return.

Affected files ...

.. //depot/projects/openpam/lib/openpam_dispatch.c#19 edit

Differences ...

==== //depot/projects/openpam/lib/openpam_dispatch.c#19 (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_dispatch.c#18 $
+ * $P4: //depot/projects/openpam/lib/openpam_dispatch.c#19 $
  */
 
 #include <sys/param.h>
@@ -59,6 +59,9 @@
 {
 	pam_chain_t *chain;
 	int err, fail, r;
+#ifdef DEBUG
+	int debug;
+#endif
 
 	ENTER();
 	if (pamh == NULL)
@@ -96,8 +99,6 @@
 
 	/* execute */
 	for (err = fail = 0; chain != NULL; chain = chain->next) {
-		openpam_log(PAM_LOG_DEBUG, "calling %s() in %s",
-		    _pam_sm_func_name[primitive], chain->module->path);
 		if (chain->module->func[primitive] == NULL) {
 			openpam_log(PAM_LOG_ERROR, "%s: no %s()",
 			    chain->module->path, _pam_sm_func_name[primitive]);
@@ -105,12 +106,23 @@
 		} else {
 			pamh->primitive = primitive;
 			pamh->current = chain;
+#ifdef DEBUG
+			debug = (openpam_get_option(pamh, "debug") != NULL);
+			if (debug)
+				++_openpam_debug;
+			openpam_log(PAM_LOG_DEBUG, "calling %s() in %s",
+			    _pam_sm_func_name[primitive], chain->module->path);
+#endif
 			r = (chain->module->func[primitive])(pamh, flags,
 			    chain->optc, (const char **)chain->optv);
 			pamh->current = NULL;
+#ifdef DEBUG
 			openpam_log(PAM_LOG_DEBUG, "%s: %s(): %s",
 			    chain->module->path, _pam_sm_func_name[primitive],
 			    pam_strerror(pamh, r));
+			if (debug)
+				--_openpam_debug;
+#endif
 		}
 
 		if (r == PAM_IGNORE)



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