--- loncom/auth/lonwebdavauth.pm 2012/06/01 11:39:29 1.2 +++ loncom/auth/lonwebdavauth.pm 2015/05/29 18:42:01 1.3 @@ -1,7 +1,7 @@ # The LearningOnline Network # Authentication Handler for webDAV access to Authoring Space. # -# $Id: lonwebdavauth.pm,v 1.2 2012/06/01 11:39:29 raeburn Exp $ +# $Id: lonwebdavauth.pm,v 1.3 2015/05/29 18:42:01 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -32,7 +32,7 @@ Apache::lonwebdavauth - webDAV Authentic =head1 SYNOPSIS -Invoked for /+webdav/[\w\-]+/[\w\-]+/ by +Invoked for ^/+webdav/[\w\-.]+/\w[\w.\-\@]+/ by /etc/httpd/conf/loncapa_apache.conf: PerlAuthenHandler Apache::lonwebdavauth @@ -208,8 +208,9 @@ sub handler { my $uhome = &Apache::lonnet::authenticate($uname,$upass,$udom); if (($uhome ne 'no_host') && (&Apache::lonnet::hostname($uhome) ne '')) { - $handle = &init_webdav_env($sessiondir,$uname,$udom, - $uhome,$now,$timetolive); + my ($author) = ($r->uri =~ m{^/webdav/($match_domain/$match_username)/}); + $handle = &init_webdav_env($r,$sessiondir,$uname,$udom, + $uhome,$now,$timetolive,$author); if ($handle ne '') { if (&Apache::lonnet::usertools_access($uname,$udom,'webdav')) { my $cookie = "lonDAV=$handle; path=/webdav/; secure; HttpOnly;"; @@ -228,7 +229,7 @@ sub handler { } sub init_webdav_env { - my ($sessiondir,$uname,$udom,$uhome,$now,$timetolive) = @_; + my ($r,$sessiondir,$uname,$udom,$uhome,$now,$timetolive,$author) = @_; my $handle; my $currnewest = 0; if ($sessiondir ne '') { @@ -297,6 +298,13 @@ sub init_webdav_env { \%userenv,\%domdef,\%is_adv); @env{keys(%disk_env)} = @disk_env{keys(%disk_env)}; untie(%disk_env); + my $ip; + my $c = $r->connection; + if (ref($c)) { + $ip = $c->remote_ip; + } + &Apache::lonnet::log($udom,$uname,$uhome, + "Login webdav/$author $ip"); } return $handle; }