From patchwork Wed Sep 18 16:29:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 3843 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:6794:b0:5b9:581e:f939 with SMTP id c20csp860622mao; Wed, 18 Sep 2024 09:46:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXch8FeXf87M3nT42HD3P1U6kdOVpgj33Vf1DRh0SBxtiKhFdqgYzvwypsCN2FClOFnIXqOw91dric=@openvpn.net X-Google-Smtp-Source: AGHT+IE7IkMwDC/KOUM5UIG5swbkw322B5hnieUMdWYP8V9VyNVpoKwKGpwpkxvjXP38QQSzi9T4 X-Received: by 2002:a05:6e02:1c0b:b0:3a0:92b1:ec4c with SMTP id e9e14a558f8ab-3a092b1ededmr135275055ab.23.1726678008340; Wed, 18 Sep 2024 09:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726678008; cv=none; d=google.com; s=arc-20240605; b=DN9jdVEZKOIM4SdQcoQRGyS0TnR516k3O9yB8FYfomBIr23Ws544P7CCeNOKNbARxb gXDJzem+YWAMT+xmxsNBH8Zb58vDbdnltbsbKKlmEKdRygAIPfeS0Qs+lTNOOr9PvZG/ 5w1eSaleJuhMmeHbK7ZOv8jwzIg8kRGekclaXtXEW66aI2Cmrw52LoRoA/d3Rz9i48HW efELHoE0Lh5f9/0qX34bAEpcp2AmyVpQINRKWnZ8bzfzQIJ492+Pnj/2WT7JqRthBA6f 8CPSxBZT1cceW6Pbo0tysqq2t+fYCsoNkrgW/YOT/2WahC97BJpj1nauV+1bInlVj8m4 tDGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature; bh=C4E/27A5GeUg0r1T5HSWqvYbOuET1jZ1sTEM5Loknhw=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=Xqndxnqemdf260D+gUE7LwZhdouqW1XPF3qRwmB54ESjbKk8RGbD+YowQviC3WAY1p T9MuBWVb6Agf/8Vdc2EjHKbNzczySum7SoxWXHw9hclr8EQjWkXg8P7S4VqTZK6M2VE1 yIYamBynY21TqkP1QmDXdTaWbzWW0tefSQIUU+dOB4zOS+9FJou6YqgrsdABHCE2g0zN QCZCVl8wlZ/sMWr/nWZrRBarkDdmTRWLij9YNE6060JBqNOr/TRJQKojSIRE1CSodGsB yuH4vLqTXw7E+SWLBvBqRJVllr9PpOwpscMhxm1ff3auLuCAnOxi33k/CgNHe7LRfX28 bhEA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Suef7Kdd; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=fXf0DBp7; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id e9e14a558f8ab-3a0b51f72c0si15405525ab.131.2024.09.18.09.46.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2024 09:46:48 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=Suef7Kdd; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=fXf0DBp7; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sqxpD-0007k9-9Q; Wed, 18 Sep 2024 16:46:42 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sqxpB-0007k3-Fy for openvpn-devel@lists.sourceforge.net; Wed, 18 Sep 2024 16:46:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=r/KJVMBv+9UyG3MQAHRBBqkaynCDdeo/HQg9h0Qm+/c=; b=Suef7Kdds4jPDGWO1qXQXm3tt7 jjV1orKOH6hoR8ZVOdBJDhwG2ntNyKz9/0/1NkESH2zczpaRWWA06qdIkdtJo7e+r0RCAAtUcokSr oPRpKU4NWdDOeckhxYBMldPUWOiXGF04NQ+GloTpuWw47LEbExSkpfJFM1R3uaTbP9Ro=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=r/KJVMBv+9UyG3MQAHRBBqkaynCDdeo/HQg9h0Qm+/c=; b=f Xf0DBp79taXAanpUNnK6l8LjKD6jHwCFlBvm4ZV6cA01vcUTrILXmyZhd0paue4KqzgOPYSi1nwu7 EmiafCG7xvSTi3zBvJod503NLQymPEP6RBQJT2cvJ7r2Ko21+zdUBo8DmNXmPX1vAFrmVXmyp4o0K ODpllojB9GQwdAzE=; Received: from vmail1.greenie.net ([195.30.8.66]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sqxp8-0006RH-DJ for openvpn-devel@lists.sourceforge.net; Wed, 18 Sep 2024 16:46:40 +0000 Received: from fbsd14bb.ov.greenie.net (fbsd14bb.ov.greenie.net [IPv6:2001:608:0:814:0:0:f000:6]) by vmail1.greenie.net (8.18.1/8.18.1) with ESMTP id 48IGTHfv052603 for ; Wed, 18 Sep 2024 18:29:17 +0200 (CEST) Received: from gert (uid 1001) (envelope-from gert@fbsd14bb.ov.greenie.net) id 18f58 by fbsd14bb.ov.greenie.net (DragonFly Mail Agent v0.13+ on fbsd14bb.ov.greenie.net); Wed, 18 Sep 2024 18:29:17 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 18 Sep 2024 18:29:17 +0200 Message-ID: <20240918162917.6809-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.4 (vmail1.greenie.net [IPv6:2001:608:1:995a:20c:29ff:feb8:10eb]); Wed, 18 Sep 2024 18:29:17 +0200 (CEST) X-Spam-Score: -0.5 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: - use "$RUN_SUDO kill -0 $pid" to test if a given process is running, not "ps -p $pid" - the latter will not work if security.bsd.see_other_uids=0 is set - produce proper error messages if pid files can not be found or are empty at server shutdown time --- tests/t_server_null_client.sh | 5 ++++- tests/t_server_null_server.sh | 5 +++++ 2 files changed, [...] Content analysis details: (-0.5 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [195.30.8.66 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-Headers-End: 1sqxp8-0006RH-DJ Subject: [Openvpn-devel] [PATCH] make t_server_null "server alive?" check more robust X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1810553119125738091?= X-GMAIL-MSGID: =?utf-8?q?1810553119125738091?= - use "$RUN_SUDO kill -0 $pid" to test if a given process is running, not "ps -p $pid" - the latter will not work if security.bsd.see_other_uids=0 is set - produce proper error messages if pid files can not be found or are empty at server shutdown time Acked-by: Frank Lichtenheld --- tests/t_server_null_client.sh | 5 ++++- tests/t_server_null_server.sh | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/t_server_null_client.sh b/tests/t_server_null_client.sh index e7dd3324..c1a25dfc 100755 --- a/tests/t_server_null_client.sh +++ b/tests/t_server_null_client.sh @@ -87,7 +87,10 @@ while [ $count -lt $server_max_wait ]; do # the active server count as the processes won't be running. for i in `set|grep 'SERVER_NAME_'|cut -d "=" -f 2|tr -d "[\']"`; do server_pid=$(cat $i.pid 2> /dev/null) - if ps -p $server_pid > /dev/null 2>&1; then + if [ -z "$server_pid" ] ; then + continue + fi + if $RUN_SUDO kill -0 $server_pid > /dev/null 2>&1; then servers_up=$(( $servers_up + 1 )) fi done diff --git a/tests/t_server_null_server.sh b/tests/t_server_null_server.sh index e5906eec..32f0362d 100755 --- a/tests/t_server_null_server.sh +++ b/tests/t_server_null_server.sh @@ -82,6 +82,11 @@ for PID_FILE in $server_pid_files do SERVER_PID=$(cat "${PID_FILE}") + if [ -z "$SERVER_PID" ] ; then + echo "WARNING: could not kill server ${PID_FILE}!" + continue + fi + if [ -z "${RUN_SUDO}" ]; then $KILL_EXEC "${SERVER_PID}" else