Skip to content

Instantly share code, notes, and snippets.

@metalefty
Created October 16, 2014 14:49
Show Gist options
  • Save metalefty/73f1d95d4e1c83f80bcf to your computer and use it in GitHub Desktop.
Save metalefty/73f1d95d4e1c83f80bcf to your computer and use it in GitHub Desktop.
FreeBSDでxrdpのPAM認証が通らなくなった原因
--- stable/10/lib/libpam/modules/pam_login_access/pam_login_access.c 2014/09/18 14:16:14 271765
+++ stable/10/lib/libpam/modules/pam_login_access/pam_login_access.c 2014/09/18 14:27:37 271766
@@ -79,7 +79,14 @@
gethostname(hostname, sizeof hostname);
- if (rhost == NULL || *(const char *)rhost == '\0') {
+ if (rhost != NULL && *(const char *)rhost != '\0') {
+ PAM_LOG("Checking login.access for user %s from host %s",
+ (const char *)user, (const char *)rhost);
+ if (login_access(user, rhost) != 0)
+ return (PAM_SUCCESS);
+ PAM_VERBOSE_ERROR("%s is not allowed to log in from %s",
+ user, rhost);
+ } else if (tty != NULL && *(const char *)tty != '\0') {
PAM_LOG("Checking login.access for user %s on tty %s",
(const char *)user, (const char *)tty);
if (login_access(user, tty) != 0)
@@ -87,12 +94,8 @@
PAM_VERBOSE_ERROR("%s is not allowed to log in on %s",
user, tty);
} else {
- PAM_LOG("Checking login.access for user %s from host %s",
- (const char *)user, (const char *)rhost);
- if (login_access(user, rhost) != 0)
- return (PAM_SUCCESS);
- PAM_VERBOSE_ERROR("%s is not allowed to log in from %s",
- user, rhost);
+ PAM_VERBOSE_ERROR("PAM_RHOST or PAM_TTY required");
+ return (PAM_AUTHINFO_UNAVAIL);
}
return (PAM_AUTH_ERR);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment