This repository was archived by the owner on Nov 15, 2025. It is now read-only.
Commit 3b92c08
committed
logind: make "self" and "auto" magic strings when operating on seats + sessions
Most of the operations one can do on sessions so far accepted an empty
session name as a shortcut for the caller's session. This is quite
useful traditionally, but much less useful than it used to be, since
most user code now (rightfully) runs in --user context, not in a
session.
With this change we tweak the logic a bit: we introduce the two special
session and seat names "self" and "auto". The former refers to the
session/seat the client is in, and is hence mostly equivalent to te
empty string "" as before. However, the latter refers to the
session/seat the client is in if that exists, with a fallback of the
user's display session if not. Clients can hence reference "auto"
instead of the empty string if they really don't want to think much
about sessions.
Why "self" btw? Previously, we'd already expose a special dbus object
with the path /org/freedesktop/login1/session/self (and similar for the
seat), matching what the empty string did for bus calls that took a
session name. With this scheme we reuse this identifier and introduce
"auto" in a similar way.
Of course this means real-life seats and sessions can never be named
"self" or "auto", but they aren't anyway: valid seat names have to start
with "seat" anyway, and sessions are generated server-side as either a
numeric value or "c" suffixed with a counter ID.
Fixes: systemd#123991 parent 469df51 commit 3b92c08
File tree
5 files changed
+179
-87
lines changed- src/login
5 files changed
+179
-87
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
50 | 55 | | |
51 | 56 | | |
| 57 | + | |
52 | 58 | | |
53 | | - | |
54 | 59 | | |
55 | 60 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
63 | 71 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
68 | 93 | | |
69 | | - | |
70 | 94 | | |
71 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
72 | 99 | | |
73 | 100 | | |
74 | 101 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | 102 | | |
80 | 103 | | |
81 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
82 | 111 | | |
83 | 112 | | |
84 | 113 | | |
85 | 114 | | |
86 | 115 | | |
87 | 116 | | |
88 | | - | |
89 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
90 | 121 | | |
91 | 122 | | |
92 | 123 | | |
| |||
97 | 128 | | |
98 | 129 | | |
99 | 130 | | |
100 | | - | |
101 | 131 | | |
102 | 132 | | |
103 | 133 | | |
| |||
109 | 139 | | |
110 | 140 | | |
111 | 141 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
116 | 149 | | |
117 | | - | |
118 | 150 | | |
119 | | - | |
| 151 | + | |
| 152 | + | |
120 | 153 | | |
121 | 154 | | |
122 | 155 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | 156 | | |
128 | 157 | | |
129 | 158 | | |
| |||
145 | 174 | | |
146 | 175 | | |
147 | 176 | | |
148 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
149 | 184 | | |
150 | 185 | | |
151 | 186 | | |
152 | 187 | | |
153 | 188 | | |
154 | 189 | | |
155 | 190 | | |
156 | | - | |
| 191 | + | |
157 | 192 | | |
158 | 193 | | |
159 | | - | |
| 194 | + | |
| 195 | + | |
160 | 196 | | |
161 | 197 | | |
162 | 198 | | |
163 | 199 | | |
164 | 200 | | |
165 | | - | |
| 201 | + | |
166 | 202 | | |
167 | 203 | | |
168 | 204 | | |
| |||
830 | 866 | | |
831 | 867 | | |
832 | 868 | | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
833 | 873 | | |
834 | 874 | | |
835 | 875 | | |
| |||
990 | 1030 | | |
991 | 1031 | | |
992 | 1032 | | |
993 | | - | |
994 | | - | |
| 1033 | + | |
995 | 1034 | | |
996 | 1035 | | |
997 | 1036 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
| 258 | + | |
| 259 | + | |
258 | 260 | | |
| 261 | + | |
259 | 262 | | |
260 | 263 | | |
261 | 264 | | |
| |||
265 | 268 | | |
266 | 269 | | |
267 | 270 | | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
281 | 274 | | |
282 | | - | |
283 | | - | |
284 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
285 | 278 | | |
286 | | - | |
287 | | - | |
288 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
289 | 282 | | |
290 | | - | |
291 | | - | |
292 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
293 | 287 | | |
| 288 | + | |
| 289 | + | |
294 | 290 | | |
295 | 291 | | |
296 | 292 | | |
| |||
335 | 331 | | |
336 | 332 | | |
337 | 333 | | |
338 | | - | |
339 | | - | |
340 | 334 | | |
341 | | - | |
| 335 | + | |
342 | 336 | | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
343 | 340 | | |
344 | 341 | | |
| 342 | + | |
| 343 | + | |
345 | 344 | | |
346 | 345 | | |
347 | 346 | | |
348 | 347 | | |
349 | 348 | | |
| 349 | + | |
| 350 | + | |
350 | 351 | | |
351 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
352 | 371 | | |
353 | 372 | | |
354 | 373 | | |
355 | 374 | | |
356 | | - | |
357 | 375 | | |
358 | 376 | | |
359 | 377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
0 commit comments