ALT Linux Bugzilla
– Attachment 342 Details for
Bug 3580
su command breaks utmp
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
SimplePAMApps-0.60-owl-alt-login-su-ut_id.patch
SimplePAMApps-0.60-owl-alt-login-su-ut_id.patch (text/plain), 2.28 KB, created by
Dmitry V. Levin
on 2004-02-09 02:02:00 MSK
(
hide
)
Description:
SimplePAMApps-0.60-owl-alt-login-su-ut_id.patch
Filename:
MIME Type:
Creator:
Dmitry V. Levin
Created:
2004-02-09 02:02:00 MSK
Size:
2.28 KB
patch
obsolete
>diff -uprk.orig SimplePAMApps-0.60.orig/common/lib/wtmp.c SimplePAMApps-0.60/common/lib/wtmp.c >--- SimplePAMApps-0.60.orig/common/lib/wtmp.c 1999-01-27 19:27:16 +0300 >+++ SimplePAMApps-0.60/common/lib/wtmp.c 2004-02-08 20:01:56 +0300 >@@ -3,9 +3,6 @@ > */ > > #define RHOST_UNKNOWN_NAME "" /* perhaps "[from.where?]" */ >- >-#define DEVICE_FILE_PREFIX "/dev/" >- > #define WTMP_LOCK_TIMEOUT 3 /* in seconds */ > > #include <fcntl.h> >@@ -41,19 +38,31 @@ > */ > > static >-const struct utmp *find_utmp_entry(const char *ut_line >- , const char *ut_id) >+const struct utmp *find_utmp_entry(const char *ut_line, char *ut_id) > { >- struct utmp *u_tmp_p; >+ struct utmp *u_tmp_p, *best; > >+ setutent(); >+ best = NULL; > while ((u_tmp_p = getutent()) != NULL) > if ((u_tmp_p->ut_type == INIT_PROCESS || >- u_tmp_p->ut_type == LOGIN_PROCESS || >- u_tmp_p->ut_type == USER_PROCESS || >- u_tmp_p->ut_type == DEAD_PROCESS) && >- !strncmp(u_tmp_p->ut_id, ut_id, UT_IDSIZE) && >- !strncmp(u_tmp_p->ut_line, ut_line, UT_LINESIZE)) >- break; >+ u_tmp_p->ut_type == LOGIN_PROCESS || >+ u_tmp_p->ut_type == USER_PROCESS) && >+ !strncmp(u_tmp_p->ut_line, ut_line, UT_LINESIZE)) { >+ if (!strncmp(u_tmp_p->ut_id, ut_id, UT_IDSIZE)) >+ break; >+ best = u_tmp_p; >+ } >+ >+ if (!u_tmp_p && best) { >+ u_tmp_p = best; >+ strncpy(ut_id, u_tmp_p->ut_id, UT_IDSIZE); >+ } >+ >+#if 0 >+ fprintf(stderr, "find_utmp_entry: '%.32s' '%.4s': %p\n", >+ ut_line, ut_id, u_tmp_p); >+#endif > > return u_tmp_p; > } >@@ -72,11 +81,11 @@ void set_terminal_name(const char *termi > if ( *terminal == '/' ) { /* now deal with filenames */ > int o1, o2; > >- o1 = strncmp(DEVICE_FILE_PREFIX, terminal, 5) ? 0 : 5; >+ o1 = strncmp("/dev/", terminal, 5) ? 0 : 5; > if (!strncmp("/dev/tty", terminal, 8)) { > o2 = 8; > } else { >- o2 = strlen(terminal) - sizeof(UT_IDSIZE); >+ o2 = (int)strlen(terminal) - UT_IDSIZE; > if (o2 < 0) > o2 = 0; > } >@@ -203,7 +212,6 @@ int utmp_do_open_session(const char *use > set_terminal_name(terminal, ut_line, ut_id); > > utmpname(_PATH_UTMP); >- setutent(); /* rewind file */ > u_tmp_p = find_utmp_entry(ut_line, ut_id); > > /* reset new entry */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 3580
:
341
| 342