summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-aix.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2018-07-10 19:39:52 +1000
committerDamien Miller <djm@mindrot.org>2018-07-10 19:39:52 +1000
commit120a1ec74e8d9d29f4eb9a27972ddd22351ddef9 (patch)
tree52308557de781f1d8ffb083369e0c209bc305c02 /openbsd-compat/port-aix.c
parent0f3958c1e6ffb8ea4ba27e2a97a00326fce23246 (diff)
downloadopenssh-git-120a1ec74e8d9d29f4eb9a27972ddd22351ddef9.tar.gz
Adapt portable to legacy buffer API removal
Diffstat (limited to 'openbsd-compat/port-aix.c')
-rw-r--r--openbsd-compat/port-aix.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c
index 79c86896..f3a84aec 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;