add username_policy "@append domain"
[freeside.git] / bin / svc_acct.export
index 7271860..e28de4a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 #
-# $Id: svc_acct.export,v 1.26 2001-10-24 15:29:30 ivan Exp $
+# $Id: svc_acct.export,v 1.29 2002-02-12 02:11:07 ivan 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')
+    ? $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;
 
@@ -279,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";
     }
@@ -565,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: $!";