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

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