/*
* 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
*/
/*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <syslog.h>
#include <thread.h>
#include <string.h>
#include <strings.h>
#include <stdarg.h>
#include <dlfcn.h>
#include <ctype.h>
#include <smbsrv/libntsvcs.h>
typedef struct logr_eventlog {
const char *el_name;
const char *el_path;
{ "smbd", "/var/smb/smbd_log.txt" }
};
typedef enum {
LOGR_MONTH = 0,
/*
* Event code translation struct for use in processing config file
*/
typedef struct logr_priority {
char *p_name;
int p_value;
"panic", LOG_EMERG,
"emerg", LOG_EMERG,
"alert", LOG_ALERT,
"crit", LOG_CRIT,
"err", LOG_ERR,
"error", LOG_ERR,
"warn", LOG_WARNING,
"warning", LOG_WARNING,
"notice", LOG_NOTICE,
"info", LOG_INFO,
"debug", LOG_DEBUG
};
typedef struct logr_syslog_node {
static struct {
/*
* Set the syslog timestamp.
*
* This is a private helper for logr_syslog_parse_entry(), which
* must ensure that the appropriate argv entries are non-null.
*/
static void
{
return;
}
}
/*
* Set the syslog priority.
*
* This is a private helper for logr_syslog_parse_entry(), which
* must ensure that the appropriate argv entries are non-null.
*/
static void
{
char *token;
int i;
return;
for (i = 0; i < sz; i++) {
entry = &logr_pri_names[i];
break;
}
}
}
/*
* Parse a syslog entry into a log_entry_t structure. A typical syslog
* entry has one of the following formats:
*
* <month> <day> <time> <host> <msg>
* <month> <day> <time> <host> <source>: [ID <ID> <facility.priority>] <msg>
*
* For Example:
* Oct 29 09:49:20 galaxy smbd[104039]: [ID 702911 daemon.info] init done
*/
static int
{
char *value;
char *bp;
int i;
if (i == LOGR_SOURCE) {
/*
* If the [ID key is not present, everything
* that follows is the message text.
*/
break;
}
do {
break;
} while (*value == '\0');
return (-1);
}
/*
* bp should be pointing at the remaining message text.
*/
*value = '\0';
return (0);
}
static void
{
}
}
static int
{
int line_num = 0;
/* Read the last 1024 entries in the queue */
if (line_num > LOGR_NMSGMASK) {
}
return (-1);
}
line_num++;
}
return (0);
}
/*
* logr_syslog_load
*
* Loads the given log file into log_info_t structure format.
*
* Returns pointer to the allocated log structure on success.
* Note that the caller is responsible for freeing the allocated
* memory for returned log_info_t structure.
*/
static int
{
int i = 0;
return (-1);
while (node) {
continue;
}
if (++i > LOGR_NMSGMASK)
break;
}
return (0);
}
/*
* logr_syslog_snapshot
*
* Return a snapshot of the given log in the buffer
* provided by the caller. Returns the number of entries in
* the log.
*/
static int
{
int i;
return (-1);
path[0] = '\0';
for (i = 0; i < sizeof (logr_eventlog)/sizeof (logr_eventlog[0]); ++i) {
}
return (-1);
return (-1);
}
return (LOGR_NMSGMASK+1);
}
/*
* logr_is_supported
*
* Determines if a given log is supported or not.
* Returns B_TRUE on success, B_FALSE on failure.
*/
{
int i;
return (B_FALSE);
for (i = 0; i < sizeof (logr_eventlog)/sizeof (logr_eventlog[0]); ++i) {
return (B_TRUE);
}
return (B_FALSE);
}
/*
* logr_get_snapshot
*
* Allocate memory and make a copy, as a snapshot, from system log.
* Returns 0 on success, -1 on failure.
*/
int
{
return (-1);
}
if (data->rd_tot_recnum < 0) {
return (-1);
}
return (0);
}
return (-1);
}
/*
* logr_init
*
* Initializes the Eventlog service.
* Checks to see if a event log utility library
* is interposed. If yes then it'll initializes logr_interposer_ops
* structure with function pointers from this library.
*/
void
logr_init(void)
{
if (logr_interposer_hdl == NULL)
return;
logr_fini();
}
/*
* logr_fini
*
* Finalizes the Eventlog service.
* Closes handle to interposed library.
*/
void
logr_fini(void)
{
}