diff --git a/xCAT-server/lib/xcat/plugins/activedirectory.pm b/xCAT-server/lib/xcat/plugins/activedirectory.pm new file mode 100644 index 000000000..11765e4d3 --- /dev/null +++ b/xCAT-server/lib/xcat/plugins/activedirectory.pm @@ -0,0 +1,63 @@ +# IBM(c) 2010 EPL license http://www.eclipse.org/legal/epl-v10.html +package xCAT_plugin::activedirectory; +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +my $callback; +use lib "$::XCATROOT/lib/perl"; +sub handled_commands { + return { + addclusteruser => 'site:directoryprovider', + addclouduser => 'site:directoryprovider', + }; +} +sub process_request { + my $request = shift; + my $callback = shift; + my $doreq = shift; + use Data::Dumper; + sendmsg(Dumper($request)); + +} + +sub sendmsg { + my $text = shift; + my $node = shift; + my $descr; + my $rc; + if (ref $text eq 'HASH') { + die "not right now"; + } elsif (ref $text eq 'ARRAY') { + $rc = $text->[0]; + $text = $text->[1]; + } + if ($text =~ /:/) { + ($descr,$text) = split /:/,$text,2; + } + $text =~ s/^ *//; + $text =~ s/ *$//; + my $msg; + my $curptr; + if ($node) { + $msg->{node}=[{name => [$node]}]; + $curptr=$msg->{node}->[0]; + } else { + $msg = {}; + $curptr = $msg; + } + if ($rc) { + $curptr->{errorcode}=[$rc]; + $curptr->{error}=[$text]; + $curptr=$curptr->{error}->[0]; + } else { + $curptr->{data}=[{contents=>[$text]}]; + $curptr=$curptr->{data}->[0]; + if ($descr) { $curptr->{desc}=[$descr]; } + } +# print $outfd freeze([$msg]); +# print $outfd "\nENDOFFREEZE6sK4ci\n"; +# yield; +# waitforack($outfd); + $callback->($msg); +}