projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't forget to send a newline when forwarding requests.
[tinc]
/
src
/
protocol_auth.c
diff --git
a/src/protocol_auth.c
b/src/protocol_auth.c
index
3bf18b2
..
057b88e
100644
(file)
--- a/
src/protocol_auth.c
+++ b/
src/protocol_auth.c
@@
-1,7
+1,7
@@
/*
protocol_auth.c -- handle the meta-protocol, authentication
Copyright (C) 1999-2005 Ivo Timmermans,
/*
protocol_auth.c -- handle the meta-protocol, authentication
Copyright (C) 1999-2005 Ivo Timmermans,
- 2000-201
0
Guus Sliepen <guus@tinc-vpn.org>
+ 2000-201
2
Guus Sliepen <guus@tinc-vpn.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-57,7
+57,7
@@
bool send_id(connection_t *c) {
return send_request(c, "%d %s %d.%d", ID, myself->connection->name, myself->connection->protocol_major, minor);
}
return send_request(c, "%d %s %d.%d", ID, myself->connection->name, myself->connection->protocol_major, minor);
}
-bool id_h(connection_t *c, char *request) {
+bool id_h(connection_t *c, c
onst c
har *request) {
char name[MAX_STRING_SIZE];
if(sscanf(request, "%*d " MAX_STRING " %d.%d", name, &c->protocol_major, &c->protocol_minor) < 2) {
char name[MAX_STRING_SIZE];
if(sscanf(request, "%*d " MAX_STRING " %d.%d", name, &c->protocol_major, &c->protocol_minor) < 2) {
@@
-72,6
+72,10
@@
bool id_h(connection_t *c, char *request) {
c->status.control = true;
c->allow_request = CONTROL;
c->last_ping_time = time(NULL) + 3600;
c->status.control = true;
c->allow_request = CONTROL;
c->last_ping_time = time(NULL) + 3600;
+
+ free(c->name);
+ c->name = xstrdup("<control>");
+
return send_request(c, "%d %d %d", ACK, TINC_CTL_VERSION_CURRENT, getpid());
}
return send_request(c, "%d %d %d", ACK, TINC_CTL_VERSION_CURRENT, getpid());
}
@@
-215,7
+219,7
@@
bool send_metakey(connection_t *c) {
return result;
}
return result;
}
-bool metakey_h(connection_t *c, char *request) {
+bool metakey_h(connection_t *c, c
onst c
har *request) {
char hexkey[MAX_STRING_SIZE];
int cipher, digest, maclength, compression;
size_t len = rsa_size(&myself->connection->rsa);
char hexkey[MAX_STRING_SIZE];
int cipher, digest, maclength, compression;
size_t len = rsa_size(&myself->connection->rsa);
@@
-289,7
+293,7
@@
bool send_challenge(connection_t *c) {
return send_request(c, "%d %s", CHALLENGE, buffer);
}
return send_request(c, "%d %s", CHALLENGE, buffer);
}
-bool challenge_h(connection_t *c, char *request) {
+bool challenge_h(connection_t *c, c
onst c
har *request) {
char buffer[MAX_STRING_SIZE];
size_t len = rsa_size(&myself->connection->rsa);
size_t digestlen = digest_length(&c->indigest);
char buffer[MAX_STRING_SIZE];
size_t len = rsa_size(&myself->connection->rsa);
size_t digestlen = digest_length(&c->indigest);
@@
-326,7
+330,7
@@
bool challenge_h(connection_t *c, char *request) {
return send_request(c, "%d %s", CHAL_REPLY, buffer);
}
return send_request(c, "%d %s", CHAL_REPLY, buffer);
}
-bool chal_reply_h(connection_t *c, char *request) {
+bool chal_reply_h(connection_t *c, c
onst c
har *request) {
char hishash[MAX_STRING_SIZE];
if(sscanf(request, "%*d " MAX_STRING, hishash) != 1) {
char hishash[MAX_STRING_SIZE];
if(sscanf(request, "%*d " MAX_STRING, hishash) != 1) {
@@
-447,7
+451,7
@@
static void send_everything(connection_t *c) {
}
}
}
}
-static bool upgrade_h(connection_t *c, char *request) {
+static bool upgrade_h(connection_t *c, c
onst c
har *request) {
char pubkey[MAX_STRING_SIZE];
if(sscanf(request, "%*d " MAX_STRING, pubkey) != 1) {
char pubkey[MAX_STRING_SIZE];
if(sscanf(request, "%*d " MAX_STRING, pubkey) != 1) {
@@
-466,7
+470,7
@@
static bool upgrade_h(connection_t *c, char *request) {
return send_termreq(c);
}
return send_termreq(c);
}
-bool ack_h(connection_t *c, char *request) {
+bool ack_h(connection_t *c, c
onst c
har *request) {
if(c->protocol_minor == 1)
return upgrade_h(c, request);
if(c->protocol_minor == 1)
return upgrade_h(c, request);