This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/22440] New: `__utmp_equal` ignores `ut_line` when system has `ut_id`


https://sourceware.org/bugzilla/show_bug.cgi?id=22440

            Bug ID: 22440
           Summary: `__utmp_equal` ignores `ut_line` when system has
                    `ut_id`
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: robertabcd at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---
             Flags: security-

In sysdeps/generic/utmp-equal.h:44:

#if _HAVE_UT_ID - 0
     (entry->ut_id[0] && match->ut_id[0]
      ? strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
      : strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0)
#else
     strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line) == 0
#endif
     );

If the system has `ut_id` and they are set on both side, it won't compare
`ut_line`. Common software like openssh fills `ut_id` with last 4 bytes of
terminal name (e.g. "pts/1000"). As only the last four bytes are used, the
whole file can only hold around ~10k entries before `ut_id` collides.

I propose to make it compare both `ut_id` and `ut_line`, when available. Let me
know what you think. Thanks.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]