From e8ec7aa8e38a93f5b034ac74cebce5de23710317 Mon Sep 17 00:00:00 2001 From: hongbotian Date: Mon, 30 Nov 2015 01:45:08 -0500 Subject: upload http JIRA: BOTTLENECK-10 Change-Id: I7598427ff904df438ce77c2819ee48ac75ffa8da Signed-off-by: hongbotian --- .../app/httpd-2.0.64/support/SHA1/convert-sha1.pl | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 rubbos/app/httpd-2.0.64/support/SHA1/convert-sha1.pl (limited to 'rubbos/app/httpd-2.0.64/support/SHA1/convert-sha1.pl') diff --git a/rubbos/app/httpd-2.0.64/support/SHA1/convert-sha1.pl b/rubbos/app/httpd-2.0.64/support/SHA1/convert-sha1.pl new file mode 100644 index 00000000..35228022 --- /dev/null +++ b/rubbos/app/httpd-2.0.64/support/SHA1/convert-sha1.pl @@ -0,0 +1,36 @@ +#!/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"; +} + -- cgit 1.2.3-korg