From 5e438aa46cf338b2ffa26c5a56efe78657e546c2 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sat, 17 Nov 2007 21:24:06 +0000 Subject: [PATCH] Make sure that the prefix is the name of a directory (not only the beginning of a directory). Openwall patch shadow-4.0.4.1-owl-userdel-path_prefix.diff. --- ChangeLog | 6 ++++++ src/userdel.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 43e04ecc..a884f4dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-17 Nicolas François + + * src/userdel.c (path_prefix): Make sure that the prefix is the + name of a directory (not only the beginning of a directory). + Openwall patch shadow-4.0.4.1-owl-userdel-path_prefix.diff. + 2007-11-17 Nicolas François * src/newgrp.c: Do not give an indication that the group has no diff --git a/src/userdel.c b/src/userdel.c index 44935aa2..9abaa283 100644 --- a/src/userdel.c +++ b/src/userdel.c @@ -542,7 +542,8 @@ static void user_cancel (const char *user) #ifdef EXTRA_CHECK_HOME_DIR static int path_prefix (const char *s1, const char *s2) { - return (strncmp (s2, s1, strlen (s1)) == 0); + return (strncmp (s2, s1, strlen (s1)) == 0 && + (s2[strlen (s1)] == '\0' || s2[strlen (s1)] == '/')); } #endif