get the host's NIS domain.
/* Define to 1 if you have the `sysctl' function. */
#undef HAVE_SYSCTL
+/* Define to 1 if you have the `sysinfo' function. */
+#undef HAVE_SYSINFO
+
/* Define to 1 if you have the <sys/bsdtypes.h> header file. */
#undef HAVE_SYS_BSDTYPES_H
/* Define to 1 if you have the <sys/sysmacros.h> header file. */
#undef HAVE_SYS_SYSMACROS_H
+/* Define to 1 if you have the <sys/systeminfo.h> header file. */
+#undef HAVE_SYS_SYSTEMINFO_H
+
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
- for ac_func in getdomainname
+ break
+fi
+done
+
+for ac_func in getdomainname
do :
ac_fn_c_check_func "$LINENO" "getdomainname" "ac_cv_func_getdomainname"
if test "x$ac_cv_func_getdomainname" = xyes; then :
#define HAVE_GETDOMAINNAME 1
_ACEOF
+else
+
+ for ac_func in sysinfo
+do :
+ ac_fn_c_check_func "$LINENO" "sysinfo" "ac_cv_func_sysinfo"
+if test "x$ac_cv_func_sysinfo" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYSINFO 1
+_ACEOF
+ for ac_header in sys/systeminfo.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/systeminfo.h" "ac_cv_header_sys_systeminfo_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_systeminfo_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_SYSTEMINFO_H 1
+_ACEOF
+
fi
+
done
- break
+
+fi
+done
+
+
fi
done
AC_CHECK_FUNCS([getifaddrs], [AC_CHECK_FUNCS([freeifaddrs])])
fi
AC_CHECK_FUNCS([lockf flock], [break])
-AC_CHECK_FUNCS([innetgr _innetgr], [AC_CHECK_FUNCS([getdomainname]) [break]])
+AC_CHECK_FUNCS([innetgr _innetgr], [break])
+AC_CHECK_FUNCS([getdomainname], [], [
+ AC_CHECK_FUNCS([sysinfo], [AC_CHECK_HEADERS([sys/systeminfo.h])])
+])
AC_CHECK_FUNCS([utimes], [
AC_CHECK_FUNCS([futimes futimesat], [break])
], [
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef HAVE_SYS_SYSTEMINFO_H
+# include <sys/systeminfo.h>
+#endif
#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
sudo_getdomainname(void)
{
char *domain = NULL;
-#ifdef HAVE_GETDOMAINNAME
+#if defined(HAVE_GETDOMAINNAME) || defined(SI_SRPC_DOMAIN)
static char buf[HOST_NAME_MAX + 1];
static bool initialized;
if (!initialized) {
- if (getdomainname(buf, sizeof(buf)) == 0 && buf[0] != '\0') {
+ int rval;
+
+# ifdef SI_SRPC_DOMAIN
+ buf[0] = '\0';
+ rval = sysinfo(SI_SRPC_DOMAIN, buf, sizeof(buf));
+# else
+ rval = getdomainname(buf, sizeof(buf));
+# endif
+ if (rval != -1 && buf[0] != '\0') {
char *cp;
domain = buf;
}
initialized = true;
}
-#endif /* HAVE_GETDOMAINNAME */
+#endif /* HAVE_GETDOMAINNAME || SI_SRPC_DOMAIN */
return domain;
}