projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f9ab8e2
)
Better default output file for generated public keys.
author
Guus Sliepen
<guus@tinc-vpn.org>
Fri, 8 Mar 2013 10:24:37 +0000
(11:24 +0100)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Fri, 8 Mar 2013 10:24:37 +0000
(11:24 +0100)
src/tincctl.c
patch
|
blob
|
history
diff --git
a/src/tincctl.c
b/src/tincctl.c
index
45bf6ee
..
ea96fa1
100644
(file)
--- a/
src/tincctl.c
+++ b/
src/tincctl.c
@@
-1199,10
+1199,11
@@
static int rstrip(char *value) {
return len;
}
return len;
}
-static char *get_my_name() {
+static char *get_my_name(
bool verbose
) {
FILE *f = fopen(tinc_conf, "r");
if(!f) {
FILE *f = fopen(tinc_conf, "r");
if(!f) {
- fprintf(stderr, "Could not open %s: %s\n", tinc_conf, strerror(errno));
+ if(verbose)
+ fprintf(stderr, "Could not open %s: %s\n", tinc_conf, strerror(errno));
return NULL;
}
return NULL;
}
@@
-1228,7
+1229,8
@@
static char *get_my_name() {
}
fclose(f);
}
fclose(f);
- fprintf(stderr, "Could not find Name in %s.\n", tinc_conf);
+ if(verbose)
+ fprintf(stderr, "Could not find Name in %s.\n", tinc_conf);
return NULL;
}
return NULL;
}
@@
-1402,7
+1404,7
@@
static int cmd_config(int argc, char *argv[]) {
/* Should this go into our own host config file? */
if(!node && !(variables[i].type & VAR_SERVER)) {
/* Should this go into our own host config file? */
if(!node && !(variables[i].type & VAR_SERVER)) {
- node = get_my_name();
+ node = get_my_name(
true
);
if(!node)
return 1;
}
if(!node)
return 1;
}
@@
-1692,6
+1694,9
@@
static int cmd_generate_keys(int argc, char *argv[]) {
return 1;
}
return 1;
}
+ if(!name)
+ name = get_my_name(false);
+
return !(rsa_keygen(argc > 1 ? atoi(argv[1]) : 2048, true) && ecdsa_keygen(true));
}
return !(rsa_keygen(argc > 1 ? atoi(argv[1]) : 2048, true) && ecdsa_keygen(true));
}
@@
-1701,6
+1706,9
@@
static int cmd_generate_rsa_keys(int argc, char *argv[]) {
return 1;
}
return 1;
}
+ if(!name)
+ name = get_my_name(false);
+
return !rsa_keygen(argc > 1 ? atoi(argv[1]) : 2048, true);
}
return !rsa_keygen(argc > 1 ? atoi(argv[1]) : 2048, true);
}
@@
-1710,6
+1718,9
@@
static int cmd_generate_ecdsa_keys(int argc, char *argv[]) {
return 1;
}
return 1;
}
+ if(!name)
+ name = get_my_name(false);
+
return !ecdsa_keygen(true);
}
return !ecdsa_keygen(true);
}
@@
-1831,7
+1842,7
@@
static int cmd_export(int argc, char *argv[]) {
return 1;
}
return 1;
}
- char *name = get_my_name();
+ char *name = get_my_name(
true
);
if(!name)
return 1;
if(!name)
return 1;