+01Aug00=======================================================================
+1. made the export and import ascii system work finally. The user_asc file
+generated (automatically and 0000Z Sunday morning) is autoloading. Just
+execute it and it will automatically reload your user database.
+2. remove import_users.pl no longer necessary
31Jul00=======================================================================
1. try to fix paging problem.
2. added help for spoof and set/forward
my @out;
my $user;
-if ($self->priv >= 5) { # allow a callsign as first arg
- my @args = split /\s+/, $line;
- $call = UC $args[0];
- $user = DXUser->get_current($call);
- shift @args if $user;
- $line = join ' ', @args;
-} else {
- $call = $self->call;
- $user = $self->user;
-}
-
+$user = $self->user;
+$line =~ s/[{}]//g; # no braces allowed
$user->addr($line);
-push @out, $self->msg('addr', $call, $line);
+push @out, $self->msg('addr', $line);
return (1, @out);
# remove leading and trailing spaces
$line =~ s/^\s+//;
$line =~ s/\s+$//;
+$line =~ s/[{}]//g; # remove any braces
return (1, $self->msg('emaile1')) if !$line;
# remove leading and trailing spaces
$line =~ s/^\s+//;
$line =~ s/\s+$//;
+$line =~ s/[{}]//g; # no braces allowed
return (1, $self->msg('hnodee1')) if !$line;
# remove leading and trailing spaces
$line =~ s/^\s+//;
$line =~ s/\s+$//;
+$line =~ s/[{}]//g; # no braces allowed
return (1, $self->msg('namee1')) if !$line;
if ($ref = DXUser->get_current($call)) {
$line =~ s/^\s*$call\s+//;
$line =~ s/\s+//og; # remove any blanks
+ $line =~ s/[{}]//g; # no braces allowed
$ref->passwd($line);
$ref->put();
push @out, $self->msg("password", $call);
# remove leading and trailing spaces
$line =~ s/^\s+//;
$line =~ s/\s+$//;
+$line =~ s/[{}]//g; # no braces allowed
return (1, $self->msg('qthe1')) if !$line;
sub del_file
{
- my ($pkg, $fn, $mode) = @_;
+ my ($pkg, $fn) = @_;
confess "need a filename in User" if !$fn;
$fn .= ".v2";
my $count = 0;
my $fh = new IO::File ">$fn" or return "cannot open $fn ($!)";
if ($fh) {
- my $ref;
- my $key;
+ my $ref = 0;
+ my $key = 0;
my $action;
my $t = scalar localtime;
- print $fh "#!/usr/bin/perl
+ print $fh q{#!/usr/bin/perl
#
# The exported userfile for a DXSpider System
#
# Time: $t
#
+package main;
+
+# search local then perl directories
+BEGIN {
+ umask 002;
+
+ # root of directory tree for this system
+ $root = "/spider";
+ $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
+
+ unshift @INC, "$root/perl"; # this IS the right way round!
+ unshift @INC, "$root/local";
+
+ # try to detect a lockfile (this isn't atomic but
+ # should do for now
+ $lockfn = "$root/perl/cluster.lock"; # lock file name
+ if (-e $lockfn) {
+ open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!";
+ my $pid = <CLLOCK>;
+ chomp $pid;
+ die "Lockfile ($lockfn) and process $pid exists - cluster must be stopped first\n" if kill 0, $pid;
+ close CLLOCK;
+ }
+}
+
package DXUser;
+use DXVars;
+use DXUser;
+
+if (@ARGV) {
+ $main::userfn = shift @ARGV;
+ print "user filename now $userfn\n";
+}
+
+DXUser->del_file($main::userfn);
+DXUser->init($main::userfn, 1);
+
%u = (
-";
-
- for ($action = R_FIRST; !$dbm->seq($key, $ref, $action); $action = R_NEXT) {
- print $fh "'$key' => $ref,\n";
- ++$count;
- }
- print $fh ");\n#\n# there were $count records\n#\n";
- $fh->close;
- }
- return $count;
+ };
+
+for ($action = R_FIRST; !$dbm->seq($key, $ref, $action); $action = R_NEXT) {
+ print $fh "'$key' => q{$ref},\n";
+ ++$count;
+}
+print $fh ");\n#\nprint \"there were $count records\\n\";\n#\n";
+print $fh "DXUser->sync; DXUser->finish;\n#\n";
+$fh->close;
+}
+ return $count;
}
#
+++ /dev/null
-#!/usr/bin/perl
-#
-# Export the user file in a form that can be directly imported
-# back with a do statement
-#
-
-require 5.004;
-
-# search local then perl directories
-BEGIN {
- umask 002;
-
- # root of directory tree for this system
- $root = "/spider";
- $root = $ENV{'DXSPIDER_ROOT'} if $ENV{'DXSPIDER_ROOT'};
-
- unshift @INC, "$root/perl"; # this IS the right way round!
- unshift @INC, "$root/local";
-}
-
-use DXVars;
-use DXUser;
-use DXUtil;
-use Carp;
-
-$inpfn = $ARGV[0] if @ARGV;
-croak "need a input filename" unless $inpfn;
-
-DXUser->del_file($userfn);
-DXUser->init($userfn, 1);
-
-my $s = readfilestr "$inpfn";
-eval $s;
-print $@ if $@;
-
-DXUser->finish();