After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 722482 - login(3) cannot work, it needs a tty
login(3) cannot work, it needs a tty
Status: RESOLVED OBSOLETE
Product: gdm
Classification: Core
Component: general
3.10.x
Other OpenBSD
: Normal minor
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2014-01-18 09:25 UTC by Antoine Jacoutot
Modified: 2018-05-24 10:59 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
manually handle utmp instead of using login(3) (5.85 KB, patch)
2014-01-18 09:25 UTC, Antoine Jacoutot
needs-work Details | Review

Description Antoine Jacoutot 2014-01-18 09:25:31 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?
Comment 1 Antoine Jacoutot 2014-01-23 09:51:16 UTC
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.
Comment 2 Antoine Jacoutot 2014-02-20 13:56:39 UTC
Hi again... I would really appreciate if a GDM developer could have a look at this... Thanks in advance.
Comment 3 Ray Strode [halfline] 2014-02-20 15:44:06 UTC
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.
Comment 4 Antoine Jacoutot 2014-02-20 15:50:18 UTC
(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 :-)
Comment 5 Ray Strode [halfline] 2014-02-20 19:10:19 UTC
(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.
Comment 6 Antoine Jacoutot 2014-02-20 19:12:15 UTC
> > 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.
Comment 7 GNOME Infrastructure Team 2018-05-24 10:59:21 UTC
-- 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.