From patchwork Fri Sep 15 13:04:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "plaisthos (Code Review)" X-Patchwork-Id: 3347 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:1486:b0:d7:3b0f:3938 with SMTP id b6csp573089dyh; Fri, 15 Sep 2023 06:05:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEiNEpHAuO8/t2vSb5iiIIgNZ371LvAm65jUFkxEwnKjKuF9jhZxQZsStc7NIMvG/369kWO X-Received: by 2002:a17:902:e886:b0:1bf:349f:b85c with SMTP id w6-20020a170902e88600b001bf349fb85cmr1627774plg.1.1694783131696; Fri, 15 Sep 2023 06:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694783131; cv=none; d=google.com; s=arc-20160816; b=WwORJK1mpQDpKSOLNNfNdBbl94U+JYv3Nd9qgGG04DVDtR71Aj7jkeOHXgg8HDF/Kw ds++BhUsilSWum3IR2URi/bU39udymkYvTNMUYSC9pQSmuGFi19FfI3TzVKNl++tAzU4 beBjvAcGPzr1gRfsb31eovwSYLQvOXo7ELI5miATCZWvAEklnB/dw0WeRACb2+9SwZYF zKhqsIZ3l9WvBmEuLcBTsj78eWwDGH15Qxkzwz7iPToSMi6vT2kvTXeYqoTZ88bFIeHj v1YZOwNKrv4bNn8OZjcbcoE92wEPdFAmjTnlylD4UclNBnX97EZ9w/QjjocOm2i1xlwz RkuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:to:date:from :dkim-signature:dkim-signature:dkim-signature; bh=H0Xsq5oXdoRfQVM9ob/6mUI50kbJ+2uYY1pCfUTOjm0=; fh=lm0MLPW7DntlrDqRECIiC9JlE1uPxhepE0URYHIf+eE=; b=rtUDBixidiQ9tw4XcJyVqFZzh1xomNt2KAT+GZ5XjF2/E8aLd5nWCB7zPBvsCLYRd3 3c1mOnYcvnQzE0d3EEm58jMVds8OkiCHBT2kcdk6n3uetvn3yy6xce7YpET1k+ZkrG5c p1RCshohNBYMbLmif8bUjKojpNIEmB5wYJC6LbM3ZSh1YHIeRKH4y21igOpELFvG4PQT z5iS7rqlvOMyW0fjS+XFB82X64jsX6sQ7H8UlYMIkMHtn7wOnyLdrYjFrlc+EzqjfF0P U8EZHJC1BymakHhILvDP8sDFMGRnIzbqruTZaJ2kex54PSfGNz8WZCmEd+xJ5X77iL4z ypWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=RZbPeFS1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=BQLP8Y3k; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=VbpyIL4v; 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=openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id y15-20020a17090264cf00b001b82a4d3ea7si1054853pli.249.2023.09.15.06.05.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Sep 2023 06:05:31 -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=RZbPeFS1; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=BQLP8Y3k; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=VbpyIL4v; 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=openvpn.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 1qh8Up-0001n7-Ft; Fri, 15 Sep 2023 13:04:32 +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 1qh8Un-0001n0-JA for openvpn-devel@lists.sourceforge.net; Fri, 15 Sep 2023 13:04:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:To:Date: From:Sender:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9hZ65Kbw+nzfids+WP2vEzDrrAAIFyl6YJYL7TqllQw=; b=RZbPeFS1D9GHynTSA+zRyihnqZ 9qYnTeMaVkGqrlOy+NpCVpbJNPbH5EG4kK2GdaJRikt9kwypMCcEj9bk32V9+Wsn2Lh2Ckeyox/Jx hzon94yCBgZnUtcpsGkZbgDa+jV0mVEaxuSYXLd+nP/GleX9ldcgeFws0JYlOUa1B+A4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:To:Date:From:Sender:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=9hZ65Kbw+nzfids+WP2vEzDrrAAIFyl6YJYL7TqllQw=; b=B QLP8Y3kqTMYXMbyCVFTqVijkq9jOQUCY9lP3mkQ06/1EQwZX2sSsNvnoWnZrAZjHUbFYF5+Ql0q+v jCT9GZlNNmBmheqGPlyHBZKXRL/h252GDBww8QPO6QR0v42CeseDixp9qPLEE9q631w7RM3LUBRVT mf40VL22ITpQbg3g=; Received: from mail-wm1-f46.google.com ([209.85.128.46]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1qh8Uf-0007PU-RF for openvpn-devel@lists.sourceforge.net; Fri, 15 Sep 2023 13:04:30 +0000 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-403012f27e3so24197765e9.3 for ; Fri, 15 Sep 2023 06:04:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1694783055; x=1695387855; darn=lists.sourceforge.net; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from:from:to:cc :subject:date:message-id:reply-to; bh=9hZ65Kbw+nzfids+WP2vEzDrrAAIFyl6YJYL7TqllQw=; b=VbpyIL4v7AUewMVhHawG8qqT1/WNi4qx+NtHSeS9WbVP5W/gMzmkqmqYR07PdczZ/t K8EdGpnBugICQcYLkkotxONL0VPSSs4qujELls4U6Mys3/ir04EEjhrcSe4ZLAblOTwv iW4DMoE/o1ClDBPgaqV1pZ0I8vN9xm+58L9drMxdTo6P2fPHK80cGOujJVHAHrJCVgBH CzZPtSOAsxyWGvef6y5G2CuXm0tkcRwqKGSntVPv8RwuFFb/bu6KmPS4UfUh92AGV/Gn xOgBRTHKvaH9wRAt+7VHFT0VeQEd8aM3Od0knthaJjt5+g1aSPUWlrKuMtP8A4deZ0aS +M6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694783055; x=1695387855; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9hZ65Kbw+nzfids+WP2vEzDrrAAIFyl6YJYL7TqllQw=; b=cMZ+iCu2bkpnn1zbWZc3izvSbpjpeyfwL7QgDqa0AgkcOUKElc2yUYFR/Fo9L+hNA+ KExMJwG8MbREZhvBZTd/eLlxwBHPN7hPvC3o+YMac99EEgF05Zj6lo1daKrZIwlriOzh 4FtCcU9unVOsdL9G1/W4AinE5eFJio0vW23E+Gg05QDpbSVSe9Ylz1/WJFb3KGjzlAVJ WzgR1BNSNroG6/ARyGxoJ7uhBFqTjdn+tomWJ0QdvujNIWXognsDMqBH4uLwrPtkD4oH MOa6FFt6jxXtBX/sahBcvhISMxSgad8EYcphpF9i0tEYeLUxa029gFVVW+BdJ3/2caQg g6Zw== X-Gm-Message-State: AOJu0YxJTYDfuBABNpSIbI4CUskUlf565C9SImNQKryUZToERsrHUirw jx6DiszTKOmGI9vWgHQ/7dQtSsplTEzhec+jV4Q= X-Received: by 2002:a7b:c446:0:b0:402:e68f:8898 with SMTP id l6-20020a7bc446000000b00402e68f8898mr1602817wmi.0.1694783055105; Fri, 15 Sep 2023 06:04:15 -0700 (PDT) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id f22-20020a1c6a16000000b003fbe4cecc3bsm7404663wmc.16.2023.09.15.06.04.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 06:04:14 -0700 (PDT) From: "stipa (Code Review)" X-Google-Original-From: "stipa (Code Review)" X-Gerrit-PatchSet: 1 Date: Fri, 15 Sep 2023 13:04:14 +0000 To: flichtenheld Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: I171d55da2be868d961caa1d4491e6f1ed10ebe8a X-Gerrit-Change-Number: 341 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: 272a4173e1b357a51489501732dcb59dc320e86e References: Message-ID: <27f10f2682d4c21ab0b6d26c5343f243c2532fa3-HTML@gerrit.openvpn.net> MIME-Version: 1.0 User-Agent: Gerrit/3.8.1 X-Spam-Score: -0.2 (/) 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: Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.128.46 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.128.46 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1qh8Uf-0007PU-RF Subject: [Openvpn-devel] [S] Change in openvpn[master]: 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: , Reply-To: lstipakov@gmail.com, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com Cc: openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1777108917072304847?= X-GMAIL-MSGID: =?utf-8?q?1777108917072304847?= Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/341?usp=email to review the following change. Change subject: CMake: fix broken daemonization and syslog functionality ...................................................................... CMake: fix broken daemonization and syslog functionality 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 --- M CMakeLists.txt M config.h.cmake.in M src/compat/compat-daemon.c 3 files changed, 8 insertions(+), 4 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/341/1 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)