Author: jerry
Date: 2005-11-08 02:27:54 +0000 (Tue, 08 Nov 2005)
New Revision: 11571

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11571

Log:
fix problem enumerating HKPD (doesn't help much in the long run)
Modified:
   trunk/source/utils/net_rpc_registry.c


Changeset:
Modified: trunk/source/utils/net_rpc_registry.c
===================================================================
--- trunk/source/utils/net_rpc_registry.c       2005-11-08 02:15:24 UTC (rev 
11570)
+++ trunk/source/utils/net_rpc_registry.c       2005-11-08 02:27:54 UTC (rev 
11571)
@@ -117,11 +117,14 @@
                return werror_to_ntstatus(result);
        }
        
-       result = rpccli_reg_open_entry(pipe_hnd, mem_ctx, &pol_hive, subpath, 
MAXIMUM_ALLOWED_ACCESS, &pol_key );
-       if ( !W_ERROR_IS_OK(result) ) {
-               d_printf("Unable to open [%s]\n", argv[0]);
-               return werror_to_ntstatus(result);
+       if ( strlen( subpath ) != 0 ) {
+               result = rpccli_reg_open_entry(pipe_hnd, mem_ctx, &pol_hive, 
subpath, MAXIMUM_ALLOWED_ACCESS, &pol_key );
+               if ( !W_ERROR_IS_OK(result) ) {
+                       d_printf("Unable to open [%s]\n", argv[0]);
+                       return werror_to_ntstatus(result);
+               }
        }
+               memcpy( &pol_key, &pol_hive, sizeof(POLICY_HND) );
        
        /* get the subkeys */
        
@@ -183,7 +186,8 @@
 out:
        /* cleanup */
        
-       rpccli_reg_close(pipe_hnd, mem_ctx, &pol_key );
+       if ( strlen( subpath ) != 0 )
+               rpccli_reg_close(pipe_hnd, mem_ctx, &pol_key );
        rpccli_reg_close(pipe_hnd, mem_ctx, &pol_hive );
 
        return werror_to_ntstatus(result);

Reply via email to