From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 66A9313829C for ; Tue, 14 Jun 2016 02:00:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 03AFCE0933; Tue, 14 Jun 2016 02:00:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 95393E0933 for ; Tue, 14 Jun 2016 02:00:47 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C816D33E5E4 for ; Tue, 14 Jun 2016 02:00:41 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 75BAA97B for ; Tue, 14 Jun 2016 02:00:38 +0000 (UTC) From: "Benda XU" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Benda XU" Message-ID: <1465869593.476e3eade829ef401bcc2eaf8ae7d0262f3d121f.heroxbd@gentoo> Subject: [gentoo-commits] proj/android:master commit in: eclass/ X-VCS-Repository: proj/android X-VCS-Files: eclass/user.eclass X-VCS-Directories: eclass/ X-VCS-Committer: heroxbd X-VCS-Committer-Name: Benda XU X-VCS-Revision: 476e3eade829ef401bcc2eaf8ae7d0262f3d121f X-VCS-Branch: master Date: Tue, 14 Jun 2016 02:00:38 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e4119aa2-6ce1-4ece-b281-ee9ce705360e X-Archives-Hash: 9e58b377b8a8bcaa6dd599975243fb3e commit: 476e3eade829ef401bcc2eaf8ae7d0262f3d121f Author: Benda Xu gentoo org> AuthorDate: Tue Jun 14 01:59:53 2016 +0000 Commit: Benda XU gentoo org> CommitDate: Tue Jun 14 01:59:53 2016 +0000 URL: https://gitweb.gentoo.org/proj/android.git/commit/?id=476e3ead user.eclass: gracefully return early on for enewgroup and enewuser. eclass/user.eclass | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/eclass/user.eclass b/eclass/user.eclass index 860aba0..9fddbbb 100644 --- a/eclass/user.eclass +++ b/eclass/user.eclass @@ -107,6 +107,10 @@ egetent() { # Default uid is (pass -1 for this) next available, default shell is # /bin/false, default homedir is /dev/null, and there are no default groups. enewuser() { + if [[ ${EUID} != 0 ]] ; then + einfo "Donot have enough privilege to execute ${FUNCNAME[0]}" + return 0 + fi _assert_pkg_ebuild_phase ${FUNCNAME} # get the username @@ -247,7 +251,7 @@ enewuser() { ;; *) - useradd -r "${opts[@]}" "${euser}" || use prefix || die + useradd -r "${opts[@]}" "${euser}" || die ;; esac @@ -267,6 +271,10 @@ enewuser() { # do the rest. You may specify the gid for the group or allow the group to # allocate the next available one. enewgroup() { + if [[ ${EUID} != 0 ]] ; then + einfo "Donot have enough privilege to execute ${FUNCNAME[0]}" + return 0 + fi _assert_pkg_ebuild_phase ${FUNCNAME} # get the group @@ -340,7 +348,7 @@ enewgroup() { opts="-g ${egid}" fi # We specify -r so that we get a GID in the system range from login.defs - groupadd -r ${opts} "${egroup}" || use prefix || die + groupadd -r ${opts} "${egroup}" || die ;; esac } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3F49513832F for ; Thu, 21 Jul 2016 02:23:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 93BC521C2B7; Thu, 21 Jul 2016 02:23:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BA98021C2B0 for ; Thu, 21 Jul 2016 02:23:16 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7ADA4340DEB for ; Thu, 21 Jul 2016 02:23:13 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 75BAEE6B for ; Thu, 21 Jul 2016 02:23:09 +0000 (UTC) From: "Benda XU" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Benda XU" Message-ID: <1465869593.476e3eade829ef401bcc2eaf8ae7d0262f3d121f.heroxbd@gentoo> Subject: [gentoo-commits] dev/heroxbd:master commit in: eclass/ X-VCS-Repository: dev/heroxbd X-VCS-Files: eclass/user.eclass X-VCS-Directories: eclass/ X-VCS-Committer: heroxbd X-VCS-Committer-Name: Benda XU X-VCS-Revision: 476e3eade829ef401bcc2eaf8ae7d0262f3d121f X-VCS-Branch: master Date: Thu, 21 Jul 2016 02:23:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 342fcf35-90d6-431a-afee-7ef906ce7bd4 X-Archives-Hash: eda50339e4a9bde9e74476669f4fcd48 Message-ID: <20160721022309.yngaf1jwkD7qW0K_m4bXMidPeLdiWUa69U4lg_ucZws@z> commit: 476e3eade829ef401bcc2eaf8ae7d0262f3d121f Author: Benda Xu gentoo org> AuthorDate: Tue Jun 14 01:59:53 2016 +0000 Commit: Benda XU gentoo org> CommitDate: Tue Jun 14 01:59:53 2016 +0000 URL: https://gitweb.gentoo.org/dev/heroxbd.git/commit/?id=476e3ead user.eclass: gracefully return early on for enewgroup and enewuser. eclass/user.eclass | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/eclass/user.eclass b/eclass/user.eclass index 860aba0..9fddbbb 100644 --- a/eclass/user.eclass +++ b/eclass/user.eclass @@ -107,6 +107,10 @@ egetent() { # Default uid is (pass -1 for this) next available, default shell is # /bin/false, default homedir is /dev/null, and there are no default groups. enewuser() { + if [[ ${EUID} != 0 ]] ; then + einfo "Donot have enough privilege to execute ${FUNCNAME[0]}" + return 0 + fi _assert_pkg_ebuild_phase ${FUNCNAME} # get the username @@ -247,7 +251,7 @@ enewuser() { ;; *) - useradd -r "${opts[@]}" "${euser}" || use prefix || die + useradd -r "${opts[@]}" "${euser}" || die ;; esac @@ -267,6 +271,10 @@ enewuser() { # do the rest. You may specify the gid for the group or allow the group to # allocate the next available one. enewgroup() { + if [[ ${EUID} != 0 ]] ; then + einfo "Donot have enough privilege to execute ${FUNCNAME[0]}" + return 0 + fi _assert_pkg_ebuild_phase ${FUNCNAME} # get the group @@ -340,7 +348,7 @@ enewgroup() { opts="-g ${egid}" fi # We specify -r so that we get a GID in the system range from login.defs - groupadd -r ${opts} "${egroup}" || use prefix || die + groupadd -r ${opts} "${egroup}" || die ;; esac }