#!/usr/bin/perl # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # # # Licensed Materials - Property of IBM # # (C) COPYRIGHT International Business Machines Corp. 2004,2019 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # sccsid = "@(#)54 1.4 src/rsct/rm/LPRM/cli/bin/lslpracl.perl, LPRM, rsct_rady, rady2035a 11/12/15 16:38:21" ###################################################################### # # # Module: lslpracl # # # # Purpose: # # lslpracl - List the Resource ACL for the LPRM class. # # # # Syntax: # # lslpracl [-a|-n host1[,host2,...]] [-l|-t|-d|-D delimiter] # # [-L] [-E] [-x] [-h] [-TV] [Name] # # # # lslpracl [-n host] -i [-E] [-h] [-TV] # # # # Flags: # # -a Lists the Resource ACLs on all nodes in the domain. # # -d Displays information using delimiters. The default # # delimiter is a pipe (|). Use -D the select a delimiter. # # -D delimiter # # Displays information using the specified delimiter. # # -E Displays permission in long form. "r" for read is # # displayed using the permissions that comprise it, "e", # # "l", "q", and "v", and "w" for write is displayed using # # the permissions that comprise it, "c", "d", "o", and "s".# # -i Generates a template in a form that can be used, after # # editing, as file input to the chlpclacl command. # # -l Displays information on separate lines (long format). # # -L Displays the Shared Resource ACL if the Resource ACL # # uses it. # # -n host1[,host2,...] # # Lists the Resource ACLs on the nodes specified in the # # the domain. # # -t Displays information in separate columns (table format). # # This is the default format. # # -x Excludes the header (suppresses the header printing). # # -h Help. Writes the command's usage statement to standard # # output. # # -T Trace. Writes the command's trace messages to standard # # error. For your software-service organization's use only.# # -V Verbose. Writes the command's verbose messages to # # standard output. # # # # Parameters: # # Name The resource name of an LP Commands resource. # # # # Description: # # The lplpracl command lists the Resource ACL for the LPRM class. # # A resource ACL protects the resource. # # # # Exit Values: # # 0 LPRM_CLI_SUCCESS Command completed successfully. # # 1 LPRM_CLI_RMC_ERROR Command terminated due to an underlying # # RMC error. # # 2 LPRM_CLI_ERROR Command terminated due to an underlying # # error in the command script. # # 3 LPRM_CLI_BAD_FLAG Command terminated due to user # # specifying an invalid flag. # # 4 LPRM_CLI_BAD_OPERAND Command terminated due to user # # specifying a bad operand. # # 5 LPRM_CLI_USER_ERROR Command terminated due to a user error, # # for example specifying a name that # # already exists. # # # # Examples: # # 1. To list the accesses defined in the Resource ACL, run: # # lslpracl # # # # Man Page: # # For the most current detailed description of this command see # # the lslpracl man page in /opt/rsct/man. # # # #--------------------------------------------------------------------# # Inputs: # # /opt/rsct/msgmaps/lprmcli.lslpracl.map - # # message mapping # # # # Outputs: # # stdout - none. # # stderr - any error message. # # # # External Ref: # # Commands: ctdspmsg # # Modules: LPRM_cli_utils.pm, LPRM_cli_rc.pm, # # LPRM_cli_include.pm, CT_cli_utils.pm # # Perl library routines: Getopt::Std # # # # Tab Settings: # # 4 and tabs should be expanded to spaces before saving this file. # # in vi: (:set ts=4 and :%!expand -4) # # # # Change Activity: # # 050107 JAC 116808: Initial design & write. # # 050130 JAC 117312: Some minor changes for -i. # # 050203 JAC 117535: Change call to process_api_error. # # 050228 JAC 118165: Make the display formats exclusive. # # 050307 JAC 118052: Return correct rc. # # 071029 JAC 146726: set delimiters for calling -api commands. # ###################################################################### #--------------------------------------------------------------------# # General Program Flow/Logic: # # # # 1. Parse command line flags and operands. # # 2. Print usage if -h specified. # # 3. Set the appropriate management scope. # # 4. Call RMC command lprsrcacl. Also pass along -VT if necessary. # # 5. Return back any errors. # # # #--------------------------------------------------------------------# #--------------------------------------------------------------------# # Included Libraries and Extensions # #--------------------------------------------------------------------# use lib "/opt/rsct/pm"; use locale; use Getopt::Std; use CT_cli_utils qw(printIMsg printEMsg); use CT_cli_display_utils qw(set_display); use LPRM_cli_rc qw(LPRM_CLI_SUCCESS LPRM_CLI_RMC_ERROR LPRM_CLI_ERROR LPRM_CLI_BAD_FLAG LPRM_CLI_BAD_OPERAND LPRM_CLI_USER_ERROR); use LPRM_cli_utils qw(error_exit printCIMsg printCEMsg getIMsg process_api_error remove_api_error process_exit_code); use LPRM_cli_include qw($TRUE $FALSE $RMC_LOCAL_SCOPE $RMC_LOCAL2_SCOPE $RMC_DM_SR_LOCAL_SCOPE $DELIMITERI $DELIMITERO $CTBINDIR $CTDIR); #--------------------------------------------------------------------# # Global Variables # #--------------------------------------------------------------------# $Trace = $FALSE; # default - trace off $Verbose = $FALSE; # default - verbose turned off $Opt_AllNodes = $FALSE; # default - not all nodes $Opt_NodeList = $FALSE; # default - not node list $Opt_Delm_Format = $FALSE; # default - no delim output $Opt_Delm_Str = "|"; # default - pipe $Opt_Long_Format = $FALSE; # default - not long format $Opt_Table_Format = $TRUE; # default - use tabular format $Opt_No_HDR = $FALSE; # default - no exclude header $Opt_LS_Input_File = $FALSE; # default - no file output $Opt_ExpandPerm = $FALSE; # default - don't expand perms $Opt_ShowShared = $FALSE; # default - don't show shared acl $Opt_AllNames = $FALSE; # default - don't all reseores $PROGNAME = "lslpracl"; # Program Name for messages $LSMSG = "$CTBINDIR/ctdspmsg"; # list / display message rtn $MSGCAT = "lprmcli.cat"; # msg catalogue for this cmd $ENV{'MSGMAPPATH'} = "$CTDIR/msgmaps"; # msg maps used by $LSMSG #--------------------------------------------------------------------# # Variables # #--------------------------------------------------------------------# my $node_list = ""; # node list from -n my $cmd_opts = ""; # lsrsrcacl-api options my $cmd_parms = ""; # lsrsrcacl-api parameters my @cmd_out = (); # lsrsrcacl-api output my @lsacl_out = (); # output from lsrsrcacl-api my @heading = (); # output heading my @col_headings = (); # individual heading my $col_heading_name = ""; # heading for parsing my @lof_acls = (); # 2D array to be displayed my $i = 0; # loop counter my $j = 0; # loop counter my $k = 0; # loop counter my @NoAclText = (); # text for No Acl my @SharedAclText = (); # text for Shared Acl my @acl_entries = (); # returned acl entries my $acl_entry = ""; # acl entry my $lprm_name = ""; # resource name my $RH_resname = ""; # reference to res name my $RH_nodename = ""; # reference to name array my $RH_save = ""; # RH for safe keeping my $acl_node_name = ""; # node name to display my $node_str = ""; # for node name text my $name_str = ""; # for name text my %SharedAcl = (); # shared acl hash by nodename #--------------------------------------------------------------------# # Main Code # #--------------------------------------------------------------------# my $rc = 0; my $p_rc = 0; # parse the command line, exit if there are errors ($rc, $node_list, $lprm_name) = &parse_cmd_line; ($rc == 0) || error_exit($rc); if ($Verbose) { printIMsg("IMsglslpraclStart"); } if ($Trace) { $cmd_opts = $cmd_opts." -T"; } if ($Verbose) { $cmd_opts = $cmd_opts." -V"; } if ($Verbose) { printIMsg("IMsglslpraclSetScope"); } # if -a and -n were not specified, set local RMC scope if ( (!$Opt_AllNodes) && (!$Opt_NodeList)) { $ENV{CT_MANAGEMENT_SCOPE} = $RMC_LOCAL_SCOPE; } # set DM/SR scope is scope is not set else { # if CT_MANAGEMENT_SCOPE is not defined, set it to 4 for DM/SR/Local scope if (!defined $ENV{CT_MANAGEMENT_SCOPE}) { $ENV{CT_MANAGEMENT_SCOPE} = $RMC_DM_SR_LOCAL_SCOPE; } # if it's defined, it shouldn't be local. If it's local, set it # to 4 for DM/SR/Local scope else { if ($ENV{CT_MANAGEMENT_SCOPE} == $RMC_LOCAL_SCOPE || $ENV{CT_MANAGEMENT_SCOPE} == $RMC_LOCAL2_SCOPE) { $ENV{CT_MANAGEMENT_SCOPE} = $RMC_DM_SR_LOCAL_SCOPE; } } } if ($Verbose) { printIMsg("IMsglslpraclProcessOptions"); } # process the command # set expand permissions if -E specified if ($Opt_ExpandPerm) { $cmd_opts = $cmd_opts . " -E "; } # call lsrsrcacl-api (lsrsrcacl-api -Ro IBM.LPCommands::name::nodes) if ($Verbose) { printIMsg("IMsglslpraclListAcl"); } if ($Trace) { print STDERR "$PROGNAME: calling lsrsrcacl-api\n";} @lsacl_out=`$CTBINDIR/lsrsrcacl-api -I ${DELIMITERI} -D ${DELIMITERO} $cmd_opts -Ro IBM.LPCommands${DELIMITERI}${lprm_name}${DELIMITERI}${node_list} 2>&1`; # capture the return code from lsrsrcacl-api $rc = $?; $rc = process_exit_code($rc); if ($Trace) { print STDERR "lsrsrcacl-api results:\n"; print STDERR "@lsacl_out";} if ($Trace) { print STDERR "$PROGNAME: lsrsrcacl-api returned $rc\n";} if ($Verbose) { printIMsg("IMsglslpraclProcessErrors"); } # show any errors if there was a bad rc if ($rc != 0) { process_api_error($DELIMITERO,$rc,@lsacl_out); @lsacl_out = remove_api_error(@lsacl_out); } if ($Verbose) { printIMsg("IMsglslpraclFormOutput"); } # form 2D array to pass to display utils # get heading from message file @heading = getIMsg("IMsglslpraclHeading"); # form heading @col_headings = split(/::/,$heading[0]); $i = 1; if ($Opt_Long_Format) { $lof_acls[0][1] = $col_headings[1]; $lof_acls[0][2] = $col_headings[2]; $lof_acls[0][3] = $col_headings[0]; $lof_acls[0][4] = $col_headings[3]; } else { foreach $col_heading_name (@col_headings) { $lof_acls[0][$i] = $col_heading_name; $i++; } } # get from message file what to use for "No Acl" (no access) @NoAclText = getIMsg("IMsglslpraclNoAcl"); # get from message file what to use for "Shared Acl" @SharedAclText = getIMsg("IMsglslpraclSharedAcl"); # set up Title text from column headings $node_str = $col_headings[$#col_headings]; $name_str = $col_headings[0]; ($RH_resname, $RH_nodename) = &get_names_nodes_for_RH($lprm_name, $node_list, \@lsacl_out); if (!$Opt_No_HDR) { printIMsg("IMsglslpraclTitle"); } # form each line of output $i = 1; $k = 1; foreach $line (@lsacl_out) { chomp($line); # parse the output @acl_entries = split(/$DELIMITERO/, $line); # get RH, id, perm, id, perm... or RH, S|N # save RH before it's over written $RH_save = $acl_entries[0]; # substitute resource name in for RH if present if (defined $$RH_resname{$RH_save}) { $acl_entries[0] = $$RH_resname{$RH_save}; } # set node name if present, or use RH if not if (defined $$RH_resname{$RH_save}) { $acl_node_name = $$RH_nodename{$RH_save}; } else { $acl_node_name = $RH_save; } # put into array $lof_acls[$i][0] = "$name_str $acl_entries[0], $node_str $acl_node_name"; # $j = 2; use 2 once node is in output of lsrsrcacl-api $j = 1; while ($j <= $#acl_entries) { # check for no ACL if ( $acl_entries[$j] eq "N" ){ if ($Opt_Long_Format) { $lof_acls[$i][1] = $NoAclText[0]; $lof_acls[$i][2] = ""; $lof_acls[$i][3] = $acl_entries[0]; $lof_acls[$i][4] = $acl_node_name; } else { $lof_acls[$i][1] = $acl_entries[0]; $lof_acls[$i][2] = $NoAclText[0]; $lof_acls[$i][3] = ""; $lof_acls[$i][4] = $acl_node_name; } } # check for Shared ACL elsif ( $acl_entries[$j] eq "S" ){ if (!$Opt_ShowShared) { if ($Opt_Long_Format) { $lof_acls[$i][1] = $SharedAclText[0]; $lof_acls[$i][2] = ""; $lof_acls[$i][3] = $acl_entries[0]; $lof_acls[$i][4] = $acl_node_name; } else { $lof_acls[$i][1] = $acl_entries[0]; $lof_acls[$i][2] = $SharedAclText[0]; $lof_acls[$i][3] = ""; $lof_acls[$i][4] = $acl_node_name; } } else { # show the shared acl $rsrc_shared_acl = &get_shared_acl($acl_node_name, $acl_entries[0]); chomp($rsrc_shared_acl); @acl_entries = split(/$DELIMITERO/, $rsrc_shared_acl); if ($Opt_Long_Format) { $lof_acls[$i][1] = $acl_entries[$j]; $lof_acls[$i][2] = $acl_entries[$j+1]; $lof_acls[$i][3] = $acl_entries[0]; $lof_acls[$i][4] = $acl_node_name; } else { $lof_acls[$i][1] = $acl_entries[0]; $lof_acls[$i][2] = $acl_entries[$j]; $lof_acls[$i][3] = $acl_entries[$j+1]; $lof_acls[$i][4] = $acl_node_name; } } } else { # regular resource output if ($Opt_Long_Format) { $lof_acls[$i][1] = $acl_entries[$j]; $lof_acls[$i][2] = $acl_entries[$j+1]; $lof_acls[$i][3] = $acl_entries[0]; $lof_acls[$i][4] = $acl_node_name; } else { $lof_acls[$i][1] = $acl_entries[0]; $lof_acls[$i][2] = $acl_entries[$j]; $lof_acls[$i][3] = $acl_entries[$j+1]; $lof_acls[$i][4] = $acl_node_name; } } $j = $j+2; $i++; } $k++; } # set how many rows of data there is $row_count = $#lof_acls; $col_count = scalar(@{$lof_acls[0]}); if ( $Opt_Long_Format ) { $col_count = $col_count - 2; } # use regular output methods if (!$Opt_LS_Input_File) { # set formatting string needed by set_display ($Opt_Long_Format) && ($display_type = "long"); ($Opt_Table_Format) && ($display_type = "column"); ($Opt_Delm_Format) && ($display_type = "delim"); # print out results, if any if ($row_count > 0) { $p_rc = set_display($display_type, $Opt_No_HDR, $row_count, $col_count, \@lof_acls, $Opt_Delm_Str); if ($rc == 0) { $rc = $p_rc; } } } # else output id/perm for -i else { # print the output for ($i=1; $i<=$row_count; $i++){ print ($lof_acls[$i][1],"\t", $lof_acls[$i][2],"\t", $lof_acls[$i][3],"\n"); } } if ($Verbose) { printIMsg("IMsglslpraclEnd"); } exit($rc); #--------------------------------------------------------------------# # End Main Code # #--------------------------------------------------------------------# #--------------------------------------------------------------------# # parse_cmd_line - Parse the command line for options and operands. # # Set appropriate global variables as outlined below, make sure we # # have a valid combination of arguments / options. # # # # Return: # # $rc 0 Command line parsed fine, no problem. # # LPRM_CLI_BAD_FLAG Command line contained a bad flag. # # $node_list List of nodes for -n. # # # # Global Variables Modified: # # $Verbose output True (-V) turn Verbose mode on. # # $Trace output True (-T) turn Trace mode on. # # $Opt_Delm_Format output True (-d,-D) delimited output # # $Opt_Delm_Str output char (-D) delimiter character # # $Opt_Long_Format output True (-l) long formatted output # # $Opt_Table_Format output True (-t) tabular formatted output # # $Opt_No_HDR output True (-x) supress heading # # $Opt_LS_Input_File output True (-i) file formatted output. # # $Opt_AllNodes output True (-1) all nodes. # # $Opt_NodeList output True (-n) nodes listed. # # $Opt_ExpandPerm output True (-E) nodes listed. # # $Opt_ShowShared output True (-L) show shared acl. # # $Opt_AllNames output True when a name is specified. # #--------------------------------------------------------------------# sub parse_cmd_line { my(@original_argv) = @ARGV; my $node_list = ""; # nodes for -n my $name = ""; # input name my %opts = (); # Process the command line... if (!&getopts('adD:EhilLn:txTV', \%opts)) { # Gather options; # if errors &print_usage; # display proper usage return LPRM_CLI_BAD_FLAG; # return bad rc - bad flag } # process h flag if (defined $opts{h}) { # -h, help request &print_usage; # print usage statement exit(0); # all done with good return! } if (defined $opts{T}) { # -T turn trace on $Trace = $TRUE; } if (defined $opts{V}) { # -V turn verbose mode on $Verbose = $TRUE; } if (defined $opts{a}) { # -a for all nodes in domain $Opt_AllNodes = $TRUE; # -a flag specified } if (defined $opts{n}) { # -n for list of nodes # error if -a is specified if ($Opt_AllNodes) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-a","-n"); &print_usage; return LPRM_CLI_BAD_FLAG; } $Opt_NodeList = $TRUE; # -n flag specified $node_list = $opts{n}; } if (defined $opts{E}) { # -E for expand permissions $Opt_ExpandPerm = $TRUE; # -E flag specified } if (defined $opts{L}) { # -L for show shared acl $Opt_ShowShared = $TRUE; # -L flag specified } if (defined $opts{D}) { # -D delimited output with specified $Opt_Delm_Format = $TRUE; # delimiter $Opt_Delm_Str = $opts{D}; $Opt_Long_Format = $FALSE; # error if -d is specified if (defined $opts{d}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-D","-d"); &print_usage; return LPRM_CLI_BAD_FLAG; } # error if -l is specified if (defined $opts{l}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-D","-l"); &print_usage; return LPRM_CLI_BAD_FLAG; } # error if -t is specified if (defined $opts{t}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-D","-t"); &print_usage; return LPRM_CLI_BAD_FLAG; } # error if -i is specified if (defined $opts{i}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-D","-i"); &print_usage; return LPRM_CLI_BAD_FLAG; } } if (defined $opts{d}) { # -d delimited output $Opt_Delm_Format = $TRUE; $Opt_Delm_Str = "|"; $Opt_Long_Format = $FALSE; # error if -l is specified if (defined $opts{l}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-d","-l"); &print_usage; return LPRM_CLI_BAD_FLAG; } # error if -t is specified if (defined $opts{t}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-d","-t"); &print_usage; return LPRM_CLI_BAD_FLAG; } # error if -i is specified if (defined $opts{i}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-d","-i"); &print_usage; return LPRM_CLI_BAD_FLAG; } } if (defined $opts{t}) { # -t table formatted output $Opt_Table_Format = $TRUE; $Opt_Long_Format = $FALSE; $Opt_Delm_Format = $FALSE; # error if -l is specified if (defined $opts{l}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-t","-l"); &print_usage; return LPRM_CLI_BAD_FLAG; } # error if -i is specified if (defined $opts{i}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-t","-i"); &print_usage; return LPRM_CLI_BAD_FLAG; } } if (defined $opts{l}) { # -l long formatted output $Opt_Long_Format = $TRUE; $Opt_Table_Format = $FALSE; $Opt_Delm_Format = $FALSE; # error if -i is specified if (defined $opts{i}) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-l","-i"); &print_usage; return LPRM_CLI_BAD_FLAG; } } if (defined $opts{x}) { # -x supress headings $Opt_No_HDR = $TRUE; } if (defined $opts{i}) { # -i input file format # error if -a is specified if ($Opt_AllNodes) { printCEMsg("EMsgLPRMcliImproperUsageCombination","-a","-i"); &print_usage; return LPRM_CLI_BAD_FLAG; } # error if -n is specified and >1 node if ($Opt_NodeList) { if ( $node_list =~ /,/ ) { printCEMsg("EMsgLPRMcliImproperNumNodes"); &print_usage; return LPRM_CLI_BAD_FLAG; } } $Opt_LS_Input_File = $TRUE; $Opt_No_HDR = $TRUE; # don't print a header for -i } # Chaeck for arguments... none needed if ($#ARGV == 0) { # any args? $Opt_AllNames = $TRUE; $name = $ARGV[0]; } if ($#ARGV > 0) { # wrong # of args? printCEMsg("EMsgLPRMcliInvalidNumberOfOperands"); &print_usage; return LPRM_CLI_BAD_OPERAND; } return(0, $node_list, $name); } # end parse_cmd_line #--------------------------------------------------------------------# # print_usage : print the usage statement (syntax) to stdout. # #--------------------------------------------------------------------# sub print_usage { &printIMsg("IMsglslpraclUsage"); } # end print_usage #--------------------------------------------------------------------# # get_names_nodes_for_RH - Get the resource name and the node name # # for one or more resource handles. The input is an array of one # # or more output lines from lsrsrcacl-api where the RH is first # # in the list up to the delimiter (::). The outputs are the # # pointers to 2 hashes, one for resource name and the other for # # node name, where the RH is the key in both. # # # # Input: # # $rsc_name The resource name used in the command. # # $node_list The list of nodes to check. # # $ls_output Reference to the lsrsrcacl-api output. # # Output # # \%RH_ResName Reference to the hash of resource # # names keyed by RH. # # \%RH_NodeName Reference to the hash of node names # # keyed by RH. # #--------------------------------------------------------------------# sub get_names_nodes_for_RH { my $rsc_name = shift(@_); # get resource name, if any my $node_list = shift(@_); # get node list, if any my $ls_output = shift(@_); # get input array of ls output my %RH_ResName = (); # resource name hash by RH my %RH_NodeName = (); # node name hash by RH my $line_out = ""; # one line of output my @line_data = ""; # elements on the line my @listout = (); # output from lsrsrc-api my $cmd_str = ""; # has the command text my $rc = 0; # call lsrsrc-api $main::Trace && print STDERR "$main::PROGNAME: calling lsrsrc-api\n"; @listout=`$CTBINDIR/lsrsrc-api -I ${DELIMITERI} -D ${DELIMITERO} -o IBM.LPCommands${DELIMITERI}${lprm_name}${DELIMITERI}${node_list}${DELIMITERI}ResourceHandle${DELIMITERI}Name${DELIMITERI}NodeNameList 2>&1`; $rc = $?; $rc = process_exit_code($rc); $main::Trace && print STDERR "$main::PROGNAME: lsrsrc-api returned $rc\n"; # show any errors if there was a bad rc if ($rc != 0) { process_api_error(${DELIMITERO},$rc,@listout); @listout = remove_api_error(@listout); } # go through the output creating the hashes foreach $line_out (@listout) { chomp($line_out); # parse the output @line_data = split(/$DELIMITERO/, $line_out); # RH, Name, NodeName # add to the resource name hash $RH_ResName{$line_data[0]} = $line_data[1]; # add to the node name hash $line_data[2] =~ s/^{//; $line_data[2] =~ s/}$//; $RH_NodeName{$line_data[0]} = $line_data[2]; } return(\%RH_ResName, \%RH_NodeName); } # get_names_nodes_for_RH #--------------------------------------------------------------------# # get_shared_acl -Get the Shared Resource ACL for the resource when # # the Resource ACL indicates that the Shared Resource ACL is used. # # # # Input: # # $node_name The node where to get the shared acl. # # $rsrc_name The resource name for the acl. # # Output # # $shared_acl The shared acl. # #--------------------------------------------------------------------# sub get_shared_acl { my $node_name = shift(@_); # get node name for acl my $rsrc_name = shift(@_); # get node name for acl my $shared_acl = ""; # the output shared acl my @lsacl_out = (); # output from lsrsrcacl-api my $line = ""; # for loop processing my $rc = 0; # have we already retrieved the shared acl for this node if (defined $SharedAcl{$node_name}) { $shared_acl = $SharedAcl{$node_name}; } else { # call lsrsrcacl-api $main::Trace && print STDERR "$main::PROGNAME: calling lsrsrcacl-api\n"; @lsacl_out=`$CTBINDIR/lsrsrcacl-api -I ${DELIMITERI} -D ${DELIMITERO} -b IBM.LPCommands${DELIMITERI}${node_name} 2>&1`; $rc = $?; $rc = process_exit_code($rc); $main::Trace && print STDERR "$main::PROGNAME: lsrsrcacl-api returned $rc\n"; # show any errors if there was a bad rc if ($rc != 0) { process_api_error(${DELIMITERO},$rc,@lsacl_out); @lsacl_out = remove_api_error(@lsacl_out); } $shared_acl = $rsrc_name . $DELIMITERO . $lsacl_out[0]; } return($shared_acl); } # get_shared_acl