Index: davical-0.9.9.5/dba/appuser_permissions.txt
--- davical-0.9.9.5/dba/appuser_permissions.txt.orig	2010-04-19 02:32:58.000000000 +0200
+++ davical-0.9.9.5/dba/appuser_permissions.txt	2010-09-21 17:32:46.000000000 +0200
@@ -1,65 +1,69 @@
-#
-# This file is used by update-rscds-database to set the correct
-# permissions for the application user.  In newer installations
-# the application user will probably be called app_davical (and
-# the administrative user will be called dba_davical) but in
-# older installations the application user was called 'general'
-# and the administrative user was probably 'postgres'.
-#
-# See the wiki topic 'Database/Users' for more discussion.
-#
-# This file includes lines like:
-#   GRANT SELECT,...
-# which define what gets granted to the following lines like:
-#   ON table1, table2, sequence1, function 3, view4, ...
-# no user-serviceable parts inside, all whitespace is ignored,
-# your mileage should not vary :-)
-#
+--
+-- This file is used by update-rscds-database to set the correct
+-- permissions for the application user.  In newer installations
+-- the application user will probably be called app_davical (and
+-- the administrative user will be called dba_davical) but in
+-- older installations the application user was called 'general'
+-- and the administrative user was probably 'postgres'.
+--
+-- See the wiki topic 'Database/Users' for more discussion.
+--
+-- This file includes lines like:
+--   GRANT SELECT,...
+-- which define what gets granted to the following lines like:
+--   ON table1, table2, sequence1, function 3, view4, ...
+-- no user-serviceable parts inside, all whitespace is ignored,
+-- your mileage should not vary :-)
+--
 
 GRANT SELECT,INSERT,UPDATE,DELETE
-  ON collection
-  ON caldav_data
-  ON calendar_item
-  ON relationship
-  ON locks
-  ON property
-  ON freebusy_ticket
-  ON usr
-  ON usr_setting
-  ON roles
-  ON role_member
-  ON session
-  ON tmp_password
-  ON group_member
-  ON principal
-  ON relationship_type
-  ON sync_tokens
-  ON sync_changes
-  ON grants
-  ON dav_principal
-  ON access_ticket
-  ON dav_binding
-  ON calendar_alarm
-  ON calendar_attendee
-  ON addressbook_resource
-  ON addressbook_address_adr
-  ON addressbook_address_tel
-  ON addressbook_address_email
+  ON collection,
+     caldav_data,
+     calendar_item,
+     relationship,
+     locks,
+     property,
+     freebusy_ticket,
+     usr,
+     usr_setting,
+     roles,
+     role_member,
+     session,
+     tmp_password,
+     group_member,
+     principal,
+     relationship_type,
+     sync_tokens,
+     sync_changes,
+     grants,
+     dav_principal,
+     access_ticket,
+     dav_binding,
+     calendar_alarm,
+     calendar_attendee,
+     addressbook_resource,
+     addressbook_address_adr,
+     addressbook_address_tel,
+     addressbook_address_email
+  TO davical;
 
 GRANT SELECT,UPDATE
-  ON relationship_type_rt_id_seq
-  ON dav_id_seq
-  ON usr_user_no_seq
-  ON roles_role_no_seq
-  ON session_session_id_seq
-  ON principal_type_principal_type_id_seq
-  ON sync_tokens_sync_token_seq
+  ON relationship_type_rt_id_seq,
+     dav_id_seq,
+     usr_user_no_seq,
+     roles_role_no_seq,
+     session_session_id_seq,
+     principal_type_principal_type_id_seq,
+     sync_tokens_sync_token_seq
+  TO davical;
 
 GRANT SELECT,INSERT
   ON time_zone
+  TO davical;
 
 GRANT SELECT
-  ON supported_locales
-  ON awl_db_revision
-  ON principal_type
+  ON supported_locales,
+     awl_db_revision,
+     principal_type
+  TO davical;
 
Index: davical-0.9.9.5/inc/always.php.in
--- davical-0.9.9.5/inc/always.php.in.orig	2010-09-21 03:40:44.000000000 +0200
+++ davical-0.9.9.5/inc/always.php.in	2010-09-21 18:20:41.000000000 +0200
@@ -123,20 +123,8 @@
 * too early.
 */
 ob_start( );
-if ( @file_exists('/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php') ) {
-  include('/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php');
-}
-else if ( @file_exists('/etc/davical/config.php') ) {
-  include('/etc/davical/config.php');
-}
-else if ( @file_exists('/usr/local/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php') ) {
-  include('/usr/local/etc/davical/'.$_SERVER['SERVER_NAME'].'-conf.php');
-}
-else if ( @file_exists('/usr/local/etc/davical/config.php') ) {
-  include('/usr/local/etc/davical/config.php');
-}
-else if ( @file_exists('../config/config.php') ) {
-  include('../config/config.php');
+if ( @file_exists("@l_prefix@/etc/davical/davical-config.php") ) {
+  include_once("@l_prefix@/etc/davical/davical-config.php");
 }
 else if ( @file_exists('config/config.php') ) {
   include('config/config.php');
Index: davical-0.9.9.5/dba/views/dav_principal.sql
--- davical-0.9.9.5/dba/views/dav_principal.sql.orig	2010-02-23 11:29:07.000000000 +0100
+++ davical-0.9.9.5/dba/views/dav_principal.sql	2010-11-22 14:33:59.832463699 +0100
@@ -2,7 +2,7 @@
 -- record 1:1 with the principal table
 
 
-DROP VIEW dav_principal CASCADE;
+DROP VIEW IF EXISTS dav_principal CASCADE;
 CREATE OR REPLACE VIEW dav_principal AS
   SELECT user_no, usr.active AS user_active, joined AS created, updated AS modified,
          username, password, fullname, email,
