}
// Check for public keys.
- // TODO: use RSAPublicKeyFile and Ed25519PublicKeyFile variables if present.
+ // TODO: use RSAPublicKeyFile variable if present.
snprintf(fname, sizeof fname, "%s/hosts/%s", confbase, name);
if(access(fname, R_OK))
fprintf(stderr, "WARNING: A public RSA key was found but no private key is known.\n");
}
#endif
- //
- // TODO: this should read the Ed25519PublicKey config variable instead.
+
ecdsa_t *ecdsa_pub = NULL;
f = fopen(fname, "r");
- if(f)
- ecdsa_pub = ecdsa_read_pem_public_key(f);
+ if(f) {
+ ecdsa_pub = get_pubkey(f);
+ if(!f) {
+ rewind(f);
+ ecdsa_pub = ecdsa_read_pem_public_key(f);
+ }
+ }
fclose(f);
if(ecdsa_priv) {
/*
tincctl.c -- Controlling a running tincd
- Copyright (C) 2007-2015 Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2007-2016 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
static void version(void) {
printf("%s version %s (built %s %s, protocol %d.%d)\n", PACKAGE,
BUILD_VERSION, BUILD_DATE, BUILD_TIME, PROT_MAJOR, PROT_MINOR);
- printf("Copyright (C) 1998-2015 Ivo Timmermans, Guus Sliepen and others.\n"
+ printf("Copyright (C) 1998-2016 Ivo Timmermans, Guus Sliepen and others.\n"
"See the AUTHORS file for a complete list.\n\n"
"tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n"
"and you are welcome to redistribute it under certain conditions;\n"
return NULL;
}
-static ecdsa_t *get_pubkey(FILE *f) {
+ecdsa_t *get_pubkey(FILE *f) {
char buf[4096];
char *value;
while(fgets(buf, sizeof buf, f)) {
/*
tincctl.h -- header for tincctl.c.
- Copyright (C) 2011-2013 Guus Sliepen <guus@tinc-vpn.org>
+ Copyright (C) 2011-2016 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
extern bool recvline(int fd, char *line, size_t len);
extern int check_port(char *name);
extern FILE *fopenmask(const char *filename, const char *mode, mode_t perms);
+extern ecdsa_t *get_pubkey(FILE *f);
#endif