source: npl/fileserver/smb-ldap-tool/modified/smbldap-groupdel @ 85c2873

Last change on this file since 85c2873 was 3187b26, checked in by Edwin Eefting <edwin@datux.nl>, 7 years ago

flush nscd cache when modifying users

  • Property mode set to 100755
File size: 2.5 KB
RevLine 
[c5c522c]1#!/usr/bin/perl -w
2
3# $Id: smbldap-groupdel 2642 2006-09-04 11:12:56Z erwin $
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 smbldap_tools;
32
33#####################
34use Getopt::Std;
35my %Options;
36
37my $ok = getopts('?', \%Options);
38if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) ) {
39  print_banner;
40  print "Usage: $0 groupname\n";
41  print "  -?   show this help message\n";
42  exit (1);
43}
44
45my $_groupName = $ARGV[0];
46
47my $ldap_master=connect_ldap_master();
48
49my $dn_line;
50if (!defined($dn_line = get_group_dn($_groupName))) {
51  print "$0: group $_groupName doesn't exist\n";
52  exit (6);
53}
54
55my $dn = get_dn_from_line($dn_line);
56
57group_del($dn);
58
[3187b26]59# my $nscd_status = system "/etc/init.d/nscd status >/dev/null 2>&1";
60#
61# if ($nscd_status == 0) {
62#   system "/etc/init.d/nscd restart > /dev/null 2>&1";
63# }
64system "nscd -i passwd; nscd -i group";
[c5c522c]65
66#if (defined($dn_line = get_group_dn($_groupName))) {
67#    print "$0: failed to delete group\n";
68#    exit (7);
69#}
70
71# take down session
72$ldap_master->unbind;
73
74
75exit (0);
76
77############################################################
78
79=head1 NAME
80
81       smbldap-groupdel - Delete a group
82
83=head1 SYNOPSIS
84
85       smbldap-groupdel group
86
87=head1 DESCRIPTION
88
89       The smbldap-groupdel command modifies the system account files,
90       deleting all entries that refer to a group.
91       The named group must exist.
92
93       You must manually check all filesystems to insure that no files remain
94       with the named group as the file group ID.
95
96=head1 SEE ALSO
97
98       groupdel(1)
99
100=cut
101
102#'
Note: See TracBrowser for help on using the repository browser.