1 |
diff -up e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update.add_ibay_machine e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update |
2 |
--- e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update.add_ibay_machine 2010-09-25 12:26:55.000000000 -0600 |
3 |
+++ e-smith-ldap-5.2.0/root/etc/e-smith/events/actions/ldap-update 2010-09-25 12:25:26.000000000 -0600 |
4 |
@@ -66,7 +66,7 @@ my $account; |
5 |
my $event = shift || die "Event name must be specified"; |
6 |
if ($event eq 'ldap-update') |
7 |
{ |
8 |
- @accounts = ($a->users, $a->groups); |
9 |
+ @accounts = ($a->users, $a->groups, $a->ibays, $a->get_all_by_prop(type => 'machine')); |
10 |
push(@accounts, $a->get('admin')); |
11 |
} |
12 |
else |
13 |
@@ -78,10 +78,8 @@ else |
14 |
die "Account $userName not found.\n" unless defined $account; |
15 |
my $type = $account->prop('type') || "unknown"; |
16 |
|
17 |
- exit (0) if ($type eq 'ibay'); |
18 |
- |
19 |
- die "Account $userName is not a user or group account; update LDAP entry failed.\n" |
20 |
- unless (($type eq 'user') || ($type eq 'group') || ($userName eq 'admin')); |
21 |
+ die "Account $userName is not a user, group, ibay, machine account; update LDAP entry failed.\n" |
22 |
+ unless ($type =~ m{^(?:user|group|ibay|machine)$} or $userName eq 'admin'); |
23 |
@accounts = ($account); |
24 |
} |
25 |
|
26 |
@@ -165,13 +163,21 @@ foreach my $acct (@accounts) |
27 |
my $key = $acct->key; |
28 |
my $type = $acct->prop('type'); |
29 |
my $desc = undef; |
30 |
+ my $dn; |
31 |
|
32 |
- if ($type =~ m{^(?:user|group)$} or $key eq 'admin') |
33 |
+ if ($type =~ m{^(?:user|group|ibay|machine)$} or $key eq 'admin') |
34 |
{ |
35 |
#------------------------------------------------------------ |
36 |
# Do the user portion |
37 |
#------------------------------------------------------------ |
38 |
- my $dn = "uid=$key,ou=Users,$base"; |
39 |
+ if ($type eq 'machine') |
40 |
+ { |
41 |
+ $dn = "uid=$key,ou=Computers,$base"; |
42 |
+ } |
43 |
+ else |
44 |
+ { |
45 |
+ $dn = "uid=$key,ou=Users,$base"; |
46 |
+ } |
47 |
$updates->{$dn}->{objectClass} = ['posixAccount', 'shadowAccount']; |
48 |
|
49 |
# Read information from getent passwd |