[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [cobalt-users] Neomail - modify domain name for the from fiel d
- Subject: RE: [cobalt-users] Neomail - modify domain name for the from fiel d
- From: "Jolley, Carl" <Carl.Jolley@xxxxxxx>
- Date: Thu Jul 18 09:34:01 2002
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
-----Original Message-----
From: cobaltusers
Sent: Wednesday, July 17, 2002 7:59 PM
To: cobalt-users@xxxxxxxxxxxxxxx
Subject: RE: [cobalt-users] Neomail - modify domain name for the from
field
I checked the build file for my Raq4i and it shows 3100R
so based on that information I was thinking that the information
Taco's script in the neomail_prefs.pl would be using the following section:
<snip>
elsif ($BUILD =~ /3001R/ || $BUILD =~ /3100R/) {
$VIRTUSERTABLE="/etc/mail/virtusertable";
</snip>
which if I'm understanding this correctly would use this
<snip>
if ($VIRTUSERTABLE ne "") {
my $SITEHOSTNAME=$ENV{HTTP_HOST};
if ($SITEHOSTNAME =~ /^([-\@\w.]+)$/) {
$SITEHOSTNAME = $1; # $data now untainted
</snip>
Could you add an elseif ($SITEHOSTNAME =~ "this is the part I have no idea
about"
with some kind of regular expression (I hope that is what this is
"/^([-\@\w.]+)$/")
to remove the my. from the domain?
Is this possible or is my guessing and fumbling just way off?
---------------------------------
The /^([-\@\w.]+)$/ is a perl regular expression which is checking
for all the characters that might appear in a hostname, i.e. the
[] construct is a character class and the '+' that follows it
says "one or more". Included in the character class are the -
character, the @ character, all alphanumeric characters and the
. (dot) character. The \w sequence says "all aphpanumeric characters".
The test is only slightly incorrect since the \w sequence also
includes the underscore character which, if my memory serves me,
is NOT a valid character in a hostname. If i'm correct about
the underscore then the \w sequence should be replaced by
the string A-Za-z0-9 to be strictly correct. Actually the
checking of the hostname is intended to do something called
"un-tainting" but that is a slightly more advanced concept than
"checking all of the characters of the hostname". Note also
that this check doesn't validate the form of a hostname at all,
based soley on the regex, the string "@--.-.@" would be considerted a
valid hostname. It does include only the correct characters but that
alone doesn't mean that it is a valid hostname.