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
Fix debian/changelog and release info
[mirror/userdir-ldap-cgi.git]
/
Util.pm
diff --git
a/Util.pm
b/Util.pm
index
374a592
..
92ea455
100644
(file)
--- a/
Util.pm
+++ b/
Util.pm
@@
-7,7
+7,7
@@
package Util;
use strict;
use Date::Manip qw(ParseDate);
use strict;
use Date::Manip qw(ParseDate);
-use Net::LDAP qw(
:all
);
+use Net::LDAP qw(
LDAP_SUCCESS LDAP_PROTOCOL_ERROR
);
use English;
my $blocksize = 8; # A blowfish block is 8 bytes
use English;
my $blocksize = 8; # A blowfish block is 8 bytes
@@
-33,21
+33,26
@@
sub CreateKey {
}
sub CreateCryptSalt {
}
sub CreateCryptSalt {
+ # CreateCryptSalt(type = 0, skip_header = 0)
# this can create either a DES type salt or a MD5 salt
# this can create either a DES type salt or a MD5 salt
+ # 0 for DES, 1 for MD5 salt
+ # if skip_header is 0, does not add $1$ for md5 salts.
my $md5 = shift; # do we want a MD5 salt?
my $md5 = shift; # do we want a MD5 salt?
+ my $no_crypttype_header = shift;
my $validstr = './0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
my @valid = split(//,$validstr);
my ($in, $out);
my $validstr = './0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
my @valid = split(//,$validstr);
my ($in, $out);
-
+
my $cryptsaltlen = ($md5 ? 8 : 2);
my $cryptsaltlen = ($md5 ? 8 : 2);
-
+
open (F, "</dev/urandom") || die &HTMLError("No /dev/urandom found!");
foreach (1..$cryptsaltlen) {
read(F, $in, 1);
$out .= $valid[ord($in) % ($#valid + 1)];
}
close F;
open (F, "</dev/urandom") || die &HTMLError("No /dev/urandom found!");
foreach (1..$cryptsaltlen) {
read(F, $in, 1);
$out .= $valid[ord($in) % ($#valid + 1)];
}
close F;
- return ($md5 ? "\$1\$$out\$" : $out);
+ if ($md5 == 1 && !$no_crypttype_header) { $out = "\$1\$$out\$"; }
+ return $out
}
sub Encrypt {
}
sub Encrypt {
@@
-354,12
+359,14
@@
sub UpgradeConnection($) {
my ($ldap) = @_;
my $mesg = $ldap->start_tls(
verify => 'require',
my ($ldap) = @_;
my $mesg = $ldap->start_tls(
verify => 'require',
- cafile => '/etc/ssl/certs/spi-cacert-2008.pem'
+ # Cannot specify the server cert, must specify the CA cert
+ #cafile => '/etc/ssl/servicecerts/db.debian.org.crt'
+ cafile => '/etc/ssl/certs/UTN_USERFirst_Hardware_Root_CA.pem'
);
$mesg->sync;
if ($mesg->code != LDAP_SUCCESS) {
print "Content-type: text/html; charset=utf-8\n\n";
);
$mesg->sync;
if ($mesg->code != LDAP_SUCCESS) {
print "Content-type: text/html; charset=utf-8\n\n";
- print "<html><body><h1>STARTTLS failed: ".
.
$mesg->error."</h1></body></html>\n";
+ print "<html><body><h1>STARTTLS failed: ".$mesg->error."</h1></body></html>\n";
exit(1);
};
};
exit(1);
};
};