PATCH: VFS audit.c module

Esh, Andrew AEsh at
Mon Apr 29 07:23:01 GMT 2002

Wouldn't a better fix be to replace the NULLs in vfs.c with calls to a
function like vfs_do_nothing, which always returns false or NULL? That way
no one working on code outside of the vfs wrapper code has to remember to
test the function pointers.

-----Original Message-----
From: Eric Lorimer [mailto:eric_lorimer at]
Sent: Saturday, April 27, 2002 5:19 PM
To: samba-technical at
Subject: PATCH: VFS audit.c module


Not sure if anyone else has run across the same thing: after making and
installing the stock module, trying to write a file to the share
causes a segfault. The problem is these lines from smbd/vfs.c:

struct vfs_ops default_vfs_ops = {
#if defined(HAVE_NO_ACLS)

if HAVE_NO_ACLS is defined, the two pointers are null, and the audit.c
module tries to follow the null pointers and causes the segfault. I would
guess the problem is also present in skel.c as well. Though the fix is
trivial, I've included a patch anyway.

- Eric Lorimer

--- audit.c	Sat Apr 27 17:11:25 2002
+++ /tmp/audit.c.good	Sat Apr 27 16:44:15 2002
@@ -287,7 +287,12 @@
 int audit_chmod_acl(struct connection_struct *conn, const char *path,
mode_t mode)
-	int result = default_vfs_ops.chmod_acl(conn, path, mode);
+	int result;
+	if ( default_vfs_ops.chmod_acl == NULL )
+		return 0;
+	result = default_vfs_ops.chmod_acl(conn, path, mode);
 	syslog(SYSLOG_PRIORITY, "chmod_acl %s mode 0x%x %s%s\n",
 	       path, mode,
@@ -311,7 +316,12 @@
 int audit_fchmod_acl(struct files_struct *fsp, int fd, mode_t mode)
-	int result = default_vfs_ops.fchmod_acl(fsp, fd, mode);
+	int result;
+	if ( default_vfs_ops.fchmod_acl == NULL )
+		return 0;
+	result = default_vfs_ops.fchmod_acl(fsp, fd, mode);
 	syslog(SYSLOG_PRIORITY, "fchmod_acl %s mode 0x%x %s%s\n",
 	       fsp->fsp_name, mode,
-------------- next part --------------
HTML attachment scrubbed and removed

More information about the samba-technical mailing list