comparison cli-auth.c @ 1899:ab9c5467970d

Merge pull request #152 from HansH111/tracelevel2
author Matt Johnston <matt@ucc.asn.au>
date Wed, 23 Mar 2022 21:55:33 +0800
parents 62e4baa059c3
children 334b742fdeb8
comparison
equal deleted inserted replaced
1890:45e552ee4391 1899:ab9c5467970d
83 } 83 }
84 84
85 banner = buf_getstring(ses.payload, &bannerlen); 85 banner = buf_getstring(ses.payload, &bannerlen);
86 buf_eatstring(ses.payload); /* The language string */ 86 buf_eatstring(ses.payload); /* The language string */
87 87
88 if (cli_opts.quiet == 0) { 88 if (bannerlen > MAX_BANNER_SIZE) {
89 if (bannerlen > MAX_BANNER_SIZE) { 89 TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen))
90 TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen)) 90 truncated = 1;
91 truncated = 1; 91 } else {
92 } else { 92 cleantext(banner);
93 cleantext(banner); 93
94 94 /* Limit to 24 lines */
95 /* Limit to 24 lines */ 95 linecount = 1;
96 linecount = 1; 96 for (i = 0; i < bannerlen; i++) {
97 for (i = 0; i < bannerlen; i++) { 97 if (banner[i] == '\n') {
98 if (banner[i] == '\n') { 98 if (linecount >= MAX_BANNER_LINES) {
99 if (linecount >= MAX_BANNER_LINES) { 99 banner[i] = '\0';
100 banner[i] = '\0'; 100 truncated = 1;
101 truncated = 1; 101 break;
102 break;
103 }
104 linecount++;
105 } 102 }
106 } 103 linecount++;
107 fprintf(stderr, "%s\n", banner); 104 }
108 } 105 }
109 106 fprintf(stderr, "%s\n", banner);
110 if (truncated) { 107 }
111 fprintf(stderr, "[Banner from the server is too long]\n"); 108
112 } 109 if (truncated) {
113 } 110 fprintf(stderr, "[Banner from the server is too long]\n");
111 }
112
114 m_free(banner); 113 m_free(banner);
115 TRACE(("leave recv_msg_userauth_banner")) 114 TRACE(("leave recv_msg_userauth_banner"))
116 } 115 }
117 116
118 /* This handles the message-specific types which 117 /* This handles the message-specific types which
259 258
260 void recv_msg_userauth_success() { 259 void recv_msg_userauth_success() {
261 /* This function can validly get called multiple times 260 /* This function can validly get called multiple times
262 if DROPBEAR_CLI_IMMEDIATE_AUTH is set */ 261 if DROPBEAR_CLI_IMMEDIATE_AUTH is set */
263 262
264 TRACE(("received msg_userauth_success")) 263 DEBUG1(("received msg_userauth_success"))
265 if (cli_opts.disable_trivial_auth && cli_ses.is_trivial_auth) { 264 if (cli_opts.disable_trivial_auth && cli_ses.is_trivial_auth) {
266 dropbear_exit("trivial authentication not allowed"); 265 dropbear_exit("trivial authentication not allowed");
267 } 266 }
268 /* Note: in delayed-zlib mode, setting authdone here 267 /* Note: in delayed-zlib mode, setting authdone here
269 * will enable compression in the transport layer */ 268 * will enable compression in the transport layer */