Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Dec 2002 08:02:13 -0800 (PST)
From:      Dag-Erling Smorgrav <des@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 22201 for review
Message-ID:  <200212121602.gBCG2Do8099897@repoman.freebsd.org>

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

Change 22201 by des@des.at.des.thinksec.com on 2002/12/12 08:01:39

	Declare _pam_func_name and _pam_err_name.
	Add a member to the pam_handle structure indicating which primitive
	is currently executing.
	Add a ton of debugging macros.

Affected files ...

.. //depot/projects/openpam/lib/openpam_impl.h#17 edit

Differences ...

==== //depot/projects/openpam/lib/openpam_impl.h#17 (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#16 $
+ * $P4: //depot/projects/openpam/lib/openpam_impl.h#17 $
  */
 
 #ifndef _OPENPAM_IMPL_H_INCLUDED
@@ -39,7 +39,9 @@
 
 #include <security/openpam.h>
 
+extern const char *_pam_func_name[PAM_NUM_PRIMITIVES];
 extern const char *_pam_sm_func_name[PAM_NUM_PRIMITIVES];
+extern const char *_pam_err_name[PAM_NUM_ERRORS];
 
 /*
  * Control flags
@@ -83,6 +85,7 @@
 	/* chains */
 	pam_chain_t	*chains[PAM_NUM_CHAINS];
 	pam_chain_t	*current;
+	int		 primitive;
 
 	/* items and data */
 	void		*item[PAM_NUM_ITEMS];
@@ -118,4 +121,41 @@
 #endif
 pam_module_t   *openpam_dynamic(const char *);
 
+#ifdef DEBUG
+#define ENTER() openpam_log(PAM_LOG_DEBUG, "entering")
+#define	RETURNV() openpam_log(PAM_LOG_DEBUG, "returning")
+#define RETURNC(c) do { \
+	if ((c) >= 0 && (c) < PAM_NUM_ERRORS)
+		openpam_log(PAM_LOG_DEBUG, "returning %s", _pam_err_name[c]); \
+	else \
+		openpam_log(PAM_LOG_DEBUG, "returning %d!", (c)); \
+	return (c); \
+} while (0)
+#define	RETURNI(n) do { \
+	openpam_log(PAM_LOG_DEBUG, "returning %d", (n)); \
+	return (n); \
+} while (0)
+#define	RETURNP(p) do { \
+	if ((p) == NULL) \
+		openpam_log(PAM_LOG_DEBUG, "returning NULL"); \
+	else \
+		openpam_log(PAM_LOG_DEBUG, "returning %p", (p)); \
+	return (p); \
+} while (0)
+#define	RETURNS(s) do { \
+	if ((s) == NULL) \
+		openpam_log(PAM_LOG_DEBUG, "returning NULL"); \
+	else \
+		openpam_log(PAM_LOG_DEBUG, "returning '%s'", (s)); \
+	return (s); \
+} while (0)
+#else
+#define ENTER()
+#define RETURNV() return
+#define RETURNC(c) return (c)
+#define RETURNI(n) return (i)
+#define RETURNP(p) return (p)
+#define RETURNS(s) return (s)
+#endif
+
 #endif

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




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