]>
Commit | Line | Data |
---|---|---|
99089a17 JB |
1 | --- NetworkManager-1.8.0/configure.ac.orig 2017-05-27 22:30:22.001467624 +0200 |
2 | +++ NetworkManager-1.8.0/configure.ac 2017-05-27 22:57:15.061449204 +0200 | |
3 | @@ -447,7 +447,7 @@ | |
ffec268f MB |
4 | # output |
5 | session_tracking= | |
6 | if test "$use_systemd_logind" = "yes" -o "$use_systemd_logind" = "auto"; then | |
c26388c7 JP |
7 | - PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd], [have_systemd_logind=yes], [PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login], [have_systemd_logind=yes], [have_systemd_logind=no])]) |
8 | + PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd], [have_systemd_logind=yes], [PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-daemon libsystemd-login], [have_systemd_logind=yes], [have_systemd_logind=no])]) | |
ffec268f | 9 | else |
c26388c7 | 10 | have_systemd_logind=no |
d7d26b92 | 11 | fi |
db3de05c JB |
12 | --- NetworkManager-1.34.0/src/core/nm-session-monitor.c.orig 2022-01-13 15:49:26.000000000 +0100 |
13 | +++ NetworkManager-1.34.0/src/core/nm-session-monitor.c 2022-01-13 20:47:31.545775434 +0100 | |
dee6277d | 14 | @@ -18,6 +18,7 @@ |
99089a17 | 15 | #endif |
b761b8be | 16 | |
b95ce425 | 17 | #if SESSION_TRACKING_SYSTEMD |
db3de05c JB |
18 | +#include <systemd/sd-daemon.h> |
19 | #include <systemd/sd-login.h> | |
20 | #define LOGIND_NAME "systemd-logind" | |
ffec268f | 21 | #endif |
dee6277d JB |
22 | @@ -52,13 +53,11 @@ struct _NMSessionMonitor { |
23 | } sd; | |
ffec268f MB |
24 | #endif |
25 | ||
b95ce425 | 26 | -#if SESSION_TRACKING_CONSOLEKIT |
dee6277d JB |
27 | struct { |
28 | GFileMonitor *monitor; | |
6350214c | 29 | GHashTable *cache; |
dee6277d JB |
30 | time_t timestamp; |
31 | } ck; | |
ffec268f | 32 | -#endif |
b761b8be ŁK |
33 | }; |
34 | ||
35 | struct _NMSessionMonitorClass { | |
dee6277d | 36 | @@ -136,7 +135,6 @@ st_sd_finalize(NMSessionMonitor *monitor |
b761b8be | 37 | |
38118a47 | 38 | /*****************************************************************************/ |
b761b8be | 39 | |
b95ce425 | 40 | -#if SESSION_TRACKING_CONSOLEKIT |
ffec268f | 41 | typedef struct { |
dee6277d | 42 | gboolean active; |
ffec268f | 43 | } CkSession; |
dee6277d JB |
44 | @@ -269,7 +267,6 @@ ck_finalize(NMSessionMonitor *monitor) |
45 | nm_clear_pointer(&monitor->ck.cache, g_hash_table_unref); | |
46 | g_clear_object(&monitor->ck.monitor); | |
b761b8be | 47 | } |
ffec268f | 48 | -#endif /* SESSION_TRACKING_CONSOLEKIT */ |
b761b8be | 49 | |
38118a47 | 50 | /*****************************************************************************/ |
b761b8be | 51 | |
dee6277d JB |
52 | @@ -295,14 +292,15 @@ nm_session_monitor_session_exists(NMSess |
53 | g_return_val_if_fail(NM_IS_SESSION_MONITOR(self), FALSE); | |
8f9f9f5f | 54 | |
b95ce425 | 55 | #if SESSION_TRACKING_XLOGIND |
dee6277d JB |
56 | + if (sd_booted() > 0) { |
57 | if (st_sd_session_exists(self, uid, active)) | |
58 | return TRUE; | |
59 | + } else | |
ffec268f MB |
60 | #endif |
61 | - | |
b95ce425 | 62 | -#if SESSION_TRACKING_CONSOLEKIT |
dee6277d JB |
63 | + { |
64 | if (ck_session_exists(self, uid, active)) | |
65 | return TRUE; | |
66 | -#endif | |
67 | + } | |
b761b8be | 68 | |
dee6277d JB |
69 | return FALSE; |
70 | } | |
71 | @@ -313,26 +311,28 @@ static void | |
72 | nm_session_monitor_init(NMSessionMonitor *monitor) | |
b761b8be | 73 | { |
b95ce425 | 74 | #if SESSION_TRACKING_XLOGIND |
dee6277d JB |
75 | + if (sd_booted() > 0) { |
76 | st_sd_init(monitor); | |
77 | _LOGD("using " LOGIND_NAME " session tracking"); | |
78 | + } else | |
ffec268f | 79 | #endif |
8f9f9f5f | 80 | |
b95ce425 | 81 | -#if SESSION_TRACKING_CONSOLEKIT |
dee6277d JB |
82 | + { |
83 | ck_init(monitor); | |
84 | _LOGD("using ConsoleKit session tracking"); | |
f6935939 | 85 | -#endif |
dee6277d | 86 | + } |
b761b8be ŁK |
87 | } |
88 | ||
f6935939 | 89 | static void |
dee6277d | 90 | finalize(GObject *object) |
b761b8be | 91 | { |
b95ce425 | 92 | #if SESSION_TRACKING_XLOGIND |
dee6277d JB |
93 | + if (sd_booted() > 0) |
94 | st_sd_finalize(NM_SESSION_MONITOR(object)); | |
95 | + else | |
ffec268f | 96 | #endif |
99089a17 | 97 | |
b95ce425 | 98 | -#if SESSION_TRACKING_CONSOLEKIT |
dee6277d | 99 | ck_finalize(NM_SESSION_MONITOR(object)); |
38118a47 | 100 | -#endif |
d7d26b92 | 101 | |
dee6277d | 102 | G_OBJECT_CLASS(nm_session_monitor_parent_class)->finalize(object); |
38118a47 | 103 | } |
db3de05c JB |
104 | --- NetworkManager-1.34.0/src/core/nm-sleep-monitor.c.orig 2022-01-13 15:49:26.000000000 +0100 |
105 | +++ NetworkManager-1.34.0/src/core/nm-sleep-monitor.c 2022-01-13 21:09:37.908589909 +0100 | |
dee6277d | 106 | @@ -11,6 +11,10 @@ |
ffec268f MB |
107 | #include <sys/stat.h> |
108 | #include <gio/gunixfdlist.h> | |
109 | ||
110 | +#ifdef SUSPEND_RESUME_SYSTEMD | |
111 | +# include <systemd/sd-daemon.h> | |
112 | +#endif | |
113 | + | |
8498e9e7 | 114 | #include "libnm-glib-aux/nm-dbus-aux.h" |
b6acf2f8 | 115 | #include "libnm-core-intern/nm-core-internal.h" |
ffec268f | 116 | #include "NetworkManagerUtils.h" |
dee6277d | 117 | @@ -24,9 +28,9 @@ |
ffec268f | 118 | |
dee6277d | 119 | #elif defined(SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_ELOGIND) |
ffec268f | 120 | |
db3de05c JB |
121 | -#define SUSPEND_DBUS_NAME "org.freedesktop.login1" |
122 | -#define SUSPEND_DBUS_PATH "/org/freedesktop/login1" | |
123 | -#define SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager" | |
124 | +#define SD_SUSPEND_DBUS_NAME "org.freedesktop.login1" | |
125 | +#define SD_SUSPEND_DBUS_PATH "/org/freedesktop/login1" | |
126 | +#define SD_SUSPEND_DBUS_INTERFACE "org.freedesktop.login1.Manager" | |
127 | #define USE_UPOWER 0 | |
128 | #if defined(SUSPEND_RESUME_SYSTEMD) | |
129 | #define _NMLOG_PREFIX_NAME "sleep-monitor-sd" | |
dee6277d | 130 | @@ -36,6 +40,17 @@ |
13a8788c JB |
131 | |
132 | #elif defined(SUSPEND_RESUME_CONSOLEKIT) | |
99089a17 | 133 | |
db3de05c JB |
134 | +#define USE_UPOWER 0 |
135 | +#define _NMLOG_PREFIX_NAME "sleep-monitor-ck" | |
13a8788c JB |
136 | + |
137 | +#else | |
138 | + | |
99089a17 | 139 | +#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER |
13a8788c JB |
140 | + |
141 | +#endif | |
142 | + | |
143 | +#if defined (SUSPEND_RESUME_SYSTEMD) || defined(SUSPEND_RESUME_CONSOLEKIT) | |
99089a17 | 144 | + |
ffec268f MB |
145 | /* ConsoleKit2 has added the same suspend/resume DBUS API that Systemd |
146 | * uses. http://consolekit2.github.io/ConsoleKit2/#Manager.Inhibit | |
99089a17 | 147 | */ |
dee6277d | 148 | @@ -43,12 +58,6 @@ |
db3de05c JB |
149 | #define SUSPEND_DBUS_NAME "org.freedesktop.ConsoleKit" |
150 | #define SUSPEND_DBUS_PATH "/org/freedesktop/ConsoleKit/Manager" | |
151 | #define SUSPEND_DBUS_INTERFACE "org.freedesktop.ConsoleKit.Manager" | |
152 | -#define USE_UPOWER 0 | |
153 | -#define _NMLOG_PREFIX_NAME "sleep-monitor-ck" | |
ffec268f | 154 | - |
13a8788c JB |
155 | -#else |
156 | - | |
db3de05c | 157 | -#error define one of SUSPEND_RESUME_SYSTEMD, SUSPEND_RESUME_ELOGIND, SUSPEND_RESUME_CONSOLEKIT, or SUSPEND_RESUME_UPOWER |
13a8788c JB |
158 | |
159 | #endif | |
160 | ||
dee6277d | 161 | @@ -329,6 +338,20 @@ nm_sleep_monitor_init(NMSleepMonitor *se |
d7d26b92 | 162 | { |
dee6277d JB |
163 | self->inhibit_fd = -1; |
164 | self->cancellable = g_cancellable_new(); | |
ffec268f | 165 | +#ifdef SUSPEND_RESUME_SYSTEMD |
dee6277d JB |
166 | + if (sd_booted() > 0) |
167 | + g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, | |
168 | + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | |
169 | + | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, | |
170 | + NULL, | |
171 | + SD_SUSPEND_DBUS_NAME, | |
172 | + SD_SUSPEND_DBUS_PATH, | |
173 | + SD_SUSPEND_DBUS_INTERFACE, | |
174 | + self->cancellable, | |
175 | + (GAsyncReadyCallback) on_proxy_acquired, | |
176 | + self); | |
177 | + else | |
ffec268f | 178 | +#endif |
dee6277d JB |
179 | g_dbus_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, |
180 | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START | |
181 | | G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, |