Skip to content

Commit 247e2ce

Browse files
committed
Remove hard-coded defaults for LHS and RHS
Don't fall back to using a default LHS or RHS when the configuration file can't be read. Instead, return an error. Original report from https://bugzilla.redhat.com/show_bug.cgi?id=1332493
1 parent 39b21da commit 247e2ce

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

src/lib/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ noinst_PROGRAMS = hestest
1515
hestest_SOURCES = hestest.c
1616
hestest_LDADD = libhesiod.la
1717

18-
TESTS_ENVIRONMENT = ./hestest
18+
TESTS_ENVIRONMENT = HESIOD_CONFIG=$(srcdir)/hesiod.conf.sample ./hestest
1919
TESTS = hestest.conf
2020

2121
EXTRA_DIST = hesiod.conf.sample hestest.conf

src/lib/hesiod.c

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ static const char rcsid[] = "$Id: hesiod.c,v 1.30 2002-04-03 21:40:55 ghudson Ex
8181
#define T_TXT 16
8282
#endif
8383

84-
/* Defaults if the configuration file is not present. */
85-
#define DEF_RHS ".athena.mit.edu"
86-
#define DEF_LHS ".ns"
87-
8884
/* Maximum size of a Hesiod response from the DNS. */
8985
#define MAX_HESRESP 1024
9086

@@ -301,22 +297,7 @@ static int read_config_file(struct hesiod_p *ctx, const char *filename)
301297
/* Try to open the configuration file. */
302298
fp = fopen(filename, "r");
303299
if (!fp)
304-
{
305-
/* Use compiled in default domain names. */
306-
ctx->lhs = malloc(strlen(DEF_LHS) + 1);
307-
ctx->rhs = malloc(strlen(DEF_RHS) + 1);
308-
if (ctx->lhs && ctx->rhs)
309-
{
310-
strcpy(ctx->lhs, DEF_LHS);
311-
strcpy(ctx->rhs, DEF_RHS);
312-
return 0;
313-
}
314-
else
315-
{
316-
errno = ENOMEM;
317-
return -1;
318-
}
319-
}
300+
return -1;
320301

321302
ctx->lhs = NULL;
322303
ctx->rhs = NULL;

0 commit comments

Comments
 (0)