[prev in list] [next in list] [prev in thread] [next in thread] 

List:       samba-technical
Subject:    [PATCH] s4-ntvfs: check if pvfs is NULL in pvfs_logoff
From:       brendan powers <brendan0powers () gmail ! com>
Date:       2009-12-17 0:01:32
Message-ID: c547abb70912161601o171add26q6223614e00c55324 () mail ! gmail ! com
[Download RAW message or body]

Hello,

I ran into a problem where if I shared a directory that did not exist,
samba would segfault. This was caused by pvfs_logoff not checking if
the pvfs pointer was valid. I assume this was caused by the directory
not existing, so no log on actually occurred.

The patch is attached.

["0001-s4-ntvfs-check-if-pvfs-is-NULL-in-pvfs_logoff.patch" (text/x-diff)]

From 61e61a72691cca027248a3cb426b4b1bde4cbae0 Mon Sep 17 00:00:00 2001
From: Brendan Powers <brendan0powers@gmail.com>
Date: Wed, 16 Dec 2009 18:48:23 -0500
Subject: [PATCH] s4-ntvfs: check if pvfs is NULL in pvfs_logoff

pvfs can be NULL if the directory a share points to does not exist. In this case, \
there would be no open files, so it is safe to just return from the function.

---
 source4/ntvfs/posix/pvfs_open.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/source4/ntvfs/posix/pvfs_open.c b/source4/ntvfs/posix/pvfs_open.c
index 621db3c..aa66ad7 100644
--- a/source4/ntvfs/posix/pvfs_open.c
+++ b/source4/ntvfs/posix/pvfs_open.c
@@ -1713,6 +1713,11 @@ NTSTATUS pvfs_logoff(struct ntvfs_module_context *ntvfs,
 				  struct pvfs_state);
 	struct pvfs_file *f, *next;
 
+	/* If pvfs is NULL, we never logged on, and no files are open. */
+	if(pvfs == NULL) {
+		return NT_STATUS_OK;
+	}
+
 	for (f=pvfs->files.list;f;f=next) {
 		next = f->next;
 		if (f->ntvfs->session_info == req->session_info) {
-- 
1.5.4.3



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic