]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Reject non-sideband connections.
authorAndre Noll <maan@systemlinux.org>
Mon, 23 Jul 2012 17:07:07 +0000 (19:07 +0200)
committerAndre Noll <maan@systemlinux.org>
Mon, 1 Apr 2013 02:19:28 +0000 (02:19 +0000)
This makes the client abort the connection if the server does not
support sideband. Conversely, the server closes the socket if the
client did not request a sideband connection.

This breaks compatibility with earlier versions of para_server and
para_client but allows to clean up the code considerably.

client_common.c
command.c
error.h

index 7bdb4738bab5feb15b4c7acb1180decb61ccfda5..a3a471aedaab1f79a3f3091bf61572a716248598 100644 (file)
@@ -345,6 +345,11 @@ static void client_post_select(struct sched *s, struct task *t)
                if (ret < 0 || n == 0)
                        goto out;
                ct->features = parse_features(buf);
+               if (!has_feature("sideband", ct)) {
+                       PARA_ERROR_LOG("server has no sideband support\n");
+                       ret = -E_INCOMPAT_FEAT;
+                       goto out;
+               }
                ct->status = CL_RECEIVED_WELCOME;
                return;
        case CL_RECEIVED_WELCOME: /* send auth command */
index 39470fa92e771b0f34da6d724bbaf12c39474203..9b279f7d5eb142f61a76fc0ae3d780da93400c5e 100644 (file)
--- a/command.c
+++ b/command.c
@@ -904,6 +904,11 @@ static int parse_auth_request(char *buf, int len, struct user **u,
                        }
                }
        }
+       if (*use_sideband == false) { /* sideband is mandatory */
+               PARA_ERROR_LOG("client did not request sideband\n");
+               ret = -E_BAD_FEATURE;
+               goto out;
+       }
        PARA_DEBUG_LOG("received auth request for user %s (sideband = %s)\n",
                username, *use_sideband? "true" : "false");
        *u = lookup_user(username);
diff --git a/error.h b/error.h
index ca172cb4032bc0e624b7122fdc26281161e10f4c..844c0045d0d2a7287d70b0bd1ed95901971fbbe3 100644 (file)
--- a/error.h
+++ b/error.h
@@ -289,6 +289,7 @@ extern const char **para_errlist[];
        PARA_ERROR(SERVER_EOF, "connection closed by para_server"), \
        PARA_ERROR(SERVER_CMD_SUCCESS, "command terminated successfully"), \
        PARA_ERROR(SERVER_CMD_FAILURE, "command failed"), \
+       PARA_ERROR(INCOMPAT_FEAT, "client/server incompatibility"), \
 
 
 #define SCHED_ERRORS \
@@ -463,7 +464,7 @@ extern const char **para_errlist[];
        PARA_ERROR(SENDER_CMD, "command not supported by this sender"), \
        PARA_ERROR(SERVER_CRASH, "para_server crashed -- can not live without it"), \
        PARA_ERROR(BAD_USER, "auth request for invalid user"), \
-       PARA_ERROR(BAD_FEATURE, "request for unknown or invalid feature"), \
+       PARA_ERROR(BAD_FEATURE, "invalid feature request"), \
        PARA_ERROR(BAD_AUTH, "authentication failure"), \