Fix bug 8920, null dereference
authorSteve Langasek <steve.langasek@ubuntu.com>
Wed, 9 May 2012 05:56:00 +0000 (07:56 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 10 May 2012 09:07:27 +0000 (11:07 +0200)
Description: Avoid null dereference in initialize_password_db()
 When initialize_password_db() is called with reload=True, it's assumed that
 the free_private_data member of pdb_methods is non-null.  This is not
 necessarily the case, as the tdb backend has no private data and therefore
 no free function.  Check to see if we have private data that needs freed
 before calling.
Author: Steve Langasek <steve.langasek@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/829221

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Thu May 10 11:07:27 CEST 2012 on sn-devel-104

source3/passdb/pdb_interface.c

index 6945a4210cca3bb8bab6ed8c689cb4dbb47af929..5931dde2d88edebf3b95bfe8e17961dcb4055fd6 100644 (file)
@@ -195,7 +195,9 @@ static struct pdb_methods *pdb_get_methods_reload( bool reload )
        static struct pdb_methods *pdb = NULL;
 
        if ( pdb && reload ) {
-               pdb->free_private_data( &(pdb->private_data) );
+               if (pdb->free_private_data != NULL) {
+                       pdb->free_private_data( &(pdb->private_data) );
+               }
                if ( !NT_STATUS_IS_OK( make_pdb_method_name( &pdb, lp_passdb_backend() ) ) ) {
                        return NULL;
                }