@@ -120,7 +120,7 @@ public function getNextUIDNumber($UnitySQL)
120
120
$ max_uid = $ UnitySQL ->getSiteVar ('MAX_UID ' );
121
121
$ new_uid = $ max_uid + 1 ;
122
122
123
- while ($ this ->UIDNumInUse ($ new_uid )) {
123
+ while ($ this ->UIDNumInUse ($ new_uid ) || $ this -> GIDNumInUse ( $ new_uid ) ) {
124
124
$ new_uid ++;
125
125
}
126
126
@@ -134,7 +134,7 @@ public function getNextPiGIDNumber($UnitySQL)
134
134
$ max_pigid = $ UnitySQL ->getSiteVar ('MAX_PIGID ' );
135
135
$ new_pigid = $ max_pigid + 1 ;
136
136
137
- while ($ this ->PIGIDNumInUse ($ new_pigid )) {
137
+ while ($ this ->GIDNumInUse ($ new_pigid )) {
138
138
$ new_pigid ++;
139
139
}
140
140
@@ -169,27 +169,28 @@ private function UIDNumInUse($id)
169
169
return false ;
170
170
}
171
171
172
- private function PIGIDNumInUse ($ id )
172
+ // FIXME libpam-ldap on unity nodes does not check specific OUs, they check the whole tree
173
+ // one should conform to the other
174
+ private function GIDNumInUse ($ id )
173
175
{
176
+ $ groups = $ this ->groupOU ->getChildrenArray (true );
177
+ foreach ($ groups as $ group ) {
178
+ if ($ group ["gidnumber " ][0 ] == $ id ) {
179
+ return true ;
180
+ }
181
+ }
174
182
$ pi_groups = $ this ->pi_groupOU ->getChildrenArray (true );
175
183
foreach ($ pi_groups as $ pi_group ) {
176
184
if ($ pi_group ["gidnumber " ][0 ] == $ id ) {
177
185
return true ;
178
186
}
179
187
}
180
-
181
- return false ;
182
- }
183
-
184
- private function GIDNumInUse ($ id )
185
- {
186
- $ groups = $ this ->groupOU ->getChildrenArray (true );
187
- foreach ($ groups as $ group ) {
188
- if ($ group ["gidnumber " ][0 ] == $ id ) {
188
+ $ org_groups = $ this ->org_groupOU ->getChildrenArray (true );
189
+ foreach ($ org_groups as $ org_group ) {
190
+ if ($ org_group ["gidnumber " ][0 ] == $ id ) {
189
191
return true ;
190
192
}
191
193
}
192
-
193
194
return false ;
194
195
}
195
196
0 commit comments