*/
#include "includes.h"
+#include "../libgpo/gpo_ini.h"
+#include "../libgpo/gpo.h"
+#include "libgpo/gpo_proto.h"
+#include "registry.h"
#define GP_EXT_NAME "registry"
char *key = NULL;
char *value = NULL;
enum gp_reg_action action = GP_REG_ACTION_NONE;
+ size_t converted_size;
ZERO_STRUCTP(*reg_entry);
if (strlen_w((const smb_ucs2_t *)file_entry->key.buffer) <= 0)
return false;
- if (!pull_ucs2_talloc(mem_ctx, &key, file_entry->key.buffer))
+ if (!pull_ucs2_talloc(mem_ctx, &key, file_entry->key.buffer,
+ &converted_size))
+ {
return false;
+ }
- if (strlen_w((const smb_ucs2_t *)file_entry->value.buffer) > 0) {
- if (!pull_ucs2_talloc(mem_ctx, &value,
- file_entry->value.buffer))
+ if (strlen_w((const smb_ucs2_t *)file_entry->value.buffer) > 0 &&
+ !pull_ucs2_talloc(mem_ctx, &value, file_entry->value.buffer,
+ &converted_size))
+ {
return false;
}
switch (data->type) {
case REG_DWORD:
- data->v.dword = atoi((char *)file_entry->data);
+ if (file_entry->size < 4) {
+ return false;
+ }
+ data->data = data_blob_talloc(mem_ctx, NULL, 4);
+ SIVAL(data->data.data, 0, atoi((char *)file_entry->data));
break;
case REG_BINARY:
- data->v.binary = data_blob_talloc(mem_ctx,
- file_entry->data,
- file_entry->size);
+ case REG_SZ:
+ data->data.length = file_entry->size;
+ data->data.data = file_entry->data;
break;
case REG_NONE:
break;
- case REG_SZ:
- data->v.sz.len = pull_ucs2_talloc(mem_ctx,
- &data->v.sz.str,
- (const smb_ucs2_t *)file_entry->data);
- break;
case REG_DWORD_BIG_ENDIAN:
case REG_EXPAND_SZ:
case REG_LINK:
return status;
}
- buf = (uint16 *)file_load(real_filename, &n, 0);
+ buf = (uint16 *)file_load(real_filename, &n, 0, NULL);
if (!buf) {
TALLOC_FREE(reg_file);
return NT_STATUS_CANNOT_LOAD_REGISTRY_FILE;
status = NT_STATUS_OK;
out:
- SAFE_FREE(buf);
+ TALLOC_FREE(buf);
prs_mem_free(&ps);
return status;
token, flags);
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("failed to apply registry: %s\n",
- dos_errstr(werr)));
+ win_errstr(werr)));
goto done;
}
}
debug_gpext_header(0, "registry_process_group_policy", flags, gpo,
extension_guid, snapin_guid);
- status = gpo_get_unix_path(mem_ctx, gpo, &unix_path);
+ status = gpo_get_unix_path(mem_ctx, cache_path(GPO_CACHE_DIR), gpo, &unix_path);
NT_STATUS_NOT_OK_RETURN(status);
status = reg_parse_registry(mem_ctx,
entries, num_entries);
if (!W_ERROR_IS_OK(werr)) {
DEBUG(0,("failed to apply registry: %s\n",
- dos_errstr(werr)));
+ win_errstr(werr)));
return werror_to_ntstatus(werr);
}