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

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