Index: class.vfs_webdav_server.inc.php
===================================================================
--- class.vfs_webdav_server.inc.php	(revision 24658)
+++ class.vfs_webdav_server.inc.php	(working copy)
@@ -411,4 +411,117 @@
 
 		return $auth;
 	}
+	
+	/**
+     * LOCK method handler
+     *
+     * @param  array  general parameter passing array
+     * @return bool   true on success
+     */
+    function LOCK(&$options) 
+    {
+        // get vfs path to requested resource
+        $vfspath = array(
+			'string' => $GLOBALS['egw']->translation->convert($options['path'],'utf-8'),
+			'relatives'	=> array(RELATIVE_ROOT),	// filename is relative to the vfs-root
+		);
+
+        // TODO recursive locks on directories not supported yet
+        // makes litmus test "32. lock_collection" fail
+        if ($this->vfs->file_type($vfspath) == 'Directory' && !empty($options["depth"])) {
+            return "409 Conflict";
+        }
+
+        $options["timeout"] = time()+300; // 5min. hardcoded
+
+        if (isset($options["update"])) { // Lock Update
+            $where = "WHERE path = '$options[path]' AND token = '$options[update]'";
+
+            $query = "SELECT owner, exclusivelock FROM egw_vfs_locks $where";
+            $res   = mysql_query($query);
+            $row   = mysql_fetch_assoc($res);
+            mysql_free_result($res);
+
+            if (is_array($row)) {
+                $query = "UPDATE {egw_vfs_locks 
+                                 SET expires = '$options[timeout]' 
+                                   , modified = ".time()."
+                              $where";
+                mysql_query($query);
+
+                $options['owner'] = $row['owner'];
+                $options['scope'] = $row["exclusivelock"] ? "exclusive" : "shared";
+                $options['type']  = $row["exclusivelock"] ? "write"     : "read";
+
+                return true;
+            } else {
+                return false;
+            }
+        }
+            
+        $query = "INSERT INTO egw_vfs_locks
+                        SET token   = '$options[locktoken]'
+                          , path    = '$options[path]'
+                          , created = ".time()."
+                          , modified = ".time()."
+                          , owner   = '$options[owner]'
+                          , expires = '$options[timeout]'
+                          , exclusivelock  = " .($options['scope'] === "exclusive" ? "1" : "0")
+            ;
+        mysql_query($query);
+
+        return mysql_affected_rows() ? "200 OK" : "409 Conflict";
+    }
+
+    /**
+     * UNLOCK method handler
+     *
+     * @param  array  general parameter passing array
+     * @return bool   true on success
+     */
+    function UNLOCK(&$options) 
+    {
+        $query = "DELETE FROM egw_vfs_locks
+                      WHERE path = '$options[path]'
+                        AND token = '$options[token]'";
+        mysql_query($query);
+
+        return mysql_affected_rows() ? "204 No Content" : "409 Conflict";
+    }
+
+    /**
+     * checkLock() helper
+     *
+     * @param  string resource path to check for locks
+     * @return bool   true on success
+     */
+    function checkLock($path) 
+    {
+        $result = false;
+            
+        $query = "SELECT owner, token, created, modified, expires, exclusivelock
+                  FROM egw_vfs_locks
+                 WHERE path = '$path'
+               ";
+        $res = mysql_query($query);
+
+        if ($res) {
+            $row = mysql_fetch_array($res);
+            mysql_free_result($res);
+
+            if ($row) {
+                $result = array( "type"    => "write",
+                                 "scope"   => $row["exclusivelock"] ? "exclusive" : "shared",
+                                 "depth"   => 0,
+                                 "owner"   => $row['owner'],
+                                 "token"   => $row['token'],
+                                 "created" => $row['created'],   
+                                 "modified" => $row['modified'],   
+                                 "expires" => $row['expires']
+                                 );
+            }
+        }
+
+        return $result;
+    }
 }
\ No newline at end of file

