Index: pam-1.5.3/modules/pam_limits/pam_limits.c =================================================================== --- pam-1.5.3.orig/modules/pam_limits/pam_limits.c +++ pam-1.5.3/modules/pam_limits/pam_limits.c @@ -28,7 +28,9 @@ #include #include #include +#ifdef __linux__ #include +#endif #include #include #include @@ -402,6 +404,7 @@ static rlim_t str2rlim_t(char *value) { item = line + pos + 1; \ } +#ifdef __linux__ static void parse_kernel_limits(pam_handle_t *pamh, struct pam_limit_s *pl, int ctrl) { int i, maxlen = 0; @@ -470,6 +473,7 @@ static void parse_kernel_limits(pam_hand pl->limits[RLIMIT_NOFILE].limit.rlim_cur = FD_SETSIZE; } } +#endif static int init_limits(pam_handle_t *pamh, struct pam_limit_s *pl, int ctrl) { @@ -1177,10 +1181,12 @@ static int setup_limits(pam_handle_t *pa } if (pl->nonewprivs) { +#ifdef __linux__ if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0) { pam_syslog(pamh, LOG_ERR, "Could not set prctl(PR_SET_NO_NEW_PRIVS): %m"); retval |= LIMIT_ERR; } +#endif } if (!retval && pl->chroot_dir[0]) {