[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

perl grab /etc/group info memory error


I'm getting an "out of memory" error when trying to grab the gid information for a user from /etc/group. The problem only occurs when there is a group of about 1000 users in it. Less than about 500 users as members of the group, will not produce the error. The original error was noticed in the old openwebmail package. I realize its not officially in the archives, but I'm still curious as to why perl bombs out. Here's the full command I run to show the error: (this should be similar to what openwebmail does when a user is logging in)

# perl -e '{while (@gr = getgrent()) { ($name,$passwd,$gid,$members) = @gr; \ print "name: $name, passwd: $passwd, gid: $gid, members: $members\n"; }}'

The output appears like this:

name: user996, passwd: x, gid: 2007, members:
name: user997, passwd: x, gid: 2008, members:
name: user998, passwd: x, gid: 2009, members:
name: user999, passwd: x, gid: 2010, members:
name: user1000, passwd: x, gid: 2011, members:
name: internet, passwd: x, gid: 1010, members: user1 user2 user3 user4 user5 user6 user7 user8 user9 user10 user11 user12 user13 user14 user15 user16 user17 user18 user19 user20 user21 user22 user23 user24 user25 user26 user27 user28 user29 user30 user31 user32 user33 user34 user35 user36 user37 user38 user39 user40 user41 user42 user43 user44 user45 user46 user47 user48 user49 user50 user51 user52 user53 user54 user55 user56 user57 user58 user59 user60 user61 user62 user63 user64 user65 user66 user67 user68 user69 user70 user71 user72 user73 user74 user75 user76 user77 user78 user79 user80 user81 user82 user83 user84 user85 user86 user87 user88 user89 user90 user91 user92 user93 user94 user95 user96 user97 user98 user99 user100 user101 user102 user103 user104 user105 user106 user107 user108 user109 user110 user111 user112 user113 user114 user115 user116 user117 user118 user119 user120 user121 user122 user123 user124 user125 user126 user127 user128 user129 user130 user131 user132 user133 user134 user135 user136 user137 user138 user139 user140 user141 user142 user143 user144 user145 user146 user147 user148 user149 user150 user151 user152 user153 user154 user155 user156 user157 user158 user159 user160 user161 user162 user163 user164 user165 user166 user167 user168 user169 user170 user171 user172 user173 user174 user175 user176 user177 user178 user179 user180 user181 user182 user183 user184 user185 user186 user187 user188 user189 user190 user191 user192 user193 user194 user195 user196 user197 user198 user199 user200 user201 user202 user203 user204 user205 user206 user207 user208 user209 user210 user211 user212 user213 user214 user215 user216 user217 user218 user219 user220 user221 user222 user223 user224 user225 user226 user227 user228 user229 user230 user231 user232 user233 user234 user235 user236 user237 user238 user239 user240 user241 user242 user243 user244 user245 user246 user247 user248 user249 user250 user251 user252 user253 user254 user255 user256 user257 user258 user259 user260 user261 user262 user263 user264 user265 user266 user267 user268 user269 user270 user271 user272 user273 user274 user275 user276 user277 user278 user279 user280 user281 user282 user283 user284 user285 user286 user287 user288 user289 user290 user291 user292 user293 user294 user295 user296 user297 user298 user299 user300 user301 user302 user303 user304 user305 user306 user307 user308 user309 user310 user311 user312 user313 user314 user315 user316 user317 user318 user319 user320 user321 user322 user323 user324 user325 user326 user327 user328 user329 user330 user331 user332 user333 user334 user335 user336 user337 user338 user339 user340 user341 user342 user343 user344 user345 user346 user347 user348 user349 user350 user351 user352 user353 user354 user355 user356 user357 user358 user359 user360 user361 user362 user363 user364 user365 user366 user367 user368 user369 user370 user371 user372 user373 user374 user375 user376 user377 user378 user379 user380 user381 user382 user383 user384 user385 user386 user387 user388 user389 user390 user391 user392 user393 user394 user395 user396 user397 user398 user399 user400 user401 user402 user403 user404 user405 user406 user407 user408 user409 user410 user411 user412 user413 user414 user415 user416 user417 user418 user419 user420 user421 user422 user423 user424 user425 user426 user427 user428 user429 user430 user431 user432 user433 user434 user435 user436 user437 user438 user439 user440 user441 user442 user443 user444 user445 user446 user447 user448 user449 user450 user451 user452 user453 user454 user455 user456 user457 user458 user459 user460 user461 user462 user463 user464 user465 user466 user467 user468 user469 user470 user471 user472 user473 user474 user475 user476 user477 user478 user479 user480 user481 user482 user483 user484 user485 user486 user487 user488 user489 user490 user491 user492 user493 user494 user495 user496 user497 user498 user499 user500 user501 user502 user503 user504 user505 user506 user507 user508 user509 user510 user511 user512 user513 user514 user515 user516 user517 user518 user519 user520
Out of memory!

As you can see, I have at least 520 users in the group internet, but get an "Out of memory!" error at the bottom. Would this be a bug in perl of somekind? or perhaps there is way to modify the command to not produce the out of memory error?

Here's the code from /usr/lib/cgi-bin/openwebmail/auth/auth_unix.pl that causes the error in openwebmail:

# get other gid for this user in /etc/group
  while (my @gr=getgrent()) {
     $gid.=' '.$gr[2] if ($gr[3]=~/\b$user\b/ && $gid!~/\b$gr[2]\b/);

Thanks for your time!


PS, running a new sarge box, with an old openwebmail 2.41 .deb

--- Sent via IMP

Reply to: