]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
show the right string for key-direction
authorArne Schwabe <arne@rfc2549.org>
Wed, 31 Jan 2018 09:53:00 +0000 (10:53 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 20 Feb 2018 09:54:26 +0000 (10:54 +0100)
V2: print also a nice string if direction is not set
V3: really include V2 changes
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1517392380-21597-1-git-send-email-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16415.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/crypto.c
src/openvpn/crypto.h
src/openvpn/options.c

index a23de65b8c698ab977776dfd1633f2cd0d007385..b59c1f73d366fb4d56ee16a1db8acede916b50a2 100644 (file)
@@ -1545,11 +1545,18 @@ ascii2keydirection(int msglevel, const char *str)
 }
 
 const char *
-keydirection2ascii(int kd, bool remote)
+keydirection2ascii(int kd, bool remote, bool humanreadable)
 {
     if (kd == KEY_DIRECTION_BIDIRECTIONAL)
     {
-        return NULL;
+        if (humanreadable)
+        {
+            return "not set";
+        }
+        else
+        {
+            return NULL;
+        }
     }
     else if (kd == KEY_DIRECTION_NORMAL)
     {
index 63aa3a8432196302b59b78d5d40be8fcc80d916a..9417fa1209b7ee51fd0ff9177bd10075e9f1141a 100644 (file)
@@ -470,7 +470,7 @@ void must_have_n_keys(const char *filename, const char *option, const struct key
 
 int ascii2keydirection(int msglevel, const char *str);
 
-const char *keydirection2ascii(int kd, bool remote);
+const char *keydirection2ascii(int kd, bool remote, bool humanreadable);
 
 /* print keys */
 void key2_print(const struct key2 *k,
index 2a5ddf209c0a8f4adef8ee39b5ab34774992a547..95fb4de30cf63e744ef2d02f6b4a3a290fb8359e 100644 (file)
@@ -1704,7 +1704,7 @@ show_settings(const struct options *o)
 #endif
 
     SHOW_STR(shared_secret_file);
-    SHOW_INT(key_direction);
+    SHOW_PARM(key_direction, keydirection2ascii(o->key_direction, false, true), "%s");
     SHOW_STR(ciphername);
     SHOW_BOOL(ncp_enabled);
     SHOW_STR(ncp_ciphers);
@@ -3577,7 +3577,7 @@ options_string(const struct options *o,
      * Key direction
      */
     {
-        const char *kd = keydirection2ascii(o->key_direction, remote);
+        const char *kd = keydirection2ascii(o->key_direction, remote, false);
         if (kd)
         {
             buf_printf(&out, ",keydir %s", kd);