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