Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1552?usp=email

to review the following change.


Change subject: Document management client versions
......................................................................

Document management client versions

Also add an enum to keep track of client version updates.

Change-Id: I1c01fa1bc7d65ac060b334724feb56ef4d0b5d35
Signed-off-by: Selva Nair <[email protected]>
---
M doc/management-notes.txt
M src/openvpn/manage.c
2 files changed, 19 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/1552/1

diff --git a/doc/management-notes.txt b/doc/management-notes.txt
index 86b74f3..41e2a91 100644
--- a/doc/management-notes.txt
+++ b/doc/management-notes.txt
@@ -496,6 +496,10 @@
 version. This was fixed starting version 4: clients should expect
 "SUCCESS: .. " message only when setting the version to >= 4.

+Minimum client version required for certain features is listed below:
+    >PK_SIGN:[base64]           -- version 2 or greater
+    >PK_SIGN:[base64],[alg]     -- version 3 or greater
+
 COMMAND -- auth-retry
 ---------------------

diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c
index 03ff5b3..b1fb577 100644
--- a/src/openvpn/manage.c
+++ b/src/openvpn/manage.c
@@ -61,6 +61,16 @@
 /* tag for blank username/password */
 static const char blank_up[] = "[[BLANK]]";

+/*
+ * Management client versions indicating feature support in client.
+ * Append new values as needed but do not change exisiting ones.
+ */
+static enum mcv {
+    MCV_DEFAULT = 1,
+    MCV_PKSIGN = 2,
+    MCV_PKSIGN_ALG = 3,
+};
+
 struct management *management; /* GLOBAL */

 /* static forward declarations */
@@ -1333,8 +1343,8 @@
     if (version)
     {
         man->connection.client_version = atoi(version);
-        /* Prior to version 3, we missed to respond to this command. 
Acknowledge only if version >= 4 */
-        if (man->connection.client_version >= 4)
+        /* Until MCV_PKSIGN_ALG, we missed to respond to this command. 
Acknowledge only if version is newer */
+        if (man->connection.client_version > MCV_PKSIGN_ALG)
         {
             msg(M_CLIENT, "SUCCESS: Management client version set to %d", 
man->connection.client_version);
         }
@@ -2656,7 +2666,7 @@
             man->connection.es = event_set_init(&maxevents, EVENT_METHOD_FAST);
         }

-        man->connection.client_version = 1; /* default version */
+        man->connection.client_version = MCV_DEFAULT; /* default version */

         /*
          * Listen/connect socket
@@ -3776,14 +3786,14 @@
     const char *desc = "pk-sign";
     struct buffer buf_data = alloc_buf(strlen(b64_data) + strlen(algorithm) + 
20);

-    if (man->connection.client_version <= 1)
+    if (man->connection.client_version <= MCV_DEFAULT)
     {
         prompt = "RSA_SIGN";
         desc = "rsa-sign";
     }

     buf_write(&buf_data, b64_data, (int)strlen(b64_data));
-    if (man->connection.client_version > 2)
+    if (man->connection.client_version >= MCV_PKSIGN_ALG)
     {
         buf_write(&buf_data, ",", (int)strlen(","));
         buf_write(&buf_data, algorithm, (int)strlen(algorithm));

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1552?usp=email
To unsubscribe, or for help writing mail filters, visit 
http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I1c01fa1bc7d65ac060b334724feb56ef4d0b5d35
Gerrit-Change-Number: 1552
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to