File bug-1009076_pacemaker-lrmd-dont-reject-protocol-1.0-clients.patch of Package pacemaker.14737

commit 1e14f50b7998044e032225016173f3ab824fd466
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Mon Oct 16 11:29:18 2017 -0500

    Fix: lrmd: don't reject protocol 1.0 clients
    
    6424a647 (1.1.15) accidentally bumped LRMD_PROTOCOL_VERSION to 1.1,
    preventing earlier releases from connecting to Pacemaker Remote with this
    version or later. This simply compares the client against 1.0 rather
    than 1.1.

diff --git a/include/crm/lrmd.h b/include/crm/lrmd.h
index 13274fadc..3398c6e48 100644
--- a/include/crm/lrmd.h
+++ b/include/crm/lrmd.h
@@ -35,8 +35,19 @@ typedef struct lrmd_key_value_s {
     struct lrmd_key_value_s *next;
 } lrmd_key_value_t;
 
+/* This should be bumped every time there is an incompatible change that
+ * prevents older clients from connecting to this version of the server.
+ */
 #define LRMD_PROTOCOL_VERSION "1.1"
 
+/* This is the version that the client version will actually be compared
+ * against. This should be identical to LRMD_PROTOCOL_VERSION. However, we
+ * accidentally bumped LRMD_PROTOCOL_VERSION in 6424a647 (1.1.15) when we didn't
+ * need to, so for now it's different. If we ever have a truly incompatible
+ * bump, we can drop this and compare against LRMD_PROTOCOL_VERSION.
+ */
+#define LRMD_MIN_PROTOCOL_VERSION "1.0"
+
 /* *INDENT-OFF* */
 #define DEFAULT_REMOTE_KEY_LOCATION "/etc/pacemaker/authkey"
 #define ALT_REMOTE_KEY_LOCATION "/etc/corosync/authkey"
diff --git a/lrmd/lrmd.c b/lrmd/lrmd.c
index 6a6cc0dc3..49bc0c283 100644
--- a/lrmd/lrmd.c
+++ b/lrmd/lrmd.c
@@ -1373,11 +1373,10 @@ process_lrmd_signon(crm_client_t * client, uint32_t id, xmlNode * request)
     const char *is_ipc_provider = crm_element_value(request, F_LRMD_IS_IPC_PROVIDER);
     const char *protocol_version = crm_element_value(request, F_LRMD_PROTOCOL_VERSION);
 
-    if (compare_version(protocol_version, LRMD_PROTOCOL_VERSION) < 0) {
+    if (compare_version(protocol_version, LRMD_MIN_PROTOCOL_VERSION) < 0) {
         crm_err("Cluster API version must be greater than or equal to %s, not %s",
-                LRMD_PROTOCOL_VERSION, protocol_version);
+                LRMD_MIN_PROTOCOL_VERSION, protocol_version);
         crm_xml_add_int(reply, F_LRMD_RC, -EPROTO);
-        crm_xml_add(reply, F_LRMD_PROTOCOL_VERSION, LRMD_PROTOCOL_VERSION);
     }
 
     crm_xml_add(reply, F_LRMD_OPERATION, CRM_OP_REGISTER);
openSUSE Build Service is sponsored by