1#!/usr/bin/perl -w 2 3# $Id: smbldap-groupdel,v 1.7 2004/11/06 17:54:26 jtournier Exp $ 4# 5# This code was developped by IDEALX (http://IDEALX.org/) and 6# contributors (their names can be found in the CONTRIBUTORS file). 7# 8# Copyright (C) 2001-2002 IDEALX 9# 10# This program is free software; you can redistribute it and/or 11# modify it under the terms of the GNU General Public License 12# as published by the Free Software Foundation; either version 2 13# of the License, or (at your option) any later version. 14# 15# This program is distributed in the hope that it will be useful, 16# but WITHOUT ANY WARRANTY; without even the implied warranty of 17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18# GNU General Public License for more details. 19# 20# You should have received a copy of the GNU General Public License 21# along with this program; if not, write to the Free Software 22# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 23# USA. 24 25# Purpose of smbldap-groupdel : group (posix) deletion 26 27use strict; 28use FindBin; 29use FindBin qw($RealBin); 30use lib "$RealBin/"; 31use Samba::LDAP::Group; 32 33##################### 34use Getopt::Std; 35my %Options; 36 37my $ok = getopts('?', \%Options); 38if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) ) { 39 print "(c) Jerome Tournier - IDEALX 2004 (http://www.idealx.com)- Licensed under the GPL\n(c) Gavin Henry - Suretec Systems Ltd 2006 (http://www.suretecsystems.com)\n"; 40 print "Usage: $0 groupname\n"; 41 print " -? show this help message\n"; 42 exit (1); 43} 44 45my $_groupName = $ARGV[0]; 46 47my $group = Samba::LDAP::Group->new(); 48print $group->delete_group( $_groupName ); 49 50my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1"; 51 52if ($nscd_status == 0) { 53 system "/etc/init.d/nscd restart > /dev/null 2>&1"; 54} 55 56exit (0); 57 58############################################################ 59 60=head1 NAME 61 62 smbldap-groupdel - Delete a group 63 64=head1 SYNOPSIS 65 66 smbldap-groupdel group 67 68=head1 DESCRIPTION 69 70 The smbldap-groupdel command modifies the system account files, 71 deleting all entries that refer to a group. 72 The named group must exist. 73 74 You must manually check all filesystems to insure that no files remain 75 with the named group as the file group ID. 76 77=head1 SEE ALSO 78 79 groupdel(1) 80 81=cut 82 83#' 84