<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/athena/bin/perl -T

$WWWROOT = "/var/www/root";

print &lt;&lt;HTTPHEAD;
Content-Type: text/html
Status: $ENV{'REDIRECT_STATUS'} Forbidden

&lt;!doctype HTML public "-//IETF//DTD HTML 2.0//EN"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Forbidden&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;h1&gt;403 Forbidden&lt;/h1&gt;

&lt;p&gt;You don't have permission to access that URL on this server.  &lt;/p&gt;

HTTPHEAD

$ru = $ENV{'REDIRECT_URL'};

if ($ru =~ m:^/people/(.*?)/:) {
   $person = $1;
   unless($actual = readlink "$WWWROOT/people/$person") {
      $actual = $ru;
   }
} else {
   $actual = $ru;
}

undef $addr;

if ($actual =~ m|/afs/sipb(\.mit\.edu)?/user/(\w{2,8})|) {
   $addr = $2;
} elsif ($actual =~ m%/afs/athena(\.mit\.edu)?/user/(./.|./other|other)/(\w{2,8})%) {
   $addr = $3;
}

# safely exec hesinfo to determine if the address we've divined is
# valid
if($addr) {
   $pid = open(CHILD, "-|");
   if(defined $pid) {
      if($pid == 0) {
# keep hesinfo from writing to our stderr
         open(SAVERR, "&gt;&amp;STDERR") || warn "unable to dup stderr\n";
         open(STDERR, "&gt;/dev/null") || warn "stderr redirect failed\n";

         exec "/bin/athena/hesinfo", $addr, "pobox";

# retrieve stderr because we have an error to report
         open(STDERR, "&gt;&amp;SAVERR");
         die "exec failed (/bin/athena/hesinfo): $!\n";
      } else {
         @hesdata = &lt;CHILD&gt;;
         close(CHILD);
# child will return zero on success, nonzero on failure
         if($? != 0) {
            undef $addr;
         }
      }
   } else {
      warn "unable to fork to exec hesinfo\n";
   }
}

# if all the above tests are passed, $addr will have a value, otherwise
# it'll be undefined
if($addr) {
   print &lt;&lt;UCONTACT;

&lt;p&gt;You tried to access&lt;/p&gt;
&lt;div align=center&gt;&lt;code&gt;http://www.mit.edu$ENV{'REDIRECT_URL'}&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;A possible contact address for the owner of this web page is 
&lt;a href="mailto:$addr\@mit.edu"&gt;$addr\@mit.edu&lt;/a&gt;.
If you send mail, please include the URL you tried to access in
the message you send so the owner of the page can fix the problem more
easily.&lt;/p&gt;
UCONTACT
} else {
   print &lt;&lt;WCONTACT;

&lt;p&gt;Perhaps you'd like to try our &lt;a href="http://www.mit.edu/storyfun"&gt;StoryFun service&lt;/a&gt; instead... &lt;hr&gt;

&lt;p&gt;Please direct questions to &lt;a href="http://www.mit.edu/comment"&gt;webmaster\@mit.edu&lt;/a&gt; &lt;/p&gt;
WCONTACT
}

print &lt;&lt;HTTPTAIL;
&lt;/body&gt;
&lt;/html&gt;
HTTPTAIL

exit 0;
</pre></body></html>