--- loncom/auth/lonauth.pm 2000/11/10 10:08:24 1.17 +++ loncom/auth/lonauth.pm 2001/01/09 22:10:40 1.18 @@ -7,6 +7,7 @@ package Apache::lonauth; +use strict; use Apache::Constants qw(:common); use Apache::File; use CGI qw(:standard); @@ -14,7 +15,7 @@ use CGI::Cookie(); use Crypt::DES; use Apache::lonnet(); use Apache::lonmenu(); - +use Fcntl qw(:flock); # ------------------------------------------------------------ Successful login sub success { @@ -88,6 +89,12 @@ sub success { { my $idf=Apache::File->new(">$lonids/$cookie.id"); + unless (flock($idf,LOCK_EX)) { + &Apache::lonnet::logthis("WARNING: ". + 'Could not obtain exclusive lock in lonauth: '.$!); + $idf->close(); + return 'error: '.$!; + } if ($userenv ne '') { print $idf "$userenv\n"; } print $idf "user.name=$username\n"; print $idf "user.domain=$domain\n"; @@ -102,6 +109,7 @@ sub success { print $idf "request.role=cm\n"; print $idf "request.host=$ENV{'HTTP_HOST'}\n"; if ($userroles ne '') { print $idf "$userroles"; } + $idf->close(); } # -------------------------------------------------------------------- Log this