warp-vpn

simple point to point tunnel
git clone git://git.2f30.org/warp-vpn.git
Log | Files | Refs | README

commit 2a21b5eb3b71a37e7861320568e2855fd20e4f41
parent fb4afdaecb88ac6d33cc09dee5ff7a3c5e0944a9
Author: sin <sin@2f30.org>
Date:   Tue Apr 12 16:15:22 +0100

fix indentation

Diffstat:
auth.c | 36++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/auth.c b/auth.c @@ -36,15 +36,15 @@ challenge(int netfd) if (pfd[0].revents & (POLLIN | POLLHUP)) { ret = netread(netfd, buf, sizeof(buf), &outlen); - if (ret == PKTFAILED) { + if (ret == PKTFAILED) return -1; - } else if (ret == PKTCOMPLETE) { - if (outlen != sizeof(buf)) - return -1; - reply = unpack64(buf); - if (n + 1 == reply) - return 0; - } + else if (ret == PKTPARTIAL) + continue; + if (outlen != sizeof(buf)) + return -1; + reply = unpack64(buf); + if (n + 1 == reply) + return 0; } } return -1; @@ -73,17 +73,17 @@ response(int netfd) if (pfd[0].revents & (POLLIN | POLLHUP)) { ret = netread(netfd, buf, sizeof(buf), &outlen); - if (ret == PKTFAILED) { + if (ret == PKTFAILED) + return -1; + else if (ret == PKTPARTIAL) + continue; + if (outlen != sizeof(buf)) + return -1; + reply = unpack64(buf); + pack64(buf, reply + 1); + if (netwrite(netfd, buf, sizeof(buf), &outlen) == PKTFAILED) return -1; - } else if (ret == PKTCOMPLETE) { - if (outlen != sizeof(buf)) - return -1; - reply = unpack64(buf); - pack64(buf, reply + 1); - if (netwrite(netfd, buf, sizeof(buf), &outlen) == PKTFAILED) - return -1; - break; - } + break; } } return 0;