From b4954b50d50fdff5e7a7ffab311b41b88f856095 Mon Sep 17 00:00:00 2001 From: Lubos Slovak <lubos.slovak@nic.cz> Date: Mon, 7 Mar 2011 16:05:00 +0100 Subject: [PATCH] Replaced all usages of name 'CuteDNS' by 'knot' --- CodingStyle | 2 +- Knot.files | 1 - src/conf/conf.c | 15 ++++++--- src/conf/conf.h | 10 +++--- src/conf/cutedns.conf.example | 61 ----------------------------------- src/conf/logconf.h | 6 ++-- src/dnslib/zone-dump.c | 6 ++-- src/dnslib/zone-load.c | 6 ++-- src/tests/conf_tests.c | 2 +- src/tests/files/sample_conf | 6 ++-- 10 files changed, 29 insertions(+), 86 deletions(-) delete mode 100644 src/conf/cutedns.conf.example diff --git a/CodingStyle b/CodingStyle index 877f98b823..7ad5893365 100644 --- a/CodingStyle +++ b/CodingStyle @@ -5,7 +5,7 @@ Coding style * Max line width: 80 chars * Pointer asterisk attached to the name of the variable * Own structures/types: _t suffix (f.e. nameserver_t) -* Header guard format: _CUTEDNS_HEADER_H_ +* Header guard format: _KNOT_HEADER_H_ * Spaces around binary operators * Space between keyword and bracket (f.e. "if (predicate)") * No space between variable and typecast (f.e. "return (int)val;") diff --git a/Knot.files b/Knot.files index 10440f8f7d..8ca0e519ec 100644 --- a/Knot.files +++ b/Knot.files @@ -117,5 +117,4 @@ src/conf/conf.c src/conf/conf.h src/conf/logconf.c src/conf/logconf.h -src/conf/cutedns.conf.example tests/querytcp.c diff --git a/src/conf/conf.c b/src/conf/conf.c index 6dc6de3cc6..8f37289369 100644 --- a/src/conf/conf.c +++ b/src/conf/conf.c @@ -10,6 +10,11 @@ #include "conf/conf.h" #include "common.h" +static const char *DEFAULT_CONFIG_1 = "/." PROJECT_EXEC "/" PROJECT_EXEC \ + ".conf"; +static const char *DEFAULT_CONFIG_2 = "/etc/" PROJECT_EXEC "/" PROJECT_EXEC \ + ".conf"; + /* Utilities. */ static char* strcdup(const char *s1, const char *s2) { @@ -147,7 +152,7 @@ static int conf_process(conf_t *conf) } // Create PID file - conf->pidfile = strcdup(conf->storage, "/cutedns.pid"); + conf->pidfile = strcdup(conf->storage, "/" PID_FILE); // Postprocess zones node *n = 0; @@ -427,18 +432,18 @@ void conf_free(conf_t *conf) char* conf_find_default() { - /* Try ~/.cutedns/cutedns.conf first. */ + /* Try DEFAULT_CONFIG_1 first. */ const char *dir = getenv("HOME"); - const char *name = "/.cutedns/cutedns.conf"; + const char *name = DEFAULT_CONFIG_1; char *path = strcdup(dir, name); struct stat st; if (stat(path, &st) != 0) { - const char* fallback_path = "/etc/cutedns/cutedns.conf"; + const char* fallback_path = DEFAULT_CONFIG_2; log_server_error("config: Trying '%s' as default configuration.\n", path); free(path); - /* Try /etc/cutedns/cutedns.conf as a fallback. */ + /* Try DEFAULT_CONFIG_2 as a fallback. */ path = strdup(fallback_path); } diff --git a/src/conf/conf.h b/src/conf/conf.h index db68be2d53..510d78a7d1 100644 --- a/src/conf/conf.h +++ b/src/conf/conf.h @@ -9,8 +9,8 @@ * \{ */ -#ifndef _CUTEDNS_CONF_H_ -#define _CUTENDS_CONF_H_ +#ifndef _KNOT_CONF_H_ +#define _KNOT_CONF_H_ #include <sys/types.h> #include <sys/socket.h> @@ -237,8 +237,8 @@ void conf_free(conf_t *conf); * \brief Find implicit configuration file. * * Ordering: - * 1. ~/.cutedns/cutedns.conf (if exists) - * 2. /etc/cutedns/cutedns.conf (fallback) + * 1. ~/.knot/knot.conf (if exists) + * 2. /etc/knot/knot.conf (fallback) * * \return Path to implicit configuration file. */ @@ -281,6 +281,6 @@ static inline conf_t* conf() { */ char* strcpath(char *path); -#endif /* _CUTEDNS_CONF_H_ */ +#endif /* _KNOT_CONF_H_ */ /*! \} */ diff --git a/src/conf/cutedns.conf.example b/src/conf/cutedns.conf.example deleted file mode 100644 index 1b28659a5d..0000000000 --- a/src/conf/cutedns.conf.example +++ /dev/null @@ -1,61 +0,0 @@ -# configuration file will follow bird (and juniper) type of configuration file -# i.e. curly brackets will be used; - -# what to do with }; -# a) ignore ; if it follows } - -system { - - identity "I have no mouth and must scream"; - version "Infinitesimal"; - storage "/var/run/cutedns/"; - key hmac-md5 "Wg=="; - -} - -zones { - example.net { - file "/var/lib/cutedns/example.net"; - } -} - -interfaces { - # short notation - # name address@port - # interface0 10.10.1.1@53; - # will expand into long notation - interface0 { - address 10.10.1.1; - port 53531; - } - - interface1 { - address ::0; - # port 53; - } -} - -log { - syslog { - any notice, warning, error; - zone all; - } - - file "/var/log/cutedns/server.err" { - server error; - } - - # Multiple specification of a log facility - # means ORing the rules. - file "/var/log/cutedns/server.err" { - server warning; - } - - stderr { - any warning, error; - } - - stdout { - any info; - } -} diff --git a/src/conf/logconf.h b/src/conf/logconf.h index 91db8fd754..bf8fa1714a 100644 --- a/src/conf/logconf.h +++ b/src/conf/logconf.h @@ -8,8 +8,8 @@ * \addtogroup logging * @{ */ -#ifndef _CUTEDNS_LOGCONF_H_ -#define _CUTEDNS_LOGCONF_H_ +#ifndef _KNOT_LOGCONF_H_ +#define _KNOT_LOGCONF_H_ struct conf_t; @@ -23,6 +23,6 @@ struct conf_t; */ int log_conf_hook(const struct conf_t *conf); -#endif /* _CUTEDNS_LOGCONF_H_ */ +#endif /* _KNOT_LOGCONF_H_ */ /*! @} */ diff --git a/src/dnslib/zone-dump.c b/src/dnslib/zone-dump.c index 55cd96f8ca..d7f4ca7acc 100644 --- a/src/dnslib/zone-dump.c +++ b/src/dnslib/zone-dump.c @@ -14,7 +14,7 @@ */ /* \note Contents of dump file: - * MAGIC(cutexx) NUMBER_OF_NORMAL_NODES NUMBER_OF_NSEC3_NODES + * MAGIC(knotxx) NUMBER_OF_NORMAL_NODES NUMBER_OF_NSEC3_NODES * [normal_nodes] [nsec3_nodes] * node has following format: * owner_size owner_wire owner_label_size owner_labels owner_id @@ -425,8 +425,8 @@ int dnslib_zdump_binary(dnslib_zone_t *zone, const char *filename) dnslib_zone_save_enclosers(zone, encloser_list); - static const uint8_t MAGIC[MAGIC_LENGTH] = {99, 117, 116, 101, 0, 2}; - /*c u t e 0.1*/ + static const uint8_t MAGIC[MAGIC_LENGTH] = {107, 110, 111, 116, 0, 2}; + /*k n o t 0.1*/ fwrite(&MAGIC, sizeof(uint8_t), MAGIC_LENGTH, f); diff --git a/src/dnslib/zone-load.c b/src/dnslib/zone-load.c index 5b76ddbef0..afede97df2 100644 --- a/src/dnslib/zone-load.c +++ b/src/dnslib/zone-load.c @@ -22,7 +22,7 @@ static inline int fread_safe(void *dst, size_t size, size_t n, FILE *fp) } /* \note Contents of dump file: - * MAGIC(cutexx) NUMBER_OF_NORMAL_NODES NUMBER_OF_NSEC3_NODES + * MAGIC(knotxx) NUMBER_OF_NORMAL_NODES NUMBER_OF_NSEC3_NODES * [normal_nodes] [nsec3_nodes] * node has following format: * owner_size owner_wire owner_label_size owner_labels owner_id @@ -492,8 +492,8 @@ dnslib_zone_t *dnslib_zload_load(const char *filename) uint auth_node_count; - static const uint8_t MAGIC[MAGIC_LENGTH] = {99, 117, 116, 101, 0, 2}; - /*c u t e 0.1*/ + static const uint8_t MAGIC[MAGIC_LENGTH] = {107, 110, 111, 116, 0, 2}; + /*k n o t 0.1*/ if (!dnslib_check_magic(f, MAGIC, MAGIC_LENGTH)) { fclose(f); diff --git a/src/tests/conf_tests.c b/src/tests/conf_tests.c index 0c0d77d68d..25e10ef730 100644 --- a/src/tests/conf_tests.c +++ b/src/tests/conf_tests.c @@ -94,7 +94,7 @@ static int conf_tests_run(int argc, char *argv[]) ok(n != 0, "log has next facility"); skip(!n, 1); { - is(log->file, "/var/log/cutedns/server.err", "log file matches"); + is(log->file, "/var/log/knot/server.err", "log file matches"); } endskip; diff --git a/src/tests/files/sample_conf b/src/tests/files/sample_conf index 43a85ba519..d7d54b4fa8 100644 --- a/src/tests/files/sample_conf +++ b/src/tests/files/sample_conf @@ -8,14 +8,14 @@ system { identity "I have no mouth and must scream"; version "Infinitesimal"; - storage "/var/run/cutedns/"; + storage "/var/run/knot/"; key hmac-md5 "Wg=="; } zones { example.net { - file "/var/lib/cutedns/example.net"; + file "/var/lib/knot/example.net"; } } @@ -41,7 +41,7 @@ log { zone all; } - file "/var/log/cutedns/server.err" { + file "/var/log/knot/server.err" { server error; } -- GitLab