Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix useradd checks #7

Merged
merged 1 commit into from Dec 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 5 additions & 6 deletions lib/RPM/Grill/Plugin/RpmScripts.pm
Expand Up @@ -16,8 +16,8 @@ use warnings;
our $VERSION = '0.01';

use Carp;
use RPM::Grill::Util qw(sanitize_text);
use Getopt::Long qw(:config gnu_getopt);
use RPM::Grill::Util qw(sanitize_text);
use Getopt::Long qw(GetOptionsFromArray :config no_ignore_case);
use Text::ParseWords;
use RPM::Grill::dprintf;

Expand Down Expand Up @@ -284,19 +284,18 @@ sub _check_generic_add {
# Parse the command-line options
my $getopt_options = $Getopt_Options{$add_command}
or die "$ME: Internal error: unknown add command '$add_command'";
local (@ARGV) = @words;
my %options;
GetOptions( \%options, @{$getopt_options});
GetOptionsFromArray(\@words, \%options, @{$getopt_options});

# There must be exactly one argument remaining, and that's the
# name of the user or group to be added.
my $arg = shift(@ARGV)
my $arg = shift(\@words)
or do {
# FIXME: this deserves a gripe
warn "$ME: WARNING: no user/group/etc in '$cmd'";
return;
};
warn "$ME: WARNING: command '$cmd' left \@ARGV with '@ARGV'" if @ARGV;
warn "$ME: WARNING: command '$cmd' left \@words with '@words'" if @words;

# Invoke the specific checker for useradd or groupadd
{
Expand Down