diff options
author | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2001-03-08 00:35:37 +0000 |
---|---|---|
committer | rbb <rbb@13f79535-47bb-0310-9956-ffa450edef68> | 2001-03-08 00:35:37 +0000 |
commit | 103eef08c918875debe3bfdd548c8348a452ab9d (patch) | |
tree | 5983255eada1721bd5c08d82e78136cd0d94a315 /user | |
parent | 2bd516d75699066f7fb2d41161883cfa1c6cd72d (diff) | |
download | libapr-103eef08c918875debe3bfdd548c8348a452ab9d.tar.gz |
Allow a way to get the password from the system password database.
Non unix platforms will likely need a similar function.
Submitted by: John Barbee <jbarbee@covalent.net>
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61347 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'user')
-rw-r--r-- | user/unix/userinfo.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/user/unix/userinfo.c b/user/unix/userinfo.c index 2987153f5..dca8e1cf9 100644 --- a/user/unix/userinfo.c +++ b/user/unix/userinfo.c @@ -129,4 +129,18 @@ APR_DECLARE(apr_status_t) apr_get_username(char **username, apr_uid_t userid, ap *username = apr_pstrdup(p, pw->pw_name); return APR_SUCCESS; } + +APR_DECLARE(apr_status_t) apr_get_user_passwd(char **passwd, + const char *username, apr_pool_t *p) +{ + struct passwd *pw; + apr_status_t rv; + + if ((rv = getpwnam_safe(username, &pw)) != APR_SUCCESS) + return rv; + + *passwd = apr_pstrdup(p, pw->pw_passwd); + + return APR_SUCCESS; +} |