From patchwork Wed Jan 27 09:21:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Cox X-Patchwork-Id: 1582 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director13.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id sCQNKLHLEWCpXgAAIUCqbw (envelope-from ) for ; Wed, 27 Jan 2021 15:23:13 -0500 Received: from proxy15.mail.ord1d.rsapps.net ([172.30.191.6]) by director13.mail.ord1d.rsapps.net with LMTP id SJ3ZJ7HLEWBcDQAA91zNiA (envelope-from ) for ; Wed, 27 Jan 2021 15:23:13 -0500 Received: from smtp21.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy15.mail.ord1d.rsapps.net with LMTPS id YN2kJ7HLEWCqeQAAAY1PeQ (envelope-from ) for ; Wed, 27 Jan 2021 15:23:13 -0500 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp21.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=fail (p=none; dis=none) header.from=mozilla.com X-Suspicious-Flag: YES X-Classification-ID: 7a3b3e72-60dd-11eb-afa9-525400a98691-1-1 Received: from [216.105.38.7] ([216.105.38.7:33946] helo=lists.sourceforge.net) by smtp21.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id EB/35-25869-0BBC1106; Wed, 27 Jan 2021 15:23:12 -0500 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1l4rKP-0000Be-Ur; Wed, 27 Jan 2021 20:22:13 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4rKO-0000BW-HM for openvpn-devel@lists.sourceforge.net; Wed, 27 Jan 2021 20:22:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding: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=23VkI0esfBmvQKjDoNyHmb6j+acM5dWboic8dinNIms=; b=fkRG8C4u8WodGQvhtczUaMDqho I64HnpNaj1E2I12QMNeB1Ox18PTj+8s8nM7bbyEwvOtMfnZQgWE+F4SDq3RaLKtiuo5SVwqE49lTd 2+h5iTeKJUUXFz2n2oJLh+eknG+lj3j1aBryysCEDcgliXRtP6sGwycyvguu+H23eow8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding: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=23VkI0esfBmvQKjDoNyHmb6j+acM5dWboic8dinNIms=; b=HSfq4CBhxZGwt57Mr7IQayv0cr 8Xl7mfVqHoSxHHxMZvgYvEqGEKqnfB3Y7/KCGwwSMTXOela++tfUt+qTN7VDtRdYPKgkL4SCnz54r JVTmyiw3IH0dtR91KomvDS+kXmeh3H7wcpF+9dXKT/s6nFLWwKB0Yj+p5HTv/gmgi6iw=; Received: from smtp1.mdc1.mozilla.com ([63.245.208.103] helo=smtp.mozilla.org) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1l4rKH-00BlTj-U0 for openvpn-devel@lists.sourceforge.net; Wed, 27 Jan 2021 20:22:12 +0000 Received: from localhost (localhost4.localdomain [127.0.0.1]) by smtp1.mail.mdc1.mozilla.com (Postfix) with ESMTP id E79AC9A333; Wed, 27 Jan 2021 20:21:59 +0000 (UTC) Received: from smtp.mozilla.org ([127.0.0.1]) by localhost (smtp1.mail.mdc1.mozilla.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1zYuA6Sf3vPW; Wed, 27 Jan 2021 20:21:59 +0000 (UTC) Received: from centos7-rpmbuild1.private.mdc1.mozilla.com (centos7-rpmbuild1.private.mdc1.mozilla.com [10.48.75.35]) by smtp1.mail.mdc1.mozilla.com (Postfix) with ESMTPS id C6DDC9A2EE; Wed, 27 Jan 2021 20:21:59 +0000 (UTC) From: Greg Cox To: openvpn-devel@lists.sourceforge.net Date: Wed, 27 Jan 2021 20:21:48 +0000 Message-Id: <1611778909-20630-1-git-send-email-gcox@mozilla.com> X-Mailer: git-send-email 2.7.6 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1l4rKH-00BlTj-U0 Subject: [Openvpn-devel] [PATCH 1/2] Update openvpn_plugin_func_v2 to _v3 in sample-plugins/defer/simple.c 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox This isn't strictly required, but it modernizes the functions used. This change makes _open the same parameter form as _func (for better parallelism in function writing) and includes a check for the correct struct version, as recommended by openvpn-plugin.h Acked-By: David Sommerseth --- sample/sample-plugins/defer/simple.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sample/sample-plugins/defer/simple.c b/sample/sample-plugins/defer/simple.c index 22bc22765d6773d3ea2344a328faf5008b0c5d89..a2e47cfc3953ae188a5a2588a3d21e12404c75f1 100644 --- a/sample/sample-plugins/defer/simple.c +++ b/sample/sample-plugins/defer/simple.c @@ -423,16 +423,21 @@ tls_final(struct plugin_context *context, struct plugin_per_client_context *pcc, } OPENVPN_EXPORT int -openvpn_plugin_func_v2(openvpn_plugin_handle_t handle, - const int type, - const char *argv[], - const char *envp[], - void *per_client_context, - struct openvpn_plugin_string_list **return_list) +openvpn_plugin_func_v3(const int v3structver, + struct openvpn_plugin_args_func_in const *args, + struct openvpn_plugin_args_func_return *ret) { - struct plugin_context *context = (struct plugin_context *) handle; - struct plugin_per_client_context *pcc = (struct plugin_per_client_context *) per_client_context; - switch (type) + /* Check API compatibility -- struct version 5 or higher needed */ + if (v3structver < 5) + { + fprintf(stderr, "%s: this plugin is incompatible with the running version of OpenVPN\n", MODULE); + return OPENVPN_PLUGIN_FUNC_ERROR; + } + const char **argv = args->argv; + const char **envp = args->envp; + struct plugin_context *context = (struct plugin_context *) args->handle; + struct plugin_per_client_context *pcc = (struct plugin_per_client_context *) args->per_client_context; + switch (args->type) { case OPENVPN_PLUGIN_UP: plugin_log(PLOG_NOTE, MODULE, "OPENVPN_PLUGIN_UP");