Don't crash when a backend doesn't have a setsampwent function available - bug report...
authorJelmer Vernooij <jelmer@samba.org>
Wed, 25 Sep 2002 11:42:30 +0000 (11:42 +0000)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 25 Sep 2002 11:42:30 +0000 (11:42 +0000)
source/passdb/pdb_interface.c

index f5926e54f1268e8197e07cdf438625a65ecf41eb..f965dd727cce7d7c912bc989466aa7c44e7cd89a 100644 (file)
@@ -41,7 +41,7 @@ const struct pdb_init_function_entry builtin_pdb_init_functions[] = {
 
 static BOOL context_setsampwent(struct pdb_context *context, BOOL update)
 {
-       if ((!context) || (!context->pdb_methods) || (!context->pdb_methods->setsampwent)) {
+       if (!context) {
                DEBUG(0, ("invalid pdb_context specified!\n"));
                return False;
        }
@@ -53,7 +53,7 @@ static BOOL context_setsampwent(struct pdb_context *context, BOOL update)
                return True;
        }
 
-       while (!(context->pwent_methods->setsampwent(context->pwent_methods, update))) {
+       while (!(context->pwent_methods->setsampwent) || !(context->pwent_methods->setsampwent(context->pwent_methods, update))) {
                context->pwent_methods = context->pwent_methods->next;
                if (context->pwent_methods == NULL) 
                        return False;