comparison cli-auth.c @ 43:942b22d7dd1c

Banner printing
author Matt Johnston <matt@ucc.asn.au>
date Mon, 02 Aug 2004 04:25:05 +0000
parents b4874d772210
children 9ee8996a375f
comparison
equal deleted inserted replaced
42:837f9172df09 43:942b22d7dd1c
32 encrypt_packet(); 32 encrypt_packet();
33 cli_ses.state = USERAUTH_METHODS_SENT; 33 cli_ses.state = USERAUTH_METHODS_SENT;
34 TRACE(("leave cli_auth_getmethods")); 34 TRACE(("leave cli_auth_getmethods"));
35 35
36 } 36 }
37
38 void recv_msg_userauth_banner() {
39
40 unsigned char* banner = NULL;
41 unsigned int bannerlen;
42 unsigned int i, linecount;
43
44 TRACE(("enter recv_msg_userauth_banner"));
45 if (ses.authstate.authdone) {
46 TRACE(("leave recv_msg_userauth_banner: banner after auth done"));
47 return;
48 }
49
50 banner = buf_getstring(ses.payload, &bannerlen);
51 buf_eatstring(ses.payload); /* The language string */
52
53 if (bannerlen > MAX_BANNER_SIZE) {
54 TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen));
55 goto out;
56 }
57
58 cleantext(banner);
59
60 /* Limit to 25 lines */
61 linecount = 1;
62 for (i = 0; i < bannerlen; i++) {
63 if (banner[i] == '\n') {
64 if (linecount >= MAX_BANNER_LINES) {
65 banner[i] = '\0';
66 break;
67 }
68 linecount++;
69 }
70 }
71
72 printf("%s\n", banner);
73
74 out:
75 m_free(banner);
76 TRACE(("leave recv_msg_userauth_banner"));
77 }
78
37 79
38 void recv_msg_userauth_failure() { 80 void recv_msg_userauth_failure() {
39 81
40 unsigned char * methods = NULL; 82 unsigned char * methods = NULL;
41 unsigned char * tok = NULL; 83 unsigned char * tok = NULL;