| Message ID | 20230920121519.177949-1-frank@lichtenheld.com |
|---|---|
| State | Accepted |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
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 <openvpn-devel-bounces@lists.sourceforge.net>)
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 <frank@lichtenheld.com>) 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 <frank@lichtenheld.com>
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:
<gerrit.1694783050000.I171d55da2be868d961caa1d4491e6f1ed10ebe8a@gerrit.openvpn.net>
References:
<gerrit.1694783050000.I171d55da2be868d961caa1d4491e6f1ed10ebe8a@gerrit.openvpn.net>
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 <lev@openvpn.net> 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: <openvpn-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive:
<http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel>
List-Post: <mailto:openvpn-devel@lists.sourceforge.net>
List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe>
Cc: Lev Stipakov <lev@openvpn.net>, Arne Schwabe <arne-openvpn@rfc2549.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
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?=
|
| Series |
[Openvpn-devel] CMake: fix broken daemonization and syslog functionality
|
|
Commit Message
Frank Lichtenheld
Sept. 20, 2023, 12:15 p.m. UTC
From: Lev Stipakov <lev@openvpn.net> 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 <lev@openvpn.net> Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org> Acked-by: Frank Lichtenheld <frank@lichtenheld.com> --- 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 <arne-openvpn@rfc2549.org> Frank Lichtenheld <frank@lichtenheld.com>
Comments
On Wed, Sep 20, 2023 at 02:15:19PM +0200, Frank Lichtenheld wrote: > From: Lev Stipakov <lev@openvpn.net> > > 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 <lev@openvpn.net> > Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org> > Acked-by: Frank Lichtenheld <frank@lichtenheld.com> > --- > > 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 <arne-openvpn@rfc2549.org> > Frank Lichtenheld <frank@lichtenheld.com> So I can automatically set In-Reply-To to the same "virtual" message ID that Gerrit uses (since that is deterministally constructed from the change metadata). However, since this is not the actual message ID by the original "newchange" mail, it still doesn't associate to the same "Patch" in Patchwork. Instead it creates a new patch. Regards,
Your patch has been applied to the master branch.
I have not tested it further, given that it has plenty of ACKs (and
only affects cmake build system).
Two observations, though - the cmake changes look incomplete, there
is still many "#undef HAVE_something" left. Shouldn't they all be
completed to "#cmakedefine" for this to make sense?
Second, while not really relevant on Linux or *BSD, erroring-out
in daemon() on chdir("/") fail is not what either manpage documents -
and I do not think chdir("/") (as root) can ever fail. So changing the
code flow just to silence the compiler feels a bit meh - doing a (void)
there would have silenced it just fine. But as I said it's not
truly relevant.
What OS were you building anyway that you hit an error in compat-daemon.c
(aka "are we missing a cmake test for daemon()")?
commit 8ae6c48d5d52dec8ec6e47cc1cfe89de9f2ffbcd (master)
Author: Lev Stipakov
Date: Wed Sep 20 14:15:19 2023 +0200
CMake: fix broken daemonization and syslog functionality
Signed-off-by: Lev Stipakov <lev@openvpn.net>
Acked-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Frank Lichtenheld <frank@lichtenheld.com>
Message-Id: <20230920121519.177949-1-frank@lichtenheld.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg27045.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
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 <syslog.h> 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)