From 4edd7680f10248c5a012cd061f729b9a12589003 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Sun, 28 Sep 2008 16:08:12 +0000 Subject: [PATCH] -Further enable WebUI to handle login reasonably git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2247 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/sbin/xcatd | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index 8cb7aad8c..46bf106c2 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -1102,7 +1102,7 @@ sub service_connection { $req = eval { XMLin($request, SuppressEmpty=>undef,ForceArray=>1) }; #first change peername on 'becomeuser' tag if present and valid if (defined $req->{becomeuser}) { - $peername=becomeuser($req->{becomeuser}->[0]->{id}->[0], + $peername=becomeuser($req->{becomeuser}->[0]->{username}->[0], $req->{becomeuser}->[0]->{password}->[0]); unless (defined $peername) { my $resp={error=>["Authentication failure"],errorcode=>[1]}; @@ -1121,7 +1121,17 @@ sub service_connection { $req->{'_xcat_clienthost'} = [$peerhost]; $req->{'_xcat_clientport'}= [$peerport]; $$progname="xCATd SSL: ".$req->{command}->[0]." for ".($peername ? $peername ."@".$peerhost : $peerhost); - if ($cmd_handlers{$req->{command}->[0]}) { + if ($req->{command}->[0] eq "authcheck") { #provide a method for UI to verify a user without actually requesting action + my $resp; + if ($peername or $peername eq "0") { + $resp->{username}=[$peername]; + $resp->{data}=["Authenticated"]; + } else { + $resp->{data}=["Unauthenticated"]; + } + $resp->{serverdone}={}; + print $sock XMLout($resp,RootName => 'xcatresponse',NoAttr=>1); + } elsif ($cmd_handlers{$req->{command}->[0]}) { return plugin_command($req,$sock,\&convey_response); } elsif ($req->{command}->[0] eq "noderange" and $req->{noderange}) { my @nodes = noderange($req->{noderange}->[0]);