/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* Event Log Service RPC (LOGR) interface definition.
*/
#include <unistd.h>
#include <strings.h>
#include <smbsrv/libmlrpc.h>
#include <smbsrv/libmlsvc.h>
/*
* READ flags for EventLogRead
*
* EVENTLOG_SEEK_READ
* The read operation proceeds from the record specified by the
* dwRecordOffset parameter. This flag cannot be used with
* EVENTLOG_SEQUENTIAL_READ.
*
* EVENTLOG_SEQUENTIAL_READ
* The read operation proceeds sequentially from the last call to the
* ReadEventLog function using this handle. This flag cannot be used
* with EVENTLOG_SEEK_READ.
*
* If the buffer is large enough, more than one record can be read at
* the specified seek position; you must specify one of the following
* flags to indicate the direction for successive read operations.
*
* EVENTLOG_FORWARDS_READ
* The log is read in chronological order. This flag cannot be used
* with EVENTLOG_BACKWARDS_READ.
*
* EVENTLOG_BACKWARDS_READ
* The log is read in reverse chronological order. This flag cannot be
* used with EVENTLOG_FORWARDS_READ.
*/
/*
* The types of events that can be logged.
*/
/*
* Event Identifiers
*
* Event identifiers uniquely identify a particular event. Each event
* source can define its own numbered events and the description strings
* to which they are mapped. Event viewers can present these strings to
* the user. They should help the user understand what went wrong and
* suggest what actions to take. Direct the description at users solving
* their own problems, not at administrators or support technicians.
* Make the description clear and concise and avoid culture-specific
* phrases.
*
* The following diagram illustrates the format of an event identifier.
*
* 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +---+-+-+-----------------------+-------------------------------+
* |Sev|C|R| Facility | Code |
* +---+-+-+-----------------------+-------------------------------+
*
* Sev
* Indicates the severity. This is one of the following values:
* 00 - Success
* 01 - Informational
* 10 - Warning
* 11 - Error
*
* C
* Indicates a customer code (1) or a system code (0).
* R
* Reserved bit.
* Facility
* Facility code.
* Code
* Status code for the facility.
*/
static int logr_s_EventLogClose(void *, ndr_xa_t *);
static int logr_s_EventLogQueryCount(void *, ndr_xa_t *);
static int logr_s_EventLogGetOldestRec(void *, ndr_xa_t *);
static int logr_s_EventLogOpen(void *, ndr_xa_t *);
static int logr_s_EventLogRead(void *, ndr_xa_t *);
{0}
};
"LOGR", /* name */
"Event Log Service", /* desc */
"\\eventlog", /* endpoint */
PIPE_NTSVCS, /* sec_addr_port */
"82273fdc-e32a-18c3-3f78-827929dc23ea", 0, /* abstract */
0, /* no bind_instance_size */
0, /* no bind_req() */
0, /* no unbind_and_close() */
0, /* use generic_call_stub() */
logr_stub_table /* stub_table */
};
/*
* logr_initialize
*
* This function registers the LOGR RPC interface with the RPC runtime
* library. It must be called in order to use either the client side
* or the server side functions.
*/
void
logr_initialize(void)
{
(void) ndr_svc_register(&logr_service);
logr_init();
}
void
logr_finalize(void)
{
logr_fini();
}
/*
* logr_hdlookup
*
*/
static ndr_handle_t *
{
return (NULL);
return (NULL);
return (NULL);
return (hd);
}
/*
* logr_context_data_free
*
* Callback to free the context data associated with local service
*/
static void
{
return;
}
/*
* logr_hdalloc
*
* Handle allocation wrapper to setup the local manager context.
*/
static ndr_hdid_t *
{
return (NULL);
return (NULL);
}
if (logr_get_snapshot(ctx) != 0) {
return (NULL);
}
}
/*
* logr_s_EventLogClose
*
* This is a request to close the LOGR interface specified by handle.
* Free the handle and associated resources, and zero out the result
* handle for the client.
*/
static int
{
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* logr_s_EventLogOpen
*
* Open the event log. Not supported yet.
*/
/*ARGSUSED*/
static int
{
if (!ndr_is_admin(mxa)) {
return (NDR_DRC_OK);
}
if (!logr_is_supported(log_name)) {
return (NDR_DRC_OK);
}
} else {
}
return (NDR_DRC_OK);
}
/*
* logr_s_EventLogQueryCount
*
* take a snapshot from system log, assign it to the given handle.
* return number of log entries in the snapshot as result of RPC
* call.
*/
static int
{
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* logr_s_EventLogGetOldestRec
*
* Return oldest record number in the snapshot as result of RPC call.
*/
static int
{
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
/*
* logr_set_event_typeid
*
* Map the local system log priority to the event type and event ID
* for Windows events.
*/
void
{
case LOG_EMERG:
case LOG_ALERT:
case LOG_CRIT:
case LOG_ERR:
break;
case LOG_WARNING:
break;
case LOG_NOTICE:
case LOG_INFO:
case LOG_DEBUG:
break;
default:
}
}
/*
* logr_get_entry
*
* Gets a log entry.
*/
static logr_entry_t *
{
}
/*
* logr_set_logrecord
*
* Fill a Windows event record based on a local system log record.
*/
static void
{
/* Because, Solaris allows remote logging, need to get hostname here */
rec->EventCategory = 0;
rec->ReservedFlags = 0;
rec->ClosingRecordNumber = 0;
rec->UserSidLength = 0;
rec->UserSidOffset = 0;
rec->DataLength = 0;
rec->DataOffset = 0;
if (len > 0)
/*LINTED E_BAD_PTR_CAST_ALIGN*/
}
/*
* logr_s_EventLogRead
*
* Reads a whole number of entries from system log. The function can
* read log entries in chronological or reverse chronological order.
*/
static int
{
return (NDR_DRC_OK);
}
return (NDR_DRC_OK);
}
else if (rdata->rd_first_read)
/*
* set last record number which is read for
* the first iteration of sequential read.
*/
: rdata->rd_last_sentrec;
/*
* function should return as many whole log entries as
* will fit in the buffer; it should not return partial
* entries, even if there is room in the buffer.
*/
if (ent_remain > ent_per_req)
if (ent_remain == 0) {
/*
* Send this error to Windows client so that it
* can figure out that there is no more record
* to read.
*/
return (NDR_DRC_OK);
}
/*LINTED E_BAD_PTR_CAST_ALIGN*/
buf += sizeof (logr_record_t);
}
rdata->rd_first_read = 0;
return (NDR_DRC_OK);
}