#include "splay_tree.h"
#include "connection.h"
#include "conf.h"
+#include "list.h"
#include "logger.h"
#include "netutl.h" /* for str2address */
#include "protocol.h"
}
bool get_config_subnet(const config_t *cfg, subnet_t ** result) {
- subnet_t subnet = {0};
+ subnet_t subnet = {NULL};
if(!cfg)
return false;
}
}
-bool read_server_config() {
+bool read_server_config(void) {
char *fname;
bool x;
return x;
}
+bool append_config_file(const char *name, const char *key, const char *value) {
+ char *fname;
+ xasprintf(&fname, "%s/hosts/%s", confbase, name);
+
+ FILE *fp = fopen(fname, "a");
+
+ if(!fp) {
+ logger(LOG_ERR, "Cannot open config file %s: %s", fname, strerror(errno));
+ } else {
+ fprintf(fp, "\n# The following line was automatically added by tinc\n%s = %s\n", key, value);
+ fclose(fp);
+ }
+
+ free(fname);
+
+ return fp;
+}
+
bool disable_old_keys(FILE *f) {
char buf[100];
long pos;