OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   06-Dec-2006 09:07:44
  Branch: HEAD                             Handle: 2006120608074300

  Modified files:
    openpkg-src/proftpd     proftpd.patch

  Log:
    try to convert the mod_sql_sqlite modules from the ancient SQLite v2
    API to the current v3 API so the module finally uses SQLite 3.x

  Summary:
    Revision    Changes     Path
    1.18        +170 -0     openpkg-src/proftpd/proftpd.patch
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/proftpd/proftpd.patch
  ============================================================================
  $ cvs diff -u -r1.17 -r1.18 proftpd.patch
  --- openpkg-src/proftpd/proftpd.patch 6 Dec 2006 07:03:13 -0000       1.17
  +++ openpkg-src/proftpd/proftpd.patch 6 Dec 2006 08:07:43 -0000       1.18
  @@ -19,6 +19,176 @@
    };
    
    static authtable otp_authtab[] = {
  +Index: mod_sql_sqlite/mod_sql_sqlite.c
  +--- mod_sql_sqlite/mod_sql_sqlite.c.orig     2006-12-06 08:49:36 +0100
  ++++ mod_sql_sqlite/mod_sql_sqlite.c  2006-12-06 09:01:01 +0100
  +@@ -22,15 +22,15 @@
  +  * the source code for OpenSSL in the source distribution.
  +  *
  +  * $Id: proftpd.patch,v 1.18 2006/12/06 08:07:43 rse Exp $
  +- * $Libraries: -lsqlite $
  ++ * $Libraries: -lsqlite3 $
  +  */
  + 
  +-#include <sqlite.h>
  ++#include <sqlite3.h>
  + 
  + #include "conf.h"
  + #include "mod_sql.h"
  + 
  +-#define MOD_SQL_SQLITE_VERSION              "mod_sql_sqlite/0.1"
  ++#define MOD_SQL_SQLITE_VERSION              "mod_sql_sqlite/0.1+"
  + 
  + /* Make sure the version of proftpd is as necessary. */
  + #if PROFTPD_VERSION_NUMBER < 0x0001021101
  +@@ -44,7 +44,7 @@
  +   char *user;
  +   char *pass;
  + 
  +-  sqlite *dbh;
  ++  sqlite3 *dbh;
  + 
  + } db_conn_t;
  + 
  +@@ -185,7 +185,6 @@
  + }
  + 
  + MODRET sql_sqlite_open(cmd_rec *cmd) {
  +-  char *tmp = NULL;
  +   conn_entry_t *entry = NULL;
  +   db_conn_t *conn = NULL;
  + 
  +@@ -220,21 +219,17 @@
  +     return HANDLED(cmd);
  +   }
  + 
  +-  conn->dbh = sqlite_open(conn->dsn, 0, &tmp);
  +-  if (conn->dbh == NULL) {
  +-    char *errstr = pstrdup(cmd->pool, tmp);
  +-    sqlite_freemem(tmp);
  ++  if (sqlite3_open(conn->dsn, &conn->dbh) != SQLITE_OK) {
  ++    char *errstr = pstrdup(cmd->pool, sqlite3_errmsg(conn->dbh));
  ++    sqlite3_close(conn->dbh);
  + 
  +     sql_log(DEBUG_FUNC, "%s", "exiting \tsqlite cmd_open");
  +     return ERROR_MSG(cmd, MOD_SQL_SQLITE_VERSION, errstr);
  +   }
  + 
  +-  if (tmp)
  +-    sqlite_freemem(tmp);
  +-
  +   /* Add some SQLite information to the logs. */
  +   sql_log(DEBUG_INFO, MOD_SQL_SQLITE_VERSION ": SQLite version: %s",
  +-    sqlite_libversion());
  ++    sqlite3_libversion());
  + 
  +   entry->nconn++;
  + 
  +@@ -295,7 +290,7 @@
  +       (cmd->argc == 2 && cmd->argv[1])) {
  + 
  +     if (conn->dbh) {
  +-      sqlite_close(conn->dbh);
  ++      sqlite3_close(conn->dbh);
  +       conn->dbh = NULL;
  +     }
  + 
  +@@ -447,9 +442,9 @@
  +   /* Perform the query.  If it doesn't work, log the error, close the
  +    * connection, then return the error from the query processing.
  +    */
  +-  if (sqlite_exec(conn->dbh, query, exec_cb, cmd, &tmp) != SQLITE_OK) {
  ++  if (sqlite3_exec(conn->dbh, query, exec_cb, cmd, &tmp) != SQLITE_OK) {
  +     char *errstr = pstrdup(cmd->pool, tmp);
  +-    sqlite_freemem(tmp);
  ++    sqlite3_free(tmp);
  + 
  +     close_cmd = pr_cmd_alloc(cmd->tmp_pool, 1, entry->name);
  +     sql_sqlite_close(close_cmd);
  +@@ -460,7 +455,7 @@
  +   }
  + 
  +   if (tmp)
  +-    sqlite_freemem(tmp);
  ++    sqlite3_free(tmp);
  + 
  +   mr = sql_sqlite_get_data(cmd);
  +   
  +@@ -517,9 +512,9 @@
  +    * connection (and log any errors there, too) then return the error
  +    * from the query processing.
  +    */
  +-  if (sqlite_exec(conn->dbh, query, exec_cb, cmd, &tmp) != SQLITE_OK) {
  ++  if (sqlite3_exec(conn->dbh, query, exec_cb, cmd, &tmp) != SQLITE_OK) {
  +     char *errstr = pstrdup(cmd->pool, tmp);
  +-    sqlite_freemem(tmp);
  ++    sqlite3_free(tmp);
  + 
  +     close_cmd = pr_cmd_alloc(cmd->tmp_pool, 1, entry->name);
  +     sql_sqlite_close(close_cmd);
  +@@ -530,7 +525,7 @@
  +   }
  + 
  +   if (tmp)
  +-    sqlite_freemem(tmp);
  ++    sqlite3_free(tmp);
  + 
  +   /* Reset these variables.  The memory in them is allocated from this
  +    * same cmd_rec, and will be recovered when the cmd_rec is destroyed.
  +@@ -594,9 +589,9 @@
  +   /* Perform the query.  If it doesn't work close the connection, then
  +    * return the error from the query processing.
  +    */
  +-  if (sqlite_exec(conn->dbh, query, exec_cb, cmd, &tmp) != SQLITE_OK) {
  ++  if (sqlite3_exec(conn->dbh, query, exec_cb, cmd, &tmp) != SQLITE_OK) {
  +     char *errstr = pstrdup(cmd->pool, tmp);
  +-    sqlite_freemem(tmp);
  ++    sqlite3_free(tmp);
  + 
  +     close_cmd = pr_cmd_alloc(cmd->tmp_pool, 1, entry->name);
  +     sql_sqlite_close(close_cmd);
  +@@ -607,7 +602,7 @@
  +   }
  + 
  +   if (tmp)
  +-    sqlite_freemem(tmp);
  ++    sqlite3_free(tmp);
  + 
  +   /* Reset these variables.  The memory in them is allocated from this
  +    * same cmd_rec, and will be recovered when the cmd_rec is destroyed.
  +@@ -674,9 +669,9 @@
  +   /* Perform the query.  If it doesn't work close the connection, then
  +    * return the error from the query processing.
  +    */
  +-  if (sqlite_exec(conn->dbh, query, exec_cb, cmd, &tmp) != SQLITE_OK) {
  ++  if (sqlite3_exec(conn->dbh, query, exec_cb, cmd, &tmp) != SQLITE_OK) {
  +     char *errstr = pstrdup(cmd->pool, tmp);
  +-    sqlite_freemem(tmp);
  ++    sqlite3_free(tmp);
  + 
  +     close_cmd = pr_cmd_alloc(cmd->tmp_pool, 1, entry->name);
  +     sql_sqlite_close(close_cmd);
  +@@ -687,7 +682,7 @@
  +   }
  + 
  +   if (tmp)
  +-    sqlite_freemem(tmp);
  ++    sqlite3_free(tmp);
  + 
  +   mr = sql_sqlite_get_data(cmd);
  +   
  +@@ -724,9 +719,9 @@
  +   conn = (db_conn_t *) entry->data;
  + 
  +   unescaped = cmd->argv[1];
  +-  tmp = sqlite_mprintf("%q", unescaped);
  ++  tmp = sqlite3_mprintf("%q", unescaped);
  +   escaped = pstrdup(cmd->pool, tmp);
  +-  sqlite_freemem(tmp);
  ++  sqlite3_free(tmp);
  + 
  +   sql_log(DEBUG_FUNC, "%s", "exiting \tsqlite cmd_escapestring");
  +   return mod_create_data(cmd, escaped);
   Index: mod_vroot/mod_vroot.c
   --- mod_vroot/mod_vroot.c.orig       2006-12-06 03:58:51 +0100
   +++ mod_vroot/mod_vroot.c    2006-12-06 08:00:45 +0100
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [email protected]

Reply via email to