Have "tinc fsck" recognize Ed25519PublicKey statements.
This commit is contained in:
		
							parent
							
								
									6805b15731
								
							
						
					
					
						commit
						76955a6c8b
					
				
					 3 changed files with 14 additions and 9 deletions
				
			
		
							
								
								
									
										12
									
								
								src/fsck.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								src/fsck.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -281,7 +281,7 @@ int fsck(const char *argv0) {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	// 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))
 | 
			
		||||
| 
						 | 
				
			
			@ -342,13 +342,17 @@ int fsck(const char *argv0) {
 | 
			
		|||
			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)
 | 
			
		||||
	if(f) {
 | 
			
		||||
		ecdsa_pub = get_pubkey(f);
 | 
			
		||||
		if(!f) {
 | 
			
		||||
			rewind(f);
 | 
			
		||||
			ecdsa_pub = ecdsa_read_pem_public_key(f);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	fclose(f);
 | 
			
		||||
 | 
			
		||||
	if(ecdsa_priv) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
/*
 | 
			
		||||
    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
 | 
			
		||||
| 
						 | 
				
			
			@ -89,7 +89,7 @@ static struct option const long_options[] = {
 | 
			
		|||
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"
 | 
			
		||||
| 
						 | 
				
			
			@ -1433,7 +1433,7 @@ char *get_my_name(bool verbose) {
 | 
			
		|||
	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)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
/*
 | 
			
		||||
    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
 | 
			
		||||
| 
						 | 
				
			
			@ -50,6 +50,7 @@ extern bool sendline(int fd, char *format, ...);
 | 
			
		|||
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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue