aboutsummaryrefslogtreecommitdiffstats
path: root/package/uhttpd/src/uhttpd-utils.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2010-11-06 16:19:04 +0000
committerJo-Philipp Wich <jow@openwrt.org>2010-11-06 16:19:04 +0000
commitfa644368ed7583c93dd1e4dffbafeb0e54167670 (patch)
treebf51d9c7e76d2e98935d7acf7331e68512095fe8 /package/uhttpd/src/uhttpd-utils.c
parentcf313b63bc5fc41180552327fdbc4b7ca97fbb43 (diff)
downloadupstream-fa644368ed7583c93dd1e4dffbafeb0e54167670.tar.gz
upstream-fa644368ed7583c93dd1e4dffbafeb0e54167670.tar.bz2
upstream-fa644368ed7583c93dd1e4dffbafeb0e54167670.zip
uhttpd: make it work without shadow password support
SVN-Revision: 23897
Diffstat (limited to 'package/uhttpd/src/uhttpd-utils.c')
-rw-r--r--package/uhttpd/src/uhttpd-utils.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/package/uhttpd/src/uhttpd-utils.c b/package/uhttpd/src/uhttpd-utils.c
index 3821eb54cb..9f9a5dd6a7 100644
--- a/package/uhttpd/src/uhttpd-utils.c
+++ b/package/uhttpd/src/uhttpd-utils.c
@@ -610,7 +610,10 @@ struct auth_realm * uh_auth_add(char *path, char *user, char *pass)
{
struct auth_realm *new = NULL;
struct passwd *pwd;
+
+#ifdef HAVE_SHADOW
struct spwd *spwd;
+#endif
if((new = (struct auth_realm *)malloc(sizeof(struct auth_realm))) != NULL)
{
@@ -625,6 +628,7 @@ struct auth_realm * uh_auth_add(char *path, char *user, char *pass)
/* given password refers to a passwd entry */
if( (strlen(pass) > 3) && !strncmp(pass, "$p$", 3) )
{
+#ifdef HAVE_SHADOW
/* try to resolve shadow entry */
if( ((spwd = getspnam(&pass[3])) != NULL) && spwd->sp_pwdp )
{
@@ -632,8 +636,11 @@ struct auth_realm * uh_auth_add(char *path, char *user, char *pass)
min(strlen(spwd->sp_pwdp), sizeof(new->pass) - 1));
}
+ else
+#endif
+
/* try to resolve passwd entry */
- else if( ((pwd = getpwnam(&pass[3])) != NULL) && pwd->pw_passwd &&
+ if( ((pwd = getpwnam(&pass[3])) != NULL) && pwd->pw_passwd &&
(pwd->pw_passwd[0] != '!') && (pwd->pw_passwd[0] != 0)
) {
memcpy(new->pass, pwd->pw_passwd,