freeside/FS/FS/part_export acct_sql.pm,1.12,1.13 shellcommands.pm,1.32,1.33 shellcommands_withdomain.pm,1.5,1.6

ivan ivan at pouncequick.420.am
Thu May 19 03:27:02 PDT 2005


Update of /home/cvs/cvsroot/freeside/FS/FS/part_export
In directory pouncequick:/tmp/cvs-serv30957/part_export

Modified Files:
	acct_sql.pm shellcommands.pm shellcommands_withdomain.pm 
Log Message:
fix shellcommands export encrypting "magic" shadow values * NP *LK*

Index: shellcommands_withdomain.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/shellcommands_withdomain.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- shellcommands_withdomain.pm	10 May 2004 13:46:52 -0000	1.5
+++ shellcommands_withdomain.pm	19 May 2005 10:26:56 -0000	1.6
@@ -44,6 +44,10 @@
   'unsuspend_stdin' => { label=>'Unsuspension command STDIN',
                          default=>'',
                        },
+  'crypt' => { label   => 'Default password encryption',
+               type=>'select', options=>[qw(crypt md5)],
+               default => 'crypt',
+             },
 ;
 
 %info = (
@@ -86,7 +90,7 @@
   <LI><code>$domain</code>
   <LI><code>$_password</code>
   <LI><code>$quoted_password</code> - unencrypted password quoted for the shell
-  <LI><code>$crypt_password</code> - encrypted password
+  <LI><code>$crypt_password</code> - encrypted password (quoted for the shell)
   <LI><code>$uid</code>
   <LI><code>$gid</code>
   <LI><code>$finger</code> - GECOS, already quoted for the shell (do not add additional quotes)

Index: acct_sql.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/acct_sql.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- acct_sql.pm	18 May 2005 14:50:44 -0000	1.12
+++ acct_sql.pm	19 May 2005 10:26:56 -0000	1.13
@@ -1,6 +1,6 @@
 package FS::part_export::acct_sql;
 
-use vars qw(@ISA %info @saltset);
+use vars qw(@ISA %info)
 use Tie::IxHash;
 #use Digest::MD5 qw(md5_hex);
 use FS::Record; #qw(qsearchs);

Index: shellcommands.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_export/shellcommands.pm,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- shellcommands.pm	21 Mar 2005 22:13:37 -0000	1.32
+++ shellcommands.pm	19 May 2005 10:26:56 -0000	1.33
@@ -1,6 +1,6 @@
 package FS::part_export::shellcommands;
 
-use vars qw(@ISA %info @saltset);
+use vars qw(@ISA %info)
 use Tie::IxHash;
 use String::ShellQuote;
 use FS::part_export;
@@ -53,6 +53,10 @@
   'unsuspend_stdin' => { label=>'Unsuspension command STDIN',
                          default=>'',
                        },
+  'crypt' => { label   => 'Default password encryption',
+               type=>'select', options=>[qw(crypt md5)],
+               default => 'crypt',
+             },
 ;
 
 %info = (
@@ -145,7 +149,7 @@
   <LI><code>$username</code>
   <LI><code>$_password</code>
   <LI><code>$quoted_password</code> - unencrypted password quoted for the shell
-  <LI><code>$crypt_password</code> - encrypted password
+  <LI><code>$crypt_password</code> - encrypted password (quoted for the shell)
   <LI><code>$uid</code>
   <LI><code>$gid</code>
   <LI><code>$finger</code> - GECOS, already quoted for the shell (do not add additional quotes)
@@ -160,8 +164,6 @@
 END
 );
 
- at saltset = ( 'a'..'z' , 'A'..'Z' , '0'..'9' , '.' , '/' );
-
 sub rebless { shift; }
 
 sub _export_insert {
@@ -229,16 +231,8 @@
   $quoted_password = shell_quote $_password;
   $domain = $svc_acct->domain;
 
-  #eventually should check a "password-encoding" field
-  if ( length($svc_acct->_password) == 13
-       || $svc_acct->_password =~ /^\$(1|2a?)\$/ ) {
-    $crypt_password = shell_quote $svc_acct->_password;
-  } else {
-    $crypt_password = crypt(
-      $svc_acct->_password,
-      $saltset[int(rand(64))].$saltset[int(rand(64))]
-    );
-  }
+  $crypt_password =
+    shell_quote( $svc_acct->crypt_password( $self->option('crypt') ) );
 
   @radius_groups = $svc_acct->radius_groups;
 
@@ -270,15 +264,8 @@
   $old_domain = $old->domain;
   $new_domain = $new->domain;
 
-  #eventuall should check a "password-encoding" field
-  if ( length($new->_password) == 13
-       || $new->_password =~ /^\$(1|2a?)\$/ ) {
-    $new_crypt_password = shell_quote $new->_password;
-  } else {
-    $new_crypt_password =
-      crypt( $new->_password, $saltset[int(rand(64))].$saltset[int(rand(64))]
-    );
-  }
+  $new_crypt_password =
+    shell_quote( $new->crypt_password( $self->option('crypt') ) );
 
   @old_radius_groups = $old->radius_groups;
   @new_radius_groups = $new->radius_groups;




More information about the freeside-commits mailing list