PATCH: VFS audit.c module

Eric Lorimer eric_lorimer at tayloru.edu
Sat Apr 27 15:14:02 GMT 2002


Hello,

Not sure if anyone else has run across the same thing: after making and installing the stock audit.so 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)
	NULL,
	NULL,
#else
	vfswrap_chmod_acl,
	vfswrap_fchmod_acl,
#endif
	...
};

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,




More information about the samba-technical mailing list