/[smeserver]/rpms/e-smith-base/sme8/e-smith-base-5.2.0-add-extra-ldap.patch
ViewVC logotype

Annotation of /rpms/e-smith-base/sme8/e-smith-base-5.2.0-add-extra-ldap.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Thu Nov 4 20:02:03 2010 UTC (14 years ago) by slords
Branch: MAIN
CVS Tags: e-smith-base-5_2_0-45_el5_sme
* Thu Nov 4 2010 Shad L. Lords <slords@lordsfam.net 5.2.0-45.sme
- Add extra attributes to ldap objects with cpu call [SME: 6334]

1 slords 1.1 diff -up e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-create-unix.add-extra-ldap e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-create-unix
2     --- e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-create-unix.add-extra-ldap 2010-11-04 10:57:22.000000000 -0600
3     +++ e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-create-unix 2010-11-04 11:06:42.000000000 -0600
4     @@ -27,6 +27,7 @@ use strict;
5     use Errno;
6     use esmith::ConfigDB;
7     use esmith::AccountsDB;
8     +use File::Temp;
9    
10     my $conf = esmith::ConfigDB->open_ro
11     or die "Could not open Config DB";
12     @@ -36,6 +37,10 @@ my $accounts = esmith::AccountsDB->open
13     my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';
14     my $x = 0; # exit value
15    
16     +my $domain = $conf->get('DomainName')
17     + || die("Couldn't determine domain name");
18     +$domain = $domain->value;
19     +
20     my $event = $ARGV [0];
21     my $groupName = $ARGV [1];
22    
23     @@ -93,11 +98,16 @@ if ($ldapauth ne 'enabled')
24     }
25    
26     # Create the user's unique group first (in ldap)
27     +my $tmpattr = File::Temp->new();
28     +print $tmpattr "mail: $groupName\@$domain\n";
29     +print $tmpattr "description: $description\n";
30     system(
31     "/usr/sbin/cpu", "groupadd",
32     + "-a", "$tmpattr",
33     "-g", $gid,
34     $groupName
35     ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $groupName.\n" );
36     +undef $tmpattr;
37    
38     # Now create the dummy user account (in ldap)
39     system(
40     diff -up e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-modify-unix.add-extra-ldap e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-modify-unix
41     --- e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-modify-unix.add-extra-ldap 2010-11-04 10:57:22.000000000 -0600
42     +++ e-smith-base-5.2.0/root/etc/e-smith/events/actions/group-modify-unix 2010-11-04 11:06:52.000000000 -0600
43     @@ -27,6 +27,7 @@ use strict;
44     use Errno;
45     use esmith::ConfigDB;
46     use esmith::AccountsDB;
47     +use File::Temp;
48    
49     my $c = esmith::ConfigDB->open_ro || die "Couldn't open config db\n";
50     my $a = esmith::AccountsDB->open_ro || die "Couldn't open accounts db\n";
51     @@ -34,6 +35,10 @@ my $a = esmith::AccountsDB->open_ro || d
52     my $ldapauth = $c->get('ldap')->prop('Authentication') || 'disabled';
53     my $x = 0; # exit value
54    
55     +my $domain = $c->get('DomainName')
56     + || die("Couldn't determine domain name");
57     +$domain = $domain->value;
58     +
59     my $event = shift || die "Event name arg missing\n";;
60     my @groups;
61    
62     @@ -76,6 +81,16 @@ foreach my $group (@groups)
63     system("/usr/sbin/cpu", "-C/etc/cpu-system.conf", "usermod", "-c", "$groupDesc", "$groupName") == 0
64     or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify (ldap) group description for $groupName.\n" );
65    
66     + my $tmpattr = File::Temp->new();
67     + print $tmpattr "mail: $groupName\@$domain\n";
68     + print $tmpattr "description: $groupDesc\n";
69     + system(
70     + "/usr/sbin/cpu", "-C/etc/cpu-system.conf", "groupmod",
71     + "-a", "$tmpattr",
72     + "$groupName"
73     + ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify (ldap) group description/email for $groupName.\n" );
74     + undef $tmpattr;
75     +
76     my ($name, $passwd, $gid, $members) = getgrnam ($groupName);
77     my @oldMembers = split (/\s+/, $members);
78     my @newMembers = split (/,/, $properties {'Members'});
79     diff -up e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-create-unix.add-extra-ldap e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-create-unix
80     --- e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-create-unix.add-extra-ldap 2010-11-04 10:57:22.000000000 -0600
81     +++ e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-create-unix 2010-11-04 11:10:41.000000000 -0600
82     @@ -27,6 +27,7 @@ use strict;
83     use Errno;
84     use esmith::ConfigDB;
85     use esmith::AccountsDB;
86     +use File::Temp;
87    
88     my $conf = esmith::ConfigDB->open_ro;
89     my $accounts = esmith::AccountsDB->open;
90     @@ -34,6 +35,10 @@ my $accounts = esmith::AccountsDB->open;
91     my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';
92     my $x = 0; # exit value
93    
94     +my $domain = $conf->get('DomainName')
95     + || die("Couldn't determine domain name");
96     +$domain = $domain->value;
97     +
98     my $event = $ARGV [0];
99     my $userName = $ARGV [1];
100    
101     @@ -62,9 +67,13 @@ unless ($uid = $acct->prop('Uid'))
102     my $gid = $acct->prop('Gid') || $uid;
103     my $first = $acct->prop('FirstName') || '';
104     my $last = $acct->prop('LastName') || '';
105     +my $phone = $acct->prop('Phone') || '';
106     +my $company = $acct->prop('Company') || '';
107     +my $dept = $acct->prop('Department') || '';
108     +my $city = $acct->prop('City') || '';
109     +my $street = $acct->prop('Street') || '';
110     my $shell = $acct->prop('Shell') || '/usr/bin/rssh';
111    
112     -
113     if ($ldapauth ne 'enabled')
114     {
115     # Create the user's unique group first
116     @@ -99,6 +108,12 @@ system(
117     ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) group $userName.\n" );
118    
119     # Now create the user account (in ldap)
120     +my $tmpattr = File::Temp->new();
121     +print $tmpattr "telephoneNumber: $phone\n";
122     +print $tmpattr "o: $company\n";
123     +print $tmpattr "ou: $dept\n";
124     +print $tmpattr "l: $city\n";
125     +print $tmpattr "street: $street\n";
126     system(
127     "/usr/sbin/cpu", "useradd",
128     "-u", $uid,
129     @@ -106,6 +121,8 @@ system(
130     "-c", "$first $last",
131     "-f", "$first",
132     "-E", "$last",
133     + "-e", "$userName\@$domain",
134     + "-a", "$tmpattr",
135     "-d", "/home/e-smith/files/users/$userName",
136     "-G", "shared",
137     "-m",
138     @@ -113,6 +130,7 @@ system(
139     "-s", "$shell",
140     $userName
141     ) == 0 or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to create (ldap) account $userName.\n" );
142     +undef $tmpattr;
143    
144    
145     # Release lock if we have one
146     diff -up e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-modify-unix.add-extra-ldap e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-modify-unix
147     --- e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-modify-unix.add-extra-ldap 2010-11-04 10:57:22.000000000 -0600
148     +++ e-smith-base-5.2.0/root/etc/e-smith/events/actions/user-modify-unix 2010-11-04 11:12:28.000000000 -0600
149     @@ -22,12 +22,17 @@ use strict;
150     use Errno;
151     use esmith::AccountsDB;
152     use esmith::ConfigDB;
153     +use File::Temp;
154    
155     my $conf = esmith::ConfigDB->open or die "Could not open configuration db";
156    
157     my $ldapauth = $conf->get('ldap')->prop('Authentication') || 'disabled';
158     my $x = 0; # exit value
159    
160     +my $domain = $conf->get('DomainName')
161     + || die("Couldn't determine domain name");
162     +$domain = $domain->value;
163     +
164     my $event = $ARGV [0];
165     my $userName = $ARGV [1];
166    
167     @@ -115,9 +120,25 @@ foreach my $u (@users)
168     or ( $x = 255, warn "Failed to modify comment of (unix) account $userName.\n" );
169     }
170    
171     - system("/usr/sbin/cpu", "usermod", "-c", "$first $last", "-G", "$groups", $userName) == 0
172     - or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify comment of (ldap) account $userName.\n" );
173     + system("/usr/sbin/cpu", "usermod", "-c", "$first $last", "-f", "$first", "-E", "$last", "-G", "$groups", $userName) == 0
174     + or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify comment/name of (ldap) account $userName.\n" );
175     }
176     +
177     + my $new_phone = $u->prop('Phone') || '';
178     + my $new_company = $u->prop('Company') || '';
179     + my $new_dept = $u->prop('Department') || '';
180     + my $new_city = $u->prop('City') || '';
181     + my $new_street = $u->prop('Street') || '';
182     +
183     + my $tmpattr = File::Temp->new();
184     + print $tmpattr "telephoneNumber: $new_phone\n" if $new_phone;
185     + print $tmpattr "o: $new_company\n" if $new_company;
186     + print $tmpattr "ou: $new_dept\n" if $new_dept;
187     + print $tmpattr "l: $new_city\n" if $new_city;
188     + print $tmpattr "street: $new_street\n" $new_street;
189     + system("/usr/sbin/cpu", "usermod", "-a", "$tmpattr", "-e", "$userName\@$domain", "-G", "$groups", $userName) == 0
190     + or ( $x = $ldapauth ne 'enabled' ? $x : 255, warn "Failed to modify email of (ldap) account $userName.\n" );
191     + undef $tmpattr;
192     }
193    
194     exit ($x);

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed