comparison cli-auth.c @ 1121:bb3a03feb31f

Merge pull request #13 from gazoo74/fix-warnings Fix warnings
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jun 2015 22:25:28 +0800
parents efb7e545a65e
children aaf576b27a10
comparison
equal deleted inserted replaced
1087:1e486f368ec3 1121:bb3a03feb31f
41 /* Send a "none" auth request to get available methods */ 41 /* Send a "none" auth request to get available methods */
42 void cli_auth_getmethods() { 42 void cli_auth_getmethods() {
43 TRACE(("enter cli_auth_getmethods")) 43 TRACE(("enter cli_auth_getmethods"))
44 CHECKCLEARTOWRITE(); 44 CHECKCLEARTOWRITE();
45 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST); 45 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST);
46 buf_putstring(ses.writepayload, cli_opts.username, 46 buf_putstring(ses.writepayload, (const unsigned char *)cli_opts.username,
47 strlen(cli_opts.username)); 47 strlen(cli_opts.username));
48 buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION, 48 buf_putstring(ses.writepayload, (const unsigned char *)SSH_SERVICE_CONNECTION,
49 SSH_SERVICE_CONNECTION_LEN); 49 SSH_SERVICE_CONNECTION_LEN);
50 buf_putstring(ses.writepayload, "none", 4); /* 'none' method */ 50 buf_putstring(ses.writepayload, (const unsigned char *)"none", 4); /* 'none' method */
51 51
52 encrypt_packet(); 52 encrypt_packet();
53 53
54 #ifdef DROPBEAR_CLI_IMMEDIATE_AUTH 54 #ifdef DROPBEAR_CLI_IMMEDIATE_AUTH
55 /* We can't haven't two auth requests in-flight with delayed zlib mode 55 /* We can't haven't two auth requests in-flight with delayed zlib mode
73 TRACE(("leave cli_auth_getmethods")) 73 TRACE(("leave cli_auth_getmethods"))
74 } 74 }
75 75
76 void recv_msg_userauth_banner() { 76 void recv_msg_userauth_banner() {
77 77
78 unsigned char* banner = NULL; 78 char* banner = NULL;
79 unsigned int bannerlen; 79 unsigned int bannerlen;
80 unsigned int i, linecount; 80 unsigned int i, linecount;
81 81
82 TRACE(("enter recv_msg_userauth_banner")) 82 TRACE(("enter recv_msg_userauth_banner"))
83 if (ses.authstate.authdone) { 83 if (ses.authstate.authdone) {
84 TRACE(("leave recv_msg_userauth_banner: banner after auth done")) 84 TRACE(("leave recv_msg_userauth_banner: banner after auth done"))
85 return; 85 return;
86 } 86 }
87 87
88 banner = buf_getstring(ses.payload, &bannerlen); 88 banner = (char *)buf_getstring(ses.payload, &bannerlen);
89 buf_eatstring(ses.payload); /* The language string */ 89 buf_eatstring(ses.payload); /* The language string */
90 90
91 if (bannerlen > MAX_BANNER_SIZE) { 91 if (bannerlen > MAX_BANNER_SIZE) {
92 TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen)) 92 TRACE(("recv_msg_userauth_banner: bannerlen too long: %d", bannerlen))
93 goto out; 93 goto out;
149 dropbear_exit("Unexpected userauth packet"); 149 dropbear_exit("Unexpected userauth packet");
150 } 150 }
151 151
152 void recv_msg_userauth_failure() { 152 void recv_msg_userauth_failure() {
153 153
154 unsigned char * methods = NULL; 154 char * methods = NULL;
155 unsigned char * tok = NULL; 155 char * tok = NULL;
156 unsigned int methlen = 0; 156 unsigned int methlen = 0;
157 unsigned int partial = 0; 157 unsigned int partial = 0;
158 unsigned int i = 0; 158 unsigned int i = 0;
159 159
160 TRACE(("<- MSG_USERAUTH_FAILURE")) 160 TRACE(("<- MSG_USERAUTH_FAILURE"))
199 #endif 199 #endif
200 cli_ses.state = USERAUTH_FAIL_RCVD; 200 cli_ses.state = USERAUTH_FAIL_RCVD;
201 cli_ses.lastauthtype = AUTH_TYPE_NONE; 201 cli_ses.lastauthtype = AUTH_TYPE_NONE;
202 } 202 }
203 203
204 methods = buf_getstring(ses.payload, &methlen); 204 methods = (char *)buf_getstring(ses.payload, &methlen);
205 205
206 partial = buf_getbool(ses.payload); 206 partial = buf_getbool(ses.payload);
207 207
208 if (partial) { 208 if (partial) {
209 dropbear_log(LOG_INFO, "Authentication partially succeeded, more attempts required"); 209 dropbear_log(LOG_INFO, "Authentication partially succeeded, more attempts required");