diff options
Diffstat (limited to 'openbsd-compat')
-rw-r--r-- | openbsd-compat/port-aix.c | 38 | ||||
-rw-r--r-- | openbsd-compat/port-aix.h | 1 |
2 files changed, 39 insertions, 0 deletions
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c index 562923720..7a981634b 100644 --- a/openbsd-compat/port-aix.c +++ b/openbsd-compat/port-aix.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include <uinfo.h> | 33 | #include <uinfo.h> |
34 | #include <../xmalloc.h> | 34 | #include <../xmalloc.h> |
35 | #include "port-aix.h" | ||
35 | 36 | ||
36 | extern ServerOptions options; | 37 | extern ServerOptions options; |
37 | 38 | ||
@@ -92,12 +93,49 @@ record_failed_login(const char *user, const char *ttyname) | |||
92 | { | 93 | { |
93 | char *hostname = get_canonical_hostname(options.use_dns); | 94 | char *hostname = get_canonical_hostname(options.use_dns); |
94 | 95 | ||
96 | if (geteuid() != 0) | ||
97 | return; | ||
98 | |||
99 | aix_setauthdb(user); | ||
95 | # ifdef AIX_LOGINFAILED_4ARG | 100 | # ifdef AIX_LOGINFAILED_4ARG |
96 | loginfailed((char *)user, hostname, (char *)ttyname, AUDIT_FAIL_AUTH); | 101 | loginfailed((char *)user, hostname, (char *)ttyname, AUDIT_FAIL_AUTH); |
97 | # else | 102 | # else |
98 | loginfailed((char *)user, hostname, (char *)ttyname); | 103 | loginfailed((char *)user, hostname, (char *)ttyname); |
99 | # endif | 104 | # endif |
100 | } | 105 | } |
106 | |||
107 | /* | ||
108 | * If we have setauthdb, retrieve the password registry for the user's | ||
109 | * account then feed it to setauthdb. This may load registry-specific method | ||
110 | * code. If we don't have setauthdb or have already called it this is a no-op. | ||
111 | */ | ||
112 | void | ||
113 | aix_setauthdb(const char *user) | ||
114 | { | ||
115 | # ifdef HAVE_SETAUTHDB | ||
116 | static char *registry = NULL; | ||
117 | |||
118 | if (registry != NULL) /* have already done setauthdb */ | ||
119 | return; | ||
120 | |||
121 | if (setuserdb(S_READ) == -1) { | ||
122 | debug3("%s: Could not open userdb to read", __func__); | ||
123 | return; | ||
124 | } | ||
125 | |||
126 | if (getuserattr((char *)user, S_REGISTRY, ®istry, SEC_CHAR) == 0) { | ||
127 | if (setauthdb(registry, NULL) == 0) | ||
128 | debug3("%s: AIX/setauthdb set registry %s", __func__, | ||
129 | registry); | ||
130 | else | ||
131 | debug3("%s: AIX/setauthdb set registry %s failed: %s", | ||
132 | __func__, registry, strerror(errno)); | ||
133 | } else | ||
134 | debug3("%s: Could not read S_REGISTRY for user: %s", __func__, | ||
135 | strerror(errno)); | ||
136 | enduserdb(); | ||
137 | # endif | ||
138 | } | ||
101 | # endif /* CUSTOM_FAILED_LOGIN */ | 139 | # endif /* CUSTOM_FAILED_LOGIN */ |
102 | #endif /* _AIX */ | 140 | #endif /* _AIX */ |
103 | 141 | ||
diff --git a/openbsd-compat/port-aix.h b/openbsd-compat/port-aix.h index 2e5def54e..25ceb5b19 100644 --- a/openbsd-compat/port-aix.h +++ b/openbsd-compat/port-aix.h | |||
@@ -53,6 +53,7 @@ | |||
53 | #ifdef WITH_AIXAUTHENTICATE | 53 | #ifdef WITH_AIXAUTHENTICATE |
54 | # define CUSTOM_FAILED_LOGIN 1 | 54 | # define CUSTOM_FAILED_LOGIN 1 |
55 | void record_failed_login(const char *user, const char *ttyname); | 55 | void record_failed_login(const char *user, const char *ttyname); |
56 | void aix_setauthdb(const char *); | ||
56 | #endif | 57 | #endif |
57 | 58 | ||
58 | void aix_usrinfo(struct passwd *pw); | 59 | void aix_usrinfo(struct passwd *pw); |