Apache2 webdav Userdir based file server preventing authenticated user to access other's directories

Today I've setted up a server which purpose is to give its users access to their personal files using WebDav. Unfortunately, as soon as a user is authenticated, the server gives him the right to access any other user's file. This can't be prevented the right way without patching. Let's do it the wrong way ;-)

For this to work, I've used mod_rewrite. The trick consists in always rewritting the requested URI, to make it point to the remotely connected user's directory, using the REMOTE_USER variable. One cannot simply compare the value of that variable with the URI, the RewriteRule and RewriteCond simply can't support such a comparison.

To prevent Apache from applying that rule recursively, I've used to [NS] flag. However, this flag is not effective into the <directory> tags. Thus, this rule needs to be applyed to the whole vhost. The consequence is that the user still believes he is browsing another user's directory, although he really is browsing his.

I anyone has a better solution :

UserDir disabled root
UserDir /home/*/
RewriteEngine On
RewriteCond %{LA-U:REMOTE_USER} !^$
RewriteRule /[^/]*/(.*) /~%{LA-U:REMOTE_USER}/$1 [NS]