projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid printing duplicate messages from read_rsa_keys
[tinc]
/
src
/
net.c
diff --git
a/src/net.c
b/src/net.c
index
3dd9974
..
14a951f
100644
(file)
--- a/
src/net.c
+++ b/
src/net.c
@@
-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.c,v 1.35.4.8
3 2000/11/30 20:08:41
zarq Exp $
+ $Id: net.c,v 1.35.4.8
5 2000/11/30 22:48:48
zarq Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-59,6
+59,12
@@
# include <err.h>
#endif
# include <err.h>
#endif
+#ifdef HAVE_OPENSSL_PEM_H
+# include <openssl/pem.h>
+#else
+# include <pem.h>
+#endif
+
#ifdef HAVE_TUNTAP
#include LINUX_IF_TUN_H
#endif
#ifdef HAVE_TUNTAP
#include LINUX_IF_TUN_H
#endif
@@
-698,11
+704,18
@@
int read_rsa_private_key(RSA **key, const char *file)
if((fp = fopen(file, "r")) == NULL)
{
if((fp = fopen(file, "r")) == NULL)
{
- syslog(LOG_ERR, _("Error reading file `%s': %m"),
+ syslog(LOG_ERR, _("Error reading
RSA key
file `%s': %m"),
file);
return -1;
}
file);
return -1;
}
- PEM_read_RSAPrivateKey(fp, key, NULL, NULL);
+ if(PEM_read_RSAPrivateKey(fp, key, NULL, NULL) == NULL)
+ {
+ syslog(LOG_ERR, _("Reading RSA private key file `%s' failed: %m"),
+ cfg->data.ptr);
+ return -1;
+ }
+
+ return 0;
}
int read_rsa_keys(void)
}
int read_rsa_keys(void)
@@
-716,6
+729,7
@@
int read_rsa_keys(void)
}
myself->rsa_key = RSA_new();
}
myself->rsa_key = RSA_new();
+
return read_rsa_private_key(&(myself->rsa_key), cfg->data.ptr);
}
return read_rsa_private_key(&(myself->rsa_key), cfg->data.ptr);
}