@@ -124,7 +124,7 @@ public function getNextUIDNumber($UnitySQL)
124
124
$ max_uid = $ UnitySQL ->getSiteVar ('MAX_UID ' );
125
125
$ new_uid = $ max_uid + 1 ;
126
126
127
- while ($ this ->UIDNumInUse ($ new_uid )) {
127
+ while ($ this ->IDNumInUse ($ new_uid )) {
128
128
$ new_uid ++;
129
129
}
130
130
@@ -138,7 +138,7 @@ public function getNextPiGIDNumber($UnitySQL)
138
138
$ max_pigid = $ UnitySQL ->getSiteVar ('MAX_PIGID ' );
139
139
$ new_pigid = $ max_pigid + 1 ;
140
140
141
- while ($ this ->PIGIDNumInUse ($ new_pigid )) {
141
+ while ($ this ->IDNumInUse ($ new_pigid )) {
142
142
$ new_pigid ++;
143
143
}
144
144
@@ -152,7 +152,7 @@ public function getNextOrgGIDNumber($UnitySQL)
152
152
$ max_gid = $ UnitySQL ->getSiteVar ('MAX_GID ' );
153
153
$ new_gid = $ max_gid + 1 ;
154
154
155
- while ($ this ->GIDNumInUse ($ new_gid )) {
155
+ while ($ this ->IDNumInUse ($ new_gid )) {
156
156
$ new_gid ++;
157
157
}
158
158
@@ -161,32 +161,24 @@ public function getNextOrgGIDNumber($UnitySQL)
161
161
return $ new_gid ;
162
162
}
163
163
164
- private function UIDNumInUse ($ id )
164
+ private function IDNumInUse ($ id )
165
165
{
166
+ // id reserved for debian packages
167
+ if (($ id >= 100 && $ id <= 999 ) || ($ id >= 60000 && $ id <= 64999 )) {
168
+ return true ;
169
+ }
166
170
$ users = $ this ->userOU ->getChildrenArray (true );
167
171
foreach ($ users as $ user ) {
168
172
if ($ user ["uidnumber " ][0 ] == $ id ) {
169
173
return true ;
170
174
}
171
175
}
172
-
173
- return false ;
174
- }
175
-
176
- private function PIGIDNumInUse ($ id )
177
- {
178
176
$ pi_groups = $ this ->pi_groupOU ->getChildrenArray (true );
179
177
foreach ($ pi_groups as $ pi_group ) {
180
178
if ($ pi_group ["gidnumber " ][0 ] == $ id ) {
181
179
return true ;
182
180
}
183
181
}
184
-
185
- return false ;
186
- }
187
-
188
- private function GIDNumInUse ($ id )
189
- {
190
182
$ groups = $ this ->groupOU ->getChildrenArray (true );
191
183
foreach ($ groups as $ group ) {
192
184
if ($ group ["gidnumber " ][0 ] == $ id ) {
@@ -212,7 +204,7 @@ public function getUnassignedID($uid, $UnitySQL)
212
204
213
205
if ($ uid == $ netid_match || $ netid == $ netid_match ) {
214
206
// found a match
215
- if (!$ this ->UIDNumInUse ( $ uid_match ) && ! $ this -> GIDNumInUse ($ uid_match )) {
207
+ if (!$ this ->IDNumInUse ($ uid_match )) {
216
208
return $ uid_match ;
217
209
}
218
210
}
0 commit comments