Link to home
Start Free TrialLog in
Avatar of mark2326
mark2326

asked on

Need help building an Apache module

I'm trying to build an apache module "mod_auth_mysql" so I can password protect a directory and have the users and passwords stored in MySQL.  http://support.modwest.com/content/1/161/en/how-do-i-protect-a-directory-with-mod_auth_mysql.html
I downloaded mod_auth_mysql 3.0

As per the build instructions...
If the mysql.h header file cannot be found, add the -I option to specify the
directory where mysql.h can be found.

If the mysqlclient library cannot be found, add the -L option to specify the
directory where libmysqlclient.so can be found.  

Example:
apxs -c -L/usr/lib/mysql -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c

My command...
apxs -c -L/usr/local/mysql-5.1.47-osx10.6-x86/lib -I/usr/local/mysql-5.1.47-osx10.6-x86/include -lmysqlclient -lm -lz mod_auth_mysql.c

I get the error...
i686-apple-darwin10-gcc-4.2.1: mod_auth_mysql.c: No such file or directory

I cd to the folder where the mod_auth_mysql.c file lives and get the same error.

Can anyone help?
Avatar of cwiedmann
cwiedmann

Couple of ideas:
-Try giving a fuller path to mod_auth_mysql.c  (e.g., "./mod_auth_mysql.c").
-Check the permissions on the file and make sure you have read access to the file.
Avatar of mark2326

ASKER

Thank You.

Now when I run it I'm getting these errors...

/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:591: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:591: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:591: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:591: error: (near initialization for ‘mysql_auth_cmds[0].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:595: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:595: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:595: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:595: error: (near initialization for ‘mysql_auth_cmds[1].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:599: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:599: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:599: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:599: error: (near initialization for ‘mysql_auth_cmds[2].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:603: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:603: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:603: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:603: error: (near initialization for ‘mysql_auth_cmds[3].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:607: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:607: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:607: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:607: error: (near initialization for ‘mysql_auth_cmds[4].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:611: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:611: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:611: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:611: error: (near initialization for ‘mysql_auth_cmds[5].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:615: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:615: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:615: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:615: error: (near initialization for ‘mysql_auth_cmds[6].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:619: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:619: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:619: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:619: error: (near initialization for ‘mysql_auth_cmds[7].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:623: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:623: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:623: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:623: error: (near initialization for ‘mysql_auth_cmds[8].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:627: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:627: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:627: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:627: error: (near initialization for ‘mysql_auth_cmds[9].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:631: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:631: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:631: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:631: error: (near initialization for ‘mysql_auth_cmds[10].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:635: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:635: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:635: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:635: error: (near initialization for ‘mysql_auth_cmds[11].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:639: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:639: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:639: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:639: error: (near initialization for ‘mysql_auth_cmds[12].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:643: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:643: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:643: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:643: error: (near initialization for ‘mysql_auth_cmds[13].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:651: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:651: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:651: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:651: error: (near initialization for ‘mysql_auth_cmds[14].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:655: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:655: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:655: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:655: error: (near initialization for ‘mysql_auth_cmds[15].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:659: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:659: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:659: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:659: error: (near initialization for ‘mysql_auth_cmds[16].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:663: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:663: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:663: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:663: error: (near initialization for ‘mysql_auth_cmds[17].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:667: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:667: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:667: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:667: error: (near initialization for ‘mysql_auth_cmds[18].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:671: error: expected expression before ‘mysql_auth_config_rec’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:671: warning: cast to pointer from integer of different size
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:671: error: initializer element is not constant
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:671: error: (near initialization for ‘mysql_auth_cmds[19].cmd_data’)
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c: In function ‘str_format’:
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:891: warning: format ‘%d’ expects type ‘int’, but argument 7 has type ‘long int’
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c: In function ‘format_request’:
/Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c:947: warning: pointer/integer type mismatch in conditional expression
apxs:Error: Command failed with rc=65536
Try this patch: http://download.3uu.org/3uu-ROM/mod_auth_mysql-3.0.0-apr1x.patch

Save the file, then apply the patch using the "patch" program.
Here is my input...

markaman:~ markaman_macpro$ apxs -c -L/usr/local/mysql-5.1.47-osx10.6-x86/lib -I/usr/local/mysql-5.1.47-osx10.6-x86/include -lmysqlclient -lm -lz /Users/markaman_macpro/Desktop/mod_auth_mysql.c


Here is the result...

/usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/include -I/usr/include/apache2  -I/usr/include/apr-1   -I/usr/include/apr-1  -I/usr/local/mysql-5.1.47-osx10.6-x86/include  -c -o /Users/markaman_macpro/Desktop/mod_auth_mysql.lo /Users/markaman_macpro/Desktop/mod_auth_mysql.c && touch /Users/markaman_macpro/Desktop/mod_auth_mysql.slo
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:1: error: expected identifier or ‘(’ before ‘--’ token
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:1:20: error: too many decimal points in number
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:2:20: error: too many decimal points in number
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:3: error: stray ‘@’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:3: error: stray ‘@’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:3: error: stray ‘@’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:3: error: stray ‘@’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:7: error: stray ‘#’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:8: error: stray ‘#’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:12: error: stray ‘@’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:12: error: stray ‘@’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:12: error: expected identifier or ‘(’ before ‘-’ token
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:12: error: stray ‘@’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:12: error: stray ‘@’ in program
/Users/markaman_macpro/Desktop/mod_auth_mysql.c:15:1: error: unterminated #ifdef
apxs:Error: Command failed with rc=65536
The patch must be applied using the patch program: "patch < mod_auth_mysql-3.0.0-apr1x.patch"

Run this in the same directory as you have the original mod_auth_mysql.c program.

See http://en.wikipedia.org/wiki/Patch_(Unix) for an explanation of what the patch program is.
After cd to the director, my input...

patch < mod_auth_mysql-3.0.0-apr1x.patch

Result

patch: **** Only garbage was found in the patch input.
I've attached the path as code to this posting.  Is this what you have in your file?
--- mod_auth_mysql-3.0.0/mod_auth_mysql.c.apr1x
+++ mod_auth_mysql-3.0.0/mod_auth_mysql.c
@@ -206,7 +206,7 @@
   #define SNPRINTF apr_snprintf
   #define PSTRDUP apr_pstrdup
   #define PSTRNDUP apr_pstrndup
-  #define STRCAT ap_pstrcat
+  #define STRCAT apr_pstrcat
   #define POOL apr_pool_t
   #include "http_request.h"   /* for ap_hook_(check_user_id | auth_checker)*/
   #include "ap_compat.h"
@@ -586,90 +586,91 @@
 }
 
 #ifdef APACHE2
+
 static
 command_rec mysql_auth_cmds[] = {
 	AP_INIT_TAKE1("AuthMySQLHost", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlhost),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlhost),
 	OR_AUTHCFG, "mysql server host name"),
 
 	AP_INIT_TAKE1("AuthMySQLPort", ap_set_int_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlport),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlport),
 	OR_AUTHCFG, "mysql server port number"),
 
 	AP_INIT_TAKE1("AuthMySQLSocket", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlsocket),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlsocket),
 	OR_AUTHCFG, "mysql server socket path"),
 
 	AP_INIT_TAKE1("AuthMySQLUser", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqluser),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqluser),
 	OR_AUTHCFG, "mysql server user name"),
 
 	AP_INIT_TAKE1("AuthMySQLPassword", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlpasswd),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlpasswd),
 	OR_AUTHCFG, "mysql server user password"),
 
 	AP_INIT_TAKE1("AuthMySQLDB", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlDB),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlDB),
 	OR_AUTHCFG, "mysql database name"),
 
 	AP_INIT_TAKE1("AuthMySQLUserTable", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlpwtable),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlpwtable),
 	OR_AUTHCFG, "mysql user table name"),
 
 	AP_INIT_TAKE1("AuthMySQLGroupTable", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlgrptable),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlgrptable),
 	OR_AUTHCFG, "mysql group table name"),
 
 	AP_INIT_TAKE1("AuthMySQLNameField", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlNameField),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlNameField),
 	OR_AUTHCFG, "mysql User ID field name within User table"),
 
 	AP_INIT_TAKE1("AuthMySQLGroupField", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlGroupField),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlGroupField),
 	OR_AUTHCFG, "mysql Group field name within table"),
 
 	AP_INIT_TAKE1("AuthMySQLGroupUserNameField", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlGroupUserNameField),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlGroupUserNameField),
 	OR_AUTHCFG, "mysql User ID field name within Group table"),
 
 	AP_INIT_TAKE1("AuthMySQLPasswordField", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlPasswordField),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlPasswordField),
 	OR_AUTHCFG, "mysql Password field name within table"),
 
 	AP_INIT_TAKE1("AuthMySQLPwEncryption", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlEncryptionField),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlEncryptionField),
 	OR_AUTHCFG, "mysql password encryption method"),
 
 	AP_INIT_TAKE1("AuthMySQLSaltField", ap_set_string_slot,
-	(void*) APR_XtOffsetOf(mysql_auth_config_rec, mysqlSaltField),
+	(void*) APR_OFFSETOF(mysql_auth_config_rec, mysqlSaltField),
 	OR_AUTHCFG, "mysql salfe field name within table"),
 
 /*	AP_INIT_FLAG("AuthMySQLKeepAlive", ap_set_flag_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlKeepAlive),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlKeepAlive),
 	OR_AUTHCFG, "mysql connection kept open across requests if On"),
 */
 	AP_INIT_FLAG("AuthMySQLAuthoritative", ap_set_flag_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlAuthoritative),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlAuthoritative),
 	OR_AUTHCFG, "mysql lookup is authoritative if On"),
 
 	AP_INIT_FLAG("AuthMySQLNoPasswd", ap_set_flag_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlNoPasswd),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlNoPasswd),
 	OR_AUTHCFG, "If On, only check if user exists; ignore password"),
 
 	AP_INIT_FLAG("AuthMySQLEnable", ap_set_flag_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlEnable),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlEnable),
 	OR_AUTHCFG, "enable mysql authorization"),
 
 	AP_INIT_TAKE1("AuthMySQLUserCondition", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlUserCondition),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlUserCondition),
 	OR_AUTHCFG, "condition to add to user where-clause"),
 
 	AP_INIT_TAKE1("AuthMySQLGroupCondition", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlGroupCondition),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlGroupCondition),
 	OR_AUTHCFG, "condition to add to group where-clause"),
 
 	AP_INIT_TAKE1("AuthMySQLCharacterSet", ap_set_string_slot,
-	(void *) APR_XtOffsetOf(mysql_auth_config_rec, mysqlCharacterSet),
+	(void *) APR_OFFSETOF(mysql_auth_config_rec, mysqlCharacterSet),
 	OR_AUTHCFG, "mysql character set to be used"),
 
   { NULL }
@@ -889,7 +890,7 @@
     }
     if (!found) {
       LOG_ERROR_2(APLOG_ERR|APLOG_NOERRNO, 0, r, "MySQL ERROR: Invalid formatting character at position %d: \"%s\"",
-		      pos-output, output);
+                  (int)(pos-output), output);
       return input;
     }
   }

Open in new window

Sorry, I realized after I replied I renamed the wrong file.

This is the result. Not sure if it worked, or what to do now.

markaman:mod_auth_mysql-3.0.0 markaman_macpro$ patch < mod_auth_mysql-3.0.0-apr1x.patch
patching file mod_auth_mysql.c
patch unexpectedly ends in middle of line
Hunk #3 succeeded at 890 with fuzz 1.
Now try compiling the file again to see if it's any better.
/usr/share/apr-1/build-1/libtool --silent --mode=compile gcc    -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/include -I/usr/include/apache2  -I/usr/include/apr-1   -I/usr/include/apr-1  -I/usr/local/mysql-5.1.47-osx10.6-x86/include  -c -o /Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.lo /Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.c && touch /Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.slo
/usr/share/apr-1/build-1/libtool --silent --mode=link gcc -o /Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.la  -L/usr/local/mysql-5.1.47-osx10.6-x86/lib -lmysqlclient -lm -lz -rpath /usr/libexec/apache2 -module -avoid-version    /Users/markaman_macpro/Downloads/mod_auth_mysql-3.0.0/mod_auth_mysql.lo
ld: warning: in /usr/local/mysql/lib/libmysqlclient.dylib, file was built for i386 which is not the architecture being linked (x86_64)
ld: warning: in /usr/local/mysql/lib/libz.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
warning: no debug symbols in executable (-arch x86_64)
ASKER CERTIFIED SOLUTION
Avatar of cwiedmann
cwiedmann

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you for your help.

Yes I assumed I needed the 32bit since I'm not booting into the 64 Kernel.
I'll download the correct one.
I'm not sure if I need to start a new thread, but I'm having some problems I can't get past.

I installed 64 bit MySQL, re installed the module, in my httpd.conf I entered LoadModule mysql_auth_module libexec/apache2/mod_auth_mysql.so
in .htaccess I entered..

AuthName "pastissues"
AuthType Basic
AuthMySQLHost 127.0.0.1:3306
AuthMySQLUser mark
AuthMySQLPassword MyPasswd
AuthMySQLDB test
AuthMySQLUserTable user_info
AuthMySQLNameField user_name
AuthMySQLPasswordField user_passwd
AuthMySQLPwEncryption none
AuthMySQLEnable On
require valid-user

When I go to the protected directory I get the prompt to enter my username and password, I enter it then I get an "Internal Server Error"

In my apache error log...
[Tue Jun 29 11:48:13 2010] [error] Internal error: pcfg_openfile() called with NULL filename
[Tue Jun 29 11:48:13 2010] [error] [client 10.0.1.205] (9)Bad file descriptor: Could not open password file: (null)

Hmm, it looks like mod_auth_mysql may not be taking effect.  Can you double-check that there aren't errors about loading the module at startup time?
sudo apachectl configtest

Syntax OK

phpinfo() shows the module loaded
Ok, I think the attached two lines should fix the issue.  Apparently Apache looks for the auth file even if the method doesn't require one.
AuthUserFile /dev/null
AuthBasicAuthoritative Off

Open in new window

Thank You, Thank You, Thank You!!
It works!
I've been on this for over two weeks.

I still have some work to do, I need to apply this to my Xserve (been testing on my MacPro). I also need to incorporate an expiration date.

You made my day :)