GNOME Bugzilla – Bug 722482
login(3) cannot work, it needs a tty
Last modified: 2018-05-24 10:59:21 UTC
Created attachment 266601 [details] [review] manually handle utmp instead of using login(3) Hi. login(3) only works if stdin, stdout or stderr is hooked up to the tty which is not the case since gdm has already detached from the controlling terminal -- so manually handle utmp(5) if getutxent(3) is not available on the platform. Test on OpenBSD: before the patch: $ w 10:01AM up 1 min, 0 users, load averages: 2.62, 0.61, 0.22 USER TTY FROM LOGIN@ IDLE WHAT after the patch: $ w 10:19AM up 16 mins, 1 user, load averages: 1.37, 1.43, 1.17 USER TTY FROM LOGIN@ IDLE WHAT ajacoutot C4 :0 10:04AM 0 - This code is adapted from OpenBSD's ftpd daemon which is under a BSD licence. (not sure if/how the license should be appended, hints welcome) Comments?
Hi. Any input on this? Note that this patch is part of the OpenBSD-current GDM package, so it got some wide testing and so far everything works as intended. Thank you.
Hi again... I would really appreciate if a GDM developer could have a look at this... Thanks in advance.
Review of attachment 266601 [details] [review]: OpenBSD doesn't provide a function to do this for us? This code already looks really bad, and it's only getting worse. I think at this point I'd rather go back to spawning sessreg instead of managing this stuff on our own. Is that something you'd be interested in writing a patch for? ::: daemon/gdm-session-record.c @@ +208,2 @@ void +gdm_login (struct utmp *ut) this should probably be called write_utmp_login_manually or something and it should be static.
(In reply to comment #3) > Review of attachment 266601 [details] [review]: > > OpenBSD doesn't provide a function to do this for us? This code already looks Well, the function is login(3) but since it needs a tty to work, then at the time it's called in GDM it is already too late. > really bad, and it's only getting worse. I think at this point I'd rather go > back to spawning sessreg instead of managing this stuff on our own. Is that > something you'd be interested in writing a patch for? You mean spawning sessreg from a gdm script? > > ::: daemon/gdm-session-record.c > @@ +208,2 @@ > void > +gdm_login (struct utmp *ut) > > this should probably be called write_utmp_login_manually or something and it > should be static. Sure, thanks :-)
(In reply to comment #4) > (In reply to comment #3) > > Review of attachment 266601 [details] [review] [details]: > > > > OpenBSD doesn't provide a function to do this for us? This code already looks > > Well, the function is login(3) but since it needs a tty to work, then at the > time it's called in GDM it is already too late. Maybe should move the classes to inside gdm-session-worker.c (the same place where we do gdm_session_auditor_report_login) ? > > really bad, and it's only getting worse. I think at this point I'd rather go > > back to spawning sessreg instead of managing this stuff on our own. Is that > > something you'd be interested in writing a patch for? > > You mean spawning sessreg from a gdm script? well what i'm really after is getting this mess of code less messy. It looks like we have login() on linux too, so maybe we can just set things up such that login() works, and drop as much of the other code as possible. an alternative would be to make the mess "somebody elses problem" so we don't have to look at it.
> > Well, the function is login(3) but since it needs a tty to work, then at the > > time it's called in GDM it is already too late. > Maybe should move the classes to inside gdm-session-worker.c (the same place > where we do gdm_session_auditor_report_login) ? That might work yes.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gdm/issues/179.