MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id$
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
return send_request(c, "%d %s %d", ID, myself->connection->name,
myself->connection->protocol_version);
}
return send_request(c, "%d %s %d", ID, myself->connection->name,
myself->connection->protocol_version);
}
if(sscanf(c->buffer, "%*d " MAX_STRING " %d", name, &c->protocol_version) != 2) {
if(sscanf(c->buffer, "%*d " MAX_STRING " %d", name, &c->protocol_version) != 2) {
- logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ID", c->name,
+ logger(LOG_ERR, "Got bad %s from %s (%s)", "ID", c->name,
- logger(LOG_ERR, _("Got bad %s from %s (%s): %s"), "ID", c->name,
+ logger(LOG_ERR, "Got bad %s from %s (%s): %s", "ID", c->name,
- logger(LOG_ERR, _("Peer %s is %s instead of %s"), c->hostname, name,
+ logger(LOG_ERR, "Peer %s is %s instead of %s", c->hostname, name,
- logger(LOG_ERR, _("Peer %s had unknown identity (%s)"), c->hostname,
+ logger(LOG_ERR, "Peer %s had unknown identity (%s)", c->hostname,
len = RSA_size(c->rsa_key);
/* Allocate buffers for the meta key */
buffer = alloca(2 * len + 1);
len = RSA_size(c->rsa_key);
/* Allocate buffers for the meta key */
buffer = alloca(2 * len + 1);
/* Copy random data to the buffer */
RAND_pseudo_bytes((unsigned char *)c->outkey, len);
/* Copy random data to the buffer */
RAND_pseudo_bytes((unsigned char *)c->outkey, len);
*/
if(RSA_public_encrypt(len, (unsigned char *)c->outkey, (unsigned char *)buffer, c->rsa_key, RSA_NO_PADDING) != len) {
*/
if(RSA_public_encrypt(len, (unsigned char *)c->outkey, (unsigned char *)buffer, c->rsa_key, RSA_NO_PADDING) != len) {
(unsigned char *)c->outkey + len - c->outcipher->key_len,
(unsigned char *)c->outkey + len - c->outcipher->key_len -
c->outcipher->iv_len)) {
(unsigned char *)c->outkey + len - c->outcipher->key_len,
(unsigned char *)c->outkey + len - c->outcipher->key_len -
c->outcipher->iv_len)) {
c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL));
return false;
}
c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL));
return false;
}
char buffer[MAX_STRING_SIZE];
int cipher, digest, maclength, compression;
int len;
char buffer[MAX_STRING_SIZE];
int cipher, digest, maclength, compression;
int len;
if(sscanf(c->buffer, "%*d %d %d %d %d " MAX_STRING, &cipher, &digest, &maclength, &compression, buffer) != 5) {
if(sscanf(c->buffer, "%*d %d %d %d %d " MAX_STRING, &cipher, &digest, &maclength, &compression, buffer) != 5) {
- logger(LOG_ERR, _("Got bad %s from %s (%s)"), "METAKEY", c->name,
+ logger(LOG_ERR, "Got bad %s from %s (%s)", "METAKEY", c->name,
- logger(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name, c->hostname, "wrong keylength");
+ logger(LOG_ERR, "Possible intruder %s (%s): %s", c->name, c->hostname, "wrong keylength");
/* Decrypt the meta key */
if(RSA_private_decrypt(len, (unsigned char *)buffer, (unsigned char *)c->inkey, myself->connection->rsa_key, RSA_NO_PADDING) != len) { /* See challenge() */
/* Decrypt the meta key */
if(RSA_private_decrypt(len, (unsigned char *)buffer, (unsigned char *)c->inkey, myself->connection->rsa_key, RSA_NO_PADDING) != len) { /* See challenge() */
- logger(LOG_ERR, _("%s (%s) uses unknown cipher!"), c->name, c->hostname);
+ logger(LOG_ERR, "%s (%s) uses unknown cipher!", c->name, c->hostname);
(unsigned char *)c->inkey + len - c->incipher->key_len,
(unsigned char *)c->inkey + len - c->incipher->key_len -
c->incipher->iv_len)) {
(unsigned char *)c->inkey + len - c->incipher->key_len,
(unsigned char *)c->inkey + len - c->incipher->key_len -
c->incipher->iv_len)) {
c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL));
return false;
}
c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL));
return false;
}
- logger(LOG_ERR, _("Node %s (%s) uses unknown digest!"), c->name, c->hostname);
+ logger(LOG_ERR, "Node %s (%s) uses unknown digest!", c->name, c->hostname);
- logger(LOG_ERR, _("%s (%s) uses bogus MAC length!"), c->name, c->hostname);
+ logger(LOG_ERR, "%s (%s) uses bogus MAC length!", c->name, c->hostname);
return send_request(c, "%d %s", CHALLENGE, buffer);
}
return send_request(c, "%d %s", CHALLENGE, buffer);
}
- logger(LOG_ERR, _("Got bad %s from %s (%s)"), "CHALLENGE", c->name,
+ logger(LOG_ERR, "Got bad %s from %s (%s)", "CHALLENGE", c->name,
- logger(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name,
+ logger(LOG_ERR, "Possible intruder %s (%s): %s", c->name,
c->hostname, "wrong challenge length");
return false;
}
/* Allocate buffers for the challenge */
c->hostname, "wrong challenge length");
return false;
}
/* Allocate buffers for the challenge */
/* Calculate the hash from the challenge we received */
if(!EVP_DigestInit(&ctx, c->indigest)
|| !EVP_DigestUpdate(&ctx, c->mychallenge, RSA_size(myself->connection->rsa_key))
|| !EVP_DigestFinal(&ctx, (unsigned char *)hash, NULL)) {
/* Calculate the hash from the challenge we received */
if(!EVP_DigestInit(&ctx, c->indigest)
|| !EVP_DigestUpdate(&ctx, c->mychallenge, RSA_size(myself->connection->rsa_key))
|| !EVP_DigestFinal(&ctx, (unsigned char *)hash, NULL)) {
c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL));
return false;
}
c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL));
return false;
}
return send_request(c, "%d %s", CHAL_REPLY, hash);
}
return send_request(c, "%d %s", CHAL_REPLY, hash);
}
- logger(LOG_ERR, _("Got bad %s from %s (%s)"), "CHAL_REPLY", c->name,
+ logger(LOG_ERR, "Got bad %s from %s (%s)", "CHAL_REPLY", c->name,
/* Check if the length of the hash is all right */
if(strlen(hishash) != c->outdigest->md_size * 2) {
/* Check if the length of the hash is all right */
if(strlen(hishash) != c->outdigest->md_size * 2) {
- logger(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name,
- c->hostname, _("wrong challenge reply length"));
+ logger(LOG_ERR, "Possible intruder %s (%s): %s", c->name,
+ c->hostname, "wrong challenge reply length");
if(!EVP_DigestInit(&ctx, c->outdigest)
|| !EVP_DigestUpdate(&ctx, c->hischallenge, RSA_size(c->rsa_key))
|| !EVP_DigestFinal(&ctx, (unsigned char *)myhash, NULL)) {
if(!EVP_DigestInit(&ctx, c->outdigest)
|| !EVP_DigestUpdate(&ctx, c->hischallenge, RSA_size(c->rsa_key))
|| !EVP_DigestFinal(&ctx, (unsigned char *)myhash, NULL)) {
c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL));
return false;
}
c->name, c->hostname, ERR_error_string(ERR_get_error(), NULL));
return false;
}
/* Verify the incoming hash with the calculated hash */
if(memcmp(hishash, myhash, c->outdigest->md_size)) {
/* Verify the incoming hash with the calculated hash */
if(memcmp(hishash, myhash, c->outdigest->md_size)) {
- logger(LOG_ERR, _("Possible intruder %s (%s): %s"), c->name,
- c->hostname, _("wrong challenge reply"));
+ logger(LOG_ERR, "Possible intruder %s (%s): %s", c->name,
+ c->hostname, "wrong challenge reply");
ifdebug(SCARY_THINGS) {
bin2hex(myhash, hishash, SHA_DIGEST_LENGTH);
hishash[SHA_DIGEST_LENGTH * 2] = '\0';
ifdebug(SCARY_THINGS) {
bin2hex(myhash, hishash, SHA_DIGEST_LENGTH);
hishash[SHA_DIGEST_LENGTH * 2] = '\0';
/* ACK message contains rest of the information the other end needs
to create node_t and edge_t structures. */
struct timeval now;
bool choice;
/* ACK message contains rest of the information the other end needs
to create node_t and edge_t structures. */
struct timeval now;
bool choice;
if((get_config_bool(lookup_config(c->config_tree, "TCPOnly"), &choice) && choice) || myself->options & OPTION_TCPONLY)
c->options |= OPTION_TCPONLY | OPTION_INDIRECT;
if((get_config_bool(lookup_config(c->config_tree, "TCPOnly"), &choice) && choice) || myself->options & OPTION_TCPONLY)
c->options |= OPTION_TCPONLY | OPTION_INDIRECT;
- return send_request(c, "%d %s %d %lx", ACK, myport, c->estimated_weight, c->options);
+ return send_request(c, "%d %s %d %x", ACK, myport, c->estimated_weight, c->options);
char hisport[MAX_STRING_SIZE];
char *hisaddress, *dummy;
int weight, mtu;
char hisport[MAX_STRING_SIZE];
char *hisaddress, *dummy;
int weight, mtu;
- cp();
-
- if(sscanf(c->buffer, "%*d " MAX_STRING " %d %lx", hisport, &weight, &options) != 3) {
- logger(LOG_ERR, _("Got bad %s from %s (%s)"), "ACK", c->name,
+ if(sscanf(c->buffer, "%*d " MAX_STRING " %d %x", hisport, &weight, &options) != 3) {
+ logger(LOG_ERR, "Got bad %s from %s (%s)", "ACK", c->name,
- ifdebug(CONNECTIONS) logger(LOG_DEBUG, _("Established a second connection with %s (%s), closing old connection"),
+ ifdebug(CONNECTIONS) logger(LOG_DEBUG, "Established a second connection with %s (%s), closing old connection",
n->name, n->hostname);
terminate_connection(n->connection, false);
/* Run graph algorithm to purge key and make sure up/down scripts are rerun with new IP addresses and stuff */
n->name, n->hostname);
terminate_connection(n->connection, false);
/* Run graph algorithm to purge key and make sure up/down scripts are rerun with new IP addresses and stuff */
- ifdebug(CONNECTIONS) logger(LOG_NOTICE, _("Connection with %s (%s) activated"), c->name,
+ ifdebug(CONNECTIONS) logger(LOG_NOTICE, "Connection with %s (%s) activated", c->name,