projects
/
systembsd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pretty hostname and static hostname no longer sync across each other
[systembsd.git]
/
src
/
interfaces
/
hostnamed
/
hostnamed.c
diff --git
a/src/interfaces/hostnamed/hostnamed.c
b/src/interfaces/hostnamed/hostnamed.c
index 9bc1f9e7d0b4164a3130d1f5823c39626825679b..0f4af9acef276ade0eb96bafbed881772ad89b2f 100644
(file)
--- a/
src/interfaces/hostnamed/hostnamed.c
+++ b/
src/interfaces/hostnamed/hostnamed.c
@@
-133,7
+133,7
@@
on_handle_set_hostname(Hostname1 *hn1_passed_interf,
bus_name = g_dbus_method_invocation_get_sender(invoc);
/* verify caller has correct permissions via polkit */
bus_name = g_dbus_method_invocation_get_sender(invoc);
/* verify caller has correct permissions via polkit */
- is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
SetH
ostname", policykit_auth);
+ is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
set-h
ostname", policykit_auth);
switch(is_authed) {
switch(is_authed) {
@@
-210,7
+210,7
@@
on_handle_set_static_hostname(Hostname1 *hn1_passed_interf,
bus_name = g_dbus_method_invocation_get_sender(invoc);
/* verify caller has correct permissions via polkit */
bus_name = g_dbus_method_invocation_get_sender(invoc);
/* verify caller has correct permissions via polkit */
- is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
SetStaticH
ostname", policykit_auth);
+ is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
set-static-h
ostname", policykit_auth);
switch(is_authed) {
switch(is_authed) {
@@
-256,9
+256,9
@@
on_handle_set_static_hostname(Hostname1 *hn1_passed_interf,
} else {
g_strdelimit(STATIC_HOSTNAME, " ", '-');
} else {
g_strdelimit(STATIC_HOSTNAME, " ", '-');
- hostname1_set_static_hostname(hn1_passed_interf, STATIC_HOSTNAME);
+ hostname1_set_static_hostname(hn1_passed_interf, STATIC_HOSTNAME);
g_ptr_array_add(hostnamed_freeable, valid_static_hostname_buf);
g_ptr_array_add(hostnamed_freeable, valid_static_hostname_buf);
- ret =
TRUE;
+ ret =
(!sethostname(valid_static_hostname_buf, MAXHOSTNAMELEN)) ? TRUE : FALSE; /* TODO set /etc/myname, guarantee domain or substitue .home.network" */
hostname1_complete_set_static_hostname(hn1_passed_interf, invoc);
}
}
hostname1_complete_set_static_hostname(hn1_passed_interf, invoc);
}
}
@@
-289,7
+289,7
@@
on_handle_set_pretty_hostname(Hostname1 *hn1_passed_interf,
bus_name = g_dbus_method_invocation_get_sender(invoc);
/* verify caller has correct permissions via polkit */
bus_name = g_dbus_method_invocation_get_sender(invoc);
/* verify caller has correct permissions via polkit */
- is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
SetPrettyH
ostname", policykit_auth);
+ is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
set-pretty-h
ostname", policykit_auth);
switch(is_authed) {
switch(is_authed) {
@@
-343,7
+343,7
@@
on_handle_set_pretty_hostname(Hostname1 *hn1_passed_interf,
g_key_file_set_string(config, "hostnamed", "PRETTY_HOSTNAME", valid_pretty_hostname_buf);
g_key_file_set_string(config, "hostnamed", "PRETTY_HOSTNAME", valid_pretty_hostname_buf);
- if((computed_static_hostname = g_hostname_to_ascii(PRETTY_HOSTNAME))) {
+
/*
if((computed_static_hostname = g_hostname_to_ascii(PRETTY_HOSTNAME))) {
g_strdelimit(computed_static_hostname, " ", '-');
hostname1_set_static_hostname(hn1_passed_interf, computed_static_hostname);
g_strdelimit(computed_static_hostname, " ", '-');
hostname1_set_static_hostname(hn1_passed_interf, computed_static_hostname);
@@
-351,10
+351,8
@@
on_handle_set_pretty_hostname(Hostname1 *hn1_passed_interf,
g_ptr_array_add(hostnamed_freeable, computed_static_hostname);
g_key_file_set_string(config, "hostnamed", "StaticHostname", computed_static_hostname);
g_ptr_array_add(hostnamed_freeable, computed_static_hostname);
g_key_file_set_string(config, "hostnamed", "StaticHostname", computed_static_hostname);
- } else
- g_free(computed_static_hostname);
+ } */
}
}
-
}
}
}
}
@@
-389,7
+387,7
@@
on_handle_set_chassis(Hostname1 *hn1_passed_interf,
g_strlcpy(valid_chassis_name_buf, proposed_chassis_name, (gsize)64);
/* verify caller has correct permissions via polkit */
g_strlcpy(valid_chassis_name_buf, proposed_chassis_name, (gsize)64);
/* verify caller has correct permissions via polkit */
- is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
SetC
hassis", policykit_auth);
+ is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
set-c
hassis", policykit_auth);
switch(is_authed) {
switch(is_authed) {
@@
-473,7
+471,7
@@
on_handle_set_icon_name(Hostname1 *hn1_passed_interf,
bus_name = g_dbus_method_invocation_get_sender(invoc);
/* verify caller has correct permissions via polkit */
bus_name = g_dbus_method_invocation_get_sender(invoc);
/* verify caller has correct permissions via polkit */
- is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
SetIconN
ame", policykit_auth);
+ is_authed = polkit_try_auth(bus_name, "org.freedesktop.hostname1.
set-icon-n
ame", policykit_auth);
switch(is_authed) {
switch(is_authed) {
@@
-628,7
+626,8
@@
our_get_kernel_release() {
const gchar *
our_get_os_cpename() {
const gchar *
our_get_os_cpename() {
- return "ONEDAY";
+ /* XXX needs to parse /etc/os-release (fallback to /usr/local/lib/os-release) */
+ return "";
}
const gchar *
}
const gchar *
@@
-813,18
+812,18
@@
gboolean set_names() {
else
PRETTY_HOSTNAME = "";
else
PRETTY_HOSTNAME = "";
- if(config)
- g_key_file_unref(config);
+
+ /* (4) set STATIC_HOSTNAME */
+ if((static_hostname_buf = g_key_file_get_value(config, "hostnamed", "STATIC_HOSTNAME", NULL)))
+ STATIC_HOSTNAME = static_hostname_buf;
- /* (4) set STATIC_HOSTNAME */
- if(!g_strcmp0(PRETTY_HOSTNAME, ""))
- STATIC_HOSTNAME = HOSTNAME;
+ else
+ STATIC_HOSTNAME = "";
-
else if((static_hostname_buf = g_hostname_to_ascii(PRETTY_HOSTNAME))
)
-
STATIC_HOSTNAME = static_hostname_buf
;
+
if(config
)
+
g_key_file_unref(config)
;
return (HOSTNAME && STATIC_HOSTNAME && PRETTY_HOSTNAME) ? TRUE : FALSE;
return (HOSTNAME && STATIC_HOSTNAME && PRETTY_HOSTNAME) ? TRUE : FALSE;
-
}
gboolean set_uname_properties() {
}
gboolean set_uname_properties() {