On Feb 3, 2008 10:01 PM, Simon Bertrang <> wrote:
> On Sun, Feb 03, 2008 at 09:55:02PM +0000, Simon H wrote:
> > On Feb 3, 2008 9:48 PM, Simon Bertrang <> wrote:
> > >
> > > On Sun, Feb 03, 2008 at 08:22:55PM +0000, Simon H wrote:
> > > > Hi all
> > > >
> > > > I recently inherited an old php/mysql app which I have migrated onto
> > > > OpenBSD 4.2 with the latest MySQL/PHP packages and modules.
> > > >
> > > > I installed the mod_auth_mysql package after realizing the app did
> > > > basic auth with this backend and when trying to start the server again
> > > > I get:
> > > >
> > > > /usr/sbin/httpd:/usr/lib/apache/modules/mod_auth_mysql.so: undefined
> > > > symbol 'mysql_connect'
> > > >
> > > > There's very little out there on Google that can advise what to do and
> > > > the maintainer of the package is listed as ports@ so I've posted here.
> > > > Should I be posting this to [EMAIL PROTECTED]
> > > >
> > > > Can anyone suggest a fix/workaround for this?
> > > >
> > >
> > > Hi Simon,
> > > you can give the attached diff a try?  I think it should fix the issue.
> > >
> > > Kind regards,
> > > Simon
> > >
> >
> > Thanks Simon.  I did see 1 post about the mysql_real_connect rename,
> > but honestly, since I didnt see many others and the fact that it was
> > 2004, I figured surely this has been resolved.
> >
>
> Actually i just took the patch from FreeBSD... ;-)
>
> > I've been using the binary package so will have to pull down the ports
> > tree.  I'll let you know how I get on.
> >
>
> Great, then we have a chance to fix it finally... as i've noticed it in
> the past but had no test case and forgot about it again.
>
> Regards,
> Simon
>

Here's the diff for anyone who's interested.  Would be great if this
made it into the port.

Thanks everyone and thanks to Simon Bertrang for the patch:


Index: Makefile
===================================================================
RCS file: /cvs/ports/www/mod_auth_mysql/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- Makefile    15 Sep 2007 20:38:22 -0000      1.12
+++ Makefile    3 Feb 2008 21:46:24 -0000
@@ -4,7 +4,7 @@ COMMENT=        Apache MySQL authentication mod

 VERSION=       3.2
 DISTNAME=      mod_auth_mysql-${VERSION}
-PKGNAME=       ${DISTNAME}p2
+PKGNAME=       ${DISTNAME}p3
 CATEGORIES=    www

 HOMEPAGE=      http://sourceforge.net/projects/mod-auth-mysql
Index: patches/patch-mod_auth_mysql_c
===================================================================
RCS file: patches/patch-mod_auth_mysql_c
diff -N patches/patch-mod_auth_mysql_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-mod_auth_mysql_c      3 Feb 2008 21:46:24 -0000
@@ -0,0 +1,62 @@
+$OpenBSD$
+--- mod_auth_mysql.c.orig      Mon Sep 10 16:12:08 2001
++++ mod_auth_mysql.c   Sun Feb  3 22:39:12 2008
+@@ -68,8 +68,14 @@ static int check_crypt_MD5_encryption(const char *pass
+
+ static int check_mysql_encryption(const char *passwd, char *enc_passwd)
+ {
+-      char scrambled_passwd[32];
++      /* Make more then big enough */
++      char scrambled_passwd[256];
+       
++#if MYSQL_VERSION_ID >= 40000
++      make_scrambled_password_323(scrambled_passwd, passwd);
++      if (strcmp(scrambled_passwd, enc_passwd) == 0) return 1;
++#endif /* MYSQL_VERSION_ID >= 40000 */
++
+       make_scrambled_password(scrambled_passwd, passwd);
+       return (!strcmp(scrambled_passwd, enc_passwd));
+ }
+@@ -388,7 +394,12 @@ static void open_auth_dblink(request_rec *r, mysql_aut
+       }
+       if (name != NULL) {                     /* open an SQL link */
+               /* link to the MySQL database and register its [EMAIL 
PROTECTED] */
++#if MYSQL_VERSION_ID >= 40000
++              mysql_init(&auth_sql_server);
++              mysql_auth = mysql_real_connect(&auth_sql_server, auth_db_host,
user, pwd, name, 0, NULL, 0);
++#else /* MYSQL_VERSION_ID < 40000 */
+               mysql_auth = mysql_connect(&auth_sql_server, auth_db_host, 
user, pwd);
++#endif /* MYSQL_VERSION_ID < 40000 */
+               if (sec->non_persistent && mysql_auth) {
+                       note_cleanups_for_mysql_auth(r->pool, mysql_auth);
+               }
+@@ -575,6 +586,10 @@ int mysql_authenticate_basic_user(request_rec *r)
+
+       switch (mysql_check_user_password(r, c->user, sent_pw, sec)) {
+               case 0:
++                      ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
++                              "user %s: authentication failure for \"%s\": 
%s",
++                              c->user, r->uri);
++                      ap_note_basic_auth_failure(r);
+                       note_basic_auth_failure(r);
+                       return AUTH_REQUIRED;
+                       break;
+@@ -598,6 +613,7 @@ int mysql_check_auth(request_rec *r)
+ {
+       mysql_auth_config_rec *sec = (mysql_auth_config_rec *)
get_module_config(r->per_dir_config, &auth_mysql_module);
+       char *user = r->connection->user;
++      conn_rec *c = r->connection;
+       int m = r->method_number;
+       int method_restricted = 0;
+       register int x;
+@@ -669,6 +685,10 @@ int mysql_check_auth(request_rec *r)
+       if (!(sec->assume_authoritative)) {
+               return DECLINED;
+       }
++      ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r,
++              "user %s: authentication failure for \"%s\": %s",
++              c->user, r->uri);
++      ap_note_basic_auth_failure(r);
+       note_basic_auth_failure(r);
+       return AUTH_REQUIRED;
+ }

Reply via email to