Whoops, forgot to make the password fields password fields
[blerg.git] / tools / convert_to_md5_passwords.pl
1 #!/usr/bin/perl
2 # Yes, we were storing passwords in plain text.
3 use Digest::MD5 qw/md5/;
4 use strict;
5
6 my $datadir = shift;
7
8 opendir DATA, $datadir;
9 while (my $user = readdir(DATA)) {
10         next if $user =~ /^\./;
11         print "Processing $user\n";
12         open P, "$datadir/$user/password";
13         my $password = <P>;
14         close P;
15         chomp $password;
16
17         my $md5password = md5($user . $password);
18
19         rename "$datadir/$user/password", "$datadir/$user/password.old";
20         open P, ">$datadir/$user/password";
21         print P $md5password;
22         close P;
23 }