Mercurial > dropbear
annotate cli-authpasswd.c @ 53:0fe267cc9dee
Be a bit safer with reentrant pw_name
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 08 Aug 2004 16:41:26 +0000 |
parents | 0ad5fb979f42 |
children | eee77ac31ccc |
rev | line source |
---|---|
33 | 1 #include "includes.h" |
2 #include "buffer.h" | |
3 #include "dbutil.h" | |
4 #include "session.h" | |
5 #include "ssh.h" | |
35
0ad5fb979f42
set the isserver flag (oops)
Matt Johnston <matt@ucc.asn.au>
parents:
33
diff
changeset
|
6 #include "runopts.h" |
33 | 7 |
8 int cli_auth_password() { | |
9 | |
10 char* password = NULL; | |
11 TRACE(("enter cli_auth_password")); | |
12 | |
13 CHECKCLEARTOWRITE(); | |
14 password = getpass("Password: "); | |
15 | |
16 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST); | |
17 | |
35
0ad5fb979f42
set the isserver flag (oops)
Matt Johnston <matt@ucc.asn.au>
parents:
33
diff
changeset
|
18 buf_putstring(ses.writepayload, cli_opts.username, |
0ad5fb979f42
set the isserver flag (oops)
Matt Johnston <matt@ucc.asn.au>
parents:
33
diff
changeset
|
19 strlen(cli_opts.username)); |
33 | 20 |
21 buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION, | |
22 SSH_SERVICE_CONNECTION_LEN); | |
23 | |
24 buf_putstring(ses.writepayload, AUTH_METHOD_PASSWORD, | |
25 AUTH_METHOD_PASSWORD_LEN); | |
26 | |
27 buf_putbyte(ses.writepayload, 0); /* FALSE - so says the spec */ | |
28 | |
29 buf_putstring(ses.writepayload, password, strlen(password)); | |
30 | |
31 encrypt_packet(); | |
32 m_burn(password, strlen(password)); | |
33 | |
34 TRACE(("leave cli_auth_password")); | |
35 return 1; /* Password auth can always be tried */ | |
36 | |
37 } |