* Wed May 15 2024 Jean-Philippe Pialasse <jpp@koozali.org> 11.0.0-10.sme
- fix user@0.service failed to start [SME: 12568] - stop loging in audit crond success - drop cpu and use esmith:util::ldap [SME: 12663]
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# copyright (C) 1999-2005 Mitel Networks Corporation
|
||||
# copyright (C) 2024 Koozali Foundation inc.
|
||||
#
|
||||
# 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
|
||||
@@ -26,6 +27,8 @@ package esmith;
|
||||
use strict;
|
||||
use Errno;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::util;
|
||||
use esmith::util::ldap;
|
||||
|
||||
my $conf = esmith::ConfigDB->open_ro
|
||||
or die "Could not open Config DB";
|
||||
@@ -33,6 +36,9 @@ my $conf = esmith::ConfigDB->open_ro
|
||||
my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';
|
||||
my $x = 0; # exit value
|
||||
|
||||
# prepare LDAP bind
|
||||
my $ldap=esmith::util::ldap->new();
|
||||
|
||||
my $event = $ARGV [0];
|
||||
my $groupName = $ARGV [1] or die "Groupname argument missing.";
|
||||
|
||||
@@ -45,10 +51,12 @@ if ($ldapauth ne 'enabled')
|
||||
or ( $x = 255, warn "Failed to delete (unix) group $groupName.\n" );
|
||||
}
|
||||
|
||||
system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "userdel", "$groupName") == 0
|
||||
or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete dummy user for (ldap) group $groupName.\n" );
|
||||
# delete dedicated user group
|
||||
my $result = $ldap->ldapdeluser($groupName);
|
||||
$result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete dummy user for (ldap) group $groupName.\n" );
|
||||
|
||||
system("/usr/sbin/cpu", "groupdel", "$groupName") == 0
|
||||
or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete (ldap) group $groupName.\n" );
|
||||
# delete group
|
||||
$result = $ldap->ldapdelgroup($groupName);
|
||||
$result && ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to delete (ldap) group $groupName.\n" );
|
||||
|
||||
exit ($x);
|
||||
|
Reference in New Issue
Block a user