diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/vmod_basicauth.c | 15 |
3 files changed, 13 insertions, 6 deletions
@@ -4,7 +4,7 @@ See the end of file for copying conditions. Please send Vmod-basicauth bug reports to <gray@gnu.org> -Version 1.5.90 (Git) +Version 1.5.91 (Git) * Improved testsute diff --git a/configure.ac b/configure.ac index bf33983..20d9827 100644 --- a/configure.ac +++ b/configure.ac @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with vmod-basicauth. If not, see <http://www.gnu.org/licenses/>. AC_PREREQ(2.69) -AC_INIT([vmod-basicauth], 1.5.90, [gray@gnu.org]) +AC_INIT([vmod-basicauth], 1.5.91, [gray@gnu.org]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR(src/vmod_basicauth.vcc) diff --git a/src/vmod_basicauth.c b/src/vmod_basicauth.c index 943fba9..d106afd 100644 --- a/src/vmod_basicauth.c +++ b/src/vmod_basicauth.c @@ -107,12 +107,18 @@ static pthread_mutex_t pass_mutex = PTHREAD_MUTEX_INITIALIZER; static int crypt_match(const char *pass, const char *hash, struct vmod_priv *priv) { - int res; + int res = 1; + char *cp; + #ifdef HAVE_CRYPT_R - res = strcmp(crypt_r(pass, hash, &get_priv_data(priv)->cdat), hash); + cp = crypt_r(pass, hash, &get_priv_data(priv)->cdat); + if (cp) + res = strcmp(cp, hash); #else pthread_mutex_lock(&pass_mutex); - res = strcmp(crypt(pass, hash), hash); + cp = crypt(pass, hash); + if (cp) + res = strcmp(cp, hash); pthread_mutex_unlock(&pass_mutex); #endif return res; @@ -128,7 +134,8 @@ static int apr_match(const char *pass, const char *hash, struct vmod_priv *priv) { char buf[120]; - return strcmp(apr_md5_encode(pass, hash, buf, sizeof(buf)), hash); + char *cp = apr_md5_encode(pass, hash, buf, sizeof(buf)); + return cp ? strcmp(cp, hash) : 1; } #define SHA1_DIGEST_SIZE 20 |