aboutsummaryrefslogtreecommitdiff
path: root/hesiod
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-22 20:10:10 +0000
commita334319f6530564d22e775935d9c91663623a1b4 (patch)
treeb5877475619e4c938e98757d518bb1e9cbead751 /hesiod
parent0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff)
downloadglibc-a334319f6530564d22e775935d9c91663623a1b4.zip
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz
glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.bz2
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'hesiod')
-rw-r--r--hesiod/README.hesiod8
-rw-r--r--hesiod/hesiod.c63
-rw-r--r--hesiod/hesiod_p.h1
3 files changed, 23 insertions, 49 deletions
diff --git a/hesiod/README.hesiod b/hesiod/README.hesiod
index 259ce8d..18cd5d4 100644
--- a/hesiod/README.hesiod
+++ b/hesiod/README.hesiod
@@ -71,14 +71,6 @@ will want to create your own. It should look something like:
rhs=.your.domain
lhs=.ns
- classes=in,hs
-
-The optional classes settings specifies which DNS classes Hesiod
-should do lookups in. Possible values are IN (the preferred class)
-and HS (the deprecated class, still used by some sites).
-You may specify both classes separated by a comma to try one class
-first and then the other if no entry is available in the first
-class. The default value of the classes variable is `IN,HS'.
The value of rhs can be overridden by the environment variable
`HES_DOMAIN'.
diff --git a/hesiod/hesiod.c b/hesiod/hesiod.c
index b3706b5..7fffb31 100644
--- a/hesiod/hesiod.c
+++ b/hesiod/hesiod.c
@@ -83,9 +83,6 @@ hesiod_init(void **context) {
ctx->LHS = NULL;
ctx->RHS = NULL;
ctx->res = NULL;
- /* Set default query classes. */
- ctx->classes[0] = C_IN;
- ctx->classes[1] = C_HS;
configname = __secure_getenv("HESIOD_CONFIG");
if (!configname)
@@ -237,12 +234,15 @@ hesiod_resolve(void *context, const char *name, const char *type) {
return (NULL);
}
- retvec = get_txt_records(ctx, ctx->classes[0], bindname);
-
- if (retvec == NULL && (errno == ENOENT || errno == ECONNREFUSED) && ctx->classes[1])
- retvec = get_txt_records(ctx, ctx->classes[1], bindname);
+ if ((retvec = get_txt_records(ctx, C_IN, bindname))) {
+ free(bindname);
+ return (retvec);
+ }
+ if (errno != ENOENT && errno != ECONNREFUSED)
+ return (NULL);
+ retvec = get_txt_records(ctx, C_HS, bindname);
free(bindname);
return (retvec);
}
@@ -261,6 +261,7 @@ hesiod_free_list(void *context, char **list) {
*/
static int
parse_config_file(struct hesiod_p *ctx, const char *filename) {
+ char *key, *data, *cp, **cpp;
char buf[MAXDNAME+7];
FILE *fp;
@@ -271,9 +272,6 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
free(ctx->RHS);
free(ctx->LHS);
ctx->RHS = ctx->LHS = 0;
- /* Set default query classes. */
- ctx->classes[0] = C_IN;
- ctx->classes[1] = C_HS;
/*
* Now open and parse the file...
@@ -282,8 +280,6 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
return (-1);
while (fgets(buf, sizeof(buf), fp) != NULL) {
- char *key, *data, *cp, **cpp;
-
cp = buf;
if (*cp == '#' || *cp == '\n' || *cp == '\r')
continue;
@@ -301,36 +297,17 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
cp++;
*cp++ = '\0';
- cpp = NULL;
- if (strcasecmp(key, "lhs") == 0)
+ if (strcmp(key, "lhs") == 0)
cpp = &ctx->LHS;
- else if (strcasecmp(key, "rhs") == 0)
+ else if (strcmp(key, "rhs") == 0)
cpp = &ctx->RHS;
- if (cpp) {
- *cpp = strdup(data);
- if (!*cpp)
- goto cleanup;
- } else if (strcasecmp(key, "classes") == 0) {
- int n = 0;
- while (*data && n < 2) {
- cp = strchrnul(data, ',');
- if (*cp != '\0')
- *cp++ = '\0';
- if (strcasecmp(data, "IN") == 0)
- ctx->classes[n++] = C_IN;
- else if (strcasecmp(data, "HS") == 0)
- ctx->classes[n++] = C_HS;
- data = cp;
- }
- if (n == 0) {
- /* Restore the default. Better than
- nother at all. */
- ctx->classes[0] = C_IN;
- ctx->classes[1] = C_HS;
- } else if (n == 1
- || ctx->classes[0] == ctx->classes[1])
- ctx->classes[1] = 0;
- }
+ else
+ continue;
+
+ *cpp = malloc(strlen(data) + 1);
+ if (!*cpp)
+ goto cleanup;
+ strcpy(*cpp, data);
}
fclose(fp);
return (0);
@@ -487,6 +464,12 @@ __hesiod_res_set(void *context, struct __res_state *res,
if (ctx->res && ctx->free_res) {
res_nclose(ctx->res);
+ if ((ctx->res->options & RES_INIT) && ctx->res->nscount > 0) {
+ for (int ns = 0; ns < MAXNS; ns++) {
+ free (ctx->res->_u._ext.nsaddrs[ns]);
+ ctx->res->_u._ext.nsaddrs[ns] = NULL;
+ }
+ }
(*ctx->free_res)(ctx->res);
}
diff --git a/hesiod/hesiod_p.h b/hesiod/hesiod_p.h
index 5010d71..71aca09 100644
--- a/hesiod/hesiod_p.h
+++ b/hesiod/hesiod_p.h
@@ -41,7 +41,6 @@ struct hesiod_p {
void (*res_set)(struct hesiod_p *, struct __res_state *,
void (*)(void *));
struct __res_state * (*res_get)(struct hesiod_p *);
- int classes[2]; /* The class search order. */
};
#define MAX_HESRESP 1024