From c5eccdc2bcc84294cc39313d0945aa4843a75c71 Mon Sep 17 00:00:00 2001
From: jlb <jlb>
Date: Fri, 20 Jun 2003 11:08:32 +0000
Subject: [PATCH] rajout de l'option de cryptage

---
 scripts/adherents/adh2passwd.pl | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/adherents/adh2passwd.pl b/scripts/adherents/adh2passwd.pl
index 1d3c6e5660c..0e3bf15a1d0 100755
--- a/scripts/adherents/adh2passwd.pl
+++ b/scripts/adherents/adh2passwd.pl
@@ -28,7 +28,7 @@ use Getopt::Long;
 # command line option hash table
 my %optctl=();
 # get command line options
-GetOptions(\%optctl,"help!","host=s","db=s","user=s","pass=s","type=s","cotis!");
+GetOptions(\%optctl,"help!","host=s","db=s","user=s","pass=s","type=s","cotis!","crypt!");
 if (defined $optctl{'help'}){
   &usage();
 }
@@ -54,13 +54,17 @@ $sth->execute;
 
 # get login,pass of each adherents
 while (my @row = $sth->fetchrow_array ){
+  if (defined $optctl{'crypt'}){
+    print "$row[0]:",crypt($row[1],join '', ('.', '/', 0..9,'A'..'Z', 'a'..'z')[rand 64, rand 64]),"\n";
+  }else{
     print "$row[0]:$row[1]\n";
+  }
 }
 
 $dbh->disconnect();
 
 sub usage{
-  print "$0 [--help] [--host] [--db] [--user] [--pass] [--cotis]\n";
+  print "$0 [--help] [--host] [--db] [--user] [--pass] [--cotis] [--crypt]\n";
   print " cotis : select only adherents with cotisations up-to-date\n";
   print "\n";
   exit (1);
-- 
GitLab