Mercurial > dropbear
comparison cli-auth.c @ 34:e2a1eaa19f22
Client mostly works up to password auth
Need to rework algo-choosing etc, since server is now broken.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 28 Jul 2004 16:44:16 +0000 |
parents | f789045062e6 |
children | 0ad5fb979f42 |
comparison
equal
deleted
inserted
replaced
33:f789045062e6 | 34:e2a1eaa19f22 |
---|---|
29 dropbear_exit("Couldn't find username for current user"); | 29 dropbear_exit("Couldn't find username for current user"); |
30 } | 30 } |
31 | 31 |
32 ses.authstate.username = m_strdup(pw->pw_name); | 32 ses.authstate.username = m_strdup(pw->pw_name); |
33 } | 33 } |
34 TRACE(("leave cli_get_user: %s", cli_ses.username)); | 34 TRACE(("leave cli_get_user: %s", ses.authstate.username)); |
35 } | 35 } |
36 | 36 |
37 /* Send a "none" auth request to get available methods */ | 37 /* Send a "none" auth request to get available methods */ |
38 void cli_auth_getmethods() { | 38 void cli_auth_getmethods() { |
39 | 39 |
88 } | 88 } |
89 | 89 |
90 tok = methods; /* tok stores the next method we'll compare */ | 90 tok = methods; /* tok stores the next method we'll compare */ |
91 for (i = 0; i <= methlen; i++) { | 91 for (i = 0; i <= methlen; i++) { |
92 if (methods[i] == '\0') { | 92 if (methods[i] == '\0') { |
93 TRACE(("auth method '%s'\n", tok)); | 93 TRACE(("auth method '%s'", tok)); |
94 #ifdef DROPBEAR_PUBKEY_AUTH | 94 #ifdef DROPBEAR_PUBKEY_AUTH |
95 if (strncmp(AUTH_METHOD_PUBKEY, tok, | 95 if (strncmp(AUTH_METHOD_PUBKEY, tok, |
96 AUTH_METHOD_PUBKEY_LEN) == 0) { | 96 AUTH_METHOD_PUBKEY_LEN) == 0) { |
97 ses.authstate.authtypes |= AUTH_TYPE_PUBKEY; | 97 ses.authstate.authtypes |= AUTH_TYPE_PUBKEY; |
98 } | 98 } |
101 if (strncmp(AUTH_METHOD_PASSWORD, tok, | 101 if (strncmp(AUTH_METHOD_PASSWORD, tok, |
102 AUTH_METHOD_PASSWORD_LEN) == 0) { | 102 AUTH_METHOD_PASSWORD_LEN) == 0) { |
103 ses.authstate.authtypes |= AUTH_TYPE_PASSWORD; | 103 ses.authstate.authtypes |= AUTH_TYPE_PASSWORD; |
104 } | 104 } |
105 #endif | 105 #endif |
106 tok = &methods[i]; /* Must make sure we don't use it after | 106 tok = &methods[i+1]; /* Must make sure we don't use it after the |
107 the last loop, since it'll point | 107 last loop, since it'll point to something |
108 to something undefined */ | 108 undefined */ |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 cli_ses.state = USERAUTH_FAIL_RCVD; | 112 cli_ses.state = USERAUTH_FAIL_RCVD; |
113 | 113 |