build-sys,hostnamed: allow distributions to override the "localhost" fallback
A configure param is added to make this easy to change if distributions want to differentiate on that. The default remains unchanged. https://bugzilla.redhat.com/show_bug.cgi?id=1392925#c10
This commit is contained in:
parent
e0afad4b64
commit
8146c32b92
10
configure.ac
10
configure.ac
|
@ -601,6 +601,15 @@ AC_ARG_WITH([nobody-group],
|
|||
AC_SUBST(NOBODY_GROUP_NAME)
|
||||
AC_DEFINE_UNQUOTED(NOBODY_GROUP_NAME, ["$NOBODY_GROUP_NAME"], [The name of the nobody group (the one with GID 65534)])
|
||||
|
||||
AC_ARG_WITH([fallback-hostname],
|
||||
AS_HELP_STRING([--with-fallback-hostname=NAME],
|
||||
[specify the hostname used if none configured]),
|
||||
[FALLBACK_HOSTNAME="$withval"],
|
||||
[FALLBACK_HOSTNAME=localhost])
|
||||
|
||||
AC_SUBST(FALLBACK_HOSTNAME)
|
||||
AC_DEFINE_UNQUOTED(FALLBACK_HOSTNAME, ["$FALLBACK_HOSTNAME"], [The hostname used if none configured])
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
have_xz=no
|
||||
AC_ARG_ENABLE(xz, AS_HELP_STRING([--disable-xz], [disable optional XZ support]))
|
||||
|
@ -1721,6 +1730,7 @@ AC_MSG_RESULT([
|
|||
Support URL: ${SUPPORT_URL}
|
||||
nobody user name: ${NOBODY_USER_NAME}
|
||||
nobody group name: ${NOBODY_GROUP_NAME}
|
||||
Fallback hostname: ${FALLBACK_HOSTNAME}
|
||||
|
||||
CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
|
||||
CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
|
||||
|
|
|
@ -283,7 +283,7 @@ static int context_update_kernel_hostname(Context *c) {
|
|||
|
||||
/* ... and the ultimate fallback */
|
||||
else
|
||||
hn = "localhost";
|
||||
hn = FALLBACK_HOSTNAME;
|
||||
|
||||
if (sethostname_idempotent(hn) < 0)
|
||||
return -errno;
|
||||
|
@ -419,7 +419,7 @@ static int method_set_hostname(sd_bus_message *m, void *userdata, sd_bus_error *
|
|||
name = c->data[PROP_STATIC_HOSTNAME];
|
||||
|
||||
if (isempty(name))
|
||||
name = "localhost";
|
||||
name = FALLBACK_HOSTNAME;
|
||||
|
||||
if (!hostname_is_valid(name, false))
|
||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid hostname '%s'", name);
|
||||
|
|
Loading…
Reference in a new issue