comparison svr-auth.c @ 483:738313e73b1c

- "-J 'nc localhost 22'" kind of works, needs fixing hostkeys, ptys etc.
author Matt Johnston <matt@ucc.asn.au>
date Mon, 15 Sep 2008 14:40:30 +0000
parents f33b0898aaa6
children d58c478bd399
comparison
equal deleted inserted replaced
482:7ad49f34a122 483:738313e73b1c
201 m_free(username); 201 m_free(username);
202 m_free(servicename); 202 m_free(servicename);
203 m_free(methodname); 203 m_free(methodname);
204 } 204 }
205 205
206 static void fill_passwd(const char* username) {
207 struct passwd *pw = NULL;
208 if (ses.authstate.pw_name)
209 m_free(ses.authstate.pw_name);
210 if (ses.authstate.pw_dir)
211 m_free(ses.authstate.pw_dir);
212 if (ses.authstate.pw_shell)
213 m_free(ses.authstate.pw_shell);
214 if (ses.authstate.pw_passwd)
215 m_free(ses.authstate.pw_passwd);
216
217 pw = getpwnam(username);
218 if (!pw) {
219 return;
220 }
221 ses.authstate.pw_uid = pw->pw_uid;
222 ses.authstate.pw_gid = pw->pw_gid;
223 ses.authstate.pw_name = m_strdup(pw->pw_name);
224 ses.authstate.pw_dir = m_strdup(pw->pw_dir);
225 ses.authstate.pw_shell = m_strdup(pw->pw_shell);
226 ses.authstate.pw_passwd = m_strdup(pw->pw_passwd);
227 }
228
229 206
230 /* Check that the username exists, has a non-empty password, and has a valid 207 /* Check that the username exists, has a non-empty password, and has a valid
231 * shell. 208 * shell.
232 * returns DROPBEAR_SUCCESS on valid username, DROPBEAR_FAILURE on failure */ 209 * returns DROPBEAR_SUCCESS on valid username, DROPBEAR_FAILURE on failure */
233 static int checkusername(unsigned char *username, unsigned int userlen) { 210 static int checkusername(unsigned char *username, unsigned int userlen) {