Commit Diff
Diff:
1082bae064a91c66911fd039ab86d0b3fb613c73
22a36b57eba0dca2cc3d68d113d98b6f1ec70553
Commit:
22a36b57eba0dca2cc3d68d113d98b6f1ec70553
Tree:
07a3fe30903498ca085f9d7478794ad866e11c4b
Author:
pjp <pjp@delphinusdns.org>
Committer:
pjp <pjp@delphinusdns.org>
Date:
Sun May 18 11:54:02 2014 UTC
Message:
* remove old Berkeley DB code, by now we're committed fully to Berkeley DB versions 4.6 and higher (as long as it's below version 6 which has license changes I read).
blob - 622b46967836f230a49a24bc0acba4b12a15ca61
blob + 7cc269db93a4eb91597e8427708a649b82f7394f
--- main.c
+++ main.c
@@ -170,7 +170,7 @@ static struct tcps {
} *tn1, *tnp, *tntmp;
-static const char rcsid[] = "$Id: main.c,v 1.96 2014/05/18 11:10:11 pjp Exp $";
+static const char rcsid[] = "$Id: main.c,v 1.97 2014/05/18 11:54:02 pjp Exp $";
/*
* MAIN - set up arguments, set up database, set up sockets, call mainloop
@@ -312,10 +312,6 @@ main(int argc, char *argv[])
*ptr = 0;
-
-
-#if DB_VERSION_MAJOR >= 4
-
if ((ret = db_env_create(&dbenv, 0)) != 0) {
dolog(LOG_INFO, "db_env_create: %s\n", db_strerror(ret));
slave_shutdown();
@@ -392,34 +388,13 @@ main(int argc, char *argv[])
}
close(fd);
-#if DB_VERSION_MINOR > 0
if (db->open(db, NULL, database, NULL, DB_BTREE, DB_CREATE, 0600) != 0) {
dolog(LOG_INFO, "db->open: %s\n", strerror(errno));
db->close(db, DB_NOSYNC);
slave_shutdown();
exit(1);
}
-#else
- if (db->open(db, database, NULL, DB_BTREE, DB_CREATE, 0600) != 0) {
- dolog(LOG_INFO, "db->open: %s\n", strerror(errno));
- db->close(db, DB_NOSYNC);
- slave_shutdown();
- exit(1);
- }
-#endif /*minor*/
-#else
- #error "db185 isn't used anymore. Please install Berkeley DB v4."
-
- db = dbopen(NULL, O_RDWR, 0, DB_BTREE, NULL);
-
- if (db == NULL) {
- dolog(LOG_INFO, "dbopen: %s\n", strerror(errno));
- slave_shutdown();
- exit(1);
- }
-
-#endif
/* make a master program that holds the pidfile, boss of ... eek */
pid = fork();
@@ -1723,11 +1698,7 @@ lookup_zone(DB *db, struct question *question, struct
data.data = NULL;
data.size = 0;
-#if DB_VERSION_MAJOR > 3
ret = db->get(db, NULL, &key, &data, 0);
-#else
- ret = db->get(db, &key, &data, 0);
-#endif
if (ret != 0) {
if (! wildcard)
@@ -1812,12 +1783,8 @@ lookup_zone(DB *db, struct question *question, struct
key.data = wildlookup;
key.size = 1;
-#if DB_VERSION_MAJOR > 3
if ((ret = db->get(db, NULL, &key, &data, 0)) != 0) {
db->err(db, ret, "db->get");
-#else
- if (db->get(db, &key, &data, 0) != 0) {
-#endif
dolog(LOG_INFO, "don't have wildcard answer\n");
*lzerrno = ERR_NXDOMAIN;
return -1;
@@ -1926,12 +1893,7 @@ get_soa(DB *db, struct question *question, struct doma
data.data = NULL;
data.size = 0;
-#if DB_VERSION_MAJOR > 3
ret = db->get(db, NULL, &key, &data, 0);
-#else
- ret = db->get(db, &key, &data, 0);
-#endif
-
if (ret != 0) {
/*
* If we're not wildcarding end the search here and
blob - 9db4a8a3de8bc59cbd04bdfc242ae5a8ff68edc4
blob + 401d2bbe6ffbf71515ce32f5a7bc44e688265ad0
--- parse.y
+++ parse.y
@@ -58,7 +58,7 @@ typedef struct {
int lineno;
} YYSTYPE;
-static const char rcsid[] = "$Id: parse.y,v 1.20 2014/05/17 09:18:11 pjp Exp $";
+static const char rcsid[] = "$Id: parse.y,v 1.21 2014/05/18 11:54:02 pjp Exp $";
static int version = 0;
static int state = 0;
static uint8_t region = 0;
@@ -2448,11 +2448,8 @@ get_record(struct domain *sdomain, char *converted_nam
data.data = NULL;
data.size = 0;
-#if DB_VERSION_MAJOR > 3
if (db->get(db, NULL, &key, &data, 0) == 0) {
-#else
- if (db->get(db, &key, &data, 0) == 0) {
-#endif
+
if (data.size != sizeof(struct domain)) {
dolog(LOG_INFO, "damaged btree database\n");
return -1;
@@ -2486,13 +2483,8 @@ set_record(struct domain *sdomain, char *converted_nam
data.data = (void*)sdomain;
data.size = sizeof(struct domain);
-#if DB_VERSION_MAJOR > 3
if ((ret = db->put(db, NULL, &key, &data, 0)) != 0) {
dolog(LOG_INFO, "db->put: %s\n" , db_strerror(ret));
-#else
- if ((ret = db->put(db, &key, &data, 0)) == 0) {
- dolog(LOG_INFO, "db->put: %s\n", db_strerror(ret));
-#endif
return;
}
blob - fb9a41778e51acf0496d9dbb9ef990e26cab4190
blob + deb9d0872bd565cb631d7bb8f55d0b1b5dbc2e22
--- recurse.c
+++ recurse.c
@@ -93,7 +93,7 @@ static struct recurseentry {
} *rn2, *rnp;
-static const char rcsid[] = "$Id: recurse.c,v 1.42 2014/05/01 15:26:24 pjp Exp $";
+static const char rcsid[] = "$Id: recurse.c,v 1.43 2014/05/18 11:54:02 pjp Exp $";
/*
* INIT_RECURSE - initialize the recurse singly linked list
@@ -619,12 +619,7 @@ again:
data.data = NULL;
data.size = 0;
-#if DB_VERSION_MAJOR > 3
ret = db->get(db, NULL, &key, &data, 0);
-#else
- ret = db->get(db, &key, &data, 0);
-#endif
-
if (ret != 0) {
if (*p != 0) {
plen -= (*p + 1);
@@ -757,12 +752,7 @@ lookup_a(DB *db, struct recurses *sr, struct ns *ns)
found = 0;
-#if DB_VERSION_MAJOR > 3
ret = db->get(db, NULL, &key, &data, 0);
-#else
- ret = db->get(db, &key, &data, 0);
-#endif
-
if (ret == 0) {
if (data.size != sizeof(struct domain)) {
dolog(LOG_ERR, "btree db is damaged");
@@ -1144,11 +1134,7 @@ again:
data.size = 0;
memset((char *)&sdomain, 0, sizeof(struct domain));
-#if DB_VERSION_MAJOR > 3
if (db->get(db, NULL, &key, &data, 0) == 0) {
-#else
- if (db->get(db, &key, &data, 0) == 0) {
-#endif
if (data.size != sizeof(struct domain)) {
dolog(LOG_INFO, "damaged btree database");
return -1;
@@ -1928,11 +1914,7 @@ remove_zone(DB *db, struct domain *sd)
key.data = (char *)zone;
key.size = zonelen;
-#if DB_VERSION_MAJOR > 3
if (db->del(db, NULL, &key, 0) != 0) {
-#else
- if (db->del(db, &key, 0) != 0) {
-#endif
dolog(LOG_ERR, "could not delete zone %s: %m", zone);
}
@@ -2209,12 +2191,7 @@ lookup_aaaa(DB *db, struct recurses *sr, struct ns *ns
found = 0;
-#if DB_VERSION_MAJOR > 3
ret = db->get(db, NULL, &key, &data, 0);
-#else
- ret = db->get(db, &key, &data, 0);
-#endif
-
if (ret == 0) {
if (data.size != sizeof(struct domain)) {
dolog(LOG_ERR, "btree db is damaged");
blob - b7eaec65e7405c5ae56df6fc3cae3522e65c755e
blob + 39f5941ada10eded8ee4bea021e85d0d2e893056
--- reply.c
+++ reply.c
@@ -89,7 +89,7 @@ struct collects {
extern int debug, verbose;
-static const char rcsid[] = "$Id: reply.c,v 1.57 2014/05/11 15:39:50 pjp Exp $";
+static const char rcsid[] = "$Id: reply.c,v 1.58 2014/05/18 11:54:02 pjp Exp $";
/*
* REPLY_A() - replies a DNS question (*q) on socket (so)
@@ -3127,13 +3127,7 @@ update_db(DB *db, struct domain *sd)
data.data = (char *)sd;
data.size = sizeof(struct domain);
- #if DB_VERSION_MAJOR > 3
- /* XXX */
ret = db->put(db, NULL, &key, &data, 0);
- #else
- ret = db->put(db, &key, &data, 0) ;
- #endif
-
} while (ret != 0);
return;
repomaster@centroid.eu