Project

General

Profile

spawn-fcgi.c.diff

fix for src/spawn-fcgi.c -- iku - Anonymous, 2007-09-24 20:54

View differences:

src/spawn-fcgi.c Mon Sep 24 23:44:06 2007
404 404
			}
405 405
		}
406 406

  
407
		/*
408
		 * Change group before chroot, when we have access
409
		 * to /etc/group
410
		 */
411
		if (groupname) {
412
			setgid(grp->gr_gid);
413
			setgroups(0, NULL);
414
			if (username) {
415
				initgroups(username, grp->gr_gid);
416
			}
417
		}
418

  
407 419
		if (changeroot) {
408 420
			if (-1 == chroot(changeroot)) {
409 421
				fprintf(stderr, "%s.%d: %s %s\n",
......
420 432
		}
421 433

  
422 434
		/* drop root privs */
423
		if (groupname) {
424
			setgid(grp->gr_gid);
425
		}
426 435
		if (username) {
427
			if (groupname) {
428
				initgroups(username, grp->gr_gid);
429
			}
430 436
			setuid(pwd->pw_uid);
431 437
		}
432 438
	}