The Samba-Bugzilla – Attachment 3113 Details for
Bug 5178
Registry backend: Problems when editing with regedit
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Prevent deletion of keys that have subkeys or values.
patch-6 (text/plain), 1.27 KB, created by
Andrew Kroeger
on 2008-01-17 14:59:33 UTC
(
hide
)
Description:
Prevent deletion of keys that have subkeys or values.
Filename:
MIME Type:
Creator:
Andrew Kroeger
Created:
2008-01-17 14:59:33 UTC
Size:
1.27 KB
patch
obsolete
>diff --git a/source/lib/registry/ldb.c b/source/lib/registry/ldb.c >index 3e98d2f..93e2861 100644 >--- a/source/lib/registry/ldb.c >+++ b/source/lib/registry/ldb.c >@@ -452,6 +452,32 @@ static WERROR ldb_del_key(const struct hive_key *key, const char *name) > struct ldb_key_data *parentkd = talloc_get_type(key, struct ldb_key_data); > struct ldb_dn *ldap_path; > TALLOC_CTX *mem_ctx = talloc_init("ldb_del_key"); >+ WERROR werr; >+ struct hive_key *tmp_key; >+ struct ldb_key_data *kd; >+ >+ /* TODO: If we want this to be consistent with the Windows behavior, we >+ * should provide the capability of recursive deletion. */ >+ /* This is currently a workaround to prevent orphaned subkeys or values >+ * from re-appearing when a key is created using the same name as a >+ * previously deleted key that contained subkeys or values. >+ */ >+ /* Begin workaround */ >+ werr = ldb_open_key(mem_ctx, key, name, &tmp_key); >+ if (! W_ERROR_IS_OK(werr)) >+ { >+ talloc_free(mem_ctx); >+ return werr; >+ } >+ kd = talloc_get_type(tmp_key, struct ldb_key_data); >+ >+ /* Do not allow deletion if there are subkeys or values */ >+ if (kd->subkey_count > 0 || kd->value_count > 0) >+ { >+ talloc_free(mem_ctx); >+ return WERR_ACCESS_DENIED; >+ } >+ /* End workaround */ > > ldap_path = reg_path_to_ldb(mem_ctx, key, name, NULL); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 5178
:
3090
|
3108
|
3109
|
3110
|
3111
|
3112
|
3113
|
3152
|
3400
|
3464
|
3466
|
3472
|
3473
|
3474
|
3480
|
3481
|
3497
|
3572