From patchwork Tue Sep 7 12:31:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 1943 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director13.mail.ord1d.rsapps.net ([172.28.255.1]) by backend30.mail.ord1d.rsapps.net with LMTP id aGPfDoToN2E7WAAAIUCqbw (envelope-from ) for ; Tue, 07 Sep 2021 18:32:36 -0400 Received: from proxy1.mail.ord1c.rsapps.net ([172.28.255.1]) by director13.mail.ord1d.rsapps.net with LMTP id MPilDoToN2EUHgAA91zNiA (envelope-from ) for ; Tue, 07 Sep 2021 18:32:36 -0400 Received: from smtp12.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy1.mail.ord1c.rsapps.net with LMTPS id mOt4MIPoN2GmNgAA2VeTtA (envelope-from ) for ; Tue, 07 Sep 2021 18:32:35 -0400 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: smtp12.gate.ord1c.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; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 7fc490d4-102b-11ec-aff9-bc305bf03e5c-1-1 Received: from [216.105.38.7] ([216.105.38.7:43854] helo=lists.sourceforge.net) by smtp12.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 9F/4E-16805-388E7316; Tue, 07 Sep 2021 18:32:36 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1mNjdD-0000GQ-Fn; Tue, 07 Sep 2021 22:31:55 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNjdC-0000GD-E9 for openvpn-devel@lists.sourceforge.net; Tue, 07 Sep 2021 22:31:54 +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=YJVuGx/hTTat9f47Cb/JArgyijM7muN3SFXTLYJRwGY=; b=cIRClS0KfwBo80aFGPFJoohBrC SMwrXbM2yvo/3vF68Hm9IhHoLZh+Y6iYKbYqaI3vmkw3yz84Q4DyodfcR++X7ARYr+Hp9eNRaFik6 tcEyUKddkMZZcWkKxCdwmYgHHffgHvh5myKi4u4XayaJhNpQzIPh4MTPZCHLH9LECcIw=; 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=YJVuGx/hTTat9f47Cb/JArgyijM7muN3SFXTLYJRwGY=; b=IXqbhnqlvQbLlcCR1SBse9V6Nw fhV+iVKAGm6gV/gXE55xA6uGN/95XykxhOWIH2fSNy8JkBjePclDexEsdvhZ5Zes85dEeQI2A7bZY FrTe9OD+lE3rbA1WBRXMqaOh3tS5Qs1RW++Xli8TjCR/Lf1+bbjh2FbRUYYWPkkt4/1U=; Received: from mail-il1-f169.google.com ([209.85.166.169]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.3) id 1mNjdB-001aUK-QL for openvpn-devel@lists.sourceforge.net; Tue, 07 Sep 2021 22:31:54 +0000 Received: by mail-il1-f169.google.com with SMTP id a1so252826ilj.6 for ; Tue, 07 Sep 2021 15:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YJVuGx/hTTat9f47Cb/JArgyijM7muN3SFXTLYJRwGY=; b=GjpVaeNOr6G/KEhPJGTTggDf7FHA11W93Ghy+rcFsZY+EojE6DWhWLkYRYYn5191F8 uVzKnYsajbZ8LVsuP3/mJlG/fQ3o9NEaJj2mbLkq8Bvgx5OPnNo8R06oS/JA9bv91Ar9 p/rmUFZStGDERETtZupOcQwZh9xqEepjfdH8iNsFbLibkIZXTqIrGp5K59072mLq3Q9f JvbdIl+pmcs+doegWXO8/H8KL8KURqf3ndJrqVXKcdX9pZZYMBKXio+whW94/8uPhMHt t7CWAXgqLK/2QWBI9fbo1EzZ2tpCViWxo9SdFH+EAisvi+lV5v39OhkyQCDRcQGE/bgU zIzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YJVuGx/hTTat9f47Cb/JArgyijM7muN3SFXTLYJRwGY=; b=qWf2oT0xBCRbRFOwLWM5GpBt2Ecdbn5uT1eEfKH5zW+AxUgvflaZbp2CiSjWakoDrM qE/Ndbg+9TYuwUM75cj65kx69gOb7k3xXzT+c+wojDsOfVnXmlkD7piJ1jsJ/zbTMQ9z Kx/xKS6XpgtRzioE+KMnOelrSbFsV/C2lDGEz4FjI6grVZD7cY97idDZWFI5vUSZaZug 6e+KaJF3HVjlkhlel5XEIqzsjrK5iwTv4YRPO3naCQ9V/iqV7A7UyuQ2dVlXcAFWmjv5 mCFAUq0QA6Vibxmjv/k66jEpHXezS0f8q4/IbJM5gYrJmiEwHQR9wRbLrqlXSUBweRbA 11jw== X-Gm-Message-State: AOAM531a/0N/iY5lB6DS9U/btSUQztJAQl+z19uCVMxVG6f4k0KavOSg ZYSJND13HFFe9WBVSvmVFtfS1pN4JKQ= X-Google-Smtp-Source: ABdhPJw/Ta9swJdWDzUPhIVRluKzuovp1x40BYii2VnvQoSWBwU3F8mvsmrmAcv5PcFu/goE46Z/gA== X-Received: by 2002:a92:c80d:: with SMTP id v13mr424307iln.198.1631053908032; Tue, 07 Sep 2021 15:31:48 -0700 (PDT) Received: from uranus.home.sansel.ca (bras-vprn-tnhlon4053w-lp130-02-70-51-223-174.dsl.bell.ca. [70.51.223.174]) by smtp.gmail.com with ESMTPSA id b10sm224405ils.13.2021.09.07.15.31.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 15:31:47 -0700 (PDT) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Tue, 7 Sep 2021 18:31:26 -0400 Message-Id: <20210907223126.8440-3-selva.nair@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210907223126.8440-1-selva.nair@gmail.com> References: <20210825210232.22509-1-selva.nair@gmail.com> <20210907223126.8440-1-selva.nair@gmail.com> MIME-Version: 1.0 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: From: Selva Nair The message "ERROR: The 'foo' commmand is not supported by current daemon mode" is repeatedly used in manage.c. Move it to a function for uniformity in messaging. v3, v3: no change Signed-off-by: Selva Nair --- src/openvpn/manage.c | 34 ++++++++++++++++++++ 1 file changed, 20 insertions(+), 14 deletions(-) Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [selva.nair[at]gmail.com] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.169 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.166.169 listed in list.dnswl.org] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -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 X-Headers-End: 1mNjdB-001aUK-QL Subject: [Openvpn-devel] [PATCH v3 3/3] Use a template for "unsupported management commands" error 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 From: Selva Nair The message "ERROR: The 'foo' commmand is not supported by current daemon mode" is repeatedly used in manage.c. Move it to a function for uniformity in messaging. v3, v3: no change Signed-off-by: Selva Nair Acked-By: Arne Schwabe --- src/openvpn/manage.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index f2a51d6c..b75014c2 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -447,6 +447,12 @@ man_signal(struct management *man, const char *name) } } +static void +man_command_unsupported(const char *command_name) +{ + msg(M_CLIENT, "ERROR: The '%s' command is not supported by the current daemon mode", command_name); +} + static void man_status(struct management *man, const int version, struct status_output *so) { @@ -456,7 +462,7 @@ man_status(struct management *man, const int version, struct status_output *so) } else { - msg(M_CLIENT, "ERROR: The 'status' command is not supported by the current daemon mode"); + man_command_unsupported("status"); } } @@ -572,7 +578,7 @@ man_kill(struct management *man, const char *victim) } else { - msg(M_CLIENT, "ERROR: The 'kill' command is not supported by the current daemon mode"); + man_command_unsupported("kill"); } gc_free(&gc); @@ -777,7 +783,7 @@ man_net(struct management *man) } else { - msg(M_CLIENT, "ERROR: The 'net' command is not supported by the current daemon mode"); + man_command_unsupported("net"); } } @@ -799,7 +805,7 @@ man_send_cc_message(struct management *man, const char *message, const char *par } else { - msg(M_CLIENT, "ERROR: This command is not supported by the current daemon mode"); + man_command_unsupported("cr-repsonse"); } } #ifdef ENABLE_PKCS11 @@ -843,7 +849,7 @@ man_remote_entry_count(struct management *man) } else { - msg(M_CLIENT, "ERROR: The remote-entry-count command is not supported by the current daemon mode"); + man_command_unsupported("remote-entry-count"); } } @@ -884,7 +890,7 @@ man_remote_entry_get(struct management *man, const char *p1, const char *p2) } else { - msg(M_CLIENT, "ERROR: The remote-entry command is not supported by the current daemon mode"); + man_command_unsupported("remote-entry-get"); } } @@ -973,7 +979,7 @@ in_extra_dispatch(struct management *man) } else { - msg(M_CLIENT, "ERROR: The client-auth command is not supported by the current daemon mode"); + man_command_unsupported("client-auth"); } break; @@ -997,7 +1003,7 @@ in_extra_dispatch(struct management *man) } else { - msg(M_CLIENT, "ERROR: The client-pf command is not supported by the current daemon mode"); + man_command_unsupported("client-pf"); } break; @@ -1082,7 +1088,7 @@ man_client_pending_auth(struct management *man, const char *cid_str, } else { - msg(M_CLIENT, "ERROR: The client-pending-auth command is not supported by the current daemon mode"); + man_command_unsupported("client-pending-auth"); } } } @@ -1133,7 +1139,7 @@ man_client_deny(struct management *man, const char *cid_str, const char *kid_str } else { - msg(M_CLIENT, "ERROR: The client-deny command is not supported by the current daemon mode"); + man_command_unsupported("client-deny"); } } } @@ -1158,7 +1164,7 @@ man_client_kill(struct management *man, const char *cid_str, const char *kill_ms } else { - msg(M_CLIENT, "ERROR: The client-kill command is not supported by the current daemon mode"); + man_command_unsupported("client-kill"); } } } @@ -1173,7 +1179,7 @@ man_client_n_clients(struct management *man) } else { - msg(M_CLIENT, "ERROR: The nclients command is not supported by the current daemon mode"); + man_command_unsupported("nclients"); } } @@ -1297,7 +1303,7 @@ man_proxy(struct management *man, const char **p) } else { - msg(M_CLIENT, "ERROR: The proxy command is not supported by the current daemon mode"); + man_command_unsupported("proxy"); } } @@ -1318,7 +1324,7 @@ man_remote(struct management *man, const char **p) } else { - msg(M_CLIENT, "ERROR: The remote command is not supported by the current daemon mode"); + man_command_unsupported("remote"); } }