r5541: Fix crash bug in the client-spoolss enumdataex-call.
authorGünther Deschner <gd@samba.org>
Thu, 24 Feb 2005 17:00:24 +0000 (17:00 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:55:46 +0000 (10:55 -0500)
With Windows2003 it's perfectly legal to receive no data when querying a
value-less subkey. Found while migrating printer settings.

Guenther
(This used to be commit 3e04def03377b2eae2987c87b18ccadf5b48a6fe)

source3/registry/reg_objects.c
source3/utils/net_rpc_printer.c

index 16fb7dd18d7bf7eedbfeda93ad0b3133d153de16..c8dc6330873d31f68a55875b2525adf2c1d4b9d5 100644 (file)
@@ -113,7 +113,7 @@ void regsubkey_ctr_destroy( REGSUBKEY_CTR *ctr )
 
 void regval_ctr_init( REGVAL_CTR *ctr )
 {
-       if ( !ctr->ctx )
+       if ( ctr && !ctr->ctx )
                ctr->ctx = talloc_init("regval_ctr_init for ctr %p", ctr);
 }
 
index 456a29287fde0795f544e80a1a40a86437384748..00b038dd8ba5a57f5e5a8f89d09265f98f9f41ed 100644 (file)
@@ -980,7 +980,7 @@ net_spoolss_enumprinterdataex(struct cli_state *cli, TALLOC_CTX *mem_ctx,
 
        /* enumprinterdataex call */
        result = cli_spoolss_enumprinterdataex(
-               cli, mem_ctx, 0, &needed, hnd, keyname, NULL);
+               cli, mem_ctx, 0, &needed, hnd, keyname, ctr);
                        
        if (W_ERROR_V(result) == W_ERROR_V(WERR_MORE_DATA)) 
                result = cli_spoolss_enumprinterdataex(