Advertisement
Guest User

pam_notifo patch for ubuntu

a guest
Dec 15th, 2011
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.43 KB | None | 0 0
  1. diff -ur pam_notifo-v0.1/Makefile pam_notifo-v0.1-ubuntu/Makefile
  2. --- pam_notifo-v0.1/Makefile    2010-09-10 18:27:36.000000000 -0400
  3. +++ pam_notifo-v0.1-ubuntu/Makefile 2011-12-15 10:01:37.148099341 -0500
  4. @@ -1,5 +1,16 @@
  5.  #CC=clang
  6.  
  7. +ubuntu: ubuntu.lock
  8. +
  9. +ubuntu.lock:
  10. +   gcc -O2 -g -fPIC -lcurl -c -o pam_notifo.o pam_notifo.c
  11. +   gcc -shared -lcurl -g -o pam_notifo.so pam_notifo.o -lcurl -lpam
  12. +   strip pam_notifo.so
  13. +   touch ubuntu.lock
  14. +
  15. +clean:
  16. +   @rm -f ubuntu.lock pam_notifo.so pam_notifo.o
  17. +
  18.  all: pam_notifo.so
  19.  
  20.  # This is at least the correct way to compile for Mac OS X Snow Leopard with curl
  21. diff -ur pam_notifo-v0.1/pam_notifo.c pam_notifo-v0.1-ubuntu/pam_notifo.c
  22. --- pam_notifo-v0.1/pam_notifo.c    2010-09-10 18:28:56.000000000 -0400
  23. +++ pam_notifo-v0.1-ubuntu/pam_notifo.c 2011-12-13 16:09:54.353590703 -0500
  24. @@ -25,8 +25,8 @@
  25.  
  26.  #include <security/pam_modules.h>
  27.  #include <security/pam_appl.h>
  28. -#include <security/openpam.h>
  29.  #include <stdio.h>
  30. +#include <string.h>
  31.  #include <stdlib.h>
  32.  #include <syslog.h>
  33.  #include <unistd.h>
  34. @@ -129,6 +129,7 @@
  35.  int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv){
  36.      int ret;
  37.      int pam_err;
  38. +    int count;
  39.      const char *pam_user = NULL;
  40.      char *pam_service = NULL;
  41.      char *pam_tty = NULL;
  42. @@ -175,14 +176,25 @@
  43.      
  44.      
  45.      // Get Notifo user info
  46. -    notifo_user = openpam_get_option(pamh, PAM_NOTIFO_USER_KEY);
  47. +    if (argc > 1) {
  48. +      for (count = 0; count < argc; count++) {
  49. +     if (strncmp(argv[count],PAM_NOTIFO_USER_KEY,strlen(PAM_NOTIFO_USER_KEY))==0) {
  50. +       notifo_user=argv[count]+strlen(PAM_NOTIFO_USER_KEY)+1;
  51. +          }
  52. +     if (strncmp(argv[count],PAM_NOTIFO_API_KEY,strlen(PAM_NOTIFO_API_KEY))==0) {
  53. +       notifo_api_key=argv[count]+strlen(PAM_NOTIFO_API_KEY)+1;
  54. +          }
  55. +   }
  56. +    }
  57. +    //notifo_user = openpam_get_option(pamh, PAM_NOTIFO_USER_KEY);
  58. +    // # No openpam
  59.      if( notifo_user == NULL ) {
  60.          syslog(LOG_WARNING, "Notifo username not provided in '%s' pam config file.", pam_service);
  61.          return PAM_SESSION_ERR;
  62.      }
  63.      
  64.      // Get Notifo API key
  65. -    notifo_api_key = openpam_get_option(pamh, PAM_NOTIFO_API_KEY);
  66. +    //notifo_api_key = openpam_get_option(pamh, PAM_NOTIFO_API_KEY);
  67.      if( notifo_api_key == NULL ) {
  68.          syslog(LOG_WARNING, "Notifo API key not provided in '%s' pam config file.", pam_service);
  69.          return PAM_SESSION_ERR;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement