diff --git a/CodingStyle b/CodingStyle index 877f98b8237a6c988beafbc91e9c0422fa6ec562..7ad5893365896643f35959b5b3c2f882e490b2df 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 10440f8f7dae3a688ccb57fdde3207cd21a856ef..8ca0e519ec3fa8424ea1936df290f1204cd7c97c 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 6dc6de3cc625ab8b433aadace3497d0dad27f902..8f37289369980aa655455646f842751da62cc117 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 db68be2d53fd96af3613b8cf70d0e71bf4a162a6..510d78a7d19f148cfdd2d4a6153c07345fd01a2a 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 1b28659a5d932fe60f3f5882e387f73b965b54ba..0000000000000000000000000000000000000000 --- 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 91db8fd754136ae31e54601991d347d7db4ffb6c..bf8fa1714aadced94c4ddce863f853891374a6f1 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 55cd96f8ca695a8498f6e424c5834cd9d85b423a..d7f4ca7acc96073e6e65deda474a295bc9bf2f6b 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 5b76ddbef0c62e07adf4413afd4d778ea5295a2a..afede97df2c2d38c23b6c26ec3f84e1dbd2efa60 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 0c0d77d68d2248cff9e2cf583fec888dde3ae705..25e10ef730341c10738a450cda31bb97c7967814 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 43a85ba51978ede9958d64ed1c8b51c8fe18dc01..d7d54b4fa8f070a44f3918f419c4d55db4e935e7 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; }