
  8   ˆl—ß=¿J	µ4Ò‚ ™P-Üm«Œ¶¦-ÿ�þZn¬Ü¤yÁ²¸ÑüÿÆ„Ž‰ßÅÃÂ ?÷     #! /usr/bin/perl


# Copyright (C) 2000 Roland Bauerschmidt <rb@debian.org>
#
# Based on the Debian "adduser" utility developed by:
#   Guy Maor <maor@debian.org>
#   Ted Hajek <tedhajek@boombox.micro.umn.edu>
#   Ian A. Murdock <imurdock@gnu.ai.mit.edu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to:
#
#   Free Software Foundation
#   51 Franklin Street, Fifth Floor
#   Boston, MA 02110
#   USA


use strict;
use warnings;

use Getopt::Long;

use Debian::AdduserCommon;

my $version = "3.134";

my $install_more_packages;

BEGIN {
    local $ENV{PERL_DL_NONLAZY}=1;
    eval 'use File::Find';
    if ($@) {
      $install_more_packages = 1;
    }
    #no warnings "File::Find";
    eval 'use File::Temp';
    if ($@) {
      $install_more_packages = 1;
    }
}


BEGIN {
    eval 'use Locale::gettext';
    if ($@) {
        *gettext = sub { shift };
        *textdomain = sub { "" };
        *LC_MESSAGES = sub { 5 };
    }
    eval {
        require POSIX;
        import POSIX qw(setlocale);
    };
    if ($@) {
        *setlocale = sub { return 1 };
    }
}

setlocale(LC_MESSAGES, "");
textdomain("adduser");

my $action = $0 =~ /delgroup$/ ? "delgroup" : "deluser";
our $verbose = 1;
my %pconfig = ();
my %config = ();
my @configfiles;
my @defaults;
my $no_preserve_root;


unless ( 
    GetOptions (
        "quiet|q" => sub {$verbose = 0; },
        "debug" => sub {$verbose = 2; },
        "verbose" => sub {$verbose = 2; },
        "version|v" => sub { &version(); exit 0; },
        "help|h" => sub { &usage(); exit 0;},
        "group" => sub { $action = "delgroup";},
        "conf|c=s" => \@configfiles,
        "system" => \$pconfig{"system"},
        "only-if-empty" => \$pconfig{"only_if_empty"},
        "remove-home" => \$pconfig{"remove_home"},
        "remove-all-files" => \$pconfig{"remove_all_files"},
        "backup" => \$pconfig{"backup"},
        "backup-to=s" => \$pconfig{"backup_to"},
        "backup-suffix=s" => \$pconfig{"backup_suffix"},
        "no-preserve-root" => \$no_preserve_root
    )
) {
    &usage;
    exit 1;
}

# everyone can issue "--help" and "--version", but only root can go on
dief (gtx("Only root may remove a user or group from the system.\n")) if ($> != 0);

if (!@configfiles) {
    @defaults = ("/etc/adduser.conf", "/etc/deluser.conf");
} else {
    @defaults = (@configfiles);
}

# explicitly set PATH, because super (1) cleans up the path and makes deluser unusable;
# this is also a good idea for sudo (which doesn't clean up)
$ENV{"PATH"}="/bin:/usr/bin:/sbin:/usr/sbin";

my @names = ();
my ($user,$group);

######################
# handling of @names #
######################

while (defined(my $arg = shift(@ARGV))) {
  if (defined($names[0]) && $arg =~ /^--/) {
        dief (gtx("No options allowed after names.\n"));
    } else {                    # it's a username
        push (@names, $arg);
    }
}

if(@names == 0) {
    if($action eq "delgroup") {
        print (gtx("Enter a group name to remove: "));
    } else {
        print (gtx("Enter a user name to remove: "));
    }
    chomp(my $answer=<STDIN>);
    push(@names, $answer);
}

if (length($names[0]) == 0 || @names > 2) {
    dief (gtx("Only one or two names allowed.\n"));
}

if(@names == 2) {      # must be deluserfromgroup
    $action = "deluserfromgroup";
    $user = shift(@names);
    $group = shift(@names);
} else {
    if($action eq "delgroup") {
        $group = shift(@names);
    } else {
        $user = sh