summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2005-10-27 13:30:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:13 -0500
commite1ffd2d612184fb1343cbe7e1d5d1aacebe0e8fa (patch)
tree6bf2f4a7c5d354c0ebbbe873817df00c8428a78a
parent66eaf508db7dac286fae0759b443a62d5aec60c1 (diff)
downloadsamba-e1ffd2d612184fb1343cbe7e1d5d1aacebe0e8fa.tar.gz
samba-e1ffd2d612184fb1343cbe7e1d5d1aacebe0e8fa.tar.bz2
samba-e1ffd2d612184fb1343cbe7e1d5d1aacebe0e8fa.zip
r11332: eventlog API uses NTSTATUS, not WERROR for return codes
(This used to be commit f5f40633bc3f641a0fef4934375d0d829899b0d7)
-rw-r--r--source3/include/rpc_eventlog.h12
-rw-r--r--source3/rpc_parse/parse_eventlog.c12
-rw-r--r--source3/rpc_server/srv_eventlog_nt.c67
3 files changed, 45 insertions, 46 deletions
diff --git a/source3/include/rpc_eventlog.h b/source3/include/rpc_eventlog.h
index c94b2fa879..67e03edbc6 100644
--- a/source3/include/rpc_eventlog.h
+++ b/source3/include/rpc_eventlog.h
@@ -76,7 +76,7 @@ typedef struct {
typedef struct {
POLICY_HND handle;
- WERROR status;
+ NTSTATUS status;
} EVENTLOG_R_OPEN_EVENTLOG;
@@ -88,7 +88,7 @@ typedef struct {
typedef struct {
POLICY_HND handle;
- WERROR status;
+ NTSTATUS status;
} EVENTLOG_R_CLOSE_EVENTLOG;
@@ -100,7 +100,7 @@ typedef struct {
typedef struct {
uint32 num_records;
- WERROR status;
+ NTSTATUS status;
} EVENTLOG_R_GET_NUM_RECORDS;
@@ -112,7 +112,7 @@ typedef struct {
typedef struct {
uint32 oldest_entry;
- WERROR status;
+ NTSTATUS status;
} EVENTLOG_R_GET_OLDEST_ENTRY;
@@ -175,7 +175,7 @@ typedef struct {
uint8 *end_of_entries_padding;
uint32 sent_size;
uint32 real_size;
- WERROR status;
+ NTSTATUS status;
} EVENTLOG_R_READ_EVENTLOG;
@@ -187,7 +187,7 @@ typedef struct {
} EVENTLOG_Q_CLEAR_EVENTLOG;
typedef struct {
- WERROR status;
+ NTSTATUS status;
} EVENTLOG_R_CLEAR_EVENTLOG;
#endif /* _RPC_EVENTLOG_H */
diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c
index 1b57272ca4..0f0b02748b 100644
--- a/source3/rpc_parse/parse_eventlog.c
+++ b/source3/rpc_parse/parse_eventlog.c
@@ -90,7 +90,7 @@ BOOL eventlog_io_r_open_eventlog(const char *desc, EVENTLOG_R_OPEN_EVENTLOG *r_u
if(!(smb_io_pol_hnd("log handle", &(r_u->handle), ps, depth)))
return False;
- if(!(prs_werror("status code", ps, depth, &(r_u->status))))
+ if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
return False;
return True;
@@ -129,7 +129,7 @@ BOOL eventlog_io_r_get_num_records(const char *desc, EVENTLOG_R_GET_NUM_RECORDS
if(!(prs_uint32("num records", ps, depth, &(r_u->num_records))))
return False;
- if(!(prs_werror("status code", ps, depth, &(r_u->status))))
+ if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
return False;
return True;
@@ -168,7 +168,7 @@ BOOL eventlog_io_r_get_oldest_entry(const char *desc, EVENTLOG_R_GET_OLDEST_ENTR
if(!(prs_uint32("oldest entry", ps, depth, &(r_u->oldest_entry))))
return False;
- if(!(prs_werror("status code", ps, depth, &(r_u->status))))
+ if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
return False;
return True;
@@ -207,7 +207,7 @@ BOOL eventlog_io_r_close_eventlog(const char *desc, EVENTLOG_R_CLOSE_EVENTLOG *r
if(!(smb_io_pol_hnd("log handle", &(r_u->handle), ps, depth)))
return False;
- if(!(prs_werror("status code", ps, depth, &(r_u->status))))
+ if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
return False;
return True;
@@ -372,7 +372,7 @@ BOOL eventlog_io_r_read_eventlog(const char *desc,
return False;
if(!(prs_uint32("real size", ps, depth, &(r_u->real_size))))
return False;
- if(!(prs_werror("status code", ps, depth, &(r_u->status))))
+ if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
return False;
return True;
@@ -424,7 +424,7 @@ BOOL eventlog_io_r_clear_eventlog(const char *desc, EVENTLOG_R_CLEAR_EVENTLOG *r
if(!prs_align(ps))
return False;
- if(!(prs_werror("status code", ps, depth, &(r_u->status))))
+ if(!(prs_ntstatus("status code", ps, depth, &r_u->status)))
return False;
return True;
diff --git a/source3/rpc_server/srv_eventlog_nt.c b/source3/rpc_server/srv_eventlog_nt.c
index 5901f68f52..6413221031 100644
--- a/source3/rpc_server/srv_eventlog_nt.c
+++ b/source3/rpc_server/srv_eventlog_nt.c
@@ -133,17 +133,17 @@ static BOOL elog_validate_logname( const char *name )
/********************************************************************
********************************************************************/
-static WERROR elog_open( pipes_struct * p, const char *logname, POLICY_HND *hnd )
+static NTSTATUS elog_open( pipes_struct * p, const char *logname, POLICY_HND *hnd )
{
EVENTLOG_INFO *elog;
/* first thing is to validate the eventlog name */
if ( !elog_validate_logname( logname ) )
- return WERR_OBJECT_PATH_INVALID;
+ return NT_STATUS_OBJECT_PATH_INVALID;
if ( !(elog = TALLOC_ZERO_P( NULL, EVENTLOG_INFO )) )
- return WERR_NOMEM;
+ return NT_STATUS_NO_MEMORY;
elog->logname = talloc_strdup( elog, logname );
@@ -169,7 +169,7 @@ static WERROR elog_open( pipes_struct * p, const char *logname, POLICY_HND *hnd
/* do the access check */
if ( !elog_check_access( elog, p->pipe_user.nt_user_token ) ) {
TALLOC_FREE( elog );
- return WERR_ACCESS_DENIED;
+ return NT_STATUS_ACCESS_DENIED;
}
become_root();
@@ -179,7 +179,7 @@ static WERROR elog_open( pipes_struct * p, const char *logname, POLICY_HND *hnd
if ( !elog->tdb ) {
TALLOC_FREE( elog );
- return WERR_ACCESS_DENIED; /* ??? */
+ return NT_STATUS_ACCESS_DENIED; /* ??? */
}
}
@@ -188,7 +188,7 @@ static WERROR elog_open( pipes_struct * p, const char *logname, POLICY_HND *hnd
if ( !elog_check_access( elog, p->pipe_user.nt_user_token ) ) {
elog_close_tdb( elog->tdb );
TALLOC_FREE( elog );
- return WERR_ACCESS_DENIED;
+ return NT_STATUS_ACCESS_DENIED;
}
/* create the policy handle */
@@ -196,22 +196,22 @@ static WERROR elog_open( pipes_struct * p, const char *logname, POLICY_HND *hnd
if ( !create_policy_hnd
( p, hnd, free_eventlog_info, ( void * ) elog ) ) {
free_eventlog_info( elog );
- return WERR_NOMEM;
+ return NT_STATUS_NO_MEMORY;
}
- return WERR_OK;
+ return NT_STATUS_OK;
}
/********************************************************************
********************************************************************/
-static WERROR elog_close( pipes_struct *p, POLICY_HND *hnd )
+static NTSTATUS elog_close( pipes_struct *p, POLICY_HND *hnd )
{
if ( !( close_policy_hnd( p, hnd ) ) ) {
- return WERR_BADFID;
+ return NT_STATUS_INVALID_HANDLE;
}
- return WERR_OK;
+ return NT_STATUS_OK;
}
/*******************************************************************
@@ -432,7 +432,6 @@ static BOOL get_num_records_hook( EVENTLOG_INFO * info )
static BOOL get_oldest_entry_hook( EVENTLOG_INFO * info )
{
-
/* it's the same thing */
return get_num_records_hook( info );
}
@@ -560,13 +559,13 @@ static BOOL add_record_to_resp( EVENTLOG_R_READ_EVENTLOG * r_u,
/********************************************************************
********************************************************************/
-WERROR _eventlog_open_eventlog( pipes_struct * p,
+NTSTATUS _eventlog_open_eventlog( pipes_struct * p,
EVENTLOG_Q_OPEN_EVENTLOG * q_u,
EVENTLOG_R_OPEN_EVENTLOG * r_u )
{
fstring servername, logname;
EVENTLOG_INFO *info;
- WERROR wresult;
+ NTSTATUS result;
fstrcpy( servername, "" );
if ( q_u->servername.string ) {
@@ -588,14 +587,14 @@ WERROR _eventlog_open_eventlog( pipes_struct * p,
/* according to MSDN, if the logfile cannot be found, we should
default to the "Application" log */
- if ( !W_ERROR_IS_OK( wresult = elog_open( p, logname, &r_u->handle )) )
- return wresult;
+ if ( !NT_STATUS_IS_OK( result = elog_open( p, logname, &r_u->handle )) )
+ return result;
if ( !(info = find_eventlog_info_by_hnd( p, &r_u->handle )) ) {
DEBUG(0,("_eventlog_open_eventlog: eventlog (%s) opened but unable to find handle!\n",
logname ));
elog_close( p, &r_u->handle );
- return WERR_BADFID;
+ return NT_STATUS_INVALID_HANDLE;
}
DEBUG(10,("_eventlog_open_eventlog: Size [%d]\n", elog_size( info )));
@@ -603,14 +602,14 @@ WERROR _eventlog_open_eventlog( pipes_struct * p,
sync_eventlog_params( info );
prune_eventlog( info->tdb );
- return WERR_OK;
+ return NT_STATUS_OK;
}
/********************************************************************
This call still needs some work
********************************************************************/
-WERROR _eventlog_clear_eventlog( pipes_struct * p,
+NTSTATUS _eventlog_clear_eventlog( pipes_struct * p,
EVENTLOG_Q_CLEAR_EVENTLOG * q_u,
EVENTLOG_R_CLEAR_EVENTLOG * r_u )
{
@@ -618,7 +617,7 @@ WERROR _eventlog_clear_eventlog( pipes_struct * p,
pstring backup_file_name;
if ( !info )
- return WERR_BADFID;
+ return NT_STATUS_INVALID_HANDLE;
pstrcpy( backup_file_name, "" );
if ( q_u->backupfile.string ) {
@@ -637,16 +636,16 @@ WERROR _eventlog_clear_eventlog( pipes_struct * p,
tdb_close( info->tdb );
if ( !(info->tdb = elog_init_tdb( ttdb[i].tdbfname )) )
- return WERR_ACCESS_DENIED;
+ return NT_STATUS_ACCESS_DENIED;
#endif
- return WERR_OK;
+ return NT_STATUS_OK;
}
/********************************************************************
********************************************************************/
-WERROR _eventlog_close_eventlog( pipes_struct * p,
+NTSTATUS _eventlog_close_eventlog( pipes_struct * p,
EVENTLOG_Q_CLOSE_EVENTLOG * q_u,
EVENTLOG_R_CLOSE_EVENTLOG * r_u )
{
@@ -656,7 +655,7 @@ WERROR _eventlog_close_eventlog( pipes_struct * p,
/********************************************************************
********************************************************************/
-WERROR _eventlog_read_eventlog( pipes_struct * p,
+NTSTATUS _eventlog_read_eventlog( pipes_struct * p,
EVENTLOG_Q_READ_EVENTLOG * q_u,
EVENTLOG_R_READ_EVENTLOG * r_u )
{
@@ -674,7 +673,7 @@ WERROR _eventlog_read_eventlog( pipes_struct * p,
bytes_left = q_u->max_read_size;
tdb = info->tdb;
if ( !tdb ) {
- return WERR_EVENTLOG_FILE_CORRUPT;
+ return NT_STATUS_ACCESS_DENIED;
}
/* DEBUG(8,("Bytes left is %d\n",bytes_left)); */
@@ -690,7 +689,7 @@ WERROR _eventlog_read_eventlog( pipes_struct * p,
/* Now see if there is enough room to add */
ee_new = read_package_entry( ps, q_u, r_u,&entry );
if ( !ee_new )
- return WERR_NOMEM;
+ return NT_STATUS_NO_MEMORY;
if ( r_u->num_bytes_in_resp + ee_new->record.length >
q_u->max_read_size ) {
@@ -716,7 +715,7 @@ WERROR _eventlog_read_eventlog( pipes_struct * p,
q_u->max_read_size ) );
} else {
DEBUG( 8, ( "get_eventlog_record returned NULL\n" ) );
- return WERR_NOMEM; /* wrong error - but return one anyway */
+ return NT_STATUS_NO_MEMORY; /* wrong error - but return one anyway */
}
@@ -726,39 +725,39 @@ WERROR _eventlog_read_eventlog( pipes_struct * p,
record_number--;
}
- return WERR_OK;
+ return NT_STATUS_OK;
}
/********************************************************************
********************************************************************/
-WERROR _eventlog_get_oldest_entry( pipes_struct * p,
+NTSTATUS _eventlog_get_oldest_entry( pipes_struct * p,
EVENTLOG_Q_GET_OLDEST_ENTRY * q_u,
EVENTLOG_R_GET_OLDEST_ENTRY * r_u )
{
EVENTLOG_INFO *info = find_eventlog_info_by_hnd( p, &q_u->handle );
if ( !( get_oldest_entry_hook( info ) ) )
- return WERR_BADFILE;
+ return NT_STATUS_ACCESS_DENIED;
r_u->oldest_entry = info->oldest_entry;
- return WERR_OK;
+ return NT_STATUS_OK;
}
/********************************************************************
********************************************************************/
-WERROR _eventlog_get_num_records( pipes_struct * p,
+NTSTATUS _eventlog_get_num_records( pipes_struct * p,
EVENTLOG_Q_GET_NUM_RECORDS * q_u,
EVENTLOG_R_GET_NUM_RECORDS * r_u )
{
EVENTLOG_INFO *info = find_eventlog_info_by_hnd( p, &q_u->handle );
if ( !( get_num_records_hook( info ) ) )
- return WERR_BADFILE;
+ return NT_STATUS_ACCESS_DENIED;
r_u->num_records = info->num_records;
- return WERR_OK;
+ return NT_STATUS_OK;
}