summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-aix.c
diff options
context:
space:
mode:
Diffstat (limited to 'openbsd-compat/port-aix.c')
-rw-r--r--openbsd-compat/port-aix.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c
index 79c868966..943177c70 100644
--- a/openbsd-compat/port-aix.c
+++ b/openbsd-compat/port-aix.c
@@ -27,8 +27,9 @@
27#include "includes.h" 27#include "includes.h"
28 28
29#include "xmalloc.h" 29#include "xmalloc.h"
30#include "buffer.h" 30#include "sshbuf.h"
31#include "key.h" 31#include "ssherr.h"
32#include "sshkey.h"
32#include "hostfile.h" 33#include "hostfile.h"
33#include "auth.h" 34#include "auth.h"
34#include "ssh.h" 35#include "ssh.h"
@@ -176,7 +177,7 @@ sys_auth_passwd(struct ssh *ssh, const char *password)
176{ 177{
177 Authctxt *ctxt = ssh->authctxt; 178 Authctxt *ctxt = ssh->authctxt;
178 char *authmsg = NULL, *msg = NULL, *name = ctxt->pw->pw_name; 179 char *authmsg = NULL, *msg = NULL, *name = ctxt->pw->pw_name;
179 int authsuccess = 0, expired, reenter, result; 180 int r, authsuccess = 0, expired, reenter, result;
180 181
181 do { 182 do {
182 result = authenticate((char *)name, (char *)password, &reenter, 183 result = authenticate((char *)name, (char *)password, &reenter,
@@ -203,7 +204,10 @@ sys_auth_passwd(struct ssh *ssh, const char *password)
203 */ 204 */
204 expired = passwdexpired(name, &msg); 205 expired = passwdexpired(name, &msg);
205 if (msg && *msg) { 206 if (msg && *msg) {
206 buffer_append(ctxt->loginmsg, msg, strlen(msg)); 207 if ((r = sshbuf_put(ctxt->loginmsg,
208 msg, strlen(msg))) != 0)
209 fatal("%s: buffer error: %s",
210 __func__, ssh_err(r));
207 aix_remove_embedded_newlines(msg); 211 aix_remove_embedded_newlines(msg);
208 } 212 }
209 debug3("AIX/passwdexpired returned %d msg %.100s", expired, msg); 213 debug3("AIX/passwdexpired returned %d msg %.100s", expired, msg);
@@ -234,10 +238,10 @@ sys_auth_passwd(struct ssh *ssh, const char *password)
234 * Returns 1 if login is allowed, 0 if not allowed. 238 * Returns 1 if login is allowed, 0 if not allowed.
235 */ 239 */
236int 240int
237sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg) 241sys_auth_allowed_user(struct passwd *pw, struct sshbuf *loginmsg)
238{ 242{
239 char *msg = NULL; 243 char *msg = NULL;
240 int result, permitted = 0; 244 int r, result, permitted = 0;
241 struct stat st; 245 struct stat st;
242 246
243 /* 247 /*
@@ -260,8 +264,10 @@ sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg)
260 */ 264 */
261 if (result == -1 && errno == EPERM && stat(_PATH_NOLOGIN, &st) == 0) 265 if (result == -1 && errno == EPERM && stat(_PATH_NOLOGIN, &st) == 0)
262 permitted = 1; 266 permitted = 1;
263 else if (msg != NULL) 267 else if (msg != NULL) {
264 buffer_append(loginmsg, msg, strlen(msg)); 268 if ((r = sshbuf_put(loginmsg, msg, strlen(msg))) != 0)
269 fatal("%s: buffer error: %s", __func__, ssh_err(r));
270 }
265 if (msg == NULL) 271 if (msg == NULL)
266 msg = xstrdup("(none)"); 272 msg = xstrdup("(none)");
267 aix_remove_embedded_newlines(msg); 273 aix_remove_embedded_newlines(msg);
@@ -275,7 +281,7 @@ sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg)
275 281
276int 282int
277sys_auth_record_login(const char *user, const char *host, const char *ttynm, 283sys_auth_record_login(const char *user, const char *host, const char *ttynm,
278 Buffer *loginmsg) 284 struct sshbuf *loginmsg)
279{ 285{
280 char *msg = NULL; 286 char *msg = NULL;
281 int success = 0; 287 int success = 0;