~ubuntu-branches/ubuntu/gutsy/samba/gutsy-updates

« back to all changes in this revision

Viewing changes to examples/LDAP/smbldap-tools-0.9.2/smbldap-groupdel

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2006-11-28 20:14:37 UTC
  • mfrom: (0.10.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061128201437-a6x4lzlhempazocp
Tags: 3.0.23d-1ubuntu1
* Merge from debian unstable.
* Drop python2.4-samba, replace with python-samba. Added Conflicts/Replaces
  on python2.4-samba
* Drop track-connection-dos.patch, ubuntu-winbind-panic.patch, 
  ubuntu-fix-ldap.patch, ubuntu-setlocale.patch, ubuntu-setlocale-fixes.patch
* Remaining Ubuntu changes:
  - Revert Debian's installation of mount.cifs and umount.cifs as suid
  - Comment out the default [homes] shares and add more verbose comments to
    explain what they do and how they work (closes: launchpad.net/27608)
  - Add a "valid users = %S" stanza to the commented-out [homes] section, to
    show users how to restrict access to \\server\username to only username.
  - Change the (commented-out) "printer admin" example to use "@lpadmin"
    instead of "@ntadmin", since the lpadmin group is used for spool admin.
  - Alter the panic-action script to encourage users to report their
    bugs in Ubuntu packages to Ubuntu, rather than reporting to Debian.
    Modify text to more closely match the Debian script
  - Munge our init script to deal with the fact that our implementation
    (or lack thereof) of log_daemon_msg and log_progress_msg differs
    from Debian's implementation of the same (Ubuntu #19691)
  - Kept ubuntu-auxsrc.patch: some auxilliary sources (undocumented in 
    previous changelogs)
  - Set default workgroup to MSHOME

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
27
use strict;
 
28
use FindBin;
 
29
use FindBin qw($RealBin);
 
30
use lib "$RealBin/";
 
31
use smbldap_tools;
 
32
 
 
33
#####################
 
34
use Getopt::Std;
 
35
my %Options;
 
36
 
 
37
my $ok = getopts('?', \%Options);
 
38
if ( (!$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
 
 
45
my $_groupName = $ARGV[0];
 
46
 
 
47
my $ldap_master=connect_ldap_master();
 
48
 
 
49
my $dn_line;
 
50
if (!defined($dn_line = get_group_dn($_groupName))) {
 
51
  print "$0: group $_groupName doesn't exist\n";
 
52
  exit (6);
 
53
}
 
54
 
 
55
my $dn = get_dn_from_line($dn_line);
 
56
 
 
57
group_del($dn);
 
58
 
 
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
}
 
64
 
 
65
#if (defined($dn_line = get_group_dn($_groupName))) {
 
66
#    print "$0: failed to delete group\n";
 
67
#    exit (7);
 
68
#}
 
69
 
 
70
# take down session
 
71
$ldap_master->unbind;
 
72
 
 
73
 
 
74
exit (0);
 
75
 
 
76
############################################################
 
77
 
 
78
=head1 NAME
 
79
 
 
80
       smbldap-groupdel - Delete a group
 
81
 
 
82
=head1 SYNOPSIS
 
83
 
 
84
       smbldap-groupdel group
 
85
 
 
86
=head1 DESCRIPTION
 
87
 
 
88
       The smbldap-groupdel command modifies the system account files,
 
89
       deleting all entries that refer to a group.
 
90
       The named group must exist.
 
91
 
 
92
       You must manually check all filesystems to insure that no files remain
 
93
       with the named group as the file group ID.
 
94
 
 
95
=head1 SEE ALSO
 
96
 
 
97
       groupdel(1)
 
98
 
 
99
=cut
 
100
 
 
101
#'