diff --git a/root/sbin/e-smith/generate_netlogon b/root/sbin/e-smith/generate_netlogon index 9669553..c86d6de 100755 --- a/root/sbin/e-smith/generate_netlogon +++ b/root/sbin/e-smith/generate_netlogon @@ -17,7 +17,7 @@ die "Time argument missing.\n" unless defined ($time); package esmith; use strict; - +use esmith::AccountsDB; use esmith::util; BEGIN @@ -33,9 +33,8 @@ BEGIN esmith::util::setRealToEffective (); -my %accounts; -tie %accounts, 'esmith::config', '/home/e-smith/db/accounts'; - +my $a = esmith::AccountsDB->open_ro() || + die "Couldn't open AccountsDB\n"; # ------------------------------------------------ # Open and read in the template netlogon.bat file. @@ -84,7 +83,7 @@ foreach $line ( @infile ) { if ( !$activelevels[ $level ] ) { - $activelevels[ $level ] = isInGroup($curUser, $group); + $activelevels[ $level ] = $a->is_user_in_group($curUser, $group); } } @@ -207,33 +206,3 @@ chmod ( 0744, "$netlogonFile" ); exit (0); -# -------------------------------------------------- -# Subroutine to check if a given user is in a group: -# -------------------------------------------------- - -sub isInGroup($$) -{ - my ($user, $group) = @_; - - my $value = $accounts{$group}; - - if ( defined ($value) ) - { - my ($type, %properties) = split (/\|/, $value); - if ($type eq 'group') - { - my @members = split (/,/, $properties {'Members'}); - my $member; - # TODO: grep (/^$user$/, @members) - foreach $member ( @members ) - { - if ( $member eq $user ) - { - return 1; - } - } - } - } - return 0; -} -