diff options
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: session.c,v 1.302 2018/07/09 21:20:26 markus Exp $ */ | 1 | /* $OpenBSD: session.c,v 1.303 2018/07/09 21:26:02 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 3 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
4 | * All rights reserved | 4 | * All rights reserved |
@@ -69,7 +69,8 @@ | |||
69 | #include "ssh2.h" | 69 | #include "ssh2.h" |
70 | #include "sshpty.h" | 70 | #include "sshpty.h" |
71 | #include "packet.h" | 71 | #include "packet.h" |
72 | #include "buffer.h" | 72 | #include "sshbuf.h" |
73 | #include "ssherr.h" | ||
73 | #include "match.h" | 74 | #include "match.h" |
74 | #include "uidswap.h" | 75 | #include "uidswap.h" |
75 | #include "compat.h" | 76 | #include "compat.h" |
@@ -139,7 +140,7 @@ extern int debug_flag; | |||
139 | extern u_int utmp_len; | 140 | extern u_int utmp_len; |
140 | extern int startup_pipe; | 141 | extern int startup_pipe; |
141 | extern void destroy_sensitive_data(void); | 142 | extern void destroy_sensitive_data(void); |
142 | extern Buffer loginmsg; | 143 | extern struct sshbuf *loginmsg; |
143 | extern struct sshauthopt *auth_opts; | 144 | extern struct sshauthopt *auth_opts; |
144 | char *tun_fwd_ifnames; /* serverloop.c */ | 145 | char *tun_fwd_ifnames; /* serverloop.c */ |
145 | 146 | ||
@@ -248,11 +249,14 @@ auth_input_request_forwarding(struct ssh *ssh, struct passwd * pw) | |||
248 | static void | 249 | static void |
249 | display_loginmsg(void) | 250 | display_loginmsg(void) |
250 | { | 251 | { |
251 | if (buffer_len(&loginmsg) > 0) { | 252 | int r; |
252 | buffer_append(&loginmsg, "\0", 1); | 253 | |
253 | printf("%s", (char *)buffer_ptr(&loginmsg)); | 254 | if (sshbuf_len(loginmsg) == 0) |
254 | buffer_clear(&loginmsg); | 255 | return; |
255 | } | 256 | if ((r = sshbuf_put_u8(loginmsg, 0)) != 0) |
257 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); | ||
258 | printf("%s", (char *)sshbuf_ptr(loginmsg)); | ||
259 | sshbuf_reset(loginmsg); | ||
256 | } | 260 | } |
257 | 261 | ||
258 | static void | 262 | static void |
@@ -757,7 +761,7 @@ do_exec(struct ssh *ssh, Session *s, const char *command) | |||
757 | * it to the user, otherwise multiple sessions may accumulate | 761 | * it to the user, otherwise multiple sessions may accumulate |
758 | * multiple copies of the login messages. | 762 | * multiple copies of the login messages. |
759 | */ | 763 | */ |
760 | buffer_clear(&loginmsg); | 764 | sshbuf_reset(loginmsg); |
761 | 765 | ||
762 | return ret; | 766 | return ret; |
763 | } | 767 | } |