r23779: Change from v2 or later to v3 or later.
[amitay/samba.git] / source3 / registry / reg_eventlog.c
index 1c65c9b21785b12eb22266581a6196df5dc3cb93..8d93cee7dc516c7e4cfba0123f37fad2e9cf270b 100644 (file)
@@ -8,7 +8,7 @@
  *  
  *  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
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation; either version 3 of the License, or
  *  (at your option) any later version.
  *  
  *  This program is distributed in the hope that it will be useful,
@@ -36,7 +36,6 @@ BOOL eventlog_init_keys( void )
        pstring evtfilepath;
        REGSUBKEY_CTR *subkeys;
        REGVAL_CTR *values;
-       uint32 uiDisplayNameId;
        uint32 uiMaxSize;
        uint32 uiRetention;
        uint32 uiCategoryCount;
@@ -49,8 +48,10 @@ BOOL eventlog_init_keys( void )
                }
                regdb_fetch_keys( KEY_EVENTLOG, subkeys );
                regsubkey_ctr_addkey( subkeys, *elogs );
-               if ( !regdb_store_keys( KEY_EVENTLOG, subkeys ) )
+               if ( !regdb_store_keys( KEY_EVENTLOG, subkeys ) ) {
+                       TALLOC_FREE(subkeys);
                        return False;
+               }
                TALLOC_FREE( subkeys );
 
                /* add in the key of form KEY_EVENTLOG/Application */
@@ -71,8 +72,10 @@ BOOL eventlog_init_keys( void )
                regdb_fetch_keys( evtlogpath, subkeys );
                regsubkey_ctr_addkey( subkeys, *elogs );
 
-               if ( !regdb_store_keys( evtlogpath, subkeys ) )
+               if ( !regdb_store_keys( evtlogpath, subkeys ) ) {
+                       TALLOC_FREE(subkeys);
                        return False;
+               }
                TALLOC_FREE( subkeys );
 
                /* now add the values to the KEY_EVENTLOG/Application form key */
@@ -92,7 +95,7 @@ BOOL eventlog_init_keys( void )
 
                        /* hard code some initial values */
 
-                       uiDisplayNameId = 0x00000100;
+                       /* uiDisplayNameId = 0x00000100; */
                        uiMaxSize = 0x00080000;
                        uiRetention = 0x93A80;
 
@@ -191,6 +194,10 @@ BOOL eventlog_add_source( const char *eventlog, const char *sourcename,
        int i;
        int numsources;
 
+       if (!elogs) {
+               return False;
+       }
+
        for ( i = 0; elogs[i]; i++ ) {
                if ( strequal( elogs[i], eventlog ) )
                        break;
@@ -234,7 +241,7 @@ BOOL eventlog_add_source( const char *eventlog, const char *sourcename,
 
        already_in = False;
        wrklist = NULL;
-       dump_data( 1, (const char *)rval->data_p, rval->size );
+       dump_data( 1, rval->data_p, rval->size );
        if ( ( numsources =
               regval_convert_multi_sz( ( uint16 * ) rval->data_p, rval->size,
                                        &wrklist ) ) > 0 ) {
@@ -277,7 +284,7 @@ BOOL eventlog_add_source( const char *eventlog, const char *sourcename,
                *( wp + numsources ) = ( char * ) sourcename;
                *( wp + numsources + 1 ) = NULL;
                mbytes = regval_build_multi_sz( wp, &msz_wp );
-               dump_data( 1, ( char * ) msz_wp, mbytes );
+               dump_data( 1, ( uint8 * ) msz_wp, mbytes );
                regval_ctr_addvalue( values, "Sources", REG_MULTI_SZ,
                                     ( char * ) msz_wp, mbytes );
                regdb_store_values( evtlogpath, values );
@@ -288,8 +295,7 @@ BOOL eventlog_add_source( const char *eventlog, const char *sourcename,
                         sourcename ) );
        }
        TALLOC_FREE( values );
-       if ( wrklist )
-               TALLOC_FREE( wrklist ); /*  */
+       TALLOC_FREE( wrklist ); /*  */
 
        if ( !( subkeys = TALLOC_ZERO_P( NULL, REGSUBKEY_CTR ) ) ) {
                DEBUG( 0, ( "talloc() failure!\n" ) );