From 120a1ec74e8d9d29f4eb9a27972ddd22351ddef9 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Tue, 10 Jul 2018 19:39:52 +1000 Subject: Adapt portable to legacy buffer API removal --- openbsd-compat/port-aix.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'openbsd-compat/port-aix.c') diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c index 79c868966..f3a84aec8 100644 --- a/openbsd-compat/port-aix.c +++ b/openbsd-compat/port-aix.c @@ -27,7 +27,8 @@ #include "includes.h" #include "xmalloc.h" -#include "buffer.h" +#include "sshbuf.h" +#include "ssherr.h" #include "key.h" #include "hostfile.h" #include "auth.h" @@ -176,7 +177,7 @@ sys_auth_passwd(struct ssh *ssh, const char *password) { Authctxt *ctxt = ssh->authctxt; char *authmsg = NULL, *msg = NULL, *name = ctxt->pw->pw_name; - int authsuccess = 0, expired, reenter, result; + int r, authsuccess = 0, expired, reenter, result; do { result = authenticate((char *)name, (char *)password, &reenter, @@ -203,7 +204,10 @@ sys_auth_passwd(struct ssh *ssh, const char *password) */ expired = passwdexpired(name, &msg); if (msg && *msg) { - buffer_append(ctxt->loginmsg, msg, strlen(msg)); + if ((r = sshbuf_put(ctx->loginmsg, + msg, strlen(msg))) != 0) + fatal("%s: buffer error: %s", + __func__, ssh_err(r)); aix_remove_embedded_newlines(msg); } debug3("AIX/passwdexpired returned %d msg %.100s", expired, msg); @@ -234,7 +238,7 @@ sys_auth_passwd(struct ssh *ssh, const char *password) * Returns 1 if login is allowed, 0 if not allowed. */ int -sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg) +sys_auth_allowed_user(struct passwd *pw, struct sshbuf *loginmsg) { char *msg = NULL; int result, permitted = 0; @@ -260,8 +264,9 @@ sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg) */ if (result == -1 && errno == EPERM && stat(_PATH_NOLOGIN, &st) == 0) permitted = 1; - else if (msg != NULL) - buffer_append(loginmsg, msg, strlen(msg)); + else if (msg != NULL) { + if ((r = sshbuf_put(loginmsg, msg, strlen(msg))) != 0) + fatal("%s: buffer error: %s", __func__, ssh_err(r)); if (msg == NULL) msg = xstrdup("(none)"); aix_remove_embedded_newlines(msg); @@ -275,7 +280,7 @@ sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg) int sys_auth_record_login(const char *user, const char *host, const char *ttynm, - Buffer *loginmsg) + struct sshbuf *loginmsg) { char *msg = NULL; int success = 0; -- cgit v1.2.3