summaryrefslogtreecommitdiff
path: root/source3/registry
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-09-25 00:55:56 +0200
committerGünther Deschner <gd@samba.org>2009-09-30 00:30:59 +0200
commit661342ee2f753110b31d0b809517ba94e091a310 (patch)
tree7e65b2b19c4a118abcc96b85082cc65c92efe235 /source3/registry
parentf8016cfee922cba97b70f56c752827e4584da6c6 (diff)
downloadsamba-661342ee2f753110b31d0b809517ba94e091a310.tar.gz
samba-661342ee2f753110b31d0b809517ba94e091a310.tar.bz2
samba-661342ee2f753110b31d0b809517ba94e091a310.zip
s3-registry: use pull_reg_multi_sz().
Guenther
Diffstat (limited to 'source3/registry')
-rw-r--r--source3/registry/reg_eventlog.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/source3/registry/reg_eventlog.c b/source3/registry/reg_eventlog.c
index dbeaa64bad..722cd58f69 100644
--- a/source3/registry/reg_eventlog.c
+++ b/source3/registry/reg_eventlog.c
@@ -196,12 +196,13 @@ bool eventlog_add_source( const char *eventlog, const char *sourcename,
struct regsubkey_ctr *subkeys;
struct regval_ctr *values;
struct regval_blob *rval;
- int ii;
+ int ii = 0;
bool already_in;
int i;
- int numsources;
+ int numsources = 0;
TALLOC_CTX *ctx = talloc_tos();
WERROR werr;
+ DATA_BLOB blob;
if (!elogs) {
return False;
@@ -255,15 +256,21 @@ bool eventlog_add_source( const char *eventlog, const char *sourcename,
already_in = False;
wrklist = NULL;
dump_data( 1, rval->data_p, rval->size );
- if ( ( numsources =
- regval_convert_multi_sz( ( uint16 * ) rval->data_p, rval->size,
- &wrklist ) ) > 0 ) {
- ii = numsources;
+ blob = data_blob_const(rval->data_p, rval->size);
+ if (!pull_reg_multi_sz(talloc_tos(), &blob, &wrklist)) {
+ return false;
+ }
+
+ for (ii=0; wrklist[ii]; ii++) {
+ numsources++;
+ }
+
+ if (numsources > 0) {
/* see if it's in there already */
wp = wrklist;
- while ( ii && wp && *wp ) {
+ while (wp && *wp ) {
if ( strequal( *wp, sourcename ) ) {
DEBUG( 5,
( "Source name [%s] already in list for [%s] \n",
@@ -272,13 +279,8 @@ bool eventlog_add_source( const char *eventlog, const char *sourcename,
break;
}
wp++;
- ii--;
}
} else {
- if ( numsources < 0 ) {
- DEBUG( 3, ( "problem in getting the sources\n" ) );
- return False;
- }
DEBUG( 3,
( "Nothing in the sources list, this might be a problem\n" ) );
}
@@ -286,7 +288,6 @@ 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, const char *, numsources + 2 );