Skip to content

Instantly share code, notes, and snippets.

@shankarunni
Created June 6, 2016 18:03
Show Gist options
  • Save shankarunni/57f3467931bbf97d90000c0f7df78764 to your computer and use it in GitHub Desktop.
Save shankarunni/57f3467931bbf97d90000c0f7df78764 to your computer and use it in GitHub Desktop.
--- a/pam_tacplus.c 2016-05-29 19:01:30.000000000 -0700
+++ b/pam_tacplus.c 2016-06-06 10:46:46.377343811 -0700
@@ -41,6 +41,12 @@
#include "config.h"
#endif
+#if defined(HAVE_OPENSSL_RAND_H) && defined(HAVE_LIBCRYPTO)
+# include <openssl/rand.h>
+#else
+# include "magic.h"
+#endif
+
/* address of server discovered by pam_sm_authenticate */
static tacplus_server_t active_server;
@@ -672,7 +678,11 @@
int pam_sm_open_session (pam_handle_t * pamh, int flags,
int argc, const char **argv) {
+#if defined(HAVE_OPENSSL_RAND_H) && defined(HAVE_LIBCRYPTO)
+ RAND_pseudo_bytes((unsigned char *) &task_id, sizeof(task_id));
+#else
task_id=(short int) magic();
+#endif
return _pam_account(pamh, argc, argv, TAC_PLUS_ACCT_FLAG_START, NULL);
} /* pam_sm_open_session */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment