- md5_passwd++;
- user_len_p1 = md5_passwd - cur->after_colon;
- /* comparing "user:" */
- if (strncmp(cur->after_colon, user_and_passwd, user_len_p1) != 0) {
+ /* compare "user:" */
+ if (cur->after_colon[0] != '*'
+ && strncmp(cur->after_colon, user_and_passwd,
+ colon_after_user - user_and_passwd + 1) != 0
+ ) {
+ continue;
+ }
+ /* this cfg entry is '*' or matches username from peer */
+
+ passwd = strchr(cur->after_colon, ':');
+ if (!passwd)
+ goto bad_input;
+ passwd++;
+ if (passwd[0] == '*') {
+# if ENABLE_PAM
+ struct pam_userinfo userinfo;
+ struct pam_conv conv_info = { &pam_talker, (void *) &userinfo };
+ pam_handle_t *pamh;
+
+ *colon_after_user = '\0';
+ userinfo.name = user_and_passwd;
+ userinfo.pw = colon_after_user + 1;
+ r = pam_start("httpd", user_and_passwd, &conv_info, &pamh) != PAM_SUCCESS;
+ if (r == 0) {
+ r = pam_authenticate(pamh, PAM_DISALLOW_NULL_AUTHTOK) != PAM_SUCCESS
+ || pam_acct_mgmt(pamh, PAM_DISALLOW_NULL_AUTHTOK) != PAM_SUCCESS
+ ;
+ pam_end(pamh, PAM_SUCCESS);
+ }
+ *colon_after_user = ':';
+ goto end_check_passwd;
+# else
+# if ENABLE_FEATURE_SHADOWPASSWDS
+ /* Using _r function to avoid pulling in static buffers */
+ struct spwd spw;
+# endif
+ struct passwd *pw;
+
+ *colon_after_user = '\0';
+ pw = getpwnam(user_and_passwd);
+ *colon_after_user = ':';
+ if (!pw || !pw->pw_passwd)