You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ConfigServer/Messenger.pm
+40-11Lines changed: 40 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -331,33 +331,41 @@ sub messenger {
331
331
logfile("lfd $oldtype messenger using $vmsize kB of VIRT memory at startup, adding up to $config{MESSENGER_CHILDREN} children = ".(($config{MESSENGER_CHILDREN} + 1) * $vmsize)." kB");
332
332
}
333
333
334
-
if ($userne"") {
334
+
if ($userne"")
335
+
{
335
336
my (undef,undef,$uid,$gid,undef,undef,undef,$homedir) = getpwnam($user);
336
337
if (($uid > 0) and ($gid > 0)) {
337
338
local$( = $gid;
338
339
local$) = "$gid$gid";
339
340
local$> = local$< = $uid;
340
-
if (($) != $gid) or ($> != $uid) or ($( != $gid) or ($< != $uid)) {
341
+
if (($) != $gid) or ($> != $uid) or ($( != $gid) or ($< != $uid))
342
+
{
341
343
logfile("MESSENGER_USER unable to drop privileges - stopping $oldtype Messenger");
342
344
exit;
343
345
}
346
+
344
347
my%children;
345
-
while (1) {
346
-
while (my$client = $server->accept()) {
347
-
while (scalar (keys%children) >= $chldallow) {
348
+
while (1)
349
+
{
350
+
while (my$client = $server->accept())
351
+
{
352
+
while (scalar (keys%children) >= $chldallow)
353
+
{
348
354
sleep 1;
349
355
foreachmy$pid (keys%children) {
350
356
unless (kill(0,$pid)) {delete$children{$pid}}
351
357
}
352
358
$0 = "lfd $oldtype messenger (busy)";
353
359
}
360
+
354
361
$0 = "lfd $oldtype messenger";
355
-
356
362
$SIG{CHLD} = 'IGNORE';
357
363
my$pid = fork;
358
364
$children{$pid} = 1;
359
-
if ($pid == 0) {
360
-
eval {
365
+
if ($pid == 0)
366
+
{
367
+
eval
368
+
{
361
369
local$SIG{__DIE__} = undef;
362
370
local$SIG{'ALRM'} = sub {die};
363
371
alarm(10);
@@ -374,14 +382,35 @@ sub messenger {
374
382
$peeraddress =~ s/^::ffff://;
375
383
$hostaddress =~ s/^::ffff://;
376
384
377
-
if ($typeeq"HTML") {
378
-
while ($firstline !~ /\n$/) {
385
+
if ($typeeq"HTML")
386
+
{
387
+
while ($firstline !~ /\n$/)
388
+
{
379
389
my$char;
380
390
$client->read($char,1);
381
391
$firstline .= $char;
382
392
if ($chareq"") {exit}
383
-
if (length$firstline > 2048) {last}
393
+
394
+
# #
395
+
# RFC 7230, Sec 3.1.1: recommends supporting at least 8000 octets.
396
+
# Prefix: GET /unblk?g-recaptcha-response= = 32 bytes
0 commit comments