Re: [PATCH] cifs.upcall: use strncmp in scandir filter function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 23 Aug 2012 09:54:19 -0400
Jeff Layton <jlayton@xxxxxxxxx> wrote:

> We want to require that the filename begins with the correct string,
> not just that it contains it somewhere.
> 
> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxx>
> ---
>  cifs.upcall.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/cifs.upcall.c b/cifs.upcall.c
> index 598a999..12d5900 100644
> --- a/cifs.upcall.c
> +++ b/cifs.upcall.c
> @@ -181,10 +181,9 @@ err_cache:
>  
>  static int krb5cc_filter(const struct dirent *dirent)
>  {
> -	if (strstr(dirent->d_name, CIFS_DEFAULT_KRB5_PREFIX))
> -		return 1;
> -	else
> -		return 0;
> +	/* subtract 1 for the null terminator */
> +	return !strncmp(dirent->d_name, CIFS_DEFAULT_KRB5_PREFIX,
> +			sizeof(CIFS_DEFAULT_KRB5_PREFIX) - 1);
>  }
>  
>  static char *

Committed...
-- 
Jeff Layton <jlayton@xxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux