diff options
author | Matt Johnston <matt@ucc.asn.au> | 2008-09-15 14:40:30 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2008-09-15 14:40:30 +0000 |
commit | e44aa503f0b816adb1611f118c1c09877e7bb3d3 (patch) | |
tree | 7a61beef6721f51dfdc1d9d2c3696b0b55a69e41 /common-session.c | |
parent | 12929e8cf09bf16ad59e04eaa20f31282bd58e30 (diff) |
- "-J 'nc localhost 22'" kind of works, needs fixing hostkeys, ptys etc.
--HG--
extra : convert_revision : 45069dd007ebf414330e0a7abf4fb7e0727049c3
Diffstat (limited to 'common-session.c')
-rw-r--r-- | common-session.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/common-session.c b/common-session.c index ea8b3f7..3d759b5 100644 --- a/common-session.c +++ b/common-session.c @@ -423,3 +423,26 @@ const char* get_user_shell() { return ses.authstate.pw_shell; } } +void fill_passwd(const char* username) { + struct passwd *pw = NULL; + if (ses.authstate.pw_name) + m_free(ses.authstate.pw_name); + if (ses.authstate.pw_dir) + m_free(ses.authstate.pw_dir); + if (ses.authstate.pw_shell) + m_free(ses.authstate.pw_shell); + if (ses.authstate.pw_passwd) + m_free(ses.authstate.pw_passwd); + + pw = getpwnam(username); + if (!pw) { + return; + } + ses.authstate.pw_uid = pw->pw_uid; + ses.authstate.pw_gid = pw->pw_gid; + ses.authstate.pw_name = m_strdup(pw->pw_name); + ses.authstate.pw_dir = m_strdup(pw->pw_dir); + ses.authstate.pw_shell = m_strdup(pw->pw_shell); + ses.authstate.pw_passwd = m_strdup(pw->pw_passwd); +} + |