chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0d49cfa
)
polkit: don't spawn local client if we access a remote system
author
Lennart Poettering
<lennart@poettering.net>
Thu, 7 Nov 2013 20:06:44 +0000
(21:06 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 7 Nov 2013 20:06:44 +0000
(21:06 +0100)
src/hostname/hostnamectl.c
patch
|
blob
|
history
src/locale/localectl.c
patch
|
blob
|
history
src/login/loginctl.c
patch
|
blob
|
history
src/machine/machinectl.c
patch
|
blob
|
history
src/shared/pager.c
patch
|
blob
|
history
src/timedate/timedatectl.c
patch
|
blob
|
history
diff --git
a/src/hostname/hostnamectl.c
b/src/hostname/hostnamectl.c
index af428179144cea540b87acf2160961b10cb3bb29..523177b27d4d412d54d7734c25130956a1aea4a4 100644
(file)
--- a/
src/hostname/hostnamectl.c
+++ b/
src/hostname/hostnamectl.c
@@
-48,6
+48,18
@@
static bool arg_transient = false;
static bool arg_pretty = false;
static bool arg_static = false;
static bool arg_pretty = false;
static bool arg_static = false;
+static void polkit_agent_open_if_enabled(void) {
+
+ /* Open the polkit agent as a child process if necessary */
+ if (!arg_ask_password)
+ return;
+
+ if (arg_transport != BUS_TRANSPORT_LOCAL)
+ return;
+
+ polkit_agent_open();
+}
+
typedef struct StatusInfo {
char *hostname;
char *static_hostname;
typedef struct StatusInfo {
char *hostname;
char *static_hostname;
@@
-192,12
+204,9
@@
static int show_status(sd_bus *bus, char **args, unsigned n) {
static int set_simple_string(sd_bus *bus, const char *method, const char *value) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
static int set_simple_string(sd_bus *bus, const char *method, const char *value) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
- static bool first=true;
int r = 0;
int r = 0;
- if (first && arg_ask_password)
- polkit_agent_open();
- first = false;
+ polkit_agent_open_if_enabled();
r = sd_bus_call_method(
bus,
r = sd_bus_call_method(
bus,
diff --git
a/src/locale/localectl.c
b/src/locale/localectl.c
index e8bf5105703822bb35a53c389dfaf73b628c8e01..748a14841d1449b08d00a99aa08525a24623799f 100644
(file)
--- a/
src/locale/localectl.c
+++ b/
src/locale/localectl.c
@@
-63,6
+63,9
@@
static void polkit_agent_open_if_enabled(void) {
if (!arg_ask_password)
return;
if (!arg_ask_password)
return;
+ if (arg_transport != BUS_TRANSPORT_LOCAL)
+ return;
+
polkit_agent_open();
}
polkit_agent_open();
}
diff --git
a/src/login/loginctl.c
b/src/login/loginctl.c
index cb05907ff12dc97cf62c523475663e6b1eed2d0f..c9899ecba528eaea30255de342873e2f7631abe1 100644
(file)
--- a/
src/login/loginctl.c
+++ b/
src/login/loginctl.c
@@
-53,7
+53,6
@@
static char *arg_host = NULL;
static void pager_open_if_enabled(void) {
static void pager_open_if_enabled(void) {
- /* Cache result before we open the pager */
if (arg_no_pager)
return;
if (arg_no_pager)
return;
@@
-67,6
+66,9
@@
static void polkit_agent_open_if_enabled(void) {
if (!arg_ask_password)
return;
if (!arg_ask_password)
return;
+ if (arg_transport != BUS_TRANSPORT_LOCAL)
+ return;
+
polkit_agent_open();
}
polkit_agent_open();
}
@@
-372,9
+374,9
@@
static int print_session_status_info(sd_bus *bus, const char *path) {
{}
};
{}
};
- SessionStatusInfo i = {};
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
char since2[FORMAT_TIMESTAMP_MAX], *s2;
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1;
char since2[FORMAT_TIMESTAMP_MAX], *s2;
+ SessionStatusInfo i = {};
int r;
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
int r;
r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i);
@@
-527,8
+529,8
@@
static int print_seat_status_info(sd_bus *bus, const char *path) {
static const struct bus_properties_map map[] = {
{ "Id", "s", NULL, offsetof(SeatStatusInfo, id) },
static const struct bus_properties_map map[] = {
{ "Id", "s", NULL, offsetof(SeatStatusInfo, id) },
- { "ActiveSession", "(so)",
&
prop_map_first_of_struct, offsetof(SeatStatusInfo, active_session) },
- { "Sessions", "a(so)",
&
prop_map_sessions_strv, offsetof(SeatStatusInfo, sessions) },
+ { "ActiveSession", "(so)", prop_map_first_of_struct, offsetof(SeatStatusInfo, active_session) },
+ { "Sessions", "a(so)", prop_map_sessions_strv, offsetof(SeatStatusInfo, sessions) },
{}
};
{}
};
diff --git
a/src/machine/machinectl.c
b/src/machine/machinectl.c
index aa2b0986eda0a1f98b9b0833410507019f5c7afb..f60c66055dd7258e5d823302f30e90d920cb4147 100644
(file)
--- a/
src/machine/machinectl.c
+++ b/
src/machine/machinectl.c
@@
-793,7
+793,7
@@
static int machinectl_main(sd_bus *bus, int argc, char *argv[]) {
left = argc - optind;
if (left <= 0)
left = argc - optind;
if (left <= 0)
- /* Special rule: no arguments means "list
-sessions
" */
+ /* Special rule: no arguments means "list" */
i = 0;
else {
if (streq(argv[optind], "help")) {
i = 0;
else {
if (streq(argv[optind], "help")) {
diff --git
a/src/shared/pager.c
b/src/shared/pager.c
index 8dddf24f4c7816ba7e739016563f4c92b282cca2..9fa611479cff0cc10b98c7d60ca0dbbfd3e3f00e 100644
(file)
--- a/
src/shared/pager.c
+++ b/
src/shared/pager.c
@@
-34,13
+34,16
@@
static pid_t pager_pid = 0;
_noreturn_ static void pager_fallback(void) {
ssize_t n;
_noreturn_ static void pager_fallback(void) {
ssize_t n;
+
do {
n = splice(STDIN_FILENO, NULL, STDOUT_FILENO, NULL, 64*1024, 0);
} while (n > 0);
do {
n = splice(STDIN_FILENO, NULL, STDOUT_FILENO, NULL, 64*1024, 0);
} while (n > 0);
+
if (n < 0) {
log_error("Internal pager failed: %m");
_exit(EXIT_FAILURE);
}
if (n < 0) {
log_error("Internal pager failed: %m");
_exit(EXIT_FAILURE);
}
+
_exit(EXIT_SUCCESS);
}
_exit(EXIT_SUCCESS);
}
diff --git
a/src/timedate/timedatectl.c
b/src/timedate/timedatectl.c
index 7ce9a824ece1944190c8d17090a622c431bdf2c6..54b39a1806f4775dff15d6835f003d3a7e5ba84f 100644
(file)
--- a/
src/timedate/timedatectl.c
+++ b/
src/timedate/timedatectl.c
@@
-58,6
+58,9
@@
static void polkit_agent_open_if_enabled(void) {
if (!arg_ask_password)
return;
if (!arg_ask_password)
return;
+ if (arg_transport != BUS_TRANSPORT_LOCAL)
+ return;
+
polkit_agent_open();
}
polkit_agent_open();
}