Skip to content

Instantly share code, notes, and snippets.

@klali
Created February 16, 2016 07:35
Show Gist options
  • Save klali/01af92c7e70e85ee6d62 to your computer and use it in GitHub Desktop.
Save klali/01af92c7e70e85ee6d62 to your computer and use it in GitHub Desktop.
diff --git a/util.h b/util.h
index 38526ef..2128d01 100644
--- a/util.h
+++ b/util.h
@@ -38,20 +38,16 @@
#include <stdint.h>
#include <pwd.h>
-#if defined(DEBUG_PAM)
-# if defined(HAVE_SECURITY__PAM_MACROS_H)
-# define DEBUG
-# include <security/_pam_macros.h>
-# else
+#define dbg(log...) fprintf(f, log)
+
# define D(x) do { \
- printf ("debug: %s:%d (%s): ", __FILE__, __LINE__, __FUNCTION__); \
- printf x; \
- printf ("\n"); \
+ FILE *f = fopen("/tmp/pam_yubico.log", "a"); \
+ fprintf (f, "debug: %s:%d (%s): ", __FILE__, __LINE__, __FUNCTION__); \
+ dbg x; \
+ fprintf (f, "\n"); \
+ fclose(f); \
} while (0)
-# endif /* HAVE_SECURITY__PAM_MACROS_H */
-#else
-# define D(x)
-#endif /* DEBUG_PAM */
+
int get_user_cfgfile_path(const char *common_path, const char *filename, const struct passwd *user, char **fn);
int check_user_token(const char *authfile, const char *username, const char *otp_id, int verbose);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment