Kill the client-0.2.6 compatibility mode and the --plain option.
[paraslash.git] / client_common.c
index 5bce7fb4c21d7a9dfaa6e7e0a220fe57bc7ad8e0..deb3a26ded485f79855516fcd2c1c5f9772761b6 100644 (file)
@@ -179,8 +179,7 @@ static void client_post_select(struct sched *s, struct task *t)
                        ct->status = CL_RECEIVED_WELCOME;
                return;
        case CL_RECEIVED_WELCOME: /* send auth command */
-               sprintf(ct->buf, "auth %s%s", ct->conf.plain_given?
-                       "" : "rc4 ", ct->user);
+               sprintf(ct->buf, "auth rc4 %s", ct->user);
                PARA_INFO_LOG("--> %s\n", ct->buf);
                t->error = send_buffer(ct->fd, ct->buf);
                if (t->error >= 0)
@@ -221,13 +220,11 @@ static void client_post_select(struct sched *s, struct task *t)
                bytes_received = t->error;
                PARA_DEBUG_LOG("++++ server info ++++\n%s\n++++ end of server "
                        "info ++++\n", ct->buf);
-               /* check if server has sent "Proceed" message */
+               /* check if server has sent "Proceed" message and the rc4 keys */
                t->error = -E_CLIENT_AUTH;
-               if (!strstr(ct->buf, PROCEED_MSG))
+               if (bytes_received < PROCEED_MSG_LEN + 2 * RC4_KEY_LEN)
                        return;
-               t->error = 0;
-               ct->status = CL_RECEIVED_PROCEED;
-               if (bytes_received < PROCEED_MSG_LEN + 32)
+               if (!strstr(ct->buf, PROCEED_MSG))
                        return;
                PARA_INFO_LOG("decrypting session key\n");
                t->error = para_decrypt_buffer(ct->key_file, rc4_buf,
@@ -238,6 +235,8 @@ static void client_post_select(struct sched *s, struct task *t)
                RC4_set_key(&ct->rc4_send_key, RC4_KEY_LEN, rc4_buf);
                RC4_set_key(&ct->rc4_recv_key, RC4_KEY_LEN, rc4_buf + RC4_KEY_LEN);
                enable_crypt(ct->fd, rc4_recv, rc4_send, ct);
+               ct->status = CL_RECEIVED_PROCEED;
+               return;
                }
        case CL_RECEIVED_PROCEED: /* concat args and send command */
                {