diff options
author | Gerald Carter <jerry@samba.org> | 2005-07-03 02:05:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:58:10 -0500 |
commit | 22ea1952c8d74a1a54af5e507d124c1e30da067f (patch) | |
tree | 26d6c29acbd753240e6e28d967213bb39b4b3f64 /source3/registry | |
parent | 4d138157507a6ac6e80fb0d6b5742a6e2ceaaf12 (diff) | |
download | samba-22ea1952c8d74a1a54af5e507d124c1e30da067f.tar.gz samba-22ea1952c8d74a1a54af5e507d124c1e30da067f.tar.bz2 samba-22ea1952c8d74a1a54af5e507d124c1e30da067f.zip |
r8089: successfully delete printer subkeys via the registry....now for values
(This used to be commit d3427960b0676c506c639b582a2544dc58990c9e)
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_printing.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/source3/registry/reg_printing.c b/source3/registry/reg_printing.c index 09a0dd0c34..60ae68c666 100644 --- a/source3/registry/reg_printing.c +++ b/source3/registry/reg_printing.c @@ -290,8 +290,9 @@ static BOOL key_printers_store_keys( const char *key, REGSUBKEY_CTR *subkeys ) char *printers_key; char *printername, *printerdatakey; NT_PRINTER_INFO_LEVEL *printer = NULL; - int i, num_subkeys; + int i, num_subkeys, num_existing_keys; char *subkeyname; + fstring *existing_subkeys = NULL; printers_key = strip_printers_prefix( key ); @@ -309,12 +310,29 @@ static BOOL key_printers_store_keys( const char *key, REGSUBKEY_CTR *subkeys ) printername)); return False; } + + /* get the top level printer keys */ + + num_existing_keys = get_printer_subkeys( &printer->info_2->data, "", &existing_subkeys ); + + for ( i=0; i<num_existing_keys; i++ ) { + + /* remove the key if it has been deleted */ + + if ( !regsubkey_ctr_key_exists( subkeys, existing_subkeys[i] ) ) { + DEBUG(5,("key_printers_store_keys: deleting key %s\n", + existing_subkeys[i])); + delete_printer_key( &printer->info_2->data, existing_subkeys[i] ); + } + } num_subkeys = regsubkey_ctr_numkeys( subkeys ); for ( i=0; i<num_subkeys; i++ ) { subkeyname = regsubkey_ctr_specific_key(subkeys, i); /* add any missing printer keys */ if ( lookup_printerkey(&printer->info_2->data, subkeyname) == -1 ) { + DEBUG(5,("key_printers_store_keys: adding key %s\n", + existing_subkeys[i])); if ( add_new_printer_key( &printer->info_2->data, subkeyname ) == -1 ) return False; } |