From 1e80e4023bce285ef4858383b5064b9ac3b254c1 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Thu, 21 Sep 2006 12:59:33 +1000 Subject: - otto@cvs.openbsd.org 2006/09/19 05:52:23 [sftp.c] Use S_IS* macros insted of masking with S_IF* flags. The latter may have multiple bits set, which lead to surprising results. Spotted by Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@ --- ChangeLog | 10 +++++++++- sftp.c | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index e43185568..0373fe17a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +20060921 + - (dtucker) OpenBSD CVS Sync + - otto@cvs.openbsd.org 2006/09/19 05:52:23 + [sftp.c] + Use S_IS* macros insted of masking with S_IF* flags. The latter may + have multiple bits set, which lead to surprising results. Spotted by + Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@ + 20060918 - (dtucker) [configure.ac] On AIX, check to see if the compiler will allow macro redefinitions, and if not, remove "-qlanglvl=ansi" from the flags. @@ -5457,4 +5465,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.4552 2006/09/18 13:54:32 dtucker Exp $ +$Id: ChangeLog,v 1.4553 2006/09/21 02:59:33 dtucker Exp $ diff --git a/sftp.c b/sftp.c index cf3dea048..c018615ae 100644 --- a/sftp.c +++ b/sftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp.c,v 1.91 2006/08/03 03:34:42 deraadt Exp $ */ +/* $OpenBSD: sftp.c,v 1.92 2006/09/19 05:52:23 otto Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -493,7 +493,7 @@ is_dir(char *path) if (stat(path, &sb) == -1) return(0); - return(sb.st_mode & S_IFDIR); + return(S_ISDIR(sb.st_mode)); } static int @@ -517,7 +517,7 @@ remote_is_dir(struct sftp_conn *conn, char *path) return(0); if (!(a->flags & SSH2_FILEXFER_ATTR_PERMISSIONS)) return(0); - return(a->perm & S_IFDIR); + return(S_ISDIR(a->perm)); } static int -- cgit v1.2.3