2004-07-27 16:30:46 +00:00
|
|
|
#include "includes.h"
|
|
|
|
#include "buffer.h"
|
|
|
|
#include "dbutil.h"
|
|
|
|
#include "session.h"
|
|
|
|
#include "ssh.h"
|
2004-07-29 02:19:03 +00:00
|
|
|
#include "runopts.h"
|
2004-07-27 16:30:46 +00:00
|
|
|
|
|
|
|
int cli_auth_password() {
|
|
|
|
|
|
|
|
char* password = NULL;
|
|
|
|
TRACE(("enter cli_auth_password"));
|
|
|
|
|
|
|
|
CHECKCLEARTOWRITE();
|
|
|
|
password = getpass("Password: ");
|
|
|
|
|
|
|
|
buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST);
|
|
|
|
|
2004-07-29 02:19:03 +00:00
|
|
|
buf_putstring(ses.writepayload, cli_opts.username,
|
|
|
|
strlen(cli_opts.username));
|
2004-07-27 16:30:46 +00:00
|
|
|
|
|
|
|
buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION,
|
|
|
|
SSH_SERVICE_CONNECTION_LEN);
|
|
|
|
|
|
|
|
buf_putstring(ses.writepayload, AUTH_METHOD_PASSWORD,
|
|
|
|
AUTH_METHOD_PASSWORD_LEN);
|
|
|
|
|
|
|
|
buf_putbyte(ses.writepayload, 0); /* FALSE - so says the spec */
|
|
|
|
|
|
|
|
buf_putstring(ses.writepayload, password, strlen(password));
|
|
|
|
|
|
|
|
encrypt_packet();
|
|
|
|
m_burn(password, strlen(password));
|
|
|
|
|
|
|
|
TRACE(("leave cli_auth_password"));
|
|
|
|
return 1; /* Password auth can always be tried */
|
|
|
|
|
|
|
|
}
|