]> granicus.if.org Git - linux-pam/commitdiff
pam_timestamp: fix typo in strncmp usage
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 14 Jun 2016 23:03:13 +0000 (23:03 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 14 Jun 2016 23:03:13 +0000 (23:03 +0000)
Before this fix, a typo in check_login_time resulted to ruser and
struct utmp.ut_user being compared by the first character only,
which in turn could lead to a too low timestamp value being assigned
to oldest_login, effectively causing bypass of check_login_time.

* modules/pam_timestamp/pam_timestamp.c (check_login_time): Fix typo
in strncmp usage.

Patch-by: Anton V. Boyarshinov <boyarsh@altlinux.org>
modules/pam_timestamp/pam_timestamp.c

index b18efdfdaec66d7142dd26511a06921c42edd966..aa8e7811a4c6f6db455e413c35fe0e3e25999a99 100644 (file)
@@ -211,7 +211,7 @@ check_login_time(const char *ruser, time_t timestamp)
                if (ut->ut_type != USER_PROCESS) {
                        continue;
                }
-               if (strncmp(ruser, ut->ut_user, sizeof(ut->ut_user) != 0)) {
+               if (strncmp(ruser, ut->ut_user, sizeof(ut->ut_user)) != 0) {
                        continue;
                }
                if (oldest_login == 0 || oldest_login > ut->ut_tv.tv_sec) {