[Openvpn-devel,v3,3/3] Use a template for "unsupported management commands" error
Commit Message
From: Selva Nair <selva.nair@gmail.com>
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 <selva.nair@gmail.com>
---
src/openvpn/manage.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
Comments
Am 08.09.21 um 00:31 schrieb selva.nair@gmail.com:
> From: Selva Nair <selva.nair@gmail.com>
>
> 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
Acked-By: Arne Schwabe <arne@rfc2549.org>
This patch currently has a conflict since PF code was removed. I will
let Gert decide if he wants to adjust the patch or a rebased v4.
Hi,
On Mon, Dec 26, 2022 at 08:50:33PM +0100, Arne Schwabe wrote:
> Am 08.09.21 um 00:31 schrieb selva.nair@gmail.com:
> > From: Selva Nair <selva.nair@gmail.com>
> >
> > 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
>
> Acked-By: Arne Schwabe <arne@rfc2549.org>
>
> This patch currently has a conflict since PF code was removed. I will
> let Gert decide if he wants to adjust the patch or a rebased v4.
This patch set was left way too long out in the sun to dry... I will
adjust this ("remove the hunk that deals with client-pf"), trivial
enough.
gert
Removed the hunk related to "client-pf". The rest went in just fine.
Verified with my favourite "why does this not work at --management-hold
time?" new command :-)
>HOLD:Waiting for hold release:0
remote-entry-count
ERROR: The 'remote-entry-count' command is not supported by the current daemon mode
Your patch has been applied to the master and release/2.6 branch.
commit caf1b9030f28a984a0e12dd87b128b428d3683f0 (master)
commit cad95bcc564e06dc53ec88e9ec4f529146569c0d (release/2.6)
Author: Selva Nair
Date: Tue Sep 7 18:31:26 2021 -0400
Use a template for 'unsupported management commands' error
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20210907223126.8440-3-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22814.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
@@ -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");
}
}