1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
$NetBSD: patch-ad,v 1.3 2007/06/29 22:58:55 joerg Exp $
--- mod_auth_mysql.c.orig 2004-06-27 11:34:55.000000000 +0000
+++ mod_auth_mysql.c
@@ -29,14 +29,14 @@
#define SNPRINTF apr_snprintf
#define PSTRDUP apr_pstrdup
#define PSTRCAT apr_pstrcat
-#define APACHELOG(severity, handle, message ...) ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_##severity, 0, handle->server, message)
+#define APACHELOG(severity, handle, message...) ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_##severity, 0, handle->server, message)
#else
#define PALLOC ap_palloc
#define PCALLOC ap_pcalloc
#define SNPRINTF ap_snprintf
#define PSTRDUP ap_pstrdup
#define PSTRCAT ap_pstrcat
-#define APACHELOG(severity, handle, message ...) ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_##severity, handle->server, message)
+#define APACHELOG(severity, handle, message...) ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_##severity, handle->server, message)
#endif
#include <httpd.h>
@@ -51,12 +51,18 @@
#include <ap_md5.h>
#endif
+#ifndef APR_XtOffsetOf
+#define APR_XtOffsetOf(x,y) APR_OFFSETOF(x,y)
+#endif
+
#include <mysql.h>
#include <errmsg.h>
#include <mysqld_error.h>
#ifdef HAVE_CRYPT_H
#include <crypt.h>
+#else
+#include <unistd.h>
#endif
#ifndef TRUE
@@ -94,7 +100,7 @@ unsigned long auth_db_client_flag = 0;
#define CRYPT_MD5_ENCRYPTION_FLAG 1<<3
#endif
#define PHP_MD5_ENCRYPTION_FLAG 1<<4
-#ifdef HAVE_CRYPT_H
+#if defined(HAVE_CRYPT_H) || defined(HAVE_LIBCRYPT)
#define CRYPT_ENCRYPTION_FLAG 1<<5
#endif
@@ -126,7 +132,7 @@ static int check_crypt_MD5_encryption(co
}
#endif
-#ifdef HAVE_CRYPT_H
+#if defined(HAVE_CRYPT_H) || defined(HAVE_LIBCRYPT)
static int check_crypt_encryption(const char *passwd, char *enc_passwd)
{
return (!strcmp(crypt(passwd, enc_passwd), enc_passwd));
@@ -206,7 +212,9 @@ encryption_type_entry supported_encrypti
#if CRYPT_MD5
{ "Crypt_MD5", check_crypt_MD5_encryption, CRYPT_MD5_ENCRYPTION_FLAG },
#endif
+#if defined(HAVE_CRYPT_H) || defined(HAVE_LIBCRYPT)
{ "Crypt", check_crypt_encryption, CRYPT_ENCRYPTION_FLAG },
+#endif
{ "PHP_MD5", check_PHP_MD5_encryption, PHP_MD5_ENCRYPTION_FLAG },
/* add additional encryption types below */
{ NULL, NULL, 0 }
@@ -1463,14 +1471,17 @@ int mysql_authenticate_basic_user(reques
return res;
}
+#ifdef APACHE2
APACHELOG(DEBUG, r,
"Starting basic user auth for [%s] in %s, child pid %i",
-#ifdef APACHE2
r->user,
+ sec->dir, getpid());
#else
+ APACHELOG(DEBUG, r,
+ "Starting basic user auth for [%s] in %s, child pid %i",
c->user,
-#endif
sec->dir, getpid());
+#endif
#ifdef APACHE2
switch (mysql_check_user_password(r, r->user, sent_pw, sec)) {
|