From patchwork Sat Oct 10 00:13:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Zhou X-Patchwork-Id: 528469 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id A06CE1402B4 for ; Sat, 10 Oct 2015 11:13:58 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 7DDD510AC5; Fri, 9 Oct 2015 17:13:50 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 91A21105CD for ; Fri, 9 Oct 2015 17:13:48 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id 0FBB6D4836 for ; Fri, 9 Oct 2015 18:13:48 -0600 (MDT) X-ASG-Debug-ID: 1444436026-03dc213abe8aaa0001-byXFYA Received: from mx3-pf2.cudamail.com ([192.168.14.1]) by bar4.cudamail.com with ESMTP id y26GP1hyTz2670Ca (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 09 Oct 2015 18:13:46 -0600 (MDT) X-Barracuda-Envelope-From: azhou@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.1 Received: from unknown (HELO mail-pa0-f41.google.com) (209.85.220.41) by mx3-pf2.cudamail.com with ESMTPS (RC4-SHA encrypted); 10 Oct 2015 00:13:46 -0000 Received-SPF: unknown (mx3-pf2.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.41 Received: by padhy16 with SMTP id hy16so99698156pad.1 for ; Fri, 09 Oct 2015 17:13:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aQ9oTOSznjdbUBeyVmV0fCQ0P407cp9MfN5V+8dTDxk=; b=Ek7xzhsGj3GS3DpBxqPscK4f0eMdnkhqPQzwv4BMjAL2pH/Ts9mXui9eAnvkNhEKhb ooTjG72yIXVjM3CPfW7OoOCqPZC7OazXpHOyXmj0wXZn10qG/YjUV81WT1XMMgKsWoFu nrls6wilT6rqC3modNX8ZQ7kUNwDLK3bz94m7SPDljYhfyHvkz8ESxF3xZSYaI/eA0UD dDwl4Idi8CBeuoUtpGXWcqJR0A6gMKyWYhbJ/4/ognbeZEDJDnouUWd/soCS7SMtnyc8 a2sbRfIMLcgYJtEoxPytb4CyOuUtYUgtKSOQUxz/Caq5p8tZCsg4ssaVZwoFVimSNIef Zbig== X-Gm-Message-State: ALoCoQmW3sDysuh6fTmmj3oE/SN8/rRCZY0x3Whc1ewpgUw9CRUvQ3JEuIIdJqcbPAlo7r81vxtL X-Received: by 10.66.158.137 with SMTP id wu9mr18591548pab.62.1444436025731; Fri, 09 Oct 2015 17:13:45 -0700 (PDT) Received: from ubuntu.localdomain ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id be3sm4595005pbc.88.2015.10.09.17.13.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Oct 2015 17:13:45 -0700 (PDT) X-CudaMail-Envelope-Sender: azhou@nicira.com X-Barracuda-Apparent-Source-IP: 208.91.1.34 From: Andy Zhou To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V2-1008071870 X-CudaMail-DTE: 100915 X-CudaMail-Originating-IP: 209.85.220.41 Date: Fri, 9 Oct 2015 17:13:22 -0700 X-ASG-Orig-Subj: [##CM-V2-1008071870##][Debian-non-root v2 2/4] ovs-ctl: Remove hard coded root user and group Message-Id: <1444436004-25557-2-git-send-email-azhou@nicira.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444436004-25557-1-git-send-email-azhou@nicira.com> References: <1444436004-25557-1-git-send-email-azhou@nicira.com> X-Barracuda-Connect: UNKNOWN[192.168.14.1] X-Barracuda-Start-Time: 1444436026 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [Debian-non-root v2 2/4] ovs-ctl: Remove hard coded root user and group X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Replace hard coded root user and group with OVS_USER and OVS_GROUP. Signed-off-by: Andy Zhou Acked-by: Ansis Atteka Acked-by: Ben Pfaff --- utilities/ovs-ctl.in | 3 +++ utilities/ovs-lib.in | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in index 0082bed..c9d75df 100755 --- a/utilities/ovs-ctl.in +++ b/utilities/ovs-ctl.in @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +OVS_USER=root # Default user. +OVS_GROUP=root # Default group. + case $0 in */*) dir0=`echo "$0" | sed 's,/[^/]*$,,'` ;; *) dir0=./ ;; diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in index dd8a1e9..da52284 100644 --- a/utilities/ovs-lib.in +++ b/utilities/ovs-lib.in @@ -140,16 +140,16 @@ start_daemon () { strace="" # drop core files in a sensible place - test -d "$DAEMON_CWD" || install -d -m 755 -o root -g root "$DAEMON_CWD" + test -d "$DAEMON_CWD" || install -d -m 755 -o "$OVS_USER" -g "$OVS_GROUP" "$DAEMON_CWD" set "$@" --no-chdir cd "$DAEMON_CWD" # log file - test -d "$logdir" || install -d -m 755 -o root -g root "$logdir" + test -d "$logdir" || install -d -m 755 -o "$OVS_USER" -g "OVS_GROUP" "$logdir" set "$@" --log-file="$logdir/$daemon.log" # pidfile and monitoring - test -d "$rundir" || install -d -m 755 -o root -g root "$rundir" + test -d "$rundir" || install -d -m 755 -o "$OVS_USER" -g "OVS_GROUP" "$rundir" set "$@" --pidfile="$rundir/$daemon.pid" set "$@" --detach --monitor