summaryrefslogtreecommitdiff
path: root/FS/bin
diff options
context:
space:
mode:
authorivan <ivan>2006-08-06 23:39:02 +0000
committerivan <ivan>2006-08-06 23:39:02 +0000
commit65fc97717e093e8ff35d6f4c0efd04e3af334c8d (patch)
tree57be70e942d0f6569de921d8f519b34356558938 /FS/bin
parent81676223e719782d4197841b78434df977457865 (diff)
slightly better bootstrapping for htpasswd kludge... hopefully that will go away in 1.7.1
Diffstat (limited to 'FS/bin')
-rw-r--r--FS/bin/freeside-adduser33
1 files changed, 22 insertions, 11 deletions
diff --git a/FS/bin/freeside-adduser b/FS/bin/freeside-adduser
index 0d8b454bf..3976caece 100644
--- a/FS/bin/freeside-adduser
+++ b/FS/bin/freeside-adduser
@@ -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 @@ if ( $opt_h ) {
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 @@ if ( $opt_g ) {
###
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 @@ freeside-adduser - Command line interface to add (freeside) users.
=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 @@ sales/tech folks) to the web interface, not for adding customer accounts.
-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