comparison cli-auth.c @ 1890:45e552ee4391

merge
author Matt Johnston <matt@ucc.asn.au>
date Tue, 22 Mar 2022 16:17:47 +0800
parents d512da7b1198
children 62e4baa059c3
comparison
equal deleted inserted replaced
1889:fc4c9ef61856 1890:45e552ee4391
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 (bannerlen > MAX_BANNER_SIZE) { 88 if (cli_opts.quiet == 0) {
89 TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen)) 89 if (bannerlen > MAX_BANNER_SIZE) {
90 truncated = 1; 90 TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen))
91 } else { 91 truncated = 1;
92 cleantext(banner); 92 } else {
93 93 cleantext(banner);
94 /* Limit to 24 lines */ 94
95 linecount = 1; 95 /* Limit to 24 lines */
96 for (i = 0; i < bannerlen; i++) { 96 linecount = 1;
97 if (banner[i] == '\n') { 97 for (i = 0; i < bannerlen; i++) {
98 if (linecount >= MAX_BANNER_LINES) { 98 if (banner[i] == '\n') {
99 banner[i] = '\0'; 99 if (linecount >= MAX_BANNER_LINES) {
100 truncated = 1; 100 banner[i] = '\0';
101 break; 101 truncated = 1;
102 break;
103 }
104 linecount++;
102 } 105 }
103 linecount++; 106 }
104 } 107 fprintf(stderr, "%s\n", banner);
105 } 108 }
106 fprintf(stderr, "%s\n", banner); 109
107 } 110 if (truncated) {
108 111 fprintf(stderr, "[Banner from the server is too long]\n");
109 if (truncated) { 112 }
110 fprintf(stderr, "[Banner from the server is too long]\n"); 113 }
111 }
112
113 m_free(banner); 114 m_free(banner);
114 TRACE(("leave recv_msg_userauth_banner")) 115 TRACE(("leave recv_msg_userauth_banner"))
115 } 116 }
116 117
117 /* This handles the message-specific types which 118 /* This handles the message-specific types which