summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-aix.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2009-12-29 21:32:03 +0000
committerColin Watson <cjwatson@debian.org>2009-12-29 21:32:03 +0000
commit04942aa41fa94ec6f2c3ce1d348f600f31bb7c78 (patch)
treeaf8e928bd79d3f2d0219bb5b2c78b573ec31d94c /openbsd-compat/port-aix.c
parent9ad7b718d42e43f3a285fcbc8f91193931fce324 (diff)
parent16704d57999d987fb8d9ba53379841a79f016d67 (diff)
import openssh-4.2p1-gsskex-20050926-2.patch
Diffstat (limited to 'openbsd-compat/port-aix.c')
-rw-r--r--openbsd-compat/port-aix.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c
index fa6a4ff7b..81d8124e0 100644
--- a/openbsd-compat/port-aix.c
+++ b/openbsd-compat/port-aix.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * 2 *
3 * Copyright (c) 2001 Gert Doering. All rights reserved. 3 * Copyright (c) 2001 Gert Doering. All rights reserved.
4 * Copyright (c) 2003,2004 Darren Tucker. All rights reserved. 4 * Copyright (c) 2003,2004,2005 Darren Tucker. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
@@ -42,14 +42,12 @@ static char old_registry[REGISTRY_SIZE] = "";
42# endif 42# endif
43 43
44/* 44/*
45 * AIX has a "usrinfo" area where logname and other stuff is stored - 45 * AIX has a "usrinfo" area where logname and other stuff is stored -
46 * a few applications actually use this and die if it's not set 46 * a few applications actually use this and die if it's not set
47 * 47 *
48 * NOTE: TTY= should be set, but since no one uses it and it's hard to 48 * NOTE: TTY= should be set, but since no one uses it and it's hard to
49 * acquire due to privsep code. We will just drop support. 49 * acquire due to privsep code. We will just drop support.
50 */ 50 */
51
52
53void 51void
54aix_usrinfo(struct passwd *pw) 52aix_usrinfo(struct passwd *pw)
55{ 53{
@@ -60,7 +58,7 @@ aix_usrinfo(struct passwd *pw)
60 len = sizeof("LOGNAME= NAME= ") + (2 * strlen(pw->pw_name)); 58 len = sizeof("LOGNAME= NAME= ") + (2 * strlen(pw->pw_name));
61 cp = xmalloc(len); 59 cp = xmalloc(len);
62 60
63 i = snprintf(cp, len, "LOGNAME=%s%cNAME=%s%c", pw->pw_name, '\0', 61 i = snprintf(cp, len, "LOGNAME=%s%cNAME=%s%c", pw->pw_name, '\0',
64 pw->pw_name, '\0'); 62 pw->pw_name, '\0');
65 if (usrinfo(SETUINFO, cp, i) == -1) 63 if (usrinfo(SETUINFO, cp, i) == -1)
66 fatal("Couldn't set usrinfo: %s", strerror(errno)); 64 fatal("Couldn't set usrinfo: %s", strerror(errno));
@@ -151,16 +149,16 @@ aix_valid_authentications(const char *user)
151 * returns 0. 149 * returns 0.
152 */ 150 */
153int 151int
154sys_auth_passwd(Authctxt *ctxt, const char *password, Buffer *loginmsg) 152sys_auth_passwd(Authctxt *ctxt, const char *password)
155{ 153{
156 char *authmsg = NULL, *msg, *name = ctxt->pw->pw_name; 154 char *authmsg = NULL, *msg = NULL, *name = ctxt->pw->pw_name;
157 int authsuccess = 0, expired, reenter, result; 155 int authsuccess = 0, expired, reenter, result;
158 156
159 do { 157 do {
160 result = authenticate((char *)name, (char *)password, &reenter, 158 result = authenticate((char *)name, (char *)password, &reenter,
161 &authmsg); 159 &authmsg);
162 aix_remove_embedded_newlines(authmsg); 160 aix_remove_embedded_newlines(authmsg);
163 debug3("AIX/authenticate result %d, msg %.100s", result, 161 debug3("AIX/authenticate result %d, authmsg %.100s", result,
164 authmsg); 162 authmsg);
165 } while (reenter); 163 } while (reenter);
166 164
@@ -170,7 +168,7 @@ sys_auth_passwd(Authctxt *ctxt, const char *password, Buffer *loginmsg)
170 if (result == 0) { 168 if (result == 0) {
171 authsuccess = 1; 169 authsuccess = 1;
172 170
173 /* 171 /*
174 * Record successful login. We don't have a pty yet, so just 172 * Record successful login. We don't have a pty yet, so just
175 * label the line as "ssh" 173 * label the line as "ssh"
176 */ 174 */
@@ -181,7 +179,7 @@ sys_auth_passwd(Authctxt *ctxt, const char *password, Buffer *loginmsg)
181 */ 179 */
182 expired = passwdexpired(name, &msg); 180 expired = passwdexpired(name, &msg);
183 if (msg && *msg) { 181 if (msg && *msg) {
184 buffer_append(loginmsg, msg, strlen(msg)); 182 buffer_append(ctxt->loginmsg, msg, strlen(msg));
185 aix_remove_embedded_newlines(msg); 183 aix_remove_embedded_newlines(msg);
186 } 184 }
187 debug3("AIX/passwdexpired returned %d msg %.100s", expired, msg); 185 debug3("AIX/passwdexpired returned %d msg %.100s", expired, msg);
@@ -257,7 +255,7 @@ int
257sys_auth_record_login(const char *user, const char *host, const char *ttynm, 255sys_auth_record_login(const char *user, const char *host, const char *ttynm,
258 Buffer *loginmsg) 256 Buffer *loginmsg)
259{ 257{
260 char *msg; 258 char *msg = NULL;
261 int success = 0; 259 int success = 0;
262 260
263 aix_setauthdb(user); 261 aix_setauthdb(user);