remove arbitary uid requirement for vpasswd generation
[freeside.git] / bin / svc_acct.export
index bc27f7f..cee63bc 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 #
-# $Id: svc_acct.export,v 1.25 2001-10-16 20:33:02 jeff Exp $
+# $Id: svc_acct.export,v 1.32 2002-02-15 20:21:56 jeff Exp $
 #
 # Create and export password, radius and vpopmail password files:
 # passwd, passwd.adjunct, shadow, acp_passwd, acp_userinfo, acp_dialup
@@ -68,6 +68,12 @@ my $textradiusprepend =
 
 warn "using depriciated textradiusprepend file" if $textradiusprepend;
 
+
+my $radiusprepend =
+  $conf->exists('radiusprepend')
+    ? join("\n", $conf->config('radiusprepend'))
+    : '';
+
 my @vpopmailmachines = $conf->config('vpopmailmachines')
   if $conf->exists('vpopmailmachines');
 my $vpopmailrestart = '';
@@ -190,6 +196,8 @@ if ( $icradiusmachines ) {
 
 setpriority(0,0,10);
 
+print USERS "$radiusprepend\n";
+
 my %usernames;  ## this hack helps keep the passwd files sane
 my @sendmail;
 
@@ -254,7 +262,8 @@ foreach $svc_domain (sort {$a->domain cmp $b->domain} @svc_domain) {
   foreach $svc_acct (qsearch('svc_acct', {'domsvc' => $svc_domain->svcnum})) {
     my($password)=$svc_acct->getfield('_password');
     my($cpassword,$rpassword);
-    if ( ( length($password) <= 8 )
+    #if ( ( length($password) <= 8 )
+    if ( ( length($password) <= 12 )
          && ( $password ne '*' )
          && ( $password ne '!!' )
          && ( $password ne '' )
@@ -278,6 +287,10 @@ foreach $svc_domain (sort {$a->domain cmp $b->domain} @svc_domain) {
       $username=$svc_acct->username . $svc_acct->domsvc;
     } elsif ($userpolicy =~ /^append domain$/) {
       $username=$svc_acct->username . $svc_domain->domain;
+    } elsif ($userpolicy =~ /^append domain$/) {
+      $username=$svc_acct->username . $svc_domain->domain;
+    } elsif ($userpolicy =~ /^append \@domain$/) {
+      $username=$svc_acct->username . '@'. $svc_domain->domain;
     } else {
       die "Unknown policy in username_policy\n";
     }
@@ -337,20 +350,20 @@ foreach $svc_domain (sort {$a->domain cmp $b->domain} @svc_domain) {
           '',
         ), "\n";
       }
+    }
 
-      ###
-      # FORMAT OF THE VPASSWD FILE HERE
-      print VPASSWD join(":",
-        $svc_acct->username,
-        $cpassword,
-        '1',
-        '0',
-        $svc_acct->username,
-        "$vpopdir/domains/" . $svc_domain->domain ."/" . $svc_acct->username,
-        'NOQUOTA',
-      ), "\n";
+    ###
+    # FORMAT OF THE VPASSWD FILE HERE
+    print VPASSWD join(":",
+      $svc_acct->username,
+      $cpassword,
+      '1',
+      '0',
+      $svc_acct->username,
+      "$vpopdir/domains/" . $svc_domain->domain ."/" . $svc_acct->username,
+      'NOQUOTA',
+    ), "\n";
 
-    }
 
     if ( $svc_acct->slipip ne '' ) {
 
@@ -564,7 +577,8 @@ foreach $bsdshellmachine (@bsdshellmachines) {
   ssh("root\@$bsdshellmachine",
     "( ".
       "mv /etc/passwd.new /etc/passwd; ".
-      "mv /etc/master.passwd.new /etc/master.passwd; ".
+      #"mv /etc/master.passwd.new /etc/master.passwd; ".
+      "pwd_mkdb /etc/master.passwd.new; ".
     " )"
   )
     == 0 or die "ssh error: $!";