From patchwork Wed Sep 20 12:15:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 3354 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7301:2697:b0:d7:3b0f:3938 with SMTP id ha23csp2276187dyb; Wed, 20 Sep 2023 05:16:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHu6bLyjZIveXnzj56rx7MBTtaw2qDZZHTfb8FMR+JiCwx1Itk3c8oS5pPqp5NKUJbv3B/b X-Received: by 2002:a17:90a:6d65:b0:26d:2635:5a7c with SMTP id z92-20020a17090a6d6500b0026d26355a7cmr2283452pjj.2.1695212163786; Wed, 20 Sep 2023 05:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695212163; cv=none; d=google.com; s=arc-20160816; b=ujSAp8SMK43lkYm52txXJeliRbA0EGsdiT1OuiFV7rtGQhjs8rm2zgh2Rdc0XPZIIJ xxB2ueK36N7xrF72MfaFmD3C/QUVum5qGzTDUssFKU7mk+gOytsr1fDjHoX0GMgSqsab Jy50xCscjbVbCs7AuO22skeeK25AlC/uABLxsYGgBKoU2aCJ1eHtjOI/AoqklPS+myAP KFhE3pl6x6nJXo34JA5B8/CT+krIbGPZgRTxe8poEpmYVD/bO3gLven0mOT5/oyn9cT1 JHkNqMQD8BXprea9I71OuopEsv8KstYYRxi+gb9zUYL6G7SeULP8FOZ1yCxF+KqJLfW3 G4JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:cc:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=QDsvnhkDJqAGpXDp2SDBaSchuM8Osxult4pdgCkIUcU=; fh=bPbV1ffll3/1Je7WaTIWZCP3p+G85pAR4TX4hG88AeA=; b=t8S6M4Mi6KCbfdWXsXWx4pmljIVY3Mk40s6/d8mcIeGrBc56v2M5zX8ztHA7Wwv9zC eTL+sWdvOXbLR3qkjqQTVrpMoELwug4nzI/jiGbIaC9qID8TzMOiSfozIv4x1zRjvFx7 q3TjU9CV5K5AD7KFFA2qEy94D51E/zR7B85KWL/vVQy4ww/9aBBag0C1IMrZ3CfN91ue iCkxRZDlnqE4+GDuqIfdh7JTtAeWTtCfJQLk3OwUBuR7u5PdZ5ySsHUvFjz9X+RUCsML RIq+cEUI6lrjhc0SN0/rOB4toABKcnTKuXr8M0Zik4gkCP5ZiZzjRtUKyOQko7be5AaR HbcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=HKkTj+7b; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=TrwFo1DT; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=xswXqU9R; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id ei5-20020a17090ae54500b00268a8e0cab3si1382742pjb.178.2023.09.20.05.16.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2023 05:16:03 -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=HKkTj+7b; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=TrwFo1DT; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=xswXqU9R; 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 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qiw7C-000372-JW; Wed, 20 Sep 2023 12:15:35 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qiw7A-00036v-9v for openvpn-devel@lists.sourceforge.net; Wed, 20 Sep 2023 12:15:33 +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:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=129BBl9eH+nu83zT4aEsevLRuJa2THYo14xfv/vDDtY=; b=HKkTj+7bltBesQdpk7FzfNlCPd SMvFncfyh3QOjKPEDb1o/bQNB4aNkAJHhkMI8w8spR79kFgUoOSl4MbhTmZ2RSDmpCg4AKMC+aTBD HszTj7pSYLnshWjzs7gPDypTq11qkLs8rup5Q27eRvT74tyGTyTbf1GAP/c4B4MSRHvY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=129BBl9eH+nu83zT4aEsevLRuJa2THYo14xfv/vDDtY=; b=TrwFo1DTE4J+cAM8xt0oRyV2az sPDBdm3C3OlKOCHvssOh2spwoW501wD74uxIKYNy34rmf+ziojtoDnIBbEspjLFbtz3MV7ZTKV49b jhTiftjYqRiVqrdZmq4Gqc/ucYwNR8df49vjMrRJGHTKMxT1jhgD1begzESw6C8WB/0I=; Received: from mout-p-201.mailbox.org ([80.241.56.171]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qiw78-00Gf8L-HY for openvpn-devel@lists.sourceforge.net; Wed, 20 Sep 2023 12:15:32 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4RrHY56lH8z9sVL; Wed, 20 Sep 2023 14:15:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1695212121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=129BBl9eH+nu83zT4aEsevLRuJa2THYo14xfv/vDDtY=; b=xswXqU9RGXaxVgpopVyRZhDuUVHO88EtDBoFD3wM7fazfo4JVHvAi88n7vi+/cp5zxPAjz 6jJnW5nDyuekW2W0d7e3DCDwlChALssK9kyUU0DBPifhcDAyDW6xVbx1Lrunx1e/JNv+d2 3TIlj3i6EG8CqNMFgw/vyMJW7qVCXR0r2sWn4akv+2REJ13DQcBOnRzrH9iMD6TWuG7NfH eM1aQ6A7FY8VpV/Uux85hUsZXsIyxoMXUpbFYJkN9dRX6MzZ4SSy/9mBjXDC5MF7QCJkT+ /k5baz4nWh3R033iPcs5WkT57Za/Pjump1bXtj5vMMSywVP0IivjQNfFJznqlw== From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Wed, 20 Sep 2023 14:15:19 +0200 Message-Id: <20230920121519.177949-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.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: From: Lev Stipakov While CMake is not the official way to build OpenVPN on Linux, it still make sense to support it. Turns out that HAVE_SETSID, HAVE_OPENLOG and HAVE_SYSLOG Content analysis details: (-0.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.171 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1qiw78-00Gf8L-HY Subject: [Openvpn-devel] [PATCH] CMake: fix broken daemonization and syslog functionality 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: , Cc: Lev Stipakov , Arne Schwabe Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1777558789943958442?= X-GMAIL-MSGID: =?utf-8?q?1777558789943958442?= From: Lev Stipakov While CMake is not the official way to build OpenVPN on Linux, it still make sense to support it. Turns out that HAVE_SETSID, HAVE_OPENLOG and HAVE_SYSLOG were not set by CMake configure, and --daemon and syslog functionality was broken. While on it, fix compiler error on unused return value of chdir(). Change-Id: I171d55da2be868d961caa1d4491e6f1ed10ebe8a Signed-off-by: Lev Stipakov Acked-by: Arne Schwabe Acked-by: Frank Lichtenheld --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/341 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Arne Schwabe Frank Lichtenheld diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dae665..9de6aba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,6 +150,7 @@ check_symbol_exists(ftruncate unistd.h HAVE_FTRUNCATE) check_symbol_exists(setgid unistd.h HAVE_SETGID) check_symbol_exists(setuid unistd.h HAVE_SETUID) +check_symbol_exists(setsid unistd.h HAVE_SETSID) check_symbol_exists(getpeereid unistd.h HAVE_GETPEEREID) check_symbol_exists(epoll_create sys/epoll.h HAVE_EPOLL_CREATE) diff --git a/config.h.cmake.in b/config.h.cmake.in index 4f28917..f2cdd39 100644 --- a/config.h.cmake.in +++ b/config.h.cmake.in @@ -218,7 +218,7 @@ #undef HAVE_NICE /* Define to 1 if you have the `openlog' function. */ -#undef HAVE_OPENLOG +#cmakedefine HAVE_OPENLOG /* OpenSSL engine support available */ #undef HAVE_OPENSSL_ENGINE @@ -258,7 +258,7 @@ #undef HAVE_SETGROUPS /* Define to 1 if you have the `setsid' function. */ -#undef HAVE_SETSID +#cmakedefine HAVE_SETSID /* Define to 1 if you have the `setsockopt' function. */ #define HAVE_SETSOCKOPT 1 @@ -303,7 +303,7 @@ #undef HAVE_STRSEP /* Define to 1 if you have the `syslog' function. */ -#undef HAVE_SYSLOG +#cmakedefine HAVE_SYSLOG /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYSLOG_H diff --git a/src/compat/compat-daemon.c b/src/compat/compat-daemon.c index aebb8f4..5c6d740 100644 --- a/src/compat/compat-daemon.c +++ b/src/compat/compat-daemon.c @@ -70,7 +70,10 @@ if (!nochdir) { - chdir("/"); + if (chdir("/") == -1) + { + return (-1); + } } if (!noclose)