diff options
author | Damien Miller <djm@mindrot.org> | 2018-07-10 19:39:52 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-07-10 19:39:52 +1000 |
commit | 120a1ec74e8d9d29f4eb9a27972ddd22351ddef9 (patch) | |
tree | 52308557de781f1d8ffb083369e0c209bc305c02 /openbsd-compat/port-aix.c | |
parent | 0f3958c1e6ffb8ea4ba27e2a97a00326fce23246 (diff) |
Adapt portable to legacy buffer API removal
Diffstat (limited to 'openbsd-compat/port-aix.c')
-rw-r--r-- | openbsd-compat/port-aix.c | 19 |
1 files changed, 12 insertions, 7 deletions
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 @@ | |||
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 "ssherr.h" | ||
31 | #include "key.h" | 32 | #include "key.h" |
32 | #include "hostfile.h" | 33 | #include "hostfile.h" |
33 | #include "auth.h" | 34 | #include "auth.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(ctx->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,7 +238,7 @@ 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 | */ |
236 | int | 240 | int |
237 | sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg) | 241 | sys_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 result, permitted = 0; |
@@ -260,8 +264,9 @@ 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)); | ||
265 | if (msg == NULL) | 270 | if (msg == NULL) |
266 | msg = xstrdup("(none)"); | 271 | msg = xstrdup("(none)"); |
267 | aix_remove_embedded_newlines(msg); | 272 | aix_remove_embedded_newlines(msg); |
@@ -275,7 +280,7 @@ sys_auth_allowed_user(struct passwd *pw, Buffer *loginmsg) | |||
275 | 280 | ||
276 | int | 281 | int |
277 | sys_auth_record_login(const char *user, const char *host, const char *ttynm, | 282 | sys_auth_record_login(const char *user, const char *host, const char *ttynm, |
278 | Buffer *loginmsg) | 283 | struct sshbuf *loginmsg) |
279 | { | 284 | { |
280 | char *msg = NULL; | 285 | char *msg = NULL; |
281 | int success = 0; | 286 | int success = 0; |