1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

r18962: * Add IDL for SaveKey() and RestoreKey() and regenerated

* Tested RegSaveKey() using win32 app.  Apparently
  this code has been brokne for a really long time.
(This used to be commit 5381dcbde3)
This commit is contained in:
Gerald Carter 2006-09-27 16:05:25 +00:00 committed by Gerald (Jerry) Carter
parent 3ae0baefa1
commit b3ec4697ef
9 changed files with 201 additions and 50 deletions

View File

@ -572,12 +572,15 @@ NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
return werror_to_ntstatus(r.out.result);
}
NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags)
{
struct winreg_RestoreKey r;
NTSTATUS status;
/* In parameters */
r.in.handle = handle;
r.in.filename = filename;
r.in.flags = flags;
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r);
@ -597,12 +600,15 @@ NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c
return werror_to_ntstatus(r.out.result);
}
NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx)
NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib)
{
struct winreg_SaveKey r;
NTSTATUS status;
/* In parameters */
r.in.handle = handle;
r.in.filename = filename;
r.in.sec_attrib = sec_attrib;
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r);

View File

@ -20,8 +20,8 @@ NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time);
NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length);
NTSTATUS rpccli_winreg_ReplaceKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);
NTSTATUS rpccli_winreg_RestoreKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags);
NTSTATUS rpccli_winreg_SaveKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib);
NTSTATUS rpccli_winreg_SetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd);
NTSTATUS rpccli_winreg_SetValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size);
NTSTATUS rpccli_winreg_UnLoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx);

View File

@ -335,6 +335,44 @@ _PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name
ndr->depth--;
}
NTSTATUS ndr_push_KeySecurityAttribute(struct ndr_push *ndr, int ndr_flags, const struct KeySecurityAttribute *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_push_align(ndr, 4));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->data_size));
NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_SCALARS, &r->sec_data));
NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->inherit));
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_push_KeySecurityData(ndr, NDR_BUFFERS, &r->sec_data));
}
return NT_STATUS_OK;
}
NTSTATUS ndr_pull_KeySecurityAttribute(struct ndr_pull *ndr, int ndr_flags, struct KeySecurityAttribute *r)
{
if (ndr_flags & NDR_SCALARS) {
NDR_CHECK(ndr_pull_align(ndr, 4));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->data_size));
NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_SCALARS, &r->sec_data));
NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->inherit));
}
if (ndr_flags & NDR_BUFFERS) {
NDR_CHECK(ndr_pull_KeySecurityData(ndr, NDR_BUFFERS, &r->sec_data));
}
return NT_STATUS_OK;
}
_PUBLIC_ void ndr_print_KeySecurityAttribute(struct ndr_print *ndr, const char *name, const struct KeySecurityAttribute *r)
{
ndr_print_struct(ndr, name, "KeySecurityAttribute");
ndr->depth++;
ndr_print_uint32(ndr, "data_size", r->data_size);
ndr_print_KeySecurityData(ndr, "sec_data", &r->sec_data);
ndr_print_uint8(ndr, "inherit", r->inherit);
ndr->depth--;
}
NTSTATUS ndr_push_QueryMultipleValue(struct ndr_push *ndr, int ndr_flags, const struct QueryMultipleValue *r)
{
if (ndr_flags & NDR_SCALARS) {
@ -2594,6 +2632,11 @@ _PUBLIC_ void ndr_print_winreg_ReplaceKey(struct ndr_print *ndr, const char *nam
NTSTATUS ndr_push_winreg_RestoreKey(struct ndr_push *ndr, int flags, const struct winreg_RestoreKey *r)
{
if (flags & NDR_IN) {
if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
if (r->in.filename == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.flags));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
@ -2603,7 +2646,24 @@ NTSTATUS ndr_push_winreg_RestoreKey(struct ndr_push *ndr, int flags, const struc
NTSTATUS ndr_pull_winreg_RestoreKey(struct ndr_pull *ndr, int flags, struct winreg_RestoreKey *r)
{
TALLOC_CTX *_mem_save_handle_0;
TALLOC_CTX *_mem_save_filename_0;
if (flags & NDR_IN) {
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.handle);
}
_mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.filename);
}
_mem_save_filename_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.filename, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filename_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.flags));
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
@ -2621,6 +2681,15 @@ _PUBLIC_ void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *nam
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "winreg_RestoreKey");
ndr->depth++;
ndr_print_ptr(ndr, "handle", r->in.handle);
ndr->depth++;
ndr_print_policy_handle(ndr, "handle", r->in.handle);
ndr->depth--;
ndr_print_ptr(ndr, "filename", r->in.filename);
ndr->depth++;
ndr_print_winreg_String(ndr, "filename", r->in.filename);
ndr->depth--;
ndr_print_uint32(ndr, "flags", r->in.flags);
ndr->depth--;
}
if (flags & NDR_OUT) {
@ -2635,6 +2704,14 @@ _PUBLIC_ void ndr_print_winreg_RestoreKey(struct ndr_print *ndr, const char *nam
NTSTATUS ndr_push_winreg_SaveKey(struct ndr_push *ndr, int flags, const struct winreg_SaveKey *r)
{
if (flags & NDR_IN) {
if (r->in.handle == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
if (r->in.filename == NULL) return NT_STATUS_INVALID_PARAMETER_MIX;
NDR_CHECK(ndr_push_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
NDR_CHECK(ndr_push_unique_ptr(ndr, r->in.sec_attrib));
if (r->in.sec_attrib) {
NDR_CHECK(ndr_push_KeySecurityAttribute(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sec_attrib));
}
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_WERROR(ndr, NDR_SCALARS, r->out.result));
@ -2644,7 +2721,37 @@ NTSTATUS ndr_push_winreg_SaveKey(struct ndr_push *ndr, int flags, const struct w
NTSTATUS ndr_pull_winreg_SaveKey(struct ndr_pull *ndr, int flags, struct winreg_SaveKey *r)
{
uint32_t _ptr_sec_attrib;
TALLOC_CTX *_mem_save_handle_0;
TALLOC_CTX *_mem_save_filename_0;
TALLOC_CTX *_mem_save_sec_attrib_0;
if (flags & NDR_IN) {
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.handle);
}
_mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
NDR_PULL_ALLOC(ndr, r->in.filename);
}
_mem_save_filename_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.filename, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_winreg_String(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.filename));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_filename_0, LIBNDR_FLAG_REF_ALLOC);
NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sec_attrib));
if (_ptr_sec_attrib) {
NDR_PULL_ALLOC(ndr, r->in.sec_attrib);
} else {
r->in.sec_attrib = NULL;
}
if (r->in.sec_attrib) {
_mem_save_sec_attrib_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->in.sec_attrib, 0);
NDR_CHECK(ndr_pull_KeySecurityAttribute(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.sec_attrib));
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sec_attrib_0, 0);
}
}
if (flags & NDR_OUT) {
NDR_CHECK(ndr_pull_WERROR(ndr, NDR_SCALARS, &r->out.result));
@ -2662,6 +2769,20 @@ _PUBLIC_ void ndr_print_winreg_SaveKey(struct ndr_print *ndr, const char *name,
if (flags & NDR_IN) {
ndr_print_struct(ndr, "in", "winreg_SaveKey");
ndr->depth++;
ndr_print_ptr(ndr, "handle", r->in.handle);
ndr->depth++;
ndr_print_policy_handle(ndr, "handle", r->in.handle);
ndr->depth--;
ndr_print_ptr(ndr, "filename", r->in.filename);
ndr->depth++;
ndr_print_winreg_String(ndr, "filename", r->in.filename);
ndr->depth--;
ndr_print_ptr(ndr, "sec_attrib", r->in.sec_attrib);
ndr->depth++;
if (r->in.sec_attrib) {
ndr_print_KeySecurityAttribute(ndr, "sec_attrib", r->in.sec_attrib);
}
ndr->depth--;
ndr->depth--;
}
if (flags & NDR_OUT) {

View File

@ -92,6 +92,7 @@ void ndr_print_KeySecurityData(struct ndr_print *ndr, const char *name, const st
void ndr_print_winreg_SecBuf(struct ndr_print *ndr, const char *name, const struct winreg_SecBuf *r);
void ndr_print_winreg_CreateAction(struct ndr_print *ndr, const char *name, enum winreg_CreateAction r);
void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name, const struct winreg_StringBuf *r);
void ndr_print_KeySecurityAttribute(struct ndr_print *ndr, const char *name, const struct KeySecurityAttribute *r);
void ndr_print_QueryMultipleValue(struct ndr_print *ndr, const char *name, const struct QueryMultipleValue *r);
void ndr_print_winreg_OpenHKCR(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCR *r);
void ndr_print_winreg_OpenHKCU(struct ndr_print *ndr, const char *name, int flags, const struct winreg_OpenHKCU *r);

View File

@ -1217,7 +1217,7 @@ static BOOL api_winreg_RestoreKey(pipes_struct *p)
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(winreg_RestoreKey, &r);
r.out.result = _winreg_RestoreKey(p);
r.out.result = _winreg_RestoreKey(p, r.in.handle, r.in.filename, r.in.flags);
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(winreg_RestoreKey, &r);
@ -1273,7 +1273,7 @@ static BOOL api_winreg_SaveKey(pipes_struct *p)
if (DEBUGLEVEL >= 10)
NDR_PRINT_IN_DEBUG(winreg_SaveKey, &r);
r.out.result = _winreg_SaveKey(p);
r.out.result = _winreg_SaveKey(p, r.in.handle, r.in.filename, r.in.sec_attrib);
if (DEBUGLEVEL >= 10)
NDR_PRINT_OUT_DEBUG(winreg_SaveKey, &r);

View File

@ -20,8 +20,8 @@ WERROR _winreg_OpenKey(pipes_struct *p, struct policy_handle *parent_handle, str
WERROR _winreg_QueryInfoKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *classname, uint32_t *num_subkeys, uint32_t *max_subkeylen, uint32_t *max_subkeysize, uint32_t *num_values, uint32_t *max_valnamelen, uint32_t *max_valbufsize, uint32_t *secdescsize, NTTIME *last_changed_time);
WERROR _winreg_QueryValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String value_name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length);
WERROR _winreg_ReplaceKey(pipes_struct *p);
WERROR _winreg_RestoreKey(pipes_struct *p);
WERROR _winreg_SaveKey(pipes_struct *p);
WERROR _winreg_RestoreKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags);
WERROR _winreg_SaveKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib);
WERROR _winreg_SetKeySecurity(pipes_struct *p, struct policy_handle *handle, uint32_t access_mask, struct KeySecurityData *sd);
WERROR _winreg_SetValue(pipes_struct *p, struct policy_handle *handle, struct winreg_String name, enum winreg_Type type, uint8_t *data, uint32_t size);
WERROR _winreg_UnLoadKey(pipes_struct *p);

View File

@ -53,6 +53,12 @@ struct winreg_StringBuf {
const char *name;/* [unique,length_is(length/2),charset(UTF16),size_is(size/2)] */
};
struct KeySecurityAttribute {
uint32_t data_size;
struct KeySecurityData sec_data;
uint8_t inherit;
};
struct QueryMultipleValue {
struct winreg_String *name;/* [unique] */
enum winreg_Type type;
@ -359,6 +365,12 @@ struct winreg_ReplaceKey {
struct winreg_RestoreKey {
struct {
struct policy_handle *handle;/* [ref] */
struct winreg_String *filename;/* [ref] */
uint32_t flags;
} in;
struct {
WERROR result;
} out;
@ -367,6 +379,12 @@ struct winreg_RestoreKey {
struct winreg_SaveKey {
struct {
struct policy_handle *handle;/* [ref] */
struct winreg_String *filename;/* [ref] */
struct KeySecurityAttribute *sec_attrib;/* [unique] */
} in;
struct {
WERROR result;
} out;

View File

@ -238,11 +238,24 @@
/******************/
/* Function: 0x13 */
WERROR winreg_RestoreKey(
[in,ref] policy_handle *handle,
[in,ref] winreg_String *filename,
[in] uint32 flags
);
/******************/
/* Function: 0x14 */
typedef struct {
uint32 data_size;
KeySecurityData sec_data;
uint8 inherit;
} KeySecurityAttribute;
WERROR winreg_SaveKey(
[in,ref] policy_handle *handle,
[in,ref] winreg_String *filename,
[in,unique] KeySecurityAttribute *sec_attrib
);
/******************/

View File

@ -1,9 +1,8 @@
/*
* Unix SMB/CIFS implementation.
* RPC Pipe client / server routines
* Copyright (C) Andrew Tridgell 1992-1997.
* Copyright (C) Jeremy Allison 2001.
* Copyright (C) Gerald Carter 2002-2005.
*
* Copyright (C) Gerald Carter 2002-2006.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,10 +27,8 @@
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
#if 0 /* temporaily disabled */
static struct generic_mapping reg_generic_map =
{ REG_KEY_READ, REG_KEY_WRITE, REG_KEY_EXECUTE, REG_KEY_ALL };
#endif
/******************************************************************
free() function for REGISTRY_KEY
@ -761,9 +758,6 @@ WERROR _winreg_AbortSystemShutdown(pipes_struct *p, uint16_t *server)
return (ret == 0) ? WERR_OK : WERR_ACCESS_DENIED;
}
#if 0 /* This code works but is disabled for now until I
fix the WinReg IDL file -- jerry */
/*******************************************************************
********************************************************************/
@ -914,26 +908,26 @@ static WERROR restore_registry_key ( REGISTRY_KEY *krecord, const char *fname )
return result;
}
#endif
/*******************************************************************
********************************************************************/
WERROR _winreg_RestoreKey(pipes_struct *p)
WERROR _winreg_RestoreKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *filename, uint32_t flags)
{
#if 0 /* temporarily disabled */
REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
pstring filename;
REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, handle );
pstring fname;
int snum;
if ( !regkey )
return WERR_BADFID;
rpcstr_pull(filename, q_u->filename.string->buffer, sizeof(filename), q_u->filename.string->uni_str_len*2, STR_TERMINATE);
if ( !filename || !filename->name )
return WERR_INVALID_PARAM;
DEBUG(8,("_reg_restore_key: verifying restore of key [%s] from \"%s\"\n", regkey->name, filename));
pstrcpy( fname, filename->name );
if ( (snum = validate_reg_filename( filename )) == -1 )
DEBUG(8,("_winreg_RestoreKey: verifying restore of key [%s] from \"%s\"\n", regkey->name, fname));
if ( (snum = validate_reg_filename( fname )) == -1 )
return WERR_OBJECT_PATH_INVALID;
/* user must posses SeRestorePrivilege for this this proceed */
@ -941,17 +935,13 @@ WERROR _winreg_RestoreKey(pipes_struct *p)
if ( !user_has_privileges( p->pipe_user.nt_user_token, &se_restore ) )
return WERR_ACCESS_DENIED;
DEBUG(2,("_reg_restore_key: Restoring [%s] from %s in share %s\n", regkey->name, filename, lp_servicename(snum) ));
DEBUG(2,("_winreg_RestoreKey: Restoring [%s] from %s in share %s\n", regkey->name, fname, lp_servicename(snum) ));
return restore_registry_key( regkey, filename );
#endif
return restore_registry_key( regkey, fname );
return WERR_NOT_SUPPORTED;
}
#if 0 /* this code works but has been disable until I fix
the winreg IDL -- jerry */
/********************************************************************
********************************************************************/
@ -987,14 +977,16 @@ static WERROR reg_write_tree( REGF_FILE *regfile, const char *keypath,
/* we need a REGISTRY_KEY object here to enumerate subkeys and values */
ZERO_STRUCT( registry_key );
pstrcpy( registry_key.name, keypath );
if ( !(registry_key.hook = reghook_cache_find( registry_key.name )) )
if ( (registry_key.name = talloc_strdup(regfile->mem_ctx, keypath)) == NULL )
return WERR_NOMEM;
if ( (registry_key.hook = reghook_cache_find( registry_key.name )) == NULL )
return WERR_BADFILE;
/* lookup the values and subkeys */
if ( !(subkeys = TALLOC_ZERO_P( regfile->mem_ctx, REGSUBKEY_CTR )) )
if ( !(subkeys = TALLOC_ZERO_P( regfile->mem_ctx, REGSUBKEY_CTR )) )
return WERR_NOMEM;
if ( !(values = TALLOC_ZERO_P( subkeys, REGVAL_CTR )) )
@ -1025,6 +1017,7 @@ static WERROR reg_write_tree( REGF_FILE *regfile, const char *keypath,
done:
TALLOC_FREE( subkeys );
TALLOC_FREE( registry_key.name );
return result;
}
@ -1101,35 +1094,32 @@ static WERROR backup_registry_key ( REGISTRY_KEY *krecord, const char *fname )
return result;
}
#endif
/*******************************************************************
********************************************************************/
WERROR _winreg_SaveKey(pipes_struct *p)
WERROR _winreg_SaveKey(pipes_struct *p, struct policy_handle *handle, struct winreg_String *filename, struct KeySecurityAttribute *sec_attrib)
{
#if 0
REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, &q_u->pol );
pstring filename;
REGISTRY_KEY *regkey = find_regkey_index_by_hnd( p, handle );
pstring fname;
int snum;
if ( !regkey )
return WERR_BADFID;
rpcstr_pull(filename, q_u->filename.string->buffer, sizeof(filename), q_u->filename.string->uni_str_len*2, STR_TERMINATE);
if ( !filename || !filename->name )
return WERR_INVALID_PARAM;
DEBUG(8,("_reg_save_key: verifying backup of key [%s] to \"%s\"\n", regkey->name, filename));
pstrcpy( fname, filename->name );
DEBUG(8,("_winreg_SaveKey: verifying backup of key [%s] to \"%s\"\n", regkey->name, fname));
if ( (snum = validate_reg_filename( filename )) == -1 )
if ( (snum = validate_reg_filename( fname )) == -1 )
return WERR_OBJECT_PATH_INVALID;
DEBUG(2,("_reg_save_key: Saving [%s] to %s in share %s\n", regkey->name, filename, lp_servicename(snum) ));
DEBUG(2,("_winreg_SaveKey: Saving [%s] to %s in share %s\n", regkey->name, fname, lp_servicename(snum) ));
return backup_registry_key( regkey, filename );
#endif
/* disabled for now until I fix the IDL --jerry */
return WERR_NOT_SUPPORTED;
return backup_registry_key( regkey, fname );
}
/*******************************************************************
@ -1137,7 +1127,9 @@ WERROR _winreg_SaveKey(pipes_struct *p)
WERROR _winreg_SaveKeyEx(pipes_struct *p)
{
/* disabled for now until I fix the IDL --jerry */
/* fill in your code here if you think this call should
do anything */
return WERR_NOT_SUPPORTED;
}