[PATCH] remove NULL pointers from vfs_ops struct

Alexander Bokovoy a.bokovoy at sam-solutions.net
Mon May 12 15:37:51 GMT 2003

On Mon, May 12, 2003 at 08:26:39AM -0700, Esh, Andrew wrote:
> I had issues with this code a while back, where someone managed to call the
> null pointer in a VFS module. I submitted a patch that fixed the specific
> problem. This fix appears to me to address all of those issues, and has the
> added value of removing a lot of null pointer testing code that I was
> interested in removing. This is a more correct fix.

> To codify what we've learned: It seems to me that there should be a policy
> that the function pointers in the ops structure should never be null.
> Perhaps an assert could enforce this. A VFS module should always do one of
> the following with each function:
> 1. Override the function with a valid function.
> 2. Override the function with a non-operational function which returns a
> correct error value.
> 3. Not override the function, leaving the default function in place.
> In cases 1 & 2, if those functions do not handle the call, they should call
> the default function, which must also not be null.
I'll make sure this will go into VFS API reference and module writers

Instead of assert, I think appropriate check needs to be in smbd's module
registration function, which should check that an array of pointers passed
back from module contains only non-NULL pointers for VFS operations.
Fortunately, we are already using VFS_OP(NULL) as an indicator of the end
of the array so no processing will be done after that element.

> -----Original Message-----
> From: Stefan (metze) Metzmacher [mailto:metze at metzemix.de]
> Sent: Monday, May 12, 2003 9:38 AM
> To: Alexander Bokovoy
> Cc: samba-technical at lists.samba.org
> Subject: [PATCH] remove NULL pointers from vfs_ops struct
> Hi Alexander,
> here's the patch that removes the NULL pointers as valid function pointer 
> from the vfs_ops struct
> when HAVE_NO_ACL is defined.
> Please check if the patch is ok...
> metze
> ----------------------------------------------------------------------------
> -
> Stefan "metze" Metzmacher <metze at metzemix.de> 

/ Alexander Bokovoy
Absence makes the heart go wander.

More information about the samba-technical mailing list