summaryrefslogtreecommitdiff
path: root/lib/nss_wrapper
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-05-20 02:10:12 +0200
committerGünther Deschner <gd@samba.org>2009-05-20 12:37:37 +0200
commit3bd360c73de77559593e11301d247fd53c4ce128 (patch)
tree29f9371bf0c0cc9380e8c2d6ab6afe2602263337 /lib/nss_wrapper
parentb3cc01fd68e30ebd616897982e0d8befd2a2a7e0 (diff)
downloadsamba-3bd360c73de77559593e11301d247fd53c4ce128.tar.gz
samba-3bd360c73de77559593e11301d247fd53c4ce128.tar.bz2
samba-3bd360c73de77559593e11301d247fd53c4ce128.zip
nsswrapper: implement group_del() in nss_wrapper.pl.
Guenther
Diffstat (limited to 'lib/nss_wrapper')
-rw-r--r--lib/nss_wrapper/nss_wrapper.pl23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/nss_wrapper/nss_wrapper.pl b/lib/nss_wrapper/nss_wrapper.pl
index 88fdc7bca6..cfd3206c2a 100644
--- a/lib/nss_wrapper/nss_wrapper.pl
+++ b/lib/nss_wrapper/nss_wrapper.pl
@@ -246,6 +246,20 @@ sub passwd_remove_entry($$)
delete $passwd->{uid}{${$eref}[2]};
}
+sub group_remove_entry($$)
+{
+ my ($group, $eref) = @_;
+
+ for (my $i = 0; defined($group->{array}[$i]); $i++) {
+ if ($eref == $group->{array}[$i]) {
+ $group->{array}[$i] = undef;
+ }
+ }
+
+ delete $group->{name}{${$eref}[0]};
+ delete $group->{gid}{${$eref}[2]};
+}
+
sub passwd_save($)
{
my ($passwd) = @_;
@@ -360,7 +374,14 @@ sub group_delete($$)
#print "group_delete: '$name' in '$path'\n";
- die("group_delete: not implemented yet!");
+ my $group = group_load($path);
+
+ my $e = group_lookup_name($group, $name);
+ die("group[$name] does not exists in '$path'") unless defined($e);
+
+ group_remove_entry($group, $e);
+
+ group_save($group);
return 0;
}