RIP BOOL. Convert BOOL -> bool. I found a few interesting
[nivanova/samba-autobuild/.git] / source3 / rpc_server / srv_eventlog_nt.c
index ec07981de9a34ff4246b9b3ad7d9e52b724d0570..d86da9054cb32682f73ca8e43374a823e10f9866 100644 (file)
@@ -7,7 +7,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,
@@ -16,8 +16,7 @@
  *  GNU General Public License for more details.
  *  
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "includes.h"
@@ -68,11 +67,11 @@ static EVENTLOG_INFO *find_eventlog_info_by_hnd( pipes_struct * p,
 /********************************************************************
 ********************************************************************/
 
-static BOOL elog_check_access( EVENTLOG_INFO *info, NT_USER_TOKEN *token )
+static bool elog_check_access( EVENTLOG_INFO *info, NT_USER_TOKEN *token )
 {
        char *tdbname = elog_tdbname( info->logname );
        SEC_DESC *sec_desc;
-       BOOL ret;
+       bool ret;
        NTSTATUS ntstatus;
        
        if ( !tdbname ) 
@@ -118,11 +117,15 @@ static BOOL elog_check_access( EVENTLOG_INFO *info, NT_USER_TOKEN *token )
 /********************************************************************
  ********************************************************************/
 
-static BOOL elog_validate_logname( const char *name )
+static bool elog_validate_logname( const char *name )
 {
        int i;
        const char **elogs = lp_eventlog_list();
        
+       if (!elogs) {
+               return False;
+       }
+
        for ( i=0; elogs[i]; i++ ) {
                if ( strequal( name, elogs[i] ) )
                        return True;
@@ -134,7 +137,7 @@ static BOOL elog_validate_logname( const char *name )
 /********************************************************************
 ********************************************************************/
 
-static BOOL get_num_records_hook( EVENTLOG_INFO * info )
+static bool get_num_records_hook( EVENTLOG_INFO * info )
 {
        int next_record;
        int oldest_record;
@@ -164,7 +167,7 @@ static BOOL get_num_records_hook( EVENTLOG_INFO * info )
 /********************************************************************
  ********************************************************************/
 
-static BOOL get_oldest_entry_hook( EVENTLOG_INFO * info )
+static bool get_oldest_entry_hook( EVENTLOG_INFO * info )
 {
        /* it's the same thing */
        return get_num_records_hook( info );
@@ -281,7 +284,7 @@ static int elog_size( EVENTLOG_INFO *info )
   Eventlog_entry.  returns NULL if it can't get the record for some reason.
  ********************************************************************/
 
-Eventlog_entry *get_eventlog_record( prs_struct * ps, TDB_CONTEXT * tdb,
+static Eventlog_entry *get_eventlog_record( prs_struct * ps, TDB_CONTEXT * tdb,
                                     int recno, Eventlog_entry * ee )
 {
        TDB_DATA ret, key;
@@ -295,7 +298,7 @@ Eventlog_entry *get_eventlog_record( prs_struct * ps, TDB_CONTEXT * tdb,
        key.dsize = sizeof( int32 );
 
        srecno = recno;
-       key.dptr = ( char * ) &srecno;
+       key.dptr = ( uint8 * ) &srecno;
 
        ret = tdb_fetch( tdb, key );
 
@@ -382,7 +385,7 @@ Eventlog_entry *get_eventlog_record( prs_struct * ps, TDB_CONTEXT * tdb,
  since it uses the table to find the tdb handle
  ********************************************************************/
 
-static BOOL sync_eventlog_params( EVENTLOG_INFO *info )
+static bool sync_eventlog_params( EVENTLOG_INFO *info )
 {
        pstring path;
        uint32 uiMaxSize;
@@ -411,9 +414,8 @@ static BOOL sync_eventlog_params( EVENTLOG_INFO *info )
 
        pstr_sprintf( path, "%s/%s", KEY_EVENTLOG, elogname );
 
-       wresult =
-               regkey_open_internal( &keyinfo, path, get_root_nt_token(  ),
-                                     REG_KEY_READ );
+       wresult = regkey_open_internal( NULL, &keyinfo, path,
+                                       get_root_nt_token(  ), REG_KEY_READ );
 
        if ( !W_ERROR_IS_OK( wresult ) ) {
                DEBUG( 4,
@@ -436,7 +438,7 @@ static BOOL sync_eventlog_params( EVENTLOG_INFO *info )
        if ( ( val = regval_ctr_getvalue( values, "MaxSize" ) ) != NULL )
                uiMaxSize = IVAL( regval_data_p( val ), 0 );
 
-       regkey_close_internal( keyinfo );
+       TALLOC_FREE( keyinfo );
 
        tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_MAXSIZE, uiMaxSize );
        tdb_store_int32( ELOG_TDB_CTX(info->etdb), EVT_RETENTION, uiRetention );
@@ -541,7 +543,7 @@ static Eventlog_entry *read_package_entry( prs_struct * ps,
 /********************************************************************
  ********************************************************************/
 
-static BOOL add_record_to_resp( EVENTLOG_R_READ_EVENTLOG * r_u,
+static bool add_record_to_resp( EVENTLOG_R_READ_EVENTLOG * r_u,
                                Eventlog_entry * ee_new )
 {
        Eventlog_entry *insert_point;
@@ -659,11 +661,9 @@ NTSTATUS _eventlog_clear_eventlog( pipes_struct * p,
 /********************************************************************
  ********************************************************************/
 
-NTSTATUS _eventlog_close_eventlog( pipes_struct * p,
-                                EVENTLOG_Q_CLOSE_EVENTLOG * q_u,
-                                EVENTLOG_R_CLOSE_EVENTLOG * r_u )
+NTSTATUS _eventlog_CloseEventLog( pipes_struct * p, struct eventlog_CloseEventLog *r )
 {
-       return elog_close( p, &q_u->handle );
+       return elog_close( p, r->in.handle );
 }
 
 /********************************************************************
@@ -802,3 +802,142 @@ NTSTATUS _eventlog_get_num_records( pipes_struct * p,
 
        return NT_STATUS_OK;
 }
+
+NTSTATUS _eventlog_ClearEventLogW(pipes_struct *p, struct eventlog_ClearEventLogW *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_BackupEventLogW(pipes_struct *p, struct eventlog_BackupEventLogW *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_DeregisterEventSource(pipes_struct *p, struct eventlog_DeregisterEventSource *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_GetNumRecords(pipes_struct *p, struct eventlog_GetNumRecords *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_GetOldestRecord(pipes_struct *p, struct eventlog_GetOldestRecord *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_ChangeNotify(pipes_struct *p, struct eventlog_ChangeNotify *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_OpenEventLogW(pipes_struct *p, struct eventlog_OpenEventLogW *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_RegisterEventSourceW(pipes_struct *p, struct eventlog_RegisterEventSourceW *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_OpenBackupEventLogW(pipes_struct *p, struct eventlog_OpenBackupEventLogW *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_ReadEventLogW(pipes_struct *p, struct eventlog_ReadEventLogW *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_ReportEventW(pipes_struct *p, struct eventlog_ReportEventW *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_ClearEventLogA(pipes_struct *p, struct eventlog_ClearEventLogA *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_BackupEventLogA(pipes_struct *p, struct eventlog_BackupEventLogA *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_OpenEventLogA(pipes_struct *p, struct eventlog_OpenEventLogA *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_RegisterEventSourceA(pipes_struct *p, struct eventlog_RegisterEventSourceA *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_OpenBackupEventLogA(pipes_struct *p, struct eventlog_OpenBackupEventLogA *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_ReadEventLogA(pipes_struct *p, struct eventlog_ReadEventLogA *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_ReportEventA(pipes_struct *p, struct eventlog_ReportEventA *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_RegisterClusterSvc(pipes_struct *p, struct eventlog_RegisterClusterSvc *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_DeregisterClusterSvc(pipes_struct *p, struct eventlog_DeregisterClusterSvc *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_WriteClusterEvents(pipes_struct *p, struct eventlog_WriteClusterEvents *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_GetLogIntormation(pipes_struct *p, struct eventlog_GetLogIntormation *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+
+NTSTATUS _eventlog_FlushEventLog(pipes_struct *p, struct eventlog_FlushEventLog *r)
+{
+       p->rng_fault_state = True;
+       return NT_STATUS_NOT_IMPLEMENTED;
+}
+