[freeside-commits] freeside/FS/bin freeside-adduser,1.12,1.13

Ivan,,, ivan at wavetail.420.am
Sun Aug 6 16:39:04 PDT 2006


Update of /home/cvs/cvsroot/freeside/FS/bin
In directory wavetail:/tmp/cvs-serv15801/FS/bin

Modified Files:
	freeside-adduser 
Log Message:
slightly better bootstrapping for htpasswd kludge... hopefully that will go away in 1.7.1

Index: freeside-adduser
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/bin/freeside-adduser,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- freeside-adduser	4 Jul 2006 12:01:02 -0000	1.12
+++ freeside-adduser	6 Aug 2006 23:39:02 -0000	1.13
@@ -1,13 +1,13 @@
 #!/usr/bin/perl -w
 
 use strict;
-use vars qw($opt_h $opt_b $opt_c $opt_g);
+use vars qw($opt_s $opt_h $opt_b $opt_c $opt_g $opt_n);
 use Fcntl qw(:flock);
 use Getopt::Std;
 
 my $FREESIDE_CONF = "/usr/local/etc/freeside";
 
-getopts("bch:g:");
+getopts("s:bch:g:n");
 die &usage if $opt_c && ! $opt_h;
 my $user = shift or die &usage;
 
@@ -27,16 +27,21 @@
   push @args, '-c' if $opt_c;
   push @args, $opt_h, $user;
   push @args, shift if $opt_b;
+  warn join(', ', 'htpasswd', @args)."\n";
   system(@args) == 0 or die "htpasswd failed: $?";
 }
 
-#my $secretfile = $opt_s || 'secrets';
-#
-#open(MAPSECRETS,">>$FREESIDE_CONF/mapsecrets")
-#  and flock(MAPSECRETS,LOCK_EX)
-#    or die "can't open $FREESIDE_CONF/mapsecrets: $!";
-#print MAPSECRETS "$user $secretfile\n";
-#close MAPSECRETS or die "can't close $FREESIDE_CONF/mapsecrets: $!";
+if ( $opt_s ) {
+  open(MAPSECRETS,">>$FREESIDE_CONF/mapsecrets")
+    and flock(MAPSECRETS,LOCK_EX)
+      or die "can't open $FREESIDE_CONF/mapsecrets: $!";
+  print MAPSECRETS "$user $opt_s\n";
+  close MAPSECRETS or die "can't close $FREESIDE_CONF/mapsecrets: $!";
+}
+
+###
+
+exit if $opt_n;
 
 ###
 
@@ -72,7 +77,7 @@
 ###
 
 sub usage {
-  die "Usage:\n\n  freeside-adduser [ -h htpasswd_file [ -c ] [ -b ] ] [ -g groupnum ] username"
+  die "Usage:\n\n  freeside-adduser [ -h htpasswd_file [ -c ] [ -b ] ] [ -g groupnum ] username [ password ]"
 }
 
 =head1 NAME
@@ -81,7 +86,7 @@
 
 =head1 SYNOPSIS
 
-  freeside-adduser [ -h htpasswd_file [ -c ] ] -g 1 username
+  freeside-adduser [ -n ] [ -h htpasswd_file [ -c ] [ -b ] ] [ -g groupnum ] username [ password ]
 
 =head1 DESCRIPTION
 
@@ -96,6 +101,12 @@
 
   -g: initial groupnum
 
+  Development/multi-DB options:
+
+  -s: alternate secrets file
+
+  -n: no ACL added, for bootstrapping
+
 =head1 SEE ALSO
 
 L<htpasswd>(1), base Freeside documentation



More information about the freeside-commits mailing list