1 |
diff -ruN e-smith-ldap-5.2.0/createlinks e-smith-ldap-5.2.0.xx/createlinks |
2 |
--- e-smith-ldap-5.2.0/createlinks 2006-03-15 16:17:43.000000000 -0500 |
3 |
+++ e-smith-ldap-5.2.0.xx/createlinks 2009-01-27 19:20:42.000000000 -0500 |
4 |
@@ -13,8 +13,6 @@ |
5 |
)); |
6 |
} |
7 |
|
8 |
-templates2events("/home/e-smith/db/ldap/ldif", "bootstrap-console-save"); |
9 |
- |
10 |
event_link("ldap-update", "group-create", "25"); |
11 |
event_link("ldap-delete", "group-delete", "25"); |
12 |
event_link("ldap-update", "user-create", "25"); |
13 |
diff -ruN e-smith-ldap-5.2.0/root/etc/e-smith/templates/etc/openldap/slapd.conf/50database e-smith-ldap-5.2.0.xx/root/etc/e-smith/templates/etc/openldap/slapd.conf/50database |
14 |
--- e-smith-ldap-5.2.0/root/etc/e-smith/templates/etc/openldap/slapd.conf/50database 2002-03-25 14:17:42.000000000 -0500 |
15 |
+++ e-smith-ldap-5.2.0.xx/root/etc/e-smith/templates/etc/openldap/slapd.conf/50database 2009-01-27 19:20:42.000000000 -0500 |
16 |
@@ -1 +1 @@ |
17 |
-database ldbm |
18 |
+database bdb |
19 |
diff -ruN e-smith-ldap-5.2.0/root/etc/e-smith/templates/var/lib/ldap/DB_CONFIG/10memory e-smith-ldap-5.2.0.xx/root/etc/e-smith/templates/var/lib/ldap/DB_CONFIG/10memory |
20 |
--- e-smith-ldap-5.2.0/root/etc/e-smith/templates/var/lib/ldap/DB_CONFIG/10memory 1969-12-31 19:00:00.000000000 -0500 |
21 |
+++ e-smith-ldap-5.2.0.xx/root/etc/e-smith/templates/var/lib/ldap/DB_CONFIG/10memory 2009-01-27 19:20:42.000000000 -0500 |
22 |
@@ -0,0 +1,4 @@ |
23 |
+# |
24 |
+# Set the database in memory cache size. |
25 |
+# |
26 |
+set_cachesize 0 2097152 0 |
27 |
diff -ruN e-smith-ldap-5.2.0/root/etc/e-smith/templates/var/lib/ldap/DB_CONFIG/30logs e-smith-ldap-5.2.0.xx/root/etc/e-smith/templates/var/lib/ldap/DB_CONFIG/30logs |
28 |
--- e-smith-ldap-5.2.0/root/etc/e-smith/templates/var/lib/ldap/DB_CONFIG/30logs 1969-12-31 19:00:00.000000000 -0500 |
29 |
+++ e-smith-ldap-5.2.0.xx/root/etc/e-smith/templates/var/lib/ldap/DB_CONFIG/30logs 2009-01-27 19:20:42.000000000 -0500 |
30 |
@@ -0,0 +1,8 @@ |
31 |
+# |
32 |
+# Set log values. |
33 |
+# |
34 |
+set_lg_regionmax 1048576 |
35 |
+set_lg_max 10485760 |
36 |
+set_lg_bsize 2097152 |
37 |
+set_lg_dir /var/log/bdb |
38 |
+ |
39 |
diff -ruN e-smith-ldap-5.2.0/root/var/service/ldap/convert_ldif e-smith-ldap-5.2.0.xx/root/var/service/ldap/convert_ldif |
40 |
--- e-smith-ldap-5.2.0/root/var/service/ldap/convert_ldif 1969-12-31 19:00:00.000000000 -0500 |
41 |
+++ e-smith-ldap-5.2.0.xx/root/var/service/ldap/convert_ldif 2009-01-27 19:20:42.000000000 -0500 |
42 |
@@ -0,0 +1,57 @@ |
43 |
+#! /usr/bin/perl |
44 |
+ |
45 |
+use strict; |
46 |
+use warnings; |
47 |
+ |
48 |
+ |
49 |
+use Net::LDAP::LDIF; |
50 |
+use esmith::util; |
51 |
+ |
52 |
+my $old = shift; |
53 |
+my $new = shift; |
54 |
+ |
55 |
+my $ldif = Net::LDAP::LDIF->new( "/dev/stdin", "r", onerror => 'undef' ); |
56 |
+my $writer = Net::LDAP::LDIF->new("/dev/stdout", "w", onerror => 'undef' ); |
57 |
+ |
58 |
+$new = esmith::util::ldapBase($new); |
59 |
+$old = esmith::util::ldapBase($old); |
60 |
+ |
61 |
+while( not $ldif->eof()) |
62 |
+{ |
63 |
+ my $entry = $ldif->read_entry(); |
64 |
+ if ($ldif->error()) |
65 |
+ { |
66 |
+ print "Error msg: ", $ldif->error(), "\n"; |
67 |
+ print "Error lines:\n", $ldif->error_lines(), "\n"; |
68 |
+ next; |
69 |
+ } |
70 |
+ next unless $entry; |
71 |
+ my $dn = $entry->dn; |
72 |
+ my @object_classes = $entry->get_value('objectClass'); |
73 |
+ my %object_classes = map { $_ => 1 } @object_classes; |
74 |
+ if ($dn eq $old) |
75 |
+ { |
76 |
+ # this is the domain container object - objectClasses will be |
77 |
+ # 'top' and 'domain' |
78 |
+ my $dc = $new; |
79 |
+ $dc =~ s/,.*//g; |
80 |
+ $dc =~ s/^dc=//; |
81 |
+ $entry->replace(dc => $dc); |
82 |
+ } |
83 |
+ if ($object_classes{group}) |
84 |
+ { |
85 |
+ # We used to create group entries with invalid objectClass group |
86 |
+ # - fix these if we find them |
87 |
+ # possibly not required any more, but harmless |
88 |
+ @object_classes = grep { $_ ne 'group' } @object_classes; |
89 |
+ $entry->replace(objectClass => [ @object_classes, 'posixGroup' ] ); |
90 |
+ } |
91 |
+ # do any other object transformations |
92 |
+ |
93 |
+ # Update basedb suffix |
94 |
+ $dn =~ s/$old$/$new/; |
95 |
+ $entry->dn($dn); |
96 |
+ $writer->write($entry); |
97 |
+} |
98 |
+$ldif->done( ); |
99 |
+ |
100 |
diff -ruN e-smith-ldap-5.2.0/root/var/service/ldap/run e-smith-ldap-5.2.0.xx/root/var/service/ldap/run |
101 |
--- e-smith-ldap-5.2.0/root/var/service/ldap/run 2008-08-20 17:26:21.000000000 -0400 |
102 |
+++ e-smith-ldap-5.2.0.xx/root/var/service/ldap/run 2009-01-27 19:20:42.000000000 -0500 |
103 |
@@ -1,28 +1,52 @@ |
104 |
#! /bin/sh |
105 |
|
106 |
domain=$(/sbin/e-smith/config get DomainName) |
107 |
+old_domain=$(readlink ldif) |
108 |
+ |
109 |
+if [ -n "$old_domain" ] |
110 |
+then |
111 |
+ old_domain=$(basename $old_domain | sed s/.ldif//) |
112 |
+ old_ldif="/home/e-smith/db/ldap/$old_domain.ldif" |
113 |
+fi |
114 |
+ |
115 |
ldif="/home/e-smith/db/ldap/$domain.ldif" |
116 |
|
117 |
-if [ -e ldif ] |
118 |
+if [ "$old_domain" != "$domain" ] |
119 |
then |
120 |
- old_ldif=$(readlink ldif) |
121 |
- if [ "$old_ldif" != "$ldif" ] |
122 |
- then |
123 |
- # The domain name has changed, so we need to delete |
124 |
- # the old directory contents. We still have the old |
125 |
- # dump. |
126 |
- find /var/lib/ldap -type f | xargs rm -f |
127 |
- fi |
128 |
+ # The domain name has changed, so we need to delete |
129 |
+ # the old directory contents. We still have the old |
130 |
+ # dump. |
131 |
+ find /var/lib/ldap -type f | xargs rm -f |
132 |
+fi |
133 |
+ |
134 |
+if [ -f /var/lib/ldap/nextid.dbb ] |
135 |
+then |
136 |
+ # We are upgrading from an earlier version which used |
137 |
+ # ldbm backend format. Delete the backend files, and |
138 |
+ # restore from ldif |
139 |
+ find /var/lib/ldap -type f | xargs rm -f |
140 |
fi |
141 |
|
142 |
# Set up symlink for ldap dump at shutdown |
143 |
ln -sf $ldif ./ldif |
144 |
|
145 |
+/sbin/e-smith/expand-template /var/lib/ldap/DB_CONFIG |
146 |
+ |
147 |
# Prime directory if required |
148 |
-if [ \! -f /var/lib/ldap/nextid.dbb -a -f $ldif ] |
149 |
+if [ \! -f /var/lib/ldap/id2entry.bdb ] |
150 |
then |
151 |
- sed 's/objectClass: group/objectClass: posixGroup/' < $ldif | \ |
152 |
- setuidgid ldap slapadd -c |
153 |
+ if [ -e "$old_ldif" ] |
154 |
+ then |
155 |
+ perl ./convert_ldif $old_domain $domain < $old_ldif | \ |
156 |
+ setuidgid ldap slapadd -c |
157 |
+ else |
158 |
+ if [ \! -e "$ldif" ] |
159 |
+ then |
160 |
+ /sbin/e-smith/expand-template /home/e-smith/db/ldap/ldif |
161 |
+ ldif="/home/e-smith/db/ldap/ldif" |
162 |
+ fi |
163 |
+ setuidgid ldap slapadd -c < $ldif |
164 |
+ fi |
165 |
fi |
166 |
|
167 |
# Now run daemon |