diff options
Diffstat (limited to 'pam-ck-connector/pam-ck-connector.c')
-rw-r--r-- | pam-ck-connector/pam-ck-connector.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/pam-ck-connector/pam-ck-connector.c b/pam-ck-connector/pam-ck-connector.c index 091f4b2..6e41cf5 100644 --- a/pam-ck-connector/pam-ck-connector.c +++ b/pam-ck-connector/pam-ck-connector.c @@ -39,6 +39,7 @@ #include <sys/types.h> #include <unistd.h> #include <dirent.h> +#include <limits.h> #include <errno.h> #ifdef HAVE_PATHS_H @@ -51,8 +52,8 @@ #define PAM_SM_SESSION +#include <security/pam_appl.h> #include <security/pam_modules.h> -#include <security/_pam_macros.h> #ifdef HAVE_SECURITY_PAM_MODUTIL_H #include <security/pam_modutil.h> #endif @@ -71,6 +72,14 @@ static int opt_nox11 = FALSE; #define LOG_AUTHPRIV LOG_AUTH #endif +#ifndef PAM_EXTERN +#ifdef PAM_STATIC +#define PAM_EXTERN static +#else +#define PAM_EXTERN extern +#endif +#endif + static void ck_pam_vsyslog (const pam_handle_t *pamh, int priority, @@ -188,10 +197,17 @@ _util_name_to_uid (const char *username, bufsize = sysconf (_SC_GETPW_R_SIZE_MAX); buf = calloc (sizeof (char), bufsize); +#ifdef __sun + pwdp = getpwnam_r (username, &pwd, buf, bufsize); + if (pwdp == NULL) { + goto out; + } +#else rc = getpwnam_r (username, &pwd, buf, bufsize, &pwdp); if (rc != 0 || pwdp == NULL) { goto out; } +#endif res = pwdp->pw_uid; if (default_gid != NULL) { |