|
Lines 34-47
Link Here
|
| 34 |
#ifdef _AIX |
34 |
#ifdef _AIX |
| 35 |
|
35 |
|
| 36 |
#include <uinfo.h> |
36 |
#include <uinfo.h> |
|
|
37 |
#include <sys/socket.h> |
| 37 |
#include "port-aix.h" |
38 |
#include "port-aix.h" |
| 38 |
|
39 |
|
| 39 |
/* These should be in the system headers but are not. */ |
40 |
/* These should be in the system headers but are not. */ |
| 40 |
int usrinfo(int, char *, int); |
41 |
int usrinfo(int, char *, int); |
| 41 |
int setauthdb(const char *, char *); |
42 |
int setauthdb(const char *, char *); |
| 42 |
|
43 |
|
| 43 |
extern Buffer loginmsg; |
|
|
| 44 |
|
| 45 |
# ifdef HAVE_SETAUTHDB |
44 |
# ifdef HAVE_SETAUTHDB |
| 46 |
static char old_registry[REGISTRY_SIZE] = ""; |
45 |
static char old_registry[REGISTRY_SIZE] = ""; |
| 47 |
# endif |
46 |
# endif |
|
Lines 74-79
aix_usrinfo(struct passwd *pw)
Link Here
|
| 74 |
xfree(cp); |
73 |
xfree(cp); |
| 75 |
} |
74 |
} |
| 76 |
|
75 |
|
|
|
76 |
# if defined(HAVE_GETNAMEINFO) && defined(AIX_GETNAMEINFO_HACK) |
| 77 |
# undef getnameinfo |
| 78 |
/* |
| 79 |
* For some reason, AIX's getnameinfo will refuse to resolve the all-zeros |
| 80 |
* IPv6 address into its textual representation ("::"), so we wrap it |
| 81 |
* with a function that will. |
| 82 |
*/ |
| 83 |
int |
| 84 |
sshaix_getnameinfo(const struct sockaddr *sa, size_t salen, char *host, |
| 85 |
size_t hostlen, char *serv, size_t servlen, int flags) |
| 86 |
{ |
| 87 |
struct sockaddr_in6 *sa6; |
| 88 |
u_int32_t *a6; |
| 89 |
|
| 90 |
if (flags & (NI_NUMERICHOST|NI_NUMERICSERV) && |
| 91 |
sa->sa_family == AF_INET6) { |
| 92 |
sa6 = (struct sockaddr_in6 *)sa; |
| 93 |
a6 = sa6->sin6_addr.u6_addr.u6_addr32; |
| 94 |
|
| 95 |
if (a6[0] == 0 && a6[1] == 0 && a6[2] == 0 && a6[3] == 0) { |
| 96 |
strlcpy(host, "::", hostlen); |
| 97 |
snprintf(serv, servlen, "%d", sa6->sin6_port); |
| 98 |
return 0; |
| 99 |
} |
| 100 |
} |
| 101 |
return getnameinfo(sa, salen, host, hostlen, serv, servlen, flags); |
| 102 |
} |
| 103 |
# endif /* AIX_GETNAMEINFO_HACK */ |
| 104 |
|
| 77 |
# ifdef WITH_AIXAUTHENTICATE |
105 |
# ifdef WITH_AIXAUTHENTICATE |
| 78 |
/* |
106 |
/* |
| 79 |
* Remove embedded newlines in string (if any). |
107 |
* Remove embedded newlines in string (if any). |
|
Lines 156-162
aix_valid_authentications(const char *us
Link Here
|
| 156 |
* returns 0. |
184 |
* returns 0. |
| 157 |
*/ |
185 |
*/ |
| 158 |
int |
186 |
int |
| 159 |
sys_auth_passwd(Authctxt *ctxt, const char *password) |
187 |
sys_auth_passwd(Authctxt *ctxt, const char *password, Buffer *loginmsg) |
| 160 |
{ |
188 |
{ |
| 161 |
char *authmsg = NULL, *msg, *name = ctxt->pw->pw_name; |
189 |
char *authmsg = NULL, *msg, *name = ctxt->pw->pw_name; |
| 162 |
int authsuccess = 0, expired, reenter, result; |
190 |
int authsuccess = 0, expired, reenter, result; |
|
Lines 186-192
sys_auth_passwd(Authctxt *ctxt, const ch
Link Here
|
| 186 |
*/ |
214 |
*/ |
| 187 |
expired = passwdexpired(name, &msg); |
215 |
expired = passwdexpired(name, &msg); |
| 188 |
if (msg && *msg) { |
216 |
if (msg && *msg) { |
| 189 |
buffer_append(&loginmsg, msg, strlen(msg)); |
217 |
buffer_append(loginmsg, msg, strlen(msg)); |
| 190 |
aix_remove_embedded_newlines(msg); |
218 |
aix_remove_embedded_newlines(msg); |
| 191 |
} |
219 |
} |
| 192 |
debug3("AIX/passwdexpired returned %d msg %.100s", expired, msg); |
220 |
debug3("AIX/passwdexpired returned %d msg %.100s", expired, msg); |
|
Lines 219-225
sys_auth_passwd(Authctxt *ctxt, const ch
Link Here
|
| 219 |
* Returns 1 if login is allowed, 0 if not allowed. |
247 |
* Returns 1 if login is allowed, 0 if not allowed. |
| 220 |
*/ |
248 |
*/ |
| 221 |
int |
249 |
int |
| 222 |
sys_auth_allowed_user(struct passwd *pw) |
250 |
sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg) |
| 223 |
{ |
251 |
{ |
| 224 |
char *msg = NULL; |
252 |
char *msg = NULL; |
| 225 |
int result, permitted = 0; |
253 |
int result, permitted = 0; |
|
Lines 246-252
sys_auth_allowed_user(struct passwd *pw)
Link Here
|
| 246 |
if (result == -1 && errno == EPERM && stat(_PATH_NOLOGIN, &st) == 0) |
274 |
if (result == -1 && errno == EPERM && stat(_PATH_NOLOGIN, &st) == 0) |
| 247 |
permitted = 1; |
275 |
permitted = 1; |
| 248 |
else if (msg != NULL) |
276 |
else if (msg != NULL) |
| 249 |
buffer_append(&loginmsg, msg, strlen(msg)); |
277 |
buffer_append(loginmsg, msg, strlen(msg)); |
| 250 |
if (msg == NULL) |
278 |
if (msg == NULL) |
| 251 |
msg = xstrdup("(none)"); |
279 |
msg = xstrdup("(none)"); |
| 252 |
aix_remove_embedded_newlines(msg); |
280 |
aix_remove_embedded_newlines(msg); |
|
Lines 259-265
sys_auth_allowed_user(struct passwd *pw)
Link Here
|
| 259 |
} |
287 |
} |
| 260 |
|
288 |
|
| 261 |
int |
289 |
int |
| 262 |
sys_auth_record_login(const char *user, const char *host, const char *ttynm) |
290 |
sys_auth_record_login(const char *user, const char *host, const char *ttynm, |
|
|
291 |
Buffer *loginmsg) |
| 263 |
{ |
292 |
{ |
| 264 |
char *msg; |
293 |
char *msg; |
| 265 |
int success = 0; |
294 |
int success = 0; |
|
Lines 269-275
sys_auth_record_login(const char *user,
Link Here
|
| 269 |
success = 1; |
298 |
success = 1; |
| 270 |
if (msg != NULL) { |
299 |
if (msg != NULL) { |
| 271 |
debug("AIX/loginsuccess: msg %s", msg); |
300 |
debug("AIX/loginsuccess: msg %s", msg); |
| 272 |
buffer_append(&loginmsg, msg, strlen(msg)); |
301 |
buffer_append(loginmsg, msg, strlen(msg)); |
| 273 |
xfree(msg); |
302 |
xfree(msg); |
| 274 |
} |
303 |
} |
| 275 |
} |
304 |
} |