Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1
login
pam_login-3.35-pts.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pam_login-3.35-pts.patch of Package login
--- src/login.c +++ src/login.c 2008-04-18 17:19:15.335806337 +0200 @@ -999,12 +999,30 @@ main (int argc, char **argv) /* for linux, write entries in utmp and wtmp */ { struct utmp ut; - struct utmp *utp; + struct utmp *utp = NULL; +#if (__WORDSIZE == 64 && defined __WORDSIZE_COMPAT32) || defined (__s390__) struct timeval ut_tv; +#endif pid_t mypid = getpid (); + char * id = (ttyn != NULL) ? ttyn + strlen(_PATH_TTY) : NULL; + char * line = (ttyn != NULL) ? ttyn + strlen(_PATH_DEV) : NULL; + memset (&ut, 0, sizeof (ut)); utmpname (_PATH_UTMP); - setutent (); + + /* + * If used for a pseudo-terminal we're called by a network daemon. + * Correct the id in that case in same manner as utemper does + * and skip scanning for spawned inittab processes. This should + * also corrected in sshd construct_utmp()/construct_utmpx(). + * Werner Fink <werner@suse.de> + */ + if (line != NULL && strncmp(line, "pts/", 4) == 0) + { + id = line + 3; + if (strlen(id) > 4) id++; + goto network; + } /* Find mypid in utmp. login sometimes overwrites the runlevel entry in /var/run/utmp, @@ -1014,51 +1032,58 @@ main (int argc, char **argv) current runlevel). Michael Riepe <michael@stud.uni-hannover.de> */ + setutent (); while ((utp = getutent ())) - if (utp->ut_pid == mypid - && utp->ut_type >= INIT_PROCESS && utp->ut_type <= DEAD_PROCESS) - break; + { + if (utp->ut_pid != mypid) + continue; + if (utp->ut_type >= INIT_PROCESS && utp->ut_type <= DEAD_PROCESS) + break; + } + endutent (); /* * If we can't find a pre-existing entry by pid, try by line * BSD network daemons may rely on this. */ - if (utp == NULL && ttyn != NULL) + if (utp == NULL && line != NULL) { - endutent (); - setutent (); + network: memset (&ut, 0, sizeof (ut)); ut.ut_type = LOGIN_PROCESS; /* XXX doesn't matter */ - strncpy (ut.ut_id, ttyn + strlen (_PATH_TTY), sizeof (ut.ut_id)); - strncpy (ut.ut_line, ttyn + strlen (_PATH_DEV), sizeof (ut.ut_line)); + strncpy (ut.ut_id, id, sizeof (ut.ut_id)); + strncpy (ut.ut_line, line, sizeof (ut.ut_line)); + setutent (); utp = getutid (&ut); } if (utp) memcpy (&ut, utp, sizeof (ut)); - else /* some gettys/telnetds don't initialize utmp... */ - memset (&ut, 0, sizeof (ut)); - if (ut.ut_id[0] == 0 && ttyn != NULL) - strncpy (ut.ut_id, ttyn + strlen (_PATH_TTY), sizeof (ut.ut_id)); + if (ut.ut_id[0] == 0 && id != NULL) + strncpy (ut.ut_id, id, sizeof (ut.ut_id)); strncpy (ut.ut_user, username, sizeof (ut.ut_user)); - strncpy (ut.ut_line, ttyn + strlen (_PATH_DEV), sizeof (ut.ut_line)); - ut.ut_line[sizeof (ut.ut_line) - 1] = 0; + if (line != NULL) + strncpy (ut.ut_line, line, sizeof (ut.ut_line)); +#if (__WORDSIZE == 64 && defined __WORDSIZE_COMPAT32) || defined(__s390__) gettimeofday (&ut_tv, NULL); - ut.ut_tv.tv_sec = ut_tv.tv_sec; - ut.ut_tv.tv_usec = ut_tv.tv_usec; + ut.ut_tv.tv_sec = (int32_t)ut_tv.tv_sec; + ut.ut_tv.tv_usec = (int32_t)ut_tv.tv_usec; +#else + gettimeofday (&ut.ut_tv, NULL); +#endif ut.ut_type = USER_PROCESS; ut.ut_pid = mypid; if (hostname) { strncpy (ut.ut_host, hostname, sizeof (ut.ut_host)); - ut.ut_host[sizeof (ut.ut_host) - 1] = 0; if (hostaddress && hostaddress->h_addr_list) memcpy (&ut.ut_addr, hostaddress->h_addr_list[0], sizeof (ut.ut_addr)); } + setutent (); pututline (&ut); endutent ();
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor