2 #************************************************************************
3 #* IRC - Internet Relay Chat, ircd/crypt/crypter
4 #* Copyright (C) 1991 Sean Batt
6 #* This program is free software; you can redistribute it and/or modify
7 #* it under the terms of the GNU General Public License as published by
8 #* the Free Software Foundation; either version 1, or (at your option)
11 #* This program is distributed in the hope that it will be useful,
12 #* but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #* GNU General Public License for more details.
16 #* You should have received a copy of the GNU General Public License
17 #* along with this program; if not, write to the Free Software
18 #* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #From Sean Batt sean@coombs.anu.edu.au
23 #Temporary output file
25 $tmpfile = "/tmp/ircd.conf.tmp";
28 #Original ircd.conf file
32 print "crypting ",$ircdconf,"\n";
33 @saltset = ('a' .. 'z', 'A' .. 'Z', '0' .. '9', '.', '/');
36 open ($ircdout, ">/tmp/ircd.conf.tmp") || die "open $!";
39 #if its not an "O" line we can ignore it
40 $text =~ /^o/i || print ($ircdout $text) && next;
42 @oline = split(':', $text);
43 $salt = $saltset[rand(time)%64].$saltset[(rand(time)>>6)%64];
44 $oline[2] = crypt(@oline[2], $salt);
45 print ($ircdout join(':',@oline)."\n");
49 print "/bin/cp ",$tmpfile," ",$ircdconf,"\n";
50 (fork()==0) ? exec("/bin/cp", $tmpfile, $ircdconf) : wait;