mirror of
https://github.com/apache/httpd.git
synced 2025-08-20 16:09:55 +00:00

Obtained from: Apache 1.3.9 (minus unused files), tag APACHE_1_3_9 Submitted by: Apache Group git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83750 13f79535-47bb-0310-9956-ffa450edef68
37 lines
934 B
Perl
37 lines
934 B
Perl
#!/usr/bin/perl -w
|
|
use strict;
|
|
|
|
# This is public domain code. Do whatever you want with it.
|
|
# It was originally included in Clinton Wong's Apache 1.3.6 SHA1/ldif
|
|
# patch distribution as sample code for converting accounts from
|
|
# ldif format (as used by Netscape web servers) to Apache password format.
|
|
|
|
my $uid='';
|
|
my $passwd='';
|
|
|
|
while (my $line = <>) {
|
|
chomp $line;
|
|
if ( $line =~ /uid:\s*(.+)/) { $uid = $1 }
|
|
if ( $line =~ /userpassword:\s*(\{\w+\}.+)/) {
|
|
$passwd = $1;
|
|
$passwd =~ s/^\{crypt\}//i; # Apache stores crypt without a magic string
|
|
}
|
|
|
|
if (length($line)==0) {
|
|
|
|
if (length $uid and length $passwd) {
|
|
print $uid, ':', $passwd, "\n";
|
|
} # output if we have something to print
|
|
|
|
$uid = '';
|
|
$passwd = '';
|
|
|
|
} # if newline
|
|
} # while something to read
|
|
|
|
# handle last entry if there isn't a newline before EOF
|
|
if (length $uid and length $passwd) {
|
|
print $uid, ':', $passwd, "\n";
|
|
}
|
|
|