server: Lookup user only once.
authorAndre Noll <maan@systemlinux.org>
Mon, 2 Dec 2013 18:52:35 +0000 (19:52 +0100)
committerAndre Noll <maan@systemlinux.org>
Fri, 20 Dec 2013 19:55:56 +0000 (20:55 +0100)
parse_auth_request() already sets cc->u, there is no need to call it
again here.

command.c

index 3d40023..34d6841 100644 (file)
--- a/command.c
+++ b/command.c
@@ -889,7 +889,7 @@ __noreturn void handle_connect(int fd, const char *peername)
        int ret;
        unsigned char rand_buf[CHALLENGE_SIZE + 2 * SESSION_KEY_LEN];
        unsigned char challenge_hash[HASH_SIZE];
-       char *p, *command = NULL, *buf = para_malloc(HANDSHAKE_BUFSIZE) /* must be on the heap */;
+       char *command = NULL, *buf = para_malloc(HANDSHAKE_BUFSIZE) /* must be on the heap */;
        size_t numbytes;
        struct command_context cc_struct = {.peer = peername}, *cc = &cc_struct;
        struct iovec iov;
@@ -914,9 +914,6 @@ __noreturn void handle_connect(int fd, const char *peername)
        ret = parse_auth_request(buf, ret, &cc->u);
        if (ret < 0)
                goto net_err;
-       p = buf + strlen(AUTH_REQUEST_MSG);
-       PARA_DEBUG_LOG("received auth request for user %s\n", p);
-       cc->u = lookup_user(p);
        if (cc->u) {
                get_random_bytes_or_die(rand_buf, sizeof(rand_buf));
                ret = pub_encrypt(cc->u->pubkey, rand_buf, sizeof(rand_buf),