Blame SOURCES/Remove-hard-coded-defaults-for-LHS-and-RHS.patch

b3731e
From 91e404cce156bcf74942309a7003fa0dc60b8258 Mon Sep 17 00:00:00 2001
b3731e
From: Nalin Dahyabhai <nalin@redhat.com>
b3731e
Date: Tue, 3 May 2016 13:34:32 -0400
b3731e
Subject: [PATCH 2/3] Remove hard-coded defaults for LHS and RHS
b3731e
b3731e
Don't fall back to using a default LHS or RHS when the configuration
b3731e
file can't be read.  Instead, return an error.
b3731e
Original report from https://bugzilla.redhat.com/show_bug.cgi?id=1332493
b3731e
b3731e
(cherry picked from commit 247e2ce1f2aff40040657acaae7f1a1d673d6618)
b3731e
---
b3731e
 src/lib/Makefile.am |  2 +-
b3731e
 src/lib/hesiod.c    | 21 +--------------------
b3731e
 2 files changed, 2 insertions(+), 21 deletions(-)
b3731e
b3731e
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
b3731e
index d092565..e6324b1 100644
b3731e
--- a/src/lib/Makefile.am
b3731e
+++ b/src/lib/Makefile.am
b3731e
@@ -15,7 +15,7 @@ noinst_PROGRAMS = hestest
b3731e
 hestest_SOURCES = hestest.c
b3731e
 hestest_LDADD = libhesiod.la
b3731e
 
b3731e
-TESTS_ENVIRONMENT = ./hestest
b3731e
+TESTS_ENVIRONMENT = HESIOD_CONFIG=$(srcdir)/hesiod.conf.sample ./hestest
b3731e
 TESTS = hestest.conf
b3731e
 
b3731e
 EXTRA_DIST = hesiod.conf.sample hestest.conf
b3731e
diff --git a/src/lib/hesiod.c b/src/lib/hesiod.c
b3731e
index 2738713..e69a8ca 100644
b3731e
--- a/src/lib/hesiod.c
b3731e
+++ b/src/lib/hesiod.c
b3731e
@@ -81,10 +81,6 @@ static const char rcsid[] = "$Id: hesiod.c,v 1.30 2002-04-03 21:40:55 ghudson Ex
b3731e
 #define T_TXT	16
b3731e
 #endif
b3731e
 
b3731e
-/* Defaults if the configuration file is not present. */
b3731e
-#define DEF_RHS ".athena.mit.edu"
b3731e
-#define DEF_LHS ".ns"
b3731e
-
b3731e
 /* Maximum size of a Hesiod response from the DNS. */
b3731e
 #define MAX_HESRESP 1024
b3731e
 
b3731e
@@ -301,22 +297,7 @@ static int read_config_file(struct hesiod_p *ctx, const char *filename)
b3731e
   /* Try to open the configuration file. */
b3731e
   fp = fopen(filename, "r");
b3731e
   if (!fp)
b3731e
-    {
b3731e
-      /* Use compiled in default domain names. */
b3731e
-      ctx->lhs = malloc(strlen(DEF_LHS) + 1);
b3731e
-      ctx->rhs = malloc(strlen(DEF_RHS) + 1);
b3731e
-      if (ctx->lhs && ctx->rhs)
b3731e
-	{
b3731e
-	  strcpy(ctx->lhs, DEF_LHS);
b3731e
-	  strcpy(ctx->rhs, DEF_RHS);
b3731e
-	  return 0;
b3731e
-	}
b3731e
-      else
b3731e
-	{
b3731e
-	  errno = ENOMEM;
b3731e
-	  return -1;
b3731e
-	}
b3731e
-    }
b3731e
+    return -1;
b3731e
 
b3731e
   ctx->lhs = NULL;
b3731e
   ctx->rhs = NULL;
b3731e
-- 
b3731e
2.31.0
b3731e