steffen: server/kolab-resource-handlers/kolab-resource-handlers/resmgr kolabfilter.php, 1.4, 1.5 resmgr.php, 1.52, 1.53
cvs at intevation.de
cvs at intevation.de
Thu Nov 18 00:40:42 CET 2004
Author: steffen
Update of /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr
In directory doto:/tmp/cvs-serv10098/kolab-resource-handlers/resmgr
Modified Files:
kolabfilter.php resmgr.php
Log Message:
better errorhandling and fixed config file rpm issue
Index: kolabfilter.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/kolabfilter.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- kolabfilter.php 11 Nov 2004 22:04:07 -0000 1.4
+++ kolabfilter.php 17 Nov 2004 23:40:40 -0000 1.5
@@ -82,7 +82,11 @@
if( $ical ) {
require_once 'kolabfilter/resmgr.php';
myLog("Calling resmgr_filter( $sender, $recipient, $tmpfname )", RM_LOG_DEBUG);
- resmgr_filter( $sender, $recipient, $tmpfname );
+ $rc = resmgr_filter( $sender, $recipient, $tmpfname );
+ if( PEAR::isError( $rc ) ) {
+ fwrite(STDOUT,"Filter failed: ".$rc->getMessage()."\n");
+ exit(EX_TEMPFAIL);
+ }
$add_headers[] = "X-Kolab-Scheduling-Message: TRUE";
} else {
$add_headers[] = "X-Kolab-Scheduling-Message: FALSE";
Index: resmgr.php
===================================================================
RCS file: /kolabrepository/server/kolab-resource-handlers/kolab-resource-handlers/resmgr/resmgr.php,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- resmgr.php 16 Nov 2004 01:45:24 -0000 1.52
+++ resmgr.php 17 Nov 2004 23:40:40 -0000 1.53
@@ -159,7 +159,7 @@
$ldap = ldap_connect($params['ldap_uri']);
if (!ldap_bind($ldap, $params['bind_dn'], $params['bind_pw'])) {
myLog('Unable to contact LDAP server: ' . ldap_error($ldap));
- return false;
+ return new PEAR_Error('Unable to contact LDAP server: ' . ldap_error($ldap));
}
$result = ldap_search($ldap, $params['base_dn'],
@@ -167,7 +167,7 @@
array("kolabEncryptedPassword", "kolabInvitationPolicy" ));
if (!$result) {
myLog('Unable to perform LDAP search: ' . ldap_error($ldap));
- return false;
+ return new PEAR_Error('Unable to perform LDAP search: ' . ldap_error($ldap));
}
$entries = ldap_get_entries($ldap, $result);
@@ -613,8 +613,9 @@
return false;
}
//$imap->setDebug(true);
- if( PEAR::isError($imap->login($params['calendar_user'], $params['calendar_pass'], true, false)) ) {
- myLog('Unable to authenticate: ' . $imap->getMessage(), RM_LOG_ERROR);
+ $rc = $imap->login($params['calendar_user'], $params['calendar_pass'], true, false);
+ if( PEAR::isError($rc) ) {
+ myLog('Unable to authenticate: ' . $rc->getMessage(), RM_LOG_ERROR);
return false;
}
$mailboxes = $imap->getMailBoxes( "user/$prefix$suffix" );
@@ -974,6 +975,11 @@
// Set some parameters
$ldapdata = &getLDAPData($sender,$resource);
+ if( PEAR::isError($ldapdata) ) return $ldapdata;
+ else if( $ldapdata === false ) {
+ // No data, probably not a local user
+ return true;
+ }
if( $ldapdata['password'] === false ) {
// No decryptable password, use calendar user
$params['calendar_uid'] = getResourceUid($resource);
@@ -993,7 +999,7 @@
// Get out as early as possible if manual
if( $params['action'] == RM_ACT_MANUAL ) {
myLog("Passing through message to $resource");
- return;
+ return true;
}
$requestText = '';
@@ -1005,13 +1011,13 @@
$iCalendar = &getICal($sender,$resource);
if( $iCalendar === false ) {
// No iCal in mail
- return;
+ return true;
}
// Get the event details out of the iTip request
$itip = &$iCalendar->findComponent('VEVENT');
if ($itip === false) {
myLog("No VEVENT found in iCalendar data, Passing through to $resource");
- return;
+ return true;
}
// What is the request's method? i.e. should we create a new event/cancel an
@@ -1054,7 +1060,7 @@
$connected = ($imap !== false);
if( !$connected ) {
myLog("Error, could not open calendar folder!", RM_LOG_ERROR);
- return;
+ return new PEAR_Error('Error, could not open calendar folder!');
}
switch ($method) {
case 'REQUEST':
@@ -1128,7 +1134,7 @@
//myLog("Conflict detected; tentatively accepting");
//sendITipReply(RM_ITIP_TENTATIVE);
myLog("Conflict detected; Passing mail through");
- return;
+ return true;
} else if ($params['action'] == RM_ACT_REJECT_IF_CONFLICTS) {
myLog("Conflict detected; rejecting");
sendITipReply($resource,$itip,RM_ITIP_DECLINE);
@@ -1324,5 +1330,6 @@
// Pass the message through to the group's mailbox
myLog("Passing through $method method to $resource");
+ return true;
}
?>
More information about the commits
mailing list