33
|
1 #include "includes.h" |
|
2 #include "buffer.h" |
|
3 #include "dbutil.h" |
|
4 #include "session.h" |
|
5 #include "ssh.h" |
|
6 |
|
7 int cli_auth_password() { |
|
8 |
|
9 char* password = NULL; |
|
10 TRACE(("enter cli_auth_password")); |
|
11 |
|
12 CHECKCLEARTOWRITE(); |
|
13 password = getpass("Password: "); |
|
14 |
|
15 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST); |
|
16 |
|
17 buf_putstring(ses.writepayload, ses.authstate.username, |
|
18 strlen(ses.authstate.username)); |
|
19 |
|
20 buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION, |
|
21 SSH_SERVICE_CONNECTION_LEN); |
|
22 |
|
23 buf_putstring(ses.writepayload, AUTH_METHOD_PASSWORD, |
|
24 AUTH_METHOD_PASSWORD_LEN); |
|
25 |
|
26 buf_putbyte(ses.writepayload, 0); /* FALSE - so says the spec */ |
|
27 |
|
28 buf_putstring(ses.writepayload, password, strlen(password)); |
|
29 |
|
30 encrypt_packet(); |
|
31 m_burn(password, strlen(password)); |
|
32 |
|
33 TRACE(("leave cli_auth_password")); |
|
34 return 1; /* Password auth can always be tried */ |
|
35 |
|
36 } |