server: Do not fail if client does not request sideband.
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 3 Jul 2016 10:45:15 +0000 (12:45 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 17 Jul 2016 11:32:13 +0000 (13:32 +0200)
Currently we insist that clients request the sideband feature during
the initial handshake. This check was introduced long ago to detect
incompatible 0.4.x clients and fail the connection early and gracefully
for those clients. These days the check is no longer needed and can
be removed.

para_server still announces the sideband feature and accepts the
sideband request, although it makes no difference any more whether
or not the client requests the feature. Therefore this change has no
impact on compatibility with 0.5.x clients.

command.c

index 93de2d2..0eb4efc 100644 (file)
--- a/command.c
+++ b/command.c
@@ -807,7 +807,6 @@ static void reset_signals(void)
 }
 
 struct connection_features {
-       bool sideband_requested;
        bool aes_ctr128_requested;
 };
 
@@ -835,8 +834,8 @@ static int parse_auth_request(char *buf, int len, struct user **u,
                create_argv(p, ",", &features);
                for (i = 0; features[i]; i++) {
                        if (strcmp(features[i], "sideband") == 0)
-                               cf->sideband_requested = true;
-                       else if (strcmp(features[i], "aes_ctr128") == 0)
+                               continue;
+                       if (strcmp(features[i], "aes_ctr128") == 0)
                                cf->aes_ctr128_requested = true;
                        else {
                                ret = -E_BAD_FEATURE;
@@ -949,11 +948,6 @@ __noreturn void handle_connect(int fd, const char *peername)
        ret = parse_auth_request(buf, ret, &cc->u, &cf);
        if (ret < 0)
                goto net_err;
-       if (!cf.sideband_requested) { /* sideband is mandatory */
-               PARA_ERROR_LOG("client did not request sideband\n");
-               ret = -E_BAD_FEATURE;
-               goto net_err;
-       }
        if (cc->u) {
                get_random_bytes_or_die(rand_buf, sizeof(rand_buf));
                ret = pub_encrypt(cc->u->pubkey, rand_buf, sizeof(rand_buf),