ARCv2

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension ARCv2.

1.05- Tue Mar 22 2005
	- fixed authentication/decryption problem, which lead to
	  staling connections when the client thought it is authenticated,
	  but the server doesn't know that
	- correct the exit-code handling in the arcx-client-script
	- another patch by Tony Fraser (ACLs, CheckCmd for the Server-Connection)
	- command-server-mapping-file for arcx-client-script

1.04  Tue Jan 04 2005
	- Fixed timeout again
	- command error handling improved, passed to the client separatly now

1.03  Tue Dec 02 2004
	- Documentation has to be created
	- line feed when command sprays an error (thanks to Wolfgang Friebel)
	- pid file
	- removed errornous white space

lib/Arc/Command.pod  view on Meta::CPAN

  my $pw = <>;
  if ($pw ne "klaus") {
	  return $this->_SetError("Wrong password.");
  }
 }
 
In ARCv2 some standard commands are already implemented: C<Arc::Command::Get>,
C<Arc::Command::Put>, C<Arc::Command::Uptime>, C<Arc::Command::Whoami>,
C<Arc::Command::Test>.

By default, these classes are mapped to B<Command Names> as follows (in the 
default arcxd.conf for arcxd):
  uptime => Arc::Command::Uptime,
  whoami => Arc::Command::Whoami,
  copy   => Arc::Command::Get,
  cp     => Arc::Command::Get,
  get    => Arc::Command::Get,
  put    => Arc::Command::Put,
  test   => Arc::Command::Test,
  help   => Arc::Command::Help,
 

lib/Arc/Connection.pm  view on Meta::CPAN

			$buf = $this->{_sasl}->decode($inbuf) 
				if $this->{_authenticated} == 1 and $this->{protocol} == 1;
				
# if authentication went wrong on the server side, but client thought it was ok
			$buf = $inbuf unless $buf;
			
			substr($buf,0,0) = $partial;
			my @buf1 = split (/\015?\012/,$buf,-1);
			$partial = pop @buf1;
			
			push(@{$this->{__linequeue}}, map { "$_\n" } @buf1);
		} else {
			$this->{_connected} = 0;
			$this->{_connection}->close();
			# if timed out, 
			return $this->_SetError("Connection timed out.");
		}
	}
	$this->{__partial} = $partial;
	return shift @{$this->{__linequeue}};
}

lib/Arc/Connection/Server.pm  view on Meta::CPAN


	my $perlcmd = $this->{commands}->{$cmd};
my $reason = $this->_CheckCmd($cmd, $perlcmd);

	if (defined $reason) {
		$this->Log(LOG_USER, "Command '$cmd' requested by user '".$this->{_username}.
		"' not ok", $reason ? ": $reason" : "");
		$this->_Error("Command $cmd not ok", $reason ? ": $reason" : "");
	} elsif( !$this->{_error} && defined $perlcmd ) {
		$this->Log(LOG_USER,"Command '$cmd' requested by user '".$this->{_username}.
			"' mapped to '$perlcmd'",$para ? "with parameters '$para'" : "");
		if (eval "require $perlcmd;") {

			my $in =  new IO::Pipe || return $this->_SetError("Could not create in-Pipe");
			my $out = new IO::Pipe || return $this->_SetError("Could not create out-Pipe");
			my $err = new IO::Pipe || return $this->_SetError("Could not create err-Pipe");

			my $oldsigchld = $SIG{CHLD};
			$SIG{CHLD} = 'IGNORE';

			my $cmdpid = fork();

scripts/arcx  view on Meta::CPAN

$args{f} = defined $args{f} && $args{f} ne "" ? $args{f} : $ENV{HOME}.'/.archistory';
$args{C} = defined $args{C} && $args{C} ne "" ? $args{C} : $Arc::ConfigPath.'/arcx.conf';

my $intact = !@ARGV;
my $stop = 0;

my @server_list;

if ($args{h}) {
	push @server_list, $args{h}.($args{p} ? ":".$args{p} : "");
# only use the cmd2server maplist, when we have a command given
} elsif (!$intact && $args{C}) {
	unless (-e $args{C}) {
		err("Configfile $args{C} not found.");
	} else {
		my $cf = new Config::IniFiles( -file => $args{C});
		my $err = @Config::IniFiles::errors;
		usage($err) if $err;

		foreach ($cf->Parameters('server_command_map')) {
			my ($host,$cmdlist) = ($_,$cf->val('server_command_map',$_));
			push @server_list, $host
				if $cmdlist eq '*' || grep( { $_ eq $ARGV[0] } split(/[,:;]/, $cmdlist));
		}
	}
}

push @server_list, "$Arc::DefaultHost:$Arc::DefaultPort" unless @server_list;

my $retval = 0;

scripts/arcx  view on Meta::CPAN

   [-F -f <history>] [-u|-U <username>] [-a|-A <authname>]
   [-w|-W <password>] [-s <mech>] [-t <timeout in sec>]
   [-r <string>] [-V] [-C <conffile>] [command [command-arguments]]

  (Remark: Some parameters behave different in comparison to the old arc)

  -h <hostname>    specify the ARCv2 server
  -p <port>        port to connect (default: $Arc::DefaultPort)
  -t <timeout>     specify the timeout in seconds (default: 30 secs)
  -0               use old protocol type (unencrypted protocol conn.)
  -C <conffile>    use <conffile> as source for server-command-mapping.
                   (default: $Arc::ConfigPath/arcx.conf)

  -r <string>      use this string as stdin value for the command

  -S <service>     name of the service used for arc auth (default: arc)
  -s <mech>        use <mech> as authentication mechanism for SASL
  -n               do nothing, just try to authenticate
  -v               be verbose

  -U <username>    username for authentication (dep. on SASL mechanism)

scripts/arcx.conf  view on Meta::CPAN

# a very simple config file, which lists servers and their ARCv2 commands

[server_command_map]
    hekate.ifh.de:4243 = kstart,fs;vos:blah
    hekate.ifh.de:4242 = fs;vos:blah
    hekate2.ifh.de     = whoami,test,
# fallback
    hekate.ifh.de      = *



( run in 0.390 second using v1.01-cache-2.11-cpan-49f99fa48dc )