Package: drupal
Version: 4.5.5-2
Severity: important
Tags: patch

The attached patch fixes a bug with the "if" postgresql function that
prevents the fourms modules from operating correctly, it fixes the
missing uid stuff defined in #312230 and #312202, and it fixes a bug
that prevents user logging out found in session.inc.


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.4.31-1um
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages drupal depends on:
ii  apache2-mpm-prefork [apache2] 2.0.54-5   traditional model for Apache2
ii  debconf [debconf-2.0]         1.4.58     Debian configuration management sy
ii  exim4                         4.54-1     metapackage to ease exim MTA (v4) 
ii  exim4-daemon-light [mail-tran 4.54-1     lightweight exim MTA (v4) daemon
ii  makepasswd                    1.10-3     Generate and encrypt passwords
ii  mysql-client                  4.1.14-6   mysql database client (transitiona
ii  mysql-client-4.1 [virtual-mys 4.1.14-6   mysql database client binaries
ii  php4-cli                      4:4.4.0-2  command-line interpreter for the p
ii  php4-mysql                    4:4.4.0-2  MySQL module for php4
ii  php4-pgsql                    4:4.4.0-2  PostgreSQL module for php4
ii  wwwconfig-common              0.0.43     Debian web auto configuration

Versions of packages drupal recommends:
pn  apache                        <none>     (no description available)
ii  libapache2-mod-php4           4:4.4.0-2  server-side, HTML-embedded scripti
pn  mysql-server | postgresql     <none>     (no description available)
ii  php4                          4:4.4.0-2  server-side, HTML-embedded scripti

-- debconf information:
  drupal/remove_backups: false
  drupal/createuser_failed:
  drupal/db_auto_update: true
  drupal/dropdb_failed:
  drupal/upgradedb_impossible:
  drupal/dbgeneration: false
  drupal/dbtype: MySQL
  drupal/database_doremove: false
  drupal/createdb_failed:
  drupal/dbserver: localhost
  drupal/webserver: apache
  drupal/upgradedb_failed:
  drupal/dbname: drupal
  drupal/dbuser: drupal
  drupal/dbadmin: root
  drupal/initdb_failed:
  drupal/conffile_failed:
diff -ruN drupal-4.5.5/database/database.pgsql 
drupal-4.5.5.new/database/database.pgsql
--- drupal-4.5.5/database/database.pgsql        2005-10-11 19:31:28.000000000 
-0500
+++ drupal-4.5.5.new/database/database.pgsql    2005-10-11 19:27:57.000000000 
-0500
@@ -780,6 +780,17 @@
 ---
 ALTER SEQUENCE menu_mid_seq RESTART 2;
 
+---
+--- Enable pl/pgSQL (added due to Debian bug #242572)
+--- Code taken from /usr/share/doc/postgresql/html/xplang.html
+---
+
+CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS
+    '$libdir/plpgsql' LANGUAGE C;
+
+CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql
+    HANDLER plpgsql_call_handler;
+
 
 ---
 --- Functions
@@ -811,22 +822,7 @@
 
 CREATE FUNCTION "if"(integer, text, text) RETURNS text AS '
 BEGIN
-  IF $1 THEN
-    RETURN $2;
-  END IF;
-  IF NOT $1 THEN
-    RETURN $3;
-  END IF;
+  SELECT CASE WHEN $1 <> 0 THEN $2 ELSE $3 END;
 END;
-' LANGUAGE 'plpgsql';
-
----
---- Enable pl/pgSQL (added due to Debian bug #242572)
---- Code taken from /usr/share/doc/postgresql/html/xplang.html
----
-
-CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler AS
-    '$libdir/plpgsql' LANGUAGE C;
+' LANGUAGE 'sql';
 
-CREATE TRUSTED PROCEDURAL LANGUAGE plpgsql
-    HANDLER plpgsql_call_handler;
Binary files drupal-4.5.5/database/.database.pgsql.swp and 
drupal-4.5.5.new/database/.database.pgsql.swp differ
diff -ruN drupal-4.5.5/includes/session.inc 
drupal-4.5.5.new/includes/session.inc
--- drupal-4.5.5/includes/session.inc   2005-08-14 19:05:38.000000000 -0500
+++ drupal-4.5.5.new/includes/session.inc       2005-10-11 19:30:59.000000000 
-0500
@@ -26,7 +26,7 @@
 
   if (!db_num_rows($result)) {
     $result = db_query("SELECT u.* FROM {users} u WHERE u.uid = 0");
-    db_query("INSERT INTO {sessions} (sid, hostname, timestamp) values('%s', 
'%s', %d)", $key, $_SERVER["REMOTE_ADDR"], time());
+    db_query("INSERT INTO {sessions} (uid, sid, hostname, timestamp) values(0, 
'%s', '%s', %d)", $key, $_SERVER["REMOTE_ADDR"], time());
   }
 
   $user = db_fetch_object($result);
@@ -51,7 +51,7 @@
 }
 
 function sess_destroy($key) {
-  db_query("DELETE FROM {sessions} WHERE sid = '%d'", $key);
+  db_query("DELETE FROM {sessions} WHERE sid = '%s'", $key);
 }
 
 function sess_gc($lifetime) {

Reply via email to