aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rwxr-xr-xconfigure83
-rw-r--r--hesiod/README.hesiod8
-rw-r--r--hesiod/hesiod.c58
-rw-r--r--hesiod/hesiod_p.h1
5 files changed, 141 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 711ae2f641..063323b76e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-06-08 Karl Kelley <kekelley@iastate.edu>
+
+ * hesiod/hesiod_p.h (struct hesiod_p): Add classes array.
+ * hesiod/hesiod.c (hesiod_init): Initialize classes. Fail if no
+ valid classes were given or if both are equal.
+ (hesiod_resolve): Use ctx->classes instead of hardcoded C_IN
+ and C_HS order.
+ (parse_config_file): Handle classes keyword.
+ * hesiod/README.hesiod: Mention addition of the classes keyword.
+
2005-06-14 Ulrich Drepper <drepper@redhat.com>
* configure.in: Add test for availability of libaudit.
diff --git a/configure b/configure
index fb69f400b8..8c978e7512 100755
--- a/configure
+++ b/configure
@@ -313,7 +313,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini no_whole_archive exceptions LIBGD have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons base_machine sysnames INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_initfinit_array libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script gnu_ld gnu_as elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -6729,6 +6729,86 @@ cat >>confdefs.h <<\_ACEOF
#define HAVE_SELINUX 1
_ACEOF
+
+ # See if we have the libaudit library
+ echo "$as_me:$LINENO: checking for audit_log_avc in -laudit" >&5
+echo $ECHO_N "checking for audit_log_avc in -laudit... $ECHO_C" >&6
+if test "${ac_cv_lib_audit_audit_log_avc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-laudit $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char audit_log_avc ();
+int
+main ()
+{
+audit_log_avc ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_audit_audit_log_avc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_audit_audit_log_avc=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_audit_audit_log_avc" >&5
+echo "${ECHO_T}$ac_cv_lib_audit_audit_log_avc" >&6
+if test $ac_cv_lib_audit_audit_log_avc = yes; then
+ have_libaudit=yes
+else
+ have_libaudit=no
+fi
+
+ if test "x$have_libaudit" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBAUDIT 1
+_ACEOF
+
+ fi
+
fi
@@ -8341,6 +8421,7 @@ s,@libc_cv_have_initfini@,$libc_cv_have_initfini,;t t
s,@no_whole_archive@,$no_whole_archive,;t t
s,@exceptions@,$exceptions,;t t
s,@LIBGD@,$LIBGD,;t t
+s,@have_libaudit@,$have_libaudit,;t t
s,@have_selinux@,$have_selinux,;t t
s,@EGREP@,$EGREP,;t t
s,@sizeof_long_double@,$sizeof_long_double,;t t
diff --git a/hesiod/README.hesiod b/hesiod/README.hesiod
index 18cd5d45dd..259ce8d447 100644
--- a/hesiod/README.hesiod
+++ b/hesiod/README.hesiod
@@ -71,6 +71,14 @@ 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 7fffb310f1..e0ce510866 100644
--- a/hesiod/hesiod.c
+++ b/hesiod/hesiod.c
@@ -83,6 +83,9 @@ 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)
@@ -123,7 +126,7 @@ hesiod_init(void **context) {
* If there is no default hesiod realm set, we return an
* error.
*/
- if (!ctx->RHS) {
+ if (!ctx->RHS || ctx->classes[0] == 0 || ctx->classes[0] == ctx->classes[1]) {
__set_errno(ENOEXEC);
goto cleanup;
}
@@ -234,15 +237,12 @@ hesiod_resolve(void *context, const char *name, const char *type) {
return (NULL);
}
- if ((retvec = get_txt_records(ctx, C_IN, bindname))) {
- free(bindname);
- return (retvec);
- }
+ 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 (errno != ENOENT && errno != ECONNREFUSED)
- return (NULL);
- retvec = get_txt_records(ctx, C_HS, bindname);
free(bindname);
return (retvec);
}
@@ -261,7 +261,6 @@ 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;
@@ -272,6 +271,9 @@ 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...
@@ -280,6 +282,8 @@ 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;
@@ -297,17 +301,35 @@ parse_config_file(struct hesiod_p *ctx, const char *filename) {
cp++;
*cp++ = '\0';
- if (strcmp(key, "lhs") == 0)
+ cpp = NULL;
+ if (strcasecmp(key, "lhs") == 0)
cpp = &ctx->LHS;
- else if (strcmp(key, "rhs") == 0)
+ else if (strcasecmp(key, "rhs") == 0)
cpp = &ctx->RHS;
- else
- continue;
-
- *cpp = malloc(strlen(data) + 1);
- if (!*cpp)
- goto cleanup;
- strcpy(*cpp, data);
+ 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[1] = 0;
+ }
}
fclose(fp);
return (0);
diff --git a/hesiod/hesiod_p.h b/hesiod/hesiod_p.h
index 71aca0976d..5010d71bc9 100644
--- a/hesiod/hesiod_p.h
+++ b/hesiod/hesiod_p.h
@@ -41,6 +41,7 @@ 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