"\n"
"Valid commands are:\n"
" init [name] Create initial configuration files.\n"
- " config Change configuration:\n"
- " [get] VARIABLE - print current value of VARIABLE\n"
- " [set] VARIABLE VALUE - set VARIABLE to VALUE\n"
- " add VARIABLE VALUE - add VARIABLE with the given VALUE\n"
- " del VARIABLE [VALUE] - remove VARIABLE [only ones with watching VALUE]\n"
+ " get VARIABLE Print current value of VARIABLE\n"
+ " set VARIABLE VALUE Set VARIABLE to VALUE\n"
+ " add VARIABLE VALUE Add VARIABLE with the given VALUE\n"
+ " del VARIABLE [VALUE] Remove VARIABLE [only ones with watching VALUE]\n"
" start [tincd options] Start tincd.\n"
" stop Stop tincd.\n"
" restart Restart tincd.\n"
top(fd);
return 0;
#else
- fprintf(stderr, "This version of tincctl was compiled without support for the curses library.\n");
+ fprintf(stderr, "This version of tinc was compiled without support for the curses library.\n");
return 1;
#endif
}
return len;
}
-static char *get_my_name() {
+static char *get_my_name(bool verbose) {
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;
}
}
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 1;
}
+ if(strcasecmp(argv[0], "config"))
+ argv--, argc++;
+
int action = -2;
if(!strcasecmp(argv[1], "get")) {
argv++, argc--;
/* 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;
}
return 1;
}
+ if(!name)
+ name = get_my_name(false);
+
return !(rsa_keygen(argc > 1 ? atoi(argv[1]) : 2048, true) && ecdsa_keygen(true));
}
return 1;
}
+ if(!name)
+ name = get_my_name(false);
+
return !rsa_keygen(argc > 1 ? atoi(argv[1]) : 2048, true);
}
return 1;
}
+ if(!name)
+ name = get_my_name(false);
+
return !ecdsa_keygen(true);
}
return 1;
}
- char *name = get_my_name();
+ char *name = get_my_name(true);
if(!name)
return 1;
int result = export(name, stdout);
if(!tty)
fclose(stdout);
+
+ free(name);
return result;
}
{"log", cmd_log},
{"pid", cmd_pid},
{"config", cmd_config},
+ {"add", cmd_config},
+ {"del", cmd_config},
+ {"get", cmd_config},
+ {"set", cmd_config},
+ {"change", cmd_config},
+ {"replace", cmd_config},
{"init", cmd_init},
{"generate-keys", cmd_generate_keys},
{"generate-rsa-keys", cmd_generate_rsa_keys},