-
-if ( $opt_s ) {
-
- #if ( -e "$FREESIDE_CONF/mapsecrets" ) {
- # open(MAPSECRETS,"<$FREESIDE_CONF/mapsecrets")
- # or die "can't open $FREESIDE_CONF/mapsecrets: $!";
- # while (<MAPSECRETS>) {
- # /^(\S+) / or die "unparsable line in mapsecrets: $_";
- # die "user $user already exists\n" if $user eq $1;
- # }
- # close MAPSECRETS;
- #}
-
- #insert new entry before a wildcard...
- open(MAPSECRETS,"<$FREESIDE_CONF/mapsecrets")
- and flock(MAPSECRETS,LOCK_EX)
- or die "can't open $FREESIDE_CONF/mapsecrets: $!";
- open(NEW,">$FREESIDE_CONF/mapsecrets.new")
- or die "can't open $FREESIDE_CONF/mapsecrets.new: $!";
- while(<MAPSECRETS>) {
- if ( /^\*\s/ ) {
- print NEW "$user $opt_s\n";
- }
- print NEW $_;
- }
- close MAPSECRETS or die "can't close $FREESIDE_CONF/mapsecrets: $!";
- close NEW or die "can't close $FREESIDE_CONF/mapsecrets.new: $!";
- rename("$FREESIDE_CONF/mapsecrets.new", "$FREESIDE_CONF/mapsecrets")
- or die "can't move mapsecrets.new into place: $!";
-
-}
-
-###
-
-exit if $opt_n;
-
-###