projects
/
mirror
/
userdir-ldap-cgi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update voip field
[mirror/userdir-ldap-cgi.git]
/
Util.pm
diff --git
a/Util.pm
b/Util.pm
index
cb6cf82
..
1688dc4
100644
(file)
--- a/
Util.pm
+++ b/
Util.pm
@@
-119,7
+119,7
@@
sub ReadPasswordFromFile {
# check to make sure the time is positive, and that the auth token
# has not expired
my $tdiff = (time - $time);
# check to make sure the time is positive, and that the auth token
# has not expired
my $tdiff = (time - $time);
- &HTMLError("Your authentication token has expired. Please <a href=\"$config{webloginhtml}\">relogin</a>") if (($tdiff < 0) || ($tdiff > $config{authexpires}));
+ &HTMLError("Your authentication token has expired. Please <a href=\"
https://$ENV{SERVER_NAME}/
$config{webloginhtml}\">relogin</a>") if (($tdiff < 0) || ($tdiff > $config{authexpires}));
return Decrypt($cipher, $passwd);
}
return Decrypt($cipher, $passwd);
}
@@
-171,15
+171,17
@@
sub FormatFingerPrint {
$out .= " " if ($_ == 7);
}
} else {
$out .= " " if ($_ == 7);
}
} else {
- foreach (0..int(length($in)/
2
)) {
+ foreach (0..int(length($in)/
4
)) {
$out .= substr($in, $_*4, 4)." ";
}
}
$out .= substr($in, $_*4, 4)." ";
}
}
+ chop $out;
return $out;
}
sub FetchKey {
my $fingerprint = shift;
return $out;
}
sub FetchKey {
my $fingerprint = shift;
+ my $signatures = shift;
my ($out, $keyringparam) = undef;
foreach (split(/:/, $config{keyrings})) {
my ($out, $keyringparam) = undef;
foreach (split(/:/, $config{keyrings})) {
@@
-189,10
+191,13
@@
sub FetchKey {
$fingerprint =~ s/\s//g;
$fingerprint = "0x".$fingerprint;
$fingerprint =~ s/\s//g;
$fingerprint = "0x".$fingerprint;
+ local $ENV{PATH} = '';
$/ = undef; # just suck it up ....
$/ = undef; # just suck it up ....
- open(FP, "$config{gpg} --no-options --no-default-keyring $keyringparam --list-sigs --fingerprint $fingerprint|");
- $out = <FP>;
- close FP;
+ if ($signatures) {
+ open(FP, "$config{gpg} --no-options --no-default-keyring $keyringparam --list-sigs --fingerprint $fingerprint|");
+ $out = <FP>;
+ close FP;
+ }
open(FP, "$config{gpg} --no-options --no-default-keyring $keyringparam --export -a $fingerprint|");
$out .= <FP>;
close FP;
open(FP, "$config{gpg} --no-options --no-default-keyring $keyringparam --export -a $fingerprint|");
$out .= <FP>;
close FP;
@@
-225,7
+230,7
@@
sub FormatLastSeen {
$lastseen = (($d1 gt $d2) ? $lastseenpgp : $lastseenfrom);
}
$lastseen = (($d1 gt $d2) ? $lastseenpgp : $lastseenfrom);
}
- my ($date,$user,$list,$msgid) = ($lastseen =~ /^\[(.+?)\]\s+"(.+?)"\s+"(?:<(.+?)>.
+
?|\-)"\s+"<(.+?)>"/);
+ my ($date,$user,$list,$msgid) = ($lastseen =~ /^\[(.+?)\]\s+"(.+?)"\s+"(?:<(.+?)>.
*
?|\-)"\s+"<(.+?)>"/);
$list = "on $list" if ($list);
return "$date $list<br> Message ID: $msgid";
}
$list = "on $list" if ($list);
return "$date $list<br> Message ID: $msgid";
}
@@
-252,7
+257,7
@@
sub LookupCountry {
my $htmlhdrsent = 0;
sub HTMLSendHeader {
my $htmlhdrsent = 0;
sub HTMLSendHeader {
- print "Content-type: text/html\n\n" if (!$htmlhdrsent);
+ print "Content-type: text/html
; charset=utf-8
\n\n" if (!$htmlhdrsent);
$htmlhdrsent = 1;
}
$htmlhdrsent = 1;
}
@@
-321,7
+326,8
@@
sub ReadConfigFile {
if ((!/^\s*#/) && ($_ ne "")) {
# Chop off any trailing comments
s/#.*//;
if ((!/^\s*#/) && ($_ ne "")) {
# Chop off any trailing comments
s/#.*//;
- ($attr, $setting) = split(/=/, $_, 2);
+ /([^=]+)=(.*)/;
+ ($attr, $setting) = ($1, $2);
$setting =~ s/"//g; #"
$setting =~ s/;$//;
$attr =~ s/^\s+//; $attr =~ s/\s+$//;
$setting =~ s/"//g; #"
$setting =~ s/;$//;
$attr =~ s/^\s+//; $attr =~ s/\s+$//;