registry: check for existence of key in regdb_get_secdesc() before proceeding.
[kai/samba.git] / source3 / registry / reg_backend_db.c
index 44a60cf03023858d172535c662fb90e25fc3c909..372ee3f18f65fbdd6246b820ace92715fa926f2d 100644 (file)
@@ -1077,6 +1077,11 @@ static WERROR regdb_get_secdesc(TALLOC_CTX *mem_ctx, const char *key,
 
        DEBUG(10, ("regdb_get_secdesc: Getting secdesc of key [%s]\n", key));
 
+       if (!regdb_key_exists(key)) {
+               err = WERR_BADFILE;
+               goto done;
+       }
+
        tdbkey = talloc_asprintf(tmp_ctx, "%s/%s", REG_SECDESC_PREFIX, key);
        if (tdbkey == NULL) {
                err = WERR_NOMEM;