Allow client to conduct anonymous operations, flesh out argument checking in validate, better clarity on connection failures in xCAT client

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@930 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-03-28 15:55:41 +00:00
parent 0d0251fdad
commit 55524bb351
2 changed files with 26 additions and 4 deletions

View File

@ -123,14 +123,27 @@ sub submit_request {
if ($ENV{XCATHOST}) {
$xcathost=$ENV{XCATHOST};
}
my $client = IO::Socket::SSL->new(
my $client;
if (-r $keyfile and -r $certfile and -r $cafile) {
$client = IO::Socket::SSL->new(
PeerAddr => $xcathost,
SSL_key_file => $keyfile,
SSL_cert_file => $certfile,
SSL_ca_file => $cafile,
SSL_use_cert => 1,
);
die "Connection failure: $@ (SSL Timeout may mean the credentials in ~/.xcat are incorrect)\n" unless ($client);
} else {
$client = IO::Socket::SSL->new(
PeerAddr => $xcathost
);
}
unless ($client) {
if ($@ =~ /SSL Timeout/) {
die "Connection failure: SSL Timeout or incorrect certificates in ~/.xcat";
} else {
die "Connection failure: $@"
}
}
my $msg=XMLout($request,RootName=>xcatrequest,NoAttr=>1,KeyAttr=>[]);
print $client $msg;
my $response;

View File

@ -978,10 +978,19 @@ sub validate {
next unless ($request->{command}->[0] eq $rule->{commands});
}
if ($rule->{parameters} and $rule->{parameters} ne '*') {
next; #TODO: not ignore this field
my $parms;
if ($request->{arg}) {
$parms = join(' ',@{$request->{arg}});
} else {
$parms = "";
}
my $patt = $rule->{parameters};
unless ($parms =~ /$patt/) {
next;
}
}
if ($rule->{noderange} and $rule->{noderange} ne '*') {
next; #TODO: not ignore this field
#TODO: not ignore this field
}
# If we are still in, that means this rule is the first match and dictates behavior.
if ($rule->{rule}) {