pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/ap2-auth-mysql Don't use APIs that were deprecated...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/fc9ba104a2f1
branches:  trunk
changeset: 483750:fc9ba104a2f1
user:      cube <cube%pkgsrc.org@localhost>
date:      Thu Nov 18 15:58:22 2004 +0000

description:
Don't use APIs that were deprecated in MySQL 3.23, and some of which are
now even absent of MySQL 4.x by default.  Bump PKGREVISION.

diffstat:

 www/ap2-auth-mysql/Makefile         |   4 +-
 www/ap2-auth-mysql/distinfo         |   4 +-
 www/ap2-auth-mysql/patches/patch-aa |  48 +++++++++++++++++++++++-------------
 3 files changed, 35 insertions(+), 21 deletions(-)

diffs (182 lines):

diff -r 6cb16cce71d6 -r fc9ba104a2f1 www/ap2-auth-mysql/Makefile
--- a/www/ap2-auth-mysql/Makefile       Thu Nov 18 15:57:37 2004 +0000
+++ b/www/ap2-auth-mysql/Makefile       Thu Nov 18 15:58:22 2004 +0000
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.8 2004/10/29 05:59:24 jdolecek Exp $
+# $NetBSD: Makefile,v 1.9 2004/11/18 15:58:22 cube Exp $
 #
 
 DISTNAME=              mod_auth_mysql.c
 PKGNAME=               ap2-auth-mysql-1.11.12
-PKGREVISION=           2
+PKGREVISION=           3
 CATEGORIES=            www databases
 MASTER_SITES=          ftp://ftp.kcilink.com/pub/
 DISTFILES=             ${DISTNAME}.gz mysql-group-auth.txt
diff -r 6cb16cce71d6 -r fc9ba104a2f1 www/ap2-auth-mysql/distinfo
--- a/www/ap2-auth-mysql/distinfo       Thu Nov 18 15:57:37 2004 +0000
+++ b/www/ap2-auth-mysql/distinfo       Thu Nov 18 15:58:22 2004 +0000
@@ -1,7 +1,7 @@
-$NetBSD: distinfo,v 1.1.1.1 2003/12/31 13:03:02 cube Exp $
+$NetBSD: distinfo,v 1.2 2004/11/18 15:58:22 cube Exp $
 
 SHA1 (ap2-auth-mysql/mod_auth_mysql.c.gz) = 0e53b22ccd2ebd36a213d5e418b02e6167a1300b
 Size (ap2-auth-mysql/mod_auth_mysql.c.gz) = 6900 bytes
 SHA1 (ap2-auth-mysql/mysql-group-auth.txt) = 6c0d39ed3ac6a3955d8d8c7c4892e07ba3d3ae77
 Size (ap2-auth-mysql/mysql-group-auth.txt) = 1564 bytes
-SHA1 (patch-aa) = cb5d7ce78de0606fc2a3581d693e93cdd16c19ac
+SHA1 (patch-aa) = 1e3faefecba3c325614215ca5c5c4643f6b96a1d
diff -r 6cb16cce71d6 -r fc9ba104a2f1 www/ap2-auth-mysql/patches/patch-aa
--- a/www/ap2-auth-mysql/patches/patch-aa       Thu Nov 18 15:57:37 2004 +0000
+++ b/www/ap2-auth-mysql/patches/patch-aa       Thu Nov 18 15:58:22 2004 +0000
@@ -1,6 +1,6 @@
-$NetBSD: patch-aa,v 1.1.1.1 2003/12/31 13:03:03 cube Exp $
+$NetBSD: patch-aa,v 1.2 2004/11/18 15:58:22 cube Exp $
 
---- mod_auth_mysql.c.orig      2003-11-24 16:36:19.000000000 +0100
+--- mod_auth_mysql.c.orig      2004-11-14 18:27:15.000000000 +0100
 +++ mod_auth_mysql.c
 @@ -189,7 +189,9 @@
  #include "http_core.h"
@@ -51,7 +51,20 @@
   * open connection to DB server if necessary.  Return TRUE if connection
   * is good, FALSE if not able to connect.  If false returned, reason
   * for failure has been logged to error_log file already.
-@@ -280,16 +274,16 @@ open_db_handle(request_rec *r, mysql_aut
+@@ -274,22 +268,28 @@ open_db_handle(request_rec *r, mysql_aut
+     db_host = m->mysqlhost;
+   }
+ 
+-  mysql_handle=mysql_connect(&mysql_conn,db_host,m->mysqluser,m->mysqlpasswd);
++  if (mysql_init(&mysql_conn) == NULL) {
++    ap_log_error (APLOG_MARK, APLOG_ERR, 0, r->server,
++      "mysql_init() failed");
++    return FALSE;
++  }
++  mysql_handle=mysql_real_connect(&mysql_conn,db_host,m->mysqluser,m->mysqlpasswd,
++    NULL, 0, NULL, 0);
+ 
+   if (mysql_handle) {
  
      if (!m->mysqlKeepAlive) {
        /* close when request done */
@@ -72,7 +85,7 @@
                  "MySQL error: %s", mysql_error(&mysql_conn));
      return FALSE;
    }
-@@ -299,9 +293,9 @@ open_db_handle(request_rec *r, mysql_aut
+@@ -299,9 +299,9 @@ open_db_handle(request_rec *r, mysql_aut
  
  
  static void *
@@ -84,7 +97,7 @@
    if (!m) return NULL;                /* failure to get memory is a bad thing */
  
    /* defaults values */
-@@ -316,45 +310,45 @@ create_mysql_auth_dir_config (pool *p, c
+@@ -316,45 +316,45 @@ create_mysql_auth_dir_config (pool *p, c
  
  static
  command_rec mysql_auth_cmds[] = {
@@ -169,7 +182,7 @@
    { NULL }
  };
  
-@@ -379,7 +373,7 @@ get_mysql_pw(request_rec *r, char *user,
+@@ -379,7 +379,7 @@ get_mysql_pw(request_rec *r, char *user,
    }
  
    if (mysql_select_db(mysql_handle,m->mysqlDB) != 0) {
@@ -178,16 +191,17 @@
                  "MySQL error: %s", mysql_error(mysql_handle));
      return NULL;
    }
-@@ -394,13 +388,13 @@ get_mysql_pw(request_rec *r, char *user,
+@@ -394,13 +394,13 @@ get_mysql_pw(request_rec *r, char *user,
    }
  
    ulen = strlen(user);
 -  sql_safe_user = ap_pcalloc(r->pool, ulen*2+1);
-+  sql_safe_user = apr_pcalloc(r->pool, ulen*2+1);
-   mysql_escape_string(sql_safe_user,user,ulen);
+-  mysql_escape_string(sql_safe_user,user,ulen);
 -  ap_snprintf(query,sizeof(query)-1,"SELECT %s FROM %s WHERE %s='%s'",
 -            m->mysqlPasswordField, m->mysqlpwtable,
 -            m->mysqlNameField, sql_safe_user);
++  sql_safe_user = apr_pcalloc(r->pool, ulen*2+1);
++  mysql_real_escape_string(mysql_handle,sql_safe_user,user,ulen);
 +  apr_snprintf(query,sizeof(query)-1,"SELECT %s FROM %s WHERE %s='%s'",
 +             m->mysqlPasswordField, m->mysqlpwtable,
 +             m->mysqlNameField, sql_safe_user);
@@ -197,7 +211,7 @@
                  "MySQL error %s: %s", mysql_error(mysql_handle),r->uri);
      return NULL;
    }
-@@ -409,10 +403,10 @@ get_mysql_pw(request_rec *r, char *user,
+@@ -409,10 +409,10 @@ get_mysql_pw(request_rec *r, char *user,
    if (result && (mysql_num_rows(result) == 1)) {
      MYSQL_ROW data = mysql_fetch_row(result);
      if (data[0]) {
@@ -210,7 +224,7 @@
                   "MySQL user %s has no valid password: %s", user, r->uri);
        mysql_free_result(result);
        return NULL;
-@@ -443,19 +437,19 @@ get_mysql_groups(request_rec *r, char *u
+@@ -443,19 +443,19 @@ get_mysql_groups(request_rec *r, char *u
    }
  
    if (mysql_select_db(mysql_handle,m->mysqlDB) != 0) {
@@ -236,7 +250,7 @@
                  "MySQL error %s: %s", mysql_error(mysql_handle),r->uri);
      return NULL;
    }
-@@ -463,12 +457,12 @@ get_mysql_groups(request_rec *r, char *u
+@@ -463,12 +463,12 @@ get_mysql_groups(request_rec *r, char *u
    result = mysql_store_result(mysql_handle);
    if (result && (mysql_num_rows(result) > 0)) {
      int i = mysql_num_rows(result);
@@ -251,7 +265,7 @@
        else
        list[i] = "";           /* if no data, make it empty, not NULL */
      }
-@@ -499,15 +493,15 @@ mysql_authenticate_basic_user (request_r
+@@ -499,15 +499,15 @@ mysql_authenticate_basic_user (request_r
    if(!sec->mysqlpwtable)      /* not configured for mysql authorization */
      return DECLINED;
  
@@ -271,7 +285,7 @@
    }
  
    /* if we don't require password, just return ok since they exist */
-@@ -517,10 +511,10 @@ mysql_authenticate_basic_user (request_r
+@@ -517,10 +517,10 @@ mysql_authenticate_basic_user (request_r
  
    /* compare the password, possibly encrypted */
    if(strcmp(real_pw, sec->mysqlCrypted ? crypt(sent_pw,real_pw) : sent_pw)) {
@@ -285,7 +299,7 @@
    }
    return OK;
  }
-@@ -534,10 +528,10 @@ mysql_check_auth(request_rec *r)
+@@ -534,10 +534,10 @@ mysql_check_auth(request_rec *r)
    mysql_auth_config_rec *sec =
      (mysql_auth_config_rec *)ap_get_module_config(r->per_dir_config,
                                                  &mysql_auth_module);
@@ -298,7 +312,7 @@
    require_line *reqs = reqs_arr ? (require_line *)reqs_arr->elts : NULL;
  
    register int x;
-@@ -560,11 +554,11 @@ mysql_check_auth(request_rec *r)
+@@ -560,11 +560,11 @@ mysql_check_auth(request_rec *r)
      if(!strcmp(want,"group")) {
        /* check for list of groups from database only first time thru */
        if (!groups && !(groups = get_mysql_groups(r, user, sec))) {
@@ -312,7 +326,7 @@
        }
  
        /* loop through list of groups specified in htaccess file */
-@@ -578,35 +572,39 @@ mysql_check_auth(request_rec *r)
+@@ -578,35 +578,39 @@ mysql_check_auth(request_rec *r)
          ++i;
        }
        }



Home | Main Index | Thread Index | Old Index