diff options
author | Pascal Bellard <pascal.bellard@ads-lu.com> | 2011-11-29 20:54:30 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-11-29 20:54:30 +0100 |
commit | 0fa3e5f6f9ad55871d52bd10988fec66398f3d65 (patch) | |
tree | f70eb754c56bdf9f42c85586d5cebf26a9b959b0 /networking/httpd.c | |
parent | 7291755439ad2f400df51a74b4e9a31a48f484b1 (diff) | |
download | busybox-w32-0fa3e5f6f9ad55871d52bd10988fec66398f3d65.tar.gz busybox-w32-0fa3e5f6f9ad55871d52bd10988fec66398f3d65.tar.bz2 busybox-w32-0fa3e5f6f9ad55871d52bd10988fec66398f3d65.zip |
httpd: small fixes to previous change
Signed-off-by: Pascal Bellard <pascal.bellard@ads-lu.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/httpd.c')
-rw-r--r-- | networking/httpd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/networking/httpd.c b/networking/httpd.c index c66e0f66b..0356e4c1b 100644 --- a/networking/httpd.c +++ b/networking/httpd.c | |||
@@ -1763,6 +1763,9 @@ static int check_user_passwd(const char *path, char *user_and_passwd) | |||
1763 | if (ENABLE_FEATURE_HTTPD_AUTH_MD5) { | 1763 | if (ENABLE_FEATURE_HTTPD_AUTH_MD5) { |
1764 | char *colon_after_user; | 1764 | char *colon_after_user; |
1765 | const char *passwd; | 1765 | const char *passwd; |
1766 | # if ENABLE_FEATURE_SHADOWPASSWDS && !ENABLE_PAM | ||
1767 | char sp_buf[256]; | ||
1768 | # endif | ||
1766 | 1769 | ||
1767 | colon_after_user = strchr(user_and_passwd, ':'); | 1770 | colon_after_user = strchr(user_and_passwd, ':'); |
1768 | if (!colon_after_user) | 1771 | if (!colon_after_user) |
@@ -1787,18 +1790,19 @@ static int check_user_passwd(const char *path, char *user_and_passwd) | |||
1787 | *colon_after_user = '\0'; | 1790 | *colon_after_user = '\0'; |
1788 | userinfo.name = user_and_passwd; | 1791 | userinfo.name = user_and_passwd; |
1789 | userinfo.pw = colon_after_user + 1; | 1792 | userinfo.pw = colon_after_user + 1; |
1790 | r = pam_start("httpd", user_and_passwd, &conv_info, &pamh) != PAM_SUCCESS | 1793 | r = pam_start("httpd", user_and_passwd, &conv_info, &pamh) != PAM_SUCCESS; |
1791 | || pam_authenticate(pamh, PAM_DISALLOW_NULL_AUTHTOK) != PAM_SUCCESS | 1794 | if (r == 0) { |
1792 | || pam_acct_mgmt(pamh, PAM_DISALLOW_NULL_AUTHTOK) != PAM_SUCCESS | 1795 | r = pam_authenticate(pamh, PAM_DISALLOW_NULL_AUTHTOK) != PAM_SUCCESS |
1793 | ; | 1796 | || pam_acct_mgmt(pamh, PAM_DISALLOW_NULL_AUTHTOK) != PAM_SUCCESS |
1794 | pam_end(pamh, PAM_SUCCESS); | 1797 | ; |
1798 | pam_end(pamh, PAM_SUCCESS); | ||
1799 | } | ||
1795 | *colon_after_user = ':'; | 1800 | *colon_after_user = ':'; |
1796 | goto end_check_passwd; | 1801 | goto end_check_passwd; |
1797 | # else | 1802 | # else |
1798 | # if ENABLE_FEATURE_SHADOWPASSWDS | 1803 | # if ENABLE_FEATURE_SHADOWPASSWDS |
1799 | /* Using _r function to avoid pulling in static buffers */ | 1804 | /* Using _r function to avoid pulling in static buffers */ |
1800 | struct spwd spw; | 1805 | struct spwd spw; |
1801 | char buffer[256]; | ||
1802 | # endif | 1806 | # endif |
1803 | struct passwd *pw; | 1807 | struct passwd *pw; |
1804 | 1808 | ||
@@ -1813,7 +1817,7 @@ static int check_user_passwd(const char *path, char *user_and_passwd) | |||
1813 | /* getspnam_r may return 0 yet set result to NULL. | 1817 | /* getspnam_r may return 0 yet set result to NULL. |
1814 | * At least glibc 2.4 does this. Be extra paranoid here. */ | 1818 | * At least glibc 2.4 does this. Be extra paranoid here. */ |
1815 | struct spwd *result = NULL; | 1819 | struct spwd *result = NULL; |
1816 | r = getspnam_r(pw->pw_name, &spw, buffer, sizeof(buffer), &result); | 1820 | r = getspnam_r(pw->pw_name, &spw, sp_buf, sizeof(sp_buf), &result); |
1817 | if (r == 0 && result) | 1821 | if (r == 0 && result) |
1818 | passwd = result->sp_pwdp; | 1822 | passwd = result->sp_pwdp; |
1819 | } | 1823 | } |