[PATCH] BUG 9965: Set lease only on regular files.

Andreas Schneider asn at samba.org
Sat Jun 22 02:48:57 MDT 2013


Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/smbd/oplock_linux.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/source3/smbd/oplock_linux.c b/source3/smbd/oplock_linux.c
index 7fa9b7c..9464d7a 100644
--- a/source3/smbd/oplock_linux.c
+++ b/source3/smbd/oplock_linux.c
@@ -74,8 +74,20 @@ int linux_set_lease_sighandler(int fd)
 
 int linux_setlease(int fd, int leasetype)
 {
+	struct stat sb;
 	int ret;
 
+	ret = fstat(fd, &sb);
+	if (ret == -1) {
+		return -1;
+	}
+
+	/* We can't set a lease on special files like pipes */
+	if (!S_ISREG(sb.st_mode)) {
+		errno = EINVAL;
+		return -1;
+	}
+
 	/* First set the signal handler. */
 	if (linux_set_lease_sighandler(fd) == -1) {
 		return -1;
-- 
1.8.1.4




More information about the samba-technical mailing list