From owner-freebsd-ports@FreeBSD.ORG Sun Sep 7 01:37:21 2003 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7DA3616A4BF for ; Sun, 7 Sep 2003 01:37:21 -0700 (PDT) Received: from relay2.krasnet.ru (relay2.krasnet.ru [195.112.224.80]) by mx1.FreeBSD.org (Postfix) with ESMTP id 647B243FA3 for ; Sun, 7 Sep 2003 01:37:19 -0700 (PDT) (envelope-from cyrill@econ.krasnoyarsk.su) Received: from post.krasnet.ru (post.krasnet.ru [195.112.224.81]) by relay2.krasnet.ru (8.12.6p2/8.12.6) with ESMTP id h878XjNP085827 for ; Sun, 7 Sep 2003 16:33:46 +0800 (KRAST) (envelope-from cyrill@econ.krasnoyarsk.su) Received: (from uucp@localhost) by post.krasnet.ru (8.12.6p2/8.12.6) with UUCP id h878Xj8X051688 for ports@FreeBSD.org; Sun, 7 Sep 2003 16:33:45 +0800 (KRAST) (envelope-from cyrill@econ.krasnoyarsk.su) Received: from ecnts2.intranet.econ.krasnoyarsk.su by ecfbsd2.intranet (8.9.1/8.9.1) with ESMTP id QAA22035; Sun, 7 Sep 2003 16:32:14 +0800 (KRSS) Date: Sun, 7 Sep 2003 16:32:13 +0800 Message-ID: <199F4C47F5056A47938D39C21423B92C1F3C05@ecnts2.intranet.econ.krasnoyarsk.su> MIME-Version: 1.0 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: FreeBSD Port: op-1.11 content-class: urn:content-classes:message Thread-Index: AcN1GomGJA53mx0oRBSNRjA54XV9CQ== X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 From: =?koi8-r?B?5sXO2MXXIOvJ0snMzCDhzMXL08HOxNLP18ne?= To: Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.1 cc: ports@FreeBSD.org Subject: FreeBSD Port: op-1.11 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Sep 2003 08:37:21 -0000 Patch for 'gid' option (doesn't work at all) --- main.c.original Thu Jan 1 08:03:17 1970 +++ main.c Sun Sep 7 15:14:30 2003 @@ -448,29 +448,17 @@ char *cp, *np; struct passwd *pw; struct group *gr; - int ngroups, gidset[256]; + int ngroups =3D 0, gidset[256]; int curenv =3D 0, curarg =3D 0; char *new_envp[MAXENV]; char *new_argv[MAXARG]; char str[MAXSTRLEN], buf[4*MAXSTRLEN]; =20 - if ((cp =3D FindOpt(cmd, "uid")) =3D=3D NULL) { - if (setuid(0) < 0) - fatal("Unable to set uid to default", cp); - } else { - if ((pw =3D getpwnam(cp)) =3D=3D NULL) { - if (setuid(atoi(cp)) < 0) - fatal("Unable to set uid to %s", cp); - } - if (setuid(pw->pw_uid) < 0) - fatal("Unable to set uid to %s", cp); - } - if ((cp =3D FindOpt(cmd, "gid")) =3D=3D NULL) { ; /* don't have a default */ } else { for (cp=3DGetField(cp, str); cp!=3DNULL; cp=3DGetField(cp, str)) { - if ((gr =3D getgrnam(cp)) !=3D NULL) + if ((gr =3D getgrnam(str)) !=3D NULL) gidset[ngroups++] =3D gr->gr_gid; } if (ngroups =3D=3D 0)=20 @@ -533,6 +521,18 @@ new_envp[curenv++] =3D environ[i]; } new_envp[curenv] =3D NULL; + + if ((cp =3D FindOpt(cmd, "uid")) =3D=3D NULL) { + if (setuid(0) < 0) + fatal("Unable to set uid to default", cp); + } else { + if ((pw =3D getpwnam(cp)) =3D=3D NULL) { + if (setuid(atoi(cp)) < 0) + fatal("Unable to set uid to %s", cp); + } + if (setuid(pw->pw_uid) < 0) + fatal("Unable to set uid to %s", cp); + } =20 if (strcmp("MAGIC_SHELL", cmd->args[0]) =3D=3D 0) { for (i =3D 0; environ[i] !=3D NULL; i++)=20