diff --git a/pam-ck-connector/Makefile.am b/pam-ck-connector/Makefile.am index eab4864..9d32639 100644 --- a/pam-ck-connector/Makefile.am +++ b/pam-ck-connector/Makefile.am @@ -22,6 +22,7 @@ pam_ck_connector_la_LIBADD = \ man_MANS = pam_ck_connector.8 +if CK_COMPILE_LINUX noinst_PROGRAMS = \ test-pam \ $(NULL) @@ -34,6 +35,7 @@ test_pam_LDADD = \ $(PAM_LIBS) \ -lpam_misc \ $(NULL) +endif endif diff --git a/pam-ck-connector/pam-ck-connector.c b/pam-ck-connector/pam-ck-connector.c index 4203651..c68218c 100644 --- a/pam-ck-connector/pam-ck-connector.c +++ b/pam-ck-connector/pam-ck-connector.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #ifdef HAVE_PATHS_H @@ -51,8 +52,8 @@ #define PAM_SM_SESSION +#include #include -#include #ifdef HAVE_SECURITY_PAM_MODUTIL_H #include #endif @@ -70,6 +71,14 @@ static int opt_debug = 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, @@ -185,10 +194,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) {