From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1S0l2x-0005fx-Ot for garchives@archives.gentoo.org; Fri, 24 Feb 2012 02:38:12 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2023BE05A5; Fri, 24 Feb 2012 02:38:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id E3F56E05A5 for ; Fri, 24 Feb 2012 02:38:03 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 499CC64C94 for ; Fri, 24 Feb 2012 02:38:03 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D7565E53FF for ; Fri, 24 Feb 2012 02:38:01 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1330037272.3272261479c2a3ed860f71523497f5662ada55eb.WilliamH@gentoo> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/start-stop-daemon.c X-VCS-Directories: src/rc/ X-VCS-Committer: WilliamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 3272261479c2a3ed860f71523497f5662ada55eb X-VCS-Branch: master Date: Fri, 24 Feb 2012 02:38:01 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: d5013f00-b6ba-444e-98c4-63256995f762 X-Archives-Hash: 8fc95b8335ed57e972562d429404303d commit: 3272261479c2a3ed860f71523497f5662ada55eb Author: William Hubbs gentoo org> AuthorDate: Thu Feb 23 22:47:52 2012 +0000 Commit: William Hubbs gentoo org> CommitDate: Thu Feb 23 22:47:52 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/openrc.git;a=3D= commit;h=3D32722614 Skip pam if running as root Reported-by: Piotr Karbowski gmail.com> X-Gentoo-Bug: 386623 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=3D386623 --- src/rc/start-stop-daemon.c | 44 ++++++++++++++++++++++----------------= ------ 1 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index a8a7bd3..965b331 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -1178,20 +1178,18 @@ start_stop_daemon(int argc, char **argv) } =20 #ifdef HAVE_PAM - if (changeuser !=3D NULL) + if (changeuser !=3D NULL) { pamr =3D pam_start("start-stop-daemon", changeuser, &conv, &pamh); - else - pamr =3D pam_start("start-stop-daemon", - "nobody", &conv, &pamh); - - if (pamr =3D=3D PAM_SUCCESS) - pamr =3D pam_acct_mgmt(pamh, PAM_SILENT); - if (pamr =3D=3D PAM_SUCCESS) - pamr =3D pam_open_session(pamh, PAM_SILENT); - if (pamr !=3D PAM_SUCCESS) - eerrorx("%s: pam error: %s", - applet, pam_strerror(pamh, pamr)); + + if (pamr =3D=3D PAM_SUCCESS) + pamr =3D pam_acct_mgmt(pamh, PAM_SILENT); + if (pamr =3D=3D PAM_SUCCESS) + pamr =3D pam_open_session(pamh, PAM_SILENT); + if (pamr !=3D PAM_SUCCESS) + eerrorx("%s: pam error: %s", + applet, pam_strerror(pamh, pamr)); + } #endif =20 if (gid && setgid(gid)) @@ -1219,15 +1217,17 @@ start_stop_daemon(int argc, char **argv) rc_stringlist_add(env_list, environ[i++]); =20 #ifdef HAVE_PAM - pamenv =3D (const char *const *)pam_getenvlist(pamh); - if (pamenv) { - while (*pamenv) { - /* Don't add strings unless they set a var */ - if (strchr(*pamenv, '=3D')) - putenv(xstrdup(*pamenv)); - else - unsetenv(*pamenv); - pamenv++; + if (changeuser !=3D NULL) { + pamenv =3D (const char *const *)pam_getenvlist(pamh); + if (pamenv) { + while (*pamenv) { + /* Don't add strings unless they set a var */ + if (strchr(*pamenv, '=3D')) + putenv(xstrdup(*pamenv)); + else + unsetenv(*pamenv); + pamenv++; + } } } #endif @@ -1304,7 +1304,7 @@ start_stop_daemon(int argc, char **argv) setsid(); execvp(exec, argv); #ifdef HAVE_PAM - if (pamr =3D=3D PAM_SUCCESS) + if (changeuser !=3D NULL && pamr =3D=3D PAM_SUCCESS) pam_close_session(pamh, PAM_SILENT); #endif eerrorx("%s: failed to exec `%s': %s",