Add README Copyright and License notices, pus minor tidying.
[buildfarm-server.git] / cgi-bin / register.pl
index b15a0e24cf88862c4699a604aff695217f641617..5b1ce0a649be81b256cc8e671e96312f61259a6e 100755 (executable)
@@ -1,5 +1,13 @@
 #!/usr/bin/perl
 
+=comment
+
+Copyright (c) 2003-2010, Andrew Dunstan
+
+See accompanying License file for license details
+
+=cut 
+
 use strict;
 use DBI;
 use Template;
@@ -7,7 +15,7 @@ use CGI;
 use Template;
 use Captcha::reCAPTCHA;
 
-use vars qw($dbhost $dbname $dbuser $dbpass $dbport $notifyapp $captcha_pubkey $captcha_privkey $template_dir);
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport $notifyapp $captcha_pubkey $captcha_privkey $template_dir $default_host);
 
 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
 
@@ -123,11 +131,14 @@ use Mail::Send;
 
 my $msg = new Mail::Send;
 
-my $me = `id -un`;
+my $me = `id -un`; chomp($me);
+my $host = `hostname`; chomp ($host);
+$host = $default_host unless ($host =~ m/[.]/ || !defined($default_host));
 
-my $host = `hostname`;
+my $from_addr = "PG Build Farm <$me\@$host>";
+$from_addr =~ tr /\r\n//d;
 
-$msg->set('From',"PG Build Farm <$me\@$host>");
+$msg->set('From',$from_addr);
 
 $msg->to(@$notifyapp);
 $msg->subject('New Buildfarm Application');