projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't include .svn directory in sample configuration.
[tinc]
/
src
/
net_setup.c
diff --git
a/src/net_setup.c
b/src/net_setup.c
index
e71d446
..
7896add
100644
(file)
--- a/
src/net_setup.c
+++ b/
src/net_setup.c
@@
-1,7
+1,7
@@
/*
net_setup.c -- Setup.
/*
net_setup.c -- Setup.
- Copyright (C) 1998-200
3 Ivo Timmermans <ivo@o2w.nl
>,
- 2000-200
3 Guus Sliepen <guus@sliepen.eu
.org>
+ Copyright (C) 1998-200
4 Ivo Timmermans <ivo@tinc-vpn.org
>,
+ 2000-200
4 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
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id
: net_setup.c,v 1.1.2.48 2003/12/20 19:47:52 guus Exp
$
+ $Id$
*/
#include "system.h"
*/
#include "system.h"
@@
-150,17
+150,23
@@
bool read_rsa_public_key(connection_t *c)
bool read_rsa_private_key(void)
{
FILE *fp;
bool read_rsa_private_key(void)
{
FILE *fp;
- char *fname, *key;
+ char *fname, *key
, *pubkey
;
struct stat s;
cp();
if(get_config_string(lookup_config(config_tree, "PrivateKey"), &key)) {
struct stat s;
cp();
if(get_config_string(lookup_config(config_tree, "PrivateKey"), &key)) {
+ if(!get_config_string(lookup_config(myself->connection->config_tree, "PublicKey"), &pubkey)) {
+ logger(LOG_ERR, _("PrivateKey used but no PublicKey found!"));
+ return false;
+ }
myself->connection->rsa_key = RSA_new();
// RSA_blinding_on(myself->connection->rsa_key, NULL);
BN_hex2bn(&myself->connection->rsa_key->d, key);
myself->connection->rsa_key = RSA_new();
// RSA_blinding_on(myself->connection->rsa_key, NULL);
BN_hex2bn(&myself->connection->rsa_key->d, key);
+ BN_hex2bn(&myself->connection->rsa_key->n, pubkey);
BN_hex2bn(&myself->connection->rsa_key->e, "FFFF");
free(key);
BN_hex2bn(&myself->connection->rsa_key->e, "FFFF");
free(key);
+ free(pubkey);
return true;
}
return true;
}
@@
-242,19
+248,15
@@
bool setup_myself(void)
myself->name = name;
myself->connection->name = xstrdup(name);
myself->name = name;
myself->connection->name = xstrdup(name);
- if(!read_rsa_private_key())
- return false;
-
if(!read_connection_config(myself->connection)) {
logger(LOG_ERR, _("Cannot open host configuration file for myself!"));
return false;
}
if(!read_connection_config(myself->connection)) {
logger(LOG_ERR, _("Cannot open host configuration file for myself!"));
return false;
}
- if(!read_rsa_p
ublic_key(myself->connection
))
+ if(!read_rsa_p
rivate_key(
))
return false;
return false;
- if(!get_config_string
- (lookup_config(myself->connection->config_tree, "Port"), &myport))
+ if(!get_config_string(lookup_config(myself->connection->config_tree, "Port"), &myport))
asprintf(&myport, "655");
/* Read in all the subnets specified in the host configuration file */
asprintf(&myport, "655");
/* Read in all the subnets specified in the host configuration file */
@@
-284,8
+286,8
@@
bool setup_myself(void)
if(get_config_bool(lookup_config(myself->connection->config_tree, "TCPOnly"), &choice) && choice)
myself->options |= OPTION_TCPONLY;
if(get_config_bool(lookup_config(myself->connection->config_tree, "TCPOnly"), &choice) && choice)
myself->options |= OPTION_TCPONLY;
- if(get_config_bool(lookup_config(myself->connection->config_tree, "
DontFragment
"), &choice) && choice)
- myself->options |= OPTION_
DONTFRAGMENT
;
+ if(get_config_bool(lookup_config(myself->connection->config_tree, "
PMTUDiscovery
"), &choice) && choice)
+ myself->options |= OPTION_
PMTU_DISCOVERY
;
if(myself->options & OPTION_TCPONLY)
myself->options |= OPTION_INDIRECT;
if(myself->options & OPTION_TCPONLY)
myself->options |= OPTION_INDIRECT;