comparison cli-auth.c @ 35:0ad5fb979f42

set the isserver flag (oops) fix password auth for the server
author Matt Johnston <matt@ucc.asn.au>
date Thu, 29 Jul 2004 02:19:03 +0000
parents e2a1eaa19f22
children 0913e2ee3545
comparison
equal deleted inserted replaced
34:e2a1eaa19f22 35:0ad5fb979f42
11 11
12 memset(&ses.authstate, 0, sizeof(ses.authstate)); 12 memset(&ses.authstate, 0, sizeof(ses.authstate));
13 } 13 }
14 14
15 15
16 void cli_get_user() {
17
18 uid_t uid;
19 struct passwd *pw;
20
21 TRACE(("enter cli_get_user"));
22 if (cli_opts.username != NULL) {
23 ses.authstate.username = cli_opts.username;
24 } else {
25 uid = getuid();
26
27 pw = getpwuid(uid);
28 if (pw == NULL || pw->pw_name == NULL) {
29 dropbear_exit("Couldn't find username for current user");
30 }
31
32 ses.authstate.username = m_strdup(pw->pw_name);
33 }
34 TRACE(("leave cli_get_user: %s", ses.authstate.username));
35 }
36
37 /* Send a "none" auth request to get available methods */ 16 /* Send a "none" auth request to get available methods */
38 void cli_auth_getmethods() { 17 void cli_auth_getmethods() {
39 18
40 TRACE(("enter cli_auth_getmethods")); 19 TRACE(("enter cli_auth_getmethods"));
41 20
42 CHECKCLEARTOWRITE(); 21 CHECKCLEARTOWRITE();
43 22
44 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST); 23 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST);
45 buf_putstring(ses.writepayload, ses.authstate.username, 24 buf_putstring(ses.writepayload, cli_opts.username,
46 strlen(ses.authstate.username)); 25 strlen(cli_opts.username));
47 buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION, 26 buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION,
48 SSH_SERVICE_CONNECTION_LEN); 27 SSH_SERVICE_CONNECTION_LEN);
49 buf_putstring(ses.writepayload, "none", 4); /* 'none' method */ 28 buf_putstring(ses.writepayload, "none", 4); /* 'none' method */
50 29
51 encrypt_packet(); 30 encrypt_packet();