This seems to work fine, but any suggestions on improvements are welcome. I am not sure whether preferences work properly without setting a password manually.
--- wiki.pl 2003/03/05 09:39:37 1.18 +++ wiki.pl 2003/03/06 15:02:17 1.21 @@ -335,7 +335,16 @@ $UserID = $UserCookie{'id'}; $UserID =~ s/\D//g; # Numeric only if ($UserID < 200) { - $UserID = 111; + if (defined $ENV{REMOTE_USER}) + { + # Use system uid + 5000 as user ID + my $httpuser = $ENV{REMOTE_USER}; + $UserID = getpwnam($httpuser) + 5000; + } + else + { + $UserID = 111; + } } else { &LoadUserData($UserID); } @@ -2435,6 +2444,15 @@ $result = $UserData{$name}; } else { $result = $default; + } + } + if ($name eq "username" && $result eq "") + { # Quick hack to use http authentication user name if defined + if (defined $ENV{REMOTE_USER}) + { + my $httpuser = $ENV{REMOTE_USER}; + my $realname = (split(/,/, (getpwnam($httpuser))[6]))[0] || ''; + $result = $realname eq '' ? $httpuser : $realname; } } return $result;