diff options
author | Matt Johnston <matt@ucc.asn.au> | 2004-08-02 04:25:05 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2004-08-02 04:25:05 +0000 |
commit | 9c91ea1caf8a7263d830de0bbd5f3b183940b595 (patch) | |
tree | 131de6789951cd6e957f7d2e32dda48ed0b18265 /cli-auth.c | |
parent | 0a60e4536d1a9b2a21c949fcbada061685b8fc1b (diff) |
Banner printing
--HG--
extra : convert_revision : a38558944355bb9b4c8e9e22147c1f2d8d327775
Diffstat (limited to 'cli-auth.c')
-rw-r--r-- | cli-auth.c | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -35,6 +35,48 @@ void cli_auth_getmethods() { } +void recv_msg_userauth_banner() { + + unsigned char* banner = NULL; + unsigned int bannerlen; + unsigned int i, linecount; + + TRACE(("enter recv_msg_userauth_banner")); + if (ses.authstate.authdone) { + TRACE(("leave recv_msg_userauth_banner: banner after auth done")); + return; + } + + banner = buf_getstring(ses.payload, &bannerlen); + buf_eatstring(ses.payload); /* The language string */ + + 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; + } + linecount++; + } + } + + printf("%s\n", banner); + +out: + m_free(banner); + TRACE(("leave recv_msg_userauth_banner")); +} + + void recv_msg_userauth_failure() { unsigned char * methods = NULL; |