summaryrefslogtreecommitdiffhomepage
path: root/cli-auth.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2016-05-04 15:28:33 +0200
committerMatt Johnston <matt@ucc.asn.au>2016-05-04 15:28:33 +0200
commit1152e47b529dc39fa9ffff3e1ee9ce2b11a3fba6 (patch)
tree12f8a8de5b2a1ba13e9027fcfa2db9f3d868969e /cli-auth.c
parent32a28d0d9cf7c567671366d6ec71df87627e2c49 (diff)
message about truncated banner
Diffstat (limited to 'cli-auth.c')
-rw-r--r--cli-auth.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/cli-auth.c b/cli-auth.c
index 5d4f182..3914c58 100644
--- a/cli-auth.c
+++ b/cli-auth.c
@@ -78,6 +78,7 @@ void recv_msg_userauth_banner() {
char* banner = NULL;
unsigned int bannerlen;
unsigned int i, linecount;
+ int truncated = 0;
TRACE(("enter recv_msg_userauth_banner"))
if (ses.authstate.authdone) {
@@ -90,26 +91,29 @@ void recv_msg_userauth_banner() {
if (bannerlen > MAX_BANNER_SIZE) {
TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen))
- goto out;
- }
-
- cleantext(banner);
-
- /* Limit to 25 lines */
- linecount = 1;
- for (i = 0; i < bannerlen; i++) {
- if (banner[i] == '\n') {
- if (linecount >= MAX_BANNER_LINES) {
- banner[i] = '\0';
- break;
+ truncated = 1;
+ } else {
+ cleantext(banner);
+
+ /* Limit to 24 lines */
+ linecount = 1;
+ for (i = 0; i < bannerlen; i++) {
+ if (banner[i] == '\n') {
+ if (linecount >= MAX_BANNER_LINES) {
+ banner[i] = '\0';
+ truncated = 1;
+ break;
+ }
+ linecount++;
}
- linecount++;
}
+ fprintf(stderr, "%s\n", banner);
}
- fprintf(stderr, "%s\n", banner);
+ if (truncated) {
+ fprintf(stderr, "[Banner from the server is too long]\n");
+ }
-out:
m_free(banner);
TRACE(("leave recv_msg_userauth_banner"))
}