summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/registry/reg_eventlog.c18
-rw-r--r--source3/rpc_server/srv_ntsvcs_nt.c14
2 files changed, 16 insertions, 16 deletions
diff --git a/source3/registry/reg_eventlog.c b/source3/registry/reg_eventlog.c
index 4d395eddb1..dbeaa64bad 100644
--- a/source3/registry/reg_eventlog.c
+++ b/source3/registry/reg_eventlog.c
@@ -191,13 +191,12 @@ bool eventlog_add_source( const char *eventlog, const char *sourcename,
need to add KEY of source to KEY_EVENTLOG/<eventlog>/<source> */
const char **elogs = lp_eventlog_list( );
- char **wrklist, **wp;
+ const char **wrklist, **wp;
char *evtlogpath = NULL;
struct regsubkey_ctr *subkeys;
struct regval_ctr *values;
struct regval_blob *rval;
- uint16 *msz_wp;
- int mbytes, ii;
+ int ii;
bool already_in;
int i;
int numsources;
@@ -287,8 +286,9 @@ bool eventlog_add_source( const char *eventlog, const char *sourcename,
wp = wrklist;
if ( !already_in ) {
+ DATA_BLOB blob;
/* make a new list with an additional entry; copy values, add another */
- wp = TALLOC_ARRAY(ctx, char *, numsources + 2 );
+ wp = TALLOC_ARRAY(ctx, const char *, numsources + 2 );
if ( !wp ) {
DEBUG( 0, ( "talloc() failed \n" ) );
@@ -297,12 +297,14 @@ bool eventlog_add_source( const char *eventlog, const char *sourcename,
memcpy( wp, wrklist, sizeof( char * ) * numsources );
*( wp + numsources ) = ( char * ) sourcename;
*( wp + numsources + 1 ) = NULL;
- mbytes = regval_build_multi_sz( wp, &msz_wp );
- dump_data( 1, ( uint8 * ) msz_wp, mbytes );
+ if (!push_reg_multi_sz(ctx, &blob, wp)) {
+ return false;
+ }
+ dump_data( 1, blob.data, blob.length);
regval_ctr_addvalue( values, "Sources", REG_MULTI_SZ,
- ( char * ) msz_wp, mbytes );
+ ( char * ) blob.data, blob.length);
regdb_store_values( evtlogpath, values );
- TALLOC_FREE(msz_wp);
+ data_blob_free(&blob);
} else {
DEBUG( 3,
( "Source name [%s] found in existing list of sources\n",
diff --git a/source3/rpc_server/srv_ntsvcs_nt.c b/source3/rpc_server/srv_ntsvcs_nt.c
index 553707bfe5..357478f274 100644
--- a/source3/rpc_server/srv_ntsvcs_nt.c
+++ b/source3/rpc_server/srv_ntsvcs_nt.c
@@ -76,9 +76,8 @@ WERROR _PNP_GetDeviceList(pipes_struct *p,
{
char *devicepath;
uint32_t size = 0;
- char **multi_sz = NULL;
- size_t multi_sz_len;
- uint16_t *multi_sz_buf;
+ const char **multi_sz = NULL;
+ DATA_BLOB blob;
if ((r->in.flags & CM_GETIDLIST_FILTER_SERVICE) &&
(!r->in.filter)) {
@@ -95,23 +94,22 @@ WERROR _PNP_GetDeviceList(pipes_struct *p,
return WERR_CM_BUFFER_SMALL;
}
- multi_sz = talloc_zero_array(p->mem_ctx, char *, 2);
+ multi_sz = talloc_zero_array(p->mem_ctx, const char *, 2);
if (!multi_sz) {
return WERR_NOMEM;
}
multi_sz[0] = devicepath;
- multi_sz_len = regval_build_multi_sz(multi_sz, &multi_sz_buf);
- if (!multi_sz_len) {
+ if (!push_reg_multi_sz(multi_sz, &blob, multi_sz)) {
return WERR_NOMEM;
}
- if (*r->in.length < multi_sz_len/2) {
+ if (*r->in.length < blob.length/2) {
return WERR_CM_BUFFER_SMALL;
}
- memcpy(r->out.buffer, multi_sz_buf, multi_sz_len);
+ memcpy(r->out.buffer, blob.data, blob.length);
return WERR_OK;
}