From 9849f048680dfdcb6db0f5dcb66a58fc01c8a281 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 19 Nov 2006 17:56:35 +0000 Subject: r19790: Check in the PIDL change and the converted unixinfo and winbind pipes without waiting for comments. This is what version control is for, and it does fix a segfault I ran into ;-) Nevertheless, Jelmer & Jerry, please take a look! Thanks, Volker (This used to be commit 95c14a822cae2ddc2e6ed87f5f5505fa7b98e4f0) --- source3/libmsrpc/cac_winreg.c | 18 +++++--- source3/librpc/gen_ndr/cli_unixinfo.c | 16 +++---- source3/librpc/gen_ndr/cli_unixinfo.h | 6 +-- source3/librpc/gen_ndr/cli_winreg.c | 82 +++++++++++++---------------------- source3/librpc/gen_ndr/cli_winreg.h | 10 ++--- source3/librpc/gen_ndr/ndr_winreg.c | 8 ++-- source3/librpc/gen_ndr/winreg.h | 2 +- source3/rpcclient/cmd_unixinfo.c | 11 ++--- source3/utils/net_rpc_registry.c | 18 +++++--- 9 files changed, 80 insertions(+), 91 deletions(-) diff --git a/source3/libmsrpc/cac_winreg.c b/source3/libmsrpc/cac_winreg.c index 4836e01893..be7bc0a220 100644 --- a/source3/libmsrpc/cac_winreg.c +++ b/source3/libmsrpc/cac_winreg.c @@ -336,6 +336,7 @@ int cac_RegCreateKey( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, struct RegOpenKey rok; struct winreg_String key_string, class_string; enum winreg_CreateAction action = 0; + enum winreg_CreateAction *paction = &action; if ( !hnd ) return CAC_FAILURE; @@ -382,7 +383,7 @@ int cac_RegCreateKey( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, rpccli_winreg_CreateKey( pipe_hnd, mem_ctx, op->in.parent_key, key_string, class_string, 0, op->in.access, NULL, key_out, - &action ); + &paction ); if ( !NT_STATUS_IS_OK( hnd->status ) ) { return CAC_FAILURE; @@ -671,9 +672,12 @@ int cac_RegQueryValue( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, REGVAL_BUFFER buffer; REG_VALUE_DATA *data_out = NULL; enum winreg_Type val_type; + enum winreg_Type *pval_type = &val_type; uint8 *buf; uint32 buf_size = 4096; + uint32 *pbuf_size = &buf_size; uint32 length = 0; + uint32 *plength = &length; if ( !hnd ) return CAC_FAILURE; @@ -702,8 +706,8 @@ int cac_RegQueryValue( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, } hnd->status = rpccli_winreg_QueryValue( pipe_hnd, mem_ctx, op->in.key, - value_string, &val_type, buf, - &buf_size, &length ); + value_string, &pval_type, &buf, + &pbuf_size, &plength ); if ( !NT_STATUS_IS_OK( hnd->status ) ) return CAC_FAILURE; @@ -834,8 +838,11 @@ int cac_RegEnumValues( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, do { uint32 data_size = maxvalbufsize; + uint32 *pdata_size = &data_size; uint32 data_length = 0; + uint32 *pdata_length = &data_length; struct winreg_StringBuf name_buf; + enum winreg_Type *ptype = &types_out[num_values_out]; memset( name_buffer, 0x0, max_valnamelen ); name_buf.name = name_buffer; @@ -845,8 +852,9 @@ int cac_RegEnumValues( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, hnd->status = rpccli_winreg_EnumValue( pipe_hnd, mem_ctx, op->in.key, resume_idx, &name_buf, - &types_out[num_values_out], - buffer, &data_size, &data_length ); + &ptype, &buffer, + &pdata_size, + &pdata_length ); if ( !NT_STATUS_IS_OK( hnd->status ) ) break; diff --git a/source3/librpc/gen_ndr/cli_unixinfo.c b/source3/librpc/gen_ndr/cli_unixinfo.c index 49ac8c8e72..078500a953 100644 --- a/source3/librpc/gen_ndr/cli_unixinfo.c +++ b/source3/librpc/gen_ndr/cli_unixinfo.c @@ -37,7 +37,7 @@ NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid) +NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid **sid) { struct unixinfo_UidToSid r; NTSTATUS status; @@ -62,9 +62,7 @@ NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c } /* Return variables */ - if ( sid ) { - *sid = *r.out.sid; - } + *sid = r.out.sid; /* Return result */ return r.out.result; @@ -101,7 +99,7 @@ NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c return r.out.result; } -NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid) +NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid **sid) { struct unixinfo_GidToSid r; NTSTATUS status; @@ -126,15 +124,13 @@ NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c } /* Return variables */ - if ( sid ) { - *sid = *r.out.sid; - } + *sid = r.out.sid; /* Return result */ return r.out.result; } -NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo *infos) +NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo **infos) { struct unixinfo_GetPWUid r; NTSTATUS status; @@ -161,7 +157,7 @@ NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* Return variables */ *count = *r.out.count; - *infos = *r.out.infos; + *infos = r.out.infos; /* Return result */ return r.out.result; diff --git a/source3/librpc/gen_ndr/cli_unixinfo.h b/source3/librpc/gen_ndr/cli_unixinfo.h index f0f2b54626..1a1683cb37 100644 --- a/source3/librpc/gen_ndr/cli_unixinfo.h +++ b/source3/librpc/gen_ndr/cli_unixinfo.h @@ -2,8 +2,8 @@ #ifndef __CLI_UNIXINFO__ #define __CLI_UNIXINFO__ NTSTATUS rpccli_unixinfo_SidToUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *uid); -NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid *sid); +NTSTATUS rpccli_unixinfo_UidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t uid, struct dom_sid **sid); NTSTATUS rpccli_unixinfo_SidToGid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct dom_sid sid, uint64_t *gid); -NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid *sid); -NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo *infos); +NTSTATUS rpccli_unixinfo_GidToSid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint64_t gid, struct dom_sid **sid); +NTSTATUS rpccli_unixinfo_GetPWUid(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint32_t *count, uint64_t *uids, struct unixinfo_GetPWUidInfo **infos); #endif /* __CLI_UNIXINFO__ */ diff --git a/source3/librpc/gen_ndr/cli_winreg.c b/source3/librpc/gen_ndr/cli_winreg.c index e8f24f1941..88ea868f60 100644 --- a/source3/librpc/gen_ndr/cli_winreg.c +++ b/source3/librpc/gen_ndr/cli_winreg.c @@ -197,7 +197,7 @@ NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken) +NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction **action_taken) { struct winreg_CreateKey r; NTSTATUS status; @@ -209,7 +209,7 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.options = options; r.in.access_mask = access_mask; r.in.secdesc = secdesc; - r.in.action_taken = action_taken; + r.in.action_taken = *action_taken; if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_CreateKey, &r); @@ -229,9 +229,7 @@ NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct /* Return variables */ *new_handle = *r.out.new_handle; - if ( action_taken ) { - *action_taken = *r.out.action_taken; - } + *action_taken = r.out.action_taken; /* Return result */ return werror_to_ntstatus(r.out.result); @@ -299,7 +297,7 @@ NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time) +NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf **keyclass, NTTIME **last_changed_time) { struct winreg_EnumKey r; NTSTATUS status; @@ -308,8 +306,8 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, r.in.handle = handle; r.in.enum_index = enum_index; r.in.name = name; - r.in.keyclass = keyclass; - r.in.last_changed_time = last_changed_time; + r.in.keyclass = *keyclass; + r.in.last_changed_time = *last_changed_time; if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_EnumKey, &r); @@ -329,18 +327,14 @@ NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, /* Return variables */ *name = *r.out.name; - if ( keyclass ) { - *keyclass = *r.out.keyclass; - } - if ( last_changed_time ) { - *last_changed_time = *r.out.last_changed_time; - } + *keyclass = r.out.keyclass; + *last_changed_time = r.out.last_changed_time; /* Return result */ return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length) +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type **type, uint8_t **data, uint32_t **data_size, uint32_t **value_length) { struct winreg_EnumValue r; NTSTATUS status; @@ -349,10 +343,10 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct r.in.handle = handle; r.in.enum_index = enum_index; r.in.name = name; - r.in.type = type; - r.in.data = data; - r.in.data_size = data_size; - r.in.value_length = value_length; + r.in.type = *type; + r.in.data = *data; + r.in.data_size = *data_size; + r.in.value_length = *value_length; if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_EnumValue, &r); @@ -372,18 +366,10 @@ NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ct /* Return variables */ *name = *r.out.name; - if ( type ) { - *type = *r.out.type; - } - if ( data ) { - *data = *r.out.data; - } - if ( data_size ) { - *data_size = *r.out.data_size; - } - if ( value_length ) { - *value_length = *r.out.value_length; - } + *type = r.out.type; + *data = r.out.data; + *data_size = r.out.data_size; + *value_length = r.out.value_length; /* Return result */ return werror_to_ntstatus(r.out.result); @@ -594,7 +580,7 @@ NTSTATUS rpccli_winreg_QueryInfoKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem return werror_to_ntstatus(r.out.result); } -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_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) { struct winreg_QueryValue r; NTSTATUS status; @@ -602,10 +588,10 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c /* In parameters */ r.in.handle = handle; r.in.value_name = value_name; - r.in.type = type; - r.in.data = data; - r.in.data_size = data_size; - r.in.value_length = value_length; + r.in.type = *type; + r.in.data = *data; + r.in.data_size = *data_size; + r.in.value_length = *value_length; if (DEBUGLEVEL >= 10) NDR_PRINT_IN_DEBUG(winreg_QueryValue, &r); @@ -624,18 +610,10 @@ NTSTATUS rpccli_winreg_QueryValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_c } /* Return variables */ - if ( type ) { - *type = *r.out.type; - } - if ( data ) { - *data = *r.out.data; - } - if ( data_size ) { - *data_size = *r.out.data_size; - } - if ( value_length ) { - *value_length = *r.out.value_length; - } + *type = r.out.type; + *data = r.out.data; + *data_size = r.out.data_size; + *value_length = r.out.value_length; /* Return result */ return werror_to_ntstatus(r.out.result); @@ -989,7 +967,7 @@ NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx return werror_to_ntstatus(r.out.result); } -NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t *buffer, uint32_t *buffer_size) +NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t **buffer, uint32_t *buffer_size) { struct winreg_QueryMultipleValues r; NTSTATUS status; @@ -998,7 +976,7 @@ NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_C r.in.key_handle = key_handle; r.in.values = values; r.in.num_values = num_values; - r.in.buffer = buffer; + r.in.buffer = *buffer; r.in.buffer_size = buffer_size; if (DEBUGLEVEL >= 10) @@ -1019,9 +997,7 @@ NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_C /* Return variables */ *values = *r.out.values; - if ( buffer ) { - *buffer = *r.out.buffer; - } + *buffer = r.out.buffer; *buffer_size = *r.out.buffer_size; /* Return result */ diff --git a/source3/librpc/gen_ndr/cli_winreg.h b/source3/librpc/gen_ndr/cli_winreg.h index d6df871c9a..0e451f5145 100644 --- a/source3/librpc/gen_ndr/cli_winreg.h +++ b/source3/librpc/gen_ndr/cli_winreg.h @@ -7,18 +7,18 @@ NTSTATUS rpccli_winreg_OpenHKLM(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx NTSTATUS rpccli_winreg_OpenHKPD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); NTSTATUS rpccli_winreg_OpenHKU(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); NTSTATUS rpccli_winreg_CloseKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); -NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction *action_taken); +NTSTATUS rpccli_winreg_CreateKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String name, struct winreg_String keyclass, uint32_t options, uint32_t access_mask, struct winreg_SecBuf *secdesc, struct policy_handle *new_handle, enum winreg_CreateAction **action_taken); NTSTATUS rpccli_winreg_DeleteKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String key); NTSTATUS rpccli_winreg_DeleteValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String value); -NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf *keyclass, NTTIME *last_changed_time); -NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type *type, uint8_t *data, uint32_t *data_size, uint32_t *value_length); +NTSTATUS rpccli_winreg_EnumKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, struct winreg_StringBuf **keyclass, NTTIME **last_changed_time); +NTSTATUS rpccli_winreg_EnumValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t enum_index, struct winreg_StringBuf *name, enum winreg_Type **type, uint8_t **data, uint32_t **data_size, uint32_t **value_length); NTSTATUS rpccli_winreg_FlushKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle); NTSTATUS rpccli_winreg_GetKeySecurity(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t sec_info, struct KeySecurityData *sd); NTSTATUS rpccli_winreg_LoadKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct winreg_String *keyname, struct winreg_String *filename); NTSTATUS rpccli_winreg_NotifyChangeKeyValue(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint8_t watch_subtree, uint32_t notify_filter, uint32_t unknown, struct winreg_String string1, struct winreg_String string2, uint32_t unknown2); NTSTATUS rpccli_winreg_OpenKey(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *parent_handle, struct winreg_String keyname, uint32_t unknown, uint32_t access_mask, struct policy_handle *handle); 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_classlen, 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_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, 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); @@ -30,7 +30,7 @@ NTSTATUS rpccli_winreg_AbortSystemShutdown(struct rpc_pipe_client *cli, TALLOC_C NTSTATUS rpccli_winreg_GetVersion(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *handle, uint32_t *version); NTSTATUS rpccli_winreg_OpenHKCC(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); NTSTATUS rpccli_winreg_OpenHKDD(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); -NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t *buffer, uint32_t *buffer_size); +NTSTATUS rpccli_winreg_QueryMultipleValues(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *key_handle, struct QueryMultipleValue *values, uint32_t num_values, uint8_t **buffer, uint32_t *buffer_size); NTSTATUS rpccli_winreg_InitiateSystemShutdownEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *hostname, struct initshutdown_String *message, uint32_t timeout, uint8_t force_apps, uint8_t reboot, uint32_t reason); NTSTATUS rpccli_winreg_SaveKeyEx(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx); NTSTATUS rpccli_winreg_OpenHKPT(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, uint16_t *system_name, uint32_t access_mask, struct policy_handle *handle); diff --git a/source3/librpc/gen_ndr/ndr_winreg.c b/source3/librpc/gen_ndr/ndr_winreg.c index c7a91afad8..811749d759 100644 --- a/source3/librpc/gen_ndr/ndr_winreg.c +++ b/source3/librpc/gen_ndr/ndr_winreg.c @@ -268,7 +268,7 @@ NTSTATUS ndr_push_winreg_StringBuf(struct ndr_push *ndr, int ndr_flags, const st { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); - NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->name)*2)); + NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term_null(r->name)*2)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->size)); NDR_CHECK(ndr_push_unique_ptr(ndr, r->name)); } @@ -276,8 +276,8 @@ NTSTATUS ndr_push_winreg_StringBuf(struct ndr_push *ndr, int ndr_flags, const st if (r->name) { NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size/2)); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0)); - NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->name)*2/2)); - NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term(r->name)*2/2, sizeof(uint16_t), CH_UTF16)); + NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term_null(r->name)*2/2)); + NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->name, strlen_m_term_null(r->name)*2/2, sizeof(uint16_t), CH_UTF16)); } } return NT_STATUS_OK; @@ -324,7 +324,7 @@ _PUBLIC_ void ndr_print_winreg_StringBuf(struct ndr_print *ndr, const char *name { ndr_print_struct(ndr, name, "winreg_StringBuf"); ndr->depth++; - ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->name)*2:r->length); + ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term_null(r->name)*2:r->length); ndr_print_uint16(ndr, "size", r->size); ndr_print_ptr(ndr, "name", r->name); ndr->depth++; diff --git a/source3/librpc/gen_ndr/winreg.h b/source3/librpc/gen_ndr/winreg.h index 8b2e4c5151..87ba27e623 100644 --- a/source3/librpc/gen_ndr/winreg.h +++ b/source3/librpc/gen_ndr/winreg.h @@ -48,7 +48,7 @@ enum winreg_CreateAction { }; struct winreg_StringBuf { - uint16_t length;/* [value(strlen_m_term(name)*2)] */ + uint16_t length;/* [value(strlen_m_term_null(name)*2)] */ uint16_t size; const char *name;/* [unique,length_is(length/2),charset(UTF16),size_is(size/2)] */ }; diff --git a/source3/rpcclient/cmd_unixinfo.c b/source3/rpcclient/cmd_unixinfo.c index 4301e43167..cafe009762 100644 --- a/source3/rpcclient/cmd_unixinfo.c +++ b/source3/rpcclient/cmd_unixinfo.c @@ -27,7 +27,7 @@ static NTSTATUS cmd_unixinfo_uid2sid(struct rpc_pipe_client *cli, int argc, const char **argv) { uid_t uid; - DOM_SID sid; + DOM_SID *sid; NTSTATUS result; if (argc != 2) { @@ -41,7 +41,7 @@ static NTSTATUS cmd_unixinfo_uid2sid(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - printf("%s\n", sid_string_static(&sid)); + printf("%s\n", sid_string_static(sid)); done: return result; @@ -81,7 +81,7 @@ static NTSTATUS cmd_unixinfo_gid2sid(struct rpc_pipe_client *cli, int argc, const char **argv) { gid_t gid; - DOM_SID sid; + DOM_SID *sid; NTSTATUS result; if (argc != 2) { @@ -96,7 +96,7 @@ static NTSTATUS cmd_unixinfo_gid2sid(struct rpc_pipe_client *cli, if (!NT_STATUS_IS_OK(result)) goto done; - printf("%s\n", sid_string_static(&sid)); + printf("%s\n", sid_string_static(sid)); done: return result; @@ -156,7 +156,8 @@ static NTSTATUS cmd_unixinfo_getpwuid(struct rpc_pipe_client *cli, uids[i] = atoi(argv[i+1]); } - result = rpccli_unixinfo_GetPWUid(cli, mem_ctx, &num_uids, uids, info); + result = rpccli_unixinfo_GetPWUid(cli, mem_ctx, &num_uids, uids, + &info); if (!NT_STATUS_IS_OK(result)) { return result; diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index aacf97445c..776a49f99c 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -154,8 +154,10 @@ static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid, idx = 0; while ( NT_STATUS_IS_OK(status) ) { struct winreg_StringBuf class_namebuf; + struct winreg_StringBuf *p_class_namebuf = &class_namebuf; fstring kname; NTTIME modtime; + NTTIME *p_modtime = &modtime; class_namebuf.name = NULL; class_namebuf.size = 0; @@ -168,8 +170,9 @@ static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid, memset( name_buffer, 0x0, max_subkeylen ); subkey_namebuf.name = name_buffer; - status = rpccli_winreg_EnumKey(pipe_hnd, mem_ctx, &pol_key, idx, - &subkey_namebuf, &class_namebuf, &modtime); + status = rpccli_winreg_EnumKey(pipe_hnd, mem_ctx, &pol_key, + idx, &subkey_namebuf, + &p_class_namebuf, &p_modtime); if ( W_ERROR_EQUAL(ntstatus_to_werror(status), WERR_NO_MORE_ITEMS) ) { status = NT_STATUS_OK; @@ -209,10 +212,13 @@ static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid, status = NT_STATUS_OK; idx = 0; while ( NT_STATUS_IS_OK(status) ) { - enum winreg_Type type; + enum winreg_Type type = REG_NONE; + enum winreg_Type *ptype = &type; fstring name; uint8 *data; uint32 data_size, value_length; + uint32 *pdata_size = &data_size; + uint32 *pvalue_length = &value_length; struct winreg_StringBuf value_namebuf; REGVAL_BUFFER value; @@ -229,8 +235,10 @@ static NTSTATUS rpc_registry_enumerate_internal(const DOM_SID *domain_sid, data_size = max_valbufsize; value_length = 0; - status = rpccli_winreg_EnumValue(pipe_hnd, mem_ctx, &pol_key, idx, - &value_namebuf, &type, data, &data_size, &value_length ); + status = rpccli_winreg_EnumValue(pipe_hnd, mem_ctx, &pol_key, + idx, &value_namebuf, &ptype, + &data, &pdata_size, + &pvalue_length ); if ( W_ERROR_EQUAL(ntstatus_to_werror(status), WERR_NO_MORE_ITEMS) ) { status = NT_STATUS_OK; -- cgit