if (hashmap_size(m->sessions) >= m->sessions_max)
return sd_bus_error_setf(error, SD_BUS_ERROR_LIMITS_EXCEEDED, "Maximum number of sessions (%" PRIu64 ") reached, refusing further sessions.", m->sessions_max);
- audit_session_from_pid(leader, &audit_id);
- if (audit_id > 0) {
+ (void) audit_session_from_pid(leader, &audit_id);
+ if (audit_session_is_valid(audit_id)) {
/* Keep our session IDs and the audit session IDs in sync */
if (asprintf(&id, "%"PRIu32, audit_id) < 0)
* ID */
if (hashmap_get(m->sessions, id)) {
log_warning("Existing logind session ID %s used by new audit session, ignoring", id);
- audit_id = 0;
+ audit_id = AUDIT_SESSION_INVALID;
id = mfree(id);
}
if (s->sessions) {
Session *i;
- fputs("SESSIONS=", f);
+ fputs_unlocked("SESSIONS=", f);
LIST_FOREACH(sessions_by_seat, i, s->sessions) {
fprintf(f,
"%s%c",
i->sessions_by_seat_next ? ' ' : '\n');
}
- fputs("UIDS=", f);
+ fputs_unlocked("UIDS=", f);
LIST_FOREACH(sessions_by_seat, i, s->sessions)
fprintf(f,
UID_FMT"%c",
#include "bus-error.h"
#include "bus-util.h"
#include "escape.h"
-#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
s->manager = m;
s->fifo_fd = -1;
s->vtfd = -1;
+ s->audit_id = AUDIT_SESSION_INVALID;
return s;
}
if (!s->vtnr)
fprintf(f, "POSITION=%u\n", s->position);
- if (s->leader > 0)
+ if (pid_is_valid(s->leader))
fprintf(f, "LEADER="PID_FMT"\n", s->leader);
- if (s->audit_id > 0)
+ if (audit_session_is_valid(s->audit_id))
fprintf(f, "AUDIT=%"PRIu32"\n", s->audit_id);
if (dual_timestamp_is_set(&s->timestamp))
}
if (leader) {
- k = parse_pid(leader, &s->leader);
- if (k >= 0)
- audit_session_from_pid(s->leader, &s->audit_id);
+ if (parse_pid(leader, &s->leader) >= 0)
+ (void) audit_session_from_pid(s->leader, &s->audit_id);
}
if (type) {
#if 1 /// elogind must queue this session again
session_add_to_gc_queue(s);
#endif // 1
-
return r;
}
Session *i;
bool first;
- fputs("SESSIONS=", f);
+ fputs_unlocked("SESSIONS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->id, f);
+ fputs_unlocked(i->id, f);
}
- fputs("\nSEATS=", f);
+ fputs_unlocked("\nSEATS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (!i->seat)
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->seat->id, f);
+ fputs_unlocked(i->seat->id, f);
}
- fputs("\nACTIVE_SESSIONS=", f);
+ fputs_unlocked("\nACTIVE_SESSIONS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (!session_is_active(i))
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->id, f);
+ fputs_unlocked(i->id, f);
}
- fputs("\nONLINE_SESSIONS=", f);
+ fputs_unlocked("\nONLINE_SESSIONS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (session_get_state(i) == SESSION_CLOSING)
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->id, f);
+ fputs_unlocked(i->id, f);
}
- fputs("\nACTIVE_SEATS=", f);
+ fputs_unlocked("\nACTIVE_SEATS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (!session_is_active(i) || !i->seat)
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->seat->id, f);
+ fputs_unlocked(i->seat->id, f);
}
- fputs("\nONLINE_SEATS=", f);
+ fputs_unlocked("\nONLINE_SEATS=", f);
first = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
if (session_get_state(i) == SESSION_CLOSING || !i->seat)
if (first)
first = false;
else
- fputc(' ', f);
+ fputc_unlocked(' ', f);
- fputs(i->seat->id, f);
+ fputs_unlocked(i->seat->id, f);
}
- fputc('\n', f);
+ fputc_unlocked('\n', f);
}
r = fflush_and_check(f);
#if 1 /// elogind must queue this user again
user_add_to_gc_queue(u);
#endif // 1
-
return r;
}
# See logind.conf(5) for details.
[Login]
+#NAutoVTs=6
+#ReserveVT=6
#KillUserProcesses=@KILL_USER_PROCESSES@
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitorsMax=8192
#SessionsMax=8192
#UserTasksMax=33%
-
-[Sleep]
-#SuspendState=mem standby freeze
-#SuspendMode=
-#HibernateState=disk
-#HibernateMode=platform shutdown
-#HybridSleepState=disk
-#HybridSleepMode=suspend platform shutdown
elogind_sources += [logind_gperf_c]
#endif // 0
+
liblogind_core_sources = files('''
logind-core.c
logind-device.c
sleep_files,
update_utmp_files]
#endif // 1
-
logind_acl_c = files('logind-acl.c')
if conf.get('HAVE_ACL', false)
liblogind_core_sources += logind_acl_c
eloginctl.h
'''.split())
#endif // 1
-
#if 0 /// elogind builds itself unconditionally and with some adaptatins
# if conf.get('ENABLE_LOGIND', false)
# logind_conf = configure_file(
if (debug)
pam_syslog(handle, LOG_DEBUG, "Asking logind to create session: "
"uid="UID_FMT" pid="PID_FMT" service=%s type=%s class=%s desktop=%s seat=%s vtnr=%"PRIu32" tty=%s display=%s remote=%s remote_user=%s remote_host=%s",
- pw->pw_uid, getpid(),
+ pw->pw_uid, getpid_cached(),
strempty(service),
type, class, strempty(desktop),
strempty(seat), vtnr, strempty(tty), strempty(display),
&reply,
"uusssssussbssa(sv)",
(uint32_t) pw->pw_uid,
- (uint32_t) getpid(),
+ (uint32_t) getpid_cached(),
service,
type,
class,