Index: openacs-4/packages/oacs-dav/tcl/oacs-dav-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/oacs-dav/tcl/oacs-dav-procs.tcl,v
diff -u -r1.12.2.2 -r1.12.2.3
--- openacs-4/packages/oacs-dav/tcl/oacs-dav-procs.tcl	27 Sep 2005 04:04:06 -0000	1.12.2.2
+++ openacs-4/packages/oacs-dav/tcl/oacs-dav-procs.tcl	18 Oct 2006 17:55:36 -0000	1.12.2.3
@@ -64,19 +64,31 @@
         
         
         ns_log debug "\nTDAV 5.0 authentication"
+	# check all authorities 
+	foreach authority [auth::authority::get_authority_options] {
+	    set authority_id [lindex $authority 1]
         array set auth [auth::authenticate \
                             -username $user \
-                            -password $password]
-        if {![string equal $auth(auth_status) "ok"]} {
-            array set auth [auth::authenticate \
-                                -email $user \
-                                -password $password]
-            if {![string equal $auth(auth_status) "ok"]} {
-                ns_log debug "\nTDAV 5.0 auth status $auth(auth_status)"
-                        ns_returnunauthorized
-                        return 0
-            }
-        }
+                            -password $password \
+			    -authority_id $authority_id \
+			    -no_cookie]
+	    if {![string equal $auth(auth_status) "ok"]} {
+		array set auth [auth::authenticate \
+				    -email $user \
+				    -password $password \
+				    -authority_id $authority_id \
+				    -no_cookie]
+	    }
+	    if {[string equal $auth(auth_status) "ok"]} {
+		# we can stop checking
+		break
+	    }
+	}
+	if {![string equal $auth(auth_status) "ok"]} {
+	    ns_log debug "\nTDAV 5.0 auth status $auth(auth_status)"
+	    ns_returnunauthorized
+	    return 0
+	}
         ns_log debug "\nTDAV: auth_check openacs 5.0 user_id= $auth(user_id)"
         ad_conn -set user_id $auth(user_id)