10Sstevel@tonic-gate /* crypto/bio/bss_log.c */
20Sstevel@tonic-gate /* ====================================================================
30Sstevel@tonic-gate * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
40Sstevel@tonic-gate *
50Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without
60Sstevel@tonic-gate * modification, are permitted provided that the following conditions
70Sstevel@tonic-gate * are met:
80Sstevel@tonic-gate *
90Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright
100Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer.
110Sstevel@tonic-gate *
120Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright
130Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in
140Sstevel@tonic-gate * the documentation and/or other materials provided with the
150Sstevel@tonic-gate * distribution.
160Sstevel@tonic-gate *
170Sstevel@tonic-gate * 3. All advertising materials mentioning features or use of this
180Sstevel@tonic-gate * software must display the following acknowledgment:
190Sstevel@tonic-gate * "This product includes software developed by the OpenSSL Project
200Sstevel@tonic-gate * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
210Sstevel@tonic-gate *
220Sstevel@tonic-gate * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
230Sstevel@tonic-gate * endorse or promote products derived from this software without
240Sstevel@tonic-gate * prior written permission. For written permission, please contact
250Sstevel@tonic-gate * licensing@OpenSSL.org.
260Sstevel@tonic-gate *
270Sstevel@tonic-gate * 5. Products derived from this software may not be called "OpenSSL"
280Sstevel@tonic-gate * nor may "OpenSSL" appear in their names without prior written
290Sstevel@tonic-gate * permission of the OpenSSL Project.
300Sstevel@tonic-gate *
310Sstevel@tonic-gate * 6. Redistributions of any form whatsoever must retain the following
320Sstevel@tonic-gate * acknowledgment:
330Sstevel@tonic-gate * "This product includes software developed by the OpenSSL Project
340Sstevel@tonic-gate * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
350Sstevel@tonic-gate *
360Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
370Sstevel@tonic-gate * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
380Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
390Sstevel@tonic-gate * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
400Sstevel@tonic-gate * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
410Sstevel@tonic-gate * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
420Sstevel@tonic-gate * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
430Sstevel@tonic-gate * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
440Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
450Sstevel@tonic-gate * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
460Sstevel@tonic-gate * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
470Sstevel@tonic-gate * OF THE POSSIBILITY OF SUCH DAMAGE.
480Sstevel@tonic-gate * ====================================================================
490Sstevel@tonic-gate *
500Sstevel@tonic-gate * This product includes cryptographic software written by Eric Young
510Sstevel@tonic-gate * (eay@cryptsoft.com). This product includes software written by Tim
520Sstevel@tonic-gate * Hudson (tjh@cryptsoft.com).
530Sstevel@tonic-gate *
540Sstevel@tonic-gate */
550Sstevel@tonic-gate
560Sstevel@tonic-gate /*
570Sstevel@tonic-gate Why BIO_s_log?
580Sstevel@tonic-gate
590Sstevel@tonic-gate BIO_s_log is useful for system daemons (or services under NT).
600Sstevel@tonic-gate It is one-way BIO, it sends all stuff to syslogd (on system that
610Sstevel@tonic-gate commonly use that), or event log (on NT), or OPCOM (on OpenVMS).
620Sstevel@tonic-gate
630Sstevel@tonic-gate */
640Sstevel@tonic-gate
650Sstevel@tonic-gate
660Sstevel@tonic-gate #include <stdio.h>
670Sstevel@tonic-gate #include <errno.h>
680Sstevel@tonic-gate
690Sstevel@tonic-gate #include "cryptlib.h"
700Sstevel@tonic-gate
710Sstevel@tonic-gate #if defined(OPENSSL_SYS_WINCE)
720Sstevel@tonic-gate #elif defined(OPENSSL_SYS_WIN32)
730Sstevel@tonic-gate # include <process.h>
740Sstevel@tonic-gate #elif defined(OPENSSL_SYS_VMS)
750Sstevel@tonic-gate # include <opcdef.h>
760Sstevel@tonic-gate # include <descrip.h>
770Sstevel@tonic-gate # include <lib$routines.h>
780Sstevel@tonic-gate # include <starlet.h>
790Sstevel@tonic-gate #elif defined(__ultrix)
800Sstevel@tonic-gate # include <sys/syslog.h>
81*2139Sjp161948 #elif defined(OPENSSL_SYS_NETWARE)
82*2139Sjp161948 # define NO_SYSLOG
830Sstevel@tonic-gate #elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG)
840Sstevel@tonic-gate # include <syslog.h>
850Sstevel@tonic-gate #endif
860Sstevel@tonic-gate
870Sstevel@tonic-gate #include <openssl/buffer.h>
880Sstevel@tonic-gate #include <openssl/err.h>
890Sstevel@tonic-gate
900Sstevel@tonic-gate #ifndef NO_SYSLOG
910Sstevel@tonic-gate
920Sstevel@tonic-gate #if defined(OPENSSL_SYS_WIN32)
930Sstevel@tonic-gate #define LOG_EMERG 0
940Sstevel@tonic-gate #define LOG_ALERT 1
950Sstevel@tonic-gate #define LOG_CRIT 2
960Sstevel@tonic-gate #define LOG_ERR 3
970Sstevel@tonic-gate #define LOG_WARNING 4
980Sstevel@tonic-gate #define LOG_NOTICE 5
990Sstevel@tonic-gate #define LOG_INFO 6
1000Sstevel@tonic-gate #define LOG_DEBUG 7
1010Sstevel@tonic-gate
1020Sstevel@tonic-gate #define LOG_DAEMON (3<<3)
1030Sstevel@tonic-gate #elif defined(OPENSSL_SYS_VMS)
1040Sstevel@tonic-gate /* On VMS, we don't really care about these, but we need them to compile */
1050Sstevel@tonic-gate #define LOG_EMERG 0
1060Sstevel@tonic-gate #define LOG_ALERT 1
1070Sstevel@tonic-gate #define LOG_CRIT 2
1080Sstevel@tonic-gate #define LOG_ERR 3
1090Sstevel@tonic-gate #define LOG_WARNING 4
1100Sstevel@tonic-gate #define LOG_NOTICE 5
1110Sstevel@tonic-gate #define LOG_INFO 6
1120Sstevel@tonic-gate #define LOG_DEBUG 7
1130Sstevel@tonic-gate
1140Sstevel@tonic-gate #define LOG_DAEMON OPC$M_NM_NTWORK
1150Sstevel@tonic-gate #endif
1160Sstevel@tonic-gate
1170Sstevel@tonic-gate static int MS_CALLBACK slg_write(BIO *h, const char *buf, int num);
1180Sstevel@tonic-gate static int MS_CALLBACK slg_puts(BIO *h, const char *str);
1190Sstevel@tonic-gate static long MS_CALLBACK slg_ctrl(BIO *h, int cmd, long arg1, void *arg2);
1200Sstevel@tonic-gate static int MS_CALLBACK slg_new(BIO *h);
1210Sstevel@tonic-gate static int MS_CALLBACK slg_free(BIO *data);
1220Sstevel@tonic-gate static void xopenlog(BIO* bp, char* name, int level);
1230Sstevel@tonic-gate static void xsyslog(BIO* bp, int priority, const char* string);
1240Sstevel@tonic-gate static void xcloselog(BIO* bp);
1250Sstevel@tonic-gate #ifdef OPENSSL_SYS_WIN32
1260Sstevel@tonic-gate LONG (WINAPI *go_for_advapi)() = RegOpenKeyEx;
1270Sstevel@tonic-gate HANDLE (WINAPI *register_event_source)() = NULL;
1280Sstevel@tonic-gate BOOL (WINAPI *deregister_event_source)() = NULL;
1290Sstevel@tonic-gate BOOL (WINAPI *report_event)() = NULL;
1300Sstevel@tonic-gate #define DL_PROC(m,f) (GetProcAddress( m, f ))
1310Sstevel@tonic-gate #ifdef UNICODE
1320Sstevel@tonic-gate #define DL_PROC_X(m,f) DL_PROC( m, f "W" )
1330Sstevel@tonic-gate #else
1340Sstevel@tonic-gate #define DL_PROC_X(m,f) DL_PROC( m, f "A" )
1350Sstevel@tonic-gate #endif
1360Sstevel@tonic-gate #endif
1370Sstevel@tonic-gate
1380Sstevel@tonic-gate static BIO_METHOD methods_slg=
1390Sstevel@tonic-gate {
1400Sstevel@tonic-gate BIO_TYPE_MEM,"syslog",
1410Sstevel@tonic-gate slg_write,
1420Sstevel@tonic-gate NULL,
1430Sstevel@tonic-gate slg_puts,
1440Sstevel@tonic-gate NULL,
1450Sstevel@tonic-gate slg_ctrl,
1460Sstevel@tonic-gate slg_new,
1470Sstevel@tonic-gate slg_free,
1480Sstevel@tonic-gate NULL,
1490Sstevel@tonic-gate };
1500Sstevel@tonic-gate
BIO_s_log(void)1510Sstevel@tonic-gate BIO_METHOD *BIO_s_log(void)
1520Sstevel@tonic-gate {
1530Sstevel@tonic-gate return(&methods_slg);
1540Sstevel@tonic-gate }
1550Sstevel@tonic-gate
slg_new(BIO * bi)1560Sstevel@tonic-gate static int MS_CALLBACK slg_new(BIO *bi)
1570Sstevel@tonic-gate {
1580Sstevel@tonic-gate bi->init=1;
1590Sstevel@tonic-gate bi->num=0;
1600Sstevel@tonic-gate bi->ptr=NULL;
1610Sstevel@tonic-gate xopenlog(bi, "application", LOG_DAEMON);
1620Sstevel@tonic-gate return(1);
1630Sstevel@tonic-gate }
1640Sstevel@tonic-gate
slg_free(BIO * a)1650Sstevel@tonic-gate static int MS_CALLBACK slg_free(BIO *a)
1660Sstevel@tonic-gate {
1670Sstevel@tonic-gate if (a == NULL) return(0);
1680Sstevel@tonic-gate xcloselog(a);
1690Sstevel@tonic-gate return(1);
1700Sstevel@tonic-gate }
1710Sstevel@tonic-gate
slg_write(BIO * b,const char * in,int inl)1720Sstevel@tonic-gate static int MS_CALLBACK slg_write(BIO *b, const char *in, int inl)
1730Sstevel@tonic-gate {
1740Sstevel@tonic-gate int ret= inl;
1750Sstevel@tonic-gate char* buf;
1760Sstevel@tonic-gate char* pp;
1770Sstevel@tonic-gate int priority, i;
1780Sstevel@tonic-gate static struct
1790Sstevel@tonic-gate {
1800Sstevel@tonic-gate int strl;
1810Sstevel@tonic-gate char str[10];
1820Sstevel@tonic-gate int log_level;
1830Sstevel@tonic-gate }
1840Sstevel@tonic-gate mapping[] =
1850Sstevel@tonic-gate {
1860Sstevel@tonic-gate { 6, "PANIC ", LOG_EMERG },
1870Sstevel@tonic-gate { 6, "EMERG ", LOG_EMERG },
1880Sstevel@tonic-gate { 4, "EMR ", LOG_EMERG },
1890Sstevel@tonic-gate { 6, "ALERT ", LOG_ALERT },
1900Sstevel@tonic-gate { 4, "ALR ", LOG_ALERT },
1910Sstevel@tonic-gate { 5, "CRIT ", LOG_CRIT },
1920Sstevel@tonic-gate { 4, "CRI ", LOG_CRIT },
1930Sstevel@tonic-gate { 6, "ERROR ", LOG_ERR },
1940Sstevel@tonic-gate { 4, "ERR ", LOG_ERR },
1950Sstevel@tonic-gate { 8, "WARNING ", LOG_WARNING },
1960Sstevel@tonic-gate { 5, "WARN ", LOG_WARNING },
1970Sstevel@tonic-gate { 4, "WAR ", LOG_WARNING },
1980Sstevel@tonic-gate { 7, "NOTICE ", LOG_NOTICE },
1990Sstevel@tonic-gate { 5, "NOTE ", LOG_NOTICE },
2000Sstevel@tonic-gate { 4, "NOT ", LOG_NOTICE },
2010Sstevel@tonic-gate { 5, "INFO ", LOG_INFO },
2020Sstevel@tonic-gate { 4, "INF ", LOG_INFO },
2030Sstevel@tonic-gate { 6, "DEBUG ", LOG_DEBUG },
2040Sstevel@tonic-gate { 4, "DBG ", LOG_DEBUG },
2050Sstevel@tonic-gate { 0, "", LOG_ERR } /* The default */
2060Sstevel@tonic-gate };
2070Sstevel@tonic-gate
2080Sstevel@tonic-gate if((buf= (char *)OPENSSL_malloc(inl+ 1)) == NULL){
2090Sstevel@tonic-gate return(0);
2100Sstevel@tonic-gate }
2110Sstevel@tonic-gate strncpy(buf, in, inl);
2120Sstevel@tonic-gate buf[inl]= '\0';
2130Sstevel@tonic-gate
2140Sstevel@tonic-gate i = 0;
2150Sstevel@tonic-gate while(strncmp(buf, mapping[i].str, mapping[i].strl) != 0) i++;
2160Sstevel@tonic-gate priority = mapping[i].log_level;
2170Sstevel@tonic-gate pp = buf + mapping[i].strl;
2180Sstevel@tonic-gate
2190Sstevel@tonic-gate xsyslog(b, priority, pp);
2200Sstevel@tonic-gate
2210Sstevel@tonic-gate OPENSSL_free(buf);
2220Sstevel@tonic-gate return(ret);
2230Sstevel@tonic-gate }
2240Sstevel@tonic-gate
slg_ctrl(BIO * b,int cmd,long num,void * ptr)2250Sstevel@tonic-gate static long MS_CALLBACK slg_ctrl(BIO *b, int cmd, long num, void *ptr)
2260Sstevel@tonic-gate {
2270Sstevel@tonic-gate switch (cmd)
2280Sstevel@tonic-gate {
2290Sstevel@tonic-gate case BIO_CTRL_SET:
2300Sstevel@tonic-gate xcloselog(b);
2310Sstevel@tonic-gate xopenlog(b, ptr, num);
2320Sstevel@tonic-gate break;
2330Sstevel@tonic-gate default:
2340Sstevel@tonic-gate break;
2350Sstevel@tonic-gate }
2360Sstevel@tonic-gate return(0);
2370Sstevel@tonic-gate }
2380Sstevel@tonic-gate
slg_puts(BIO * bp,const char * str)2390Sstevel@tonic-gate static int MS_CALLBACK slg_puts(BIO *bp, const char *str)
2400Sstevel@tonic-gate {
2410Sstevel@tonic-gate int n,ret;
2420Sstevel@tonic-gate
2430Sstevel@tonic-gate n=strlen(str);
2440Sstevel@tonic-gate ret=slg_write(bp,str,n);
2450Sstevel@tonic-gate return(ret);
2460Sstevel@tonic-gate }
2470Sstevel@tonic-gate
2480Sstevel@tonic-gate #if defined(OPENSSL_SYS_WIN32)
2490Sstevel@tonic-gate
xopenlog(BIO * bp,char * name,int level)2500Sstevel@tonic-gate static void xopenlog(BIO* bp, char* name, int level)
2510Sstevel@tonic-gate {
2520Sstevel@tonic-gate if ( !register_event_source )
2530Sstevel@tonic-gate {
2540Sstevel@tonic-gate HANDLE advapi;
2550Sstevel@tonic-gate if ( !(advapi = GetModuleHandle("advapi32")) )
2560Sstevel@tonic-gate return;
2570Sstevel@tonic-gate register_event_source = (HANDLE (WINAPI *)())DL_PROC_X(advapi,
2580Sstevel@tonic-gate "RegisterEventSource" );
2590Sstevel@tonic-gate deregister_event_source = (BOOL (WINAPI *)())DL_PROC(advapi,
2600Sstevel@tonic-gate "DeregisterEventSource");
2610Sstevel@tonic-gate report_event = (BOOL (WINAPI *)())DL_PROC_X(advapi,
2620Sstevel@tonic-gate "ReportEvent" );
2630Sstevel@tonic-gate if ( !(register_event_source && deregister_event_source &&
2640Sstevel@tonic-gate report_event) )
2650Sstevel@tonic-gate {
2660Sstevel@tonic-gate register_event_source = NULL;
2670Sstevel@tonic-gate deregister_event_source = NULL;
2680Sstevel@tonic-gate report_event = NULL;
2690Sstevel@tonic-gate return;
2700Sstevel@tonic-gate }
2710Sstevel@tonic-gate }
2720Sstevel@tonic-gate bp->ptr= (char *)register_event_source(NULL, name);
2730Sstevel@tonic-gate }
2740Sstevel@tonic-gate
xsyslog(BIO * bp,int priority,const char * string)2750Sstevel@tonic-gate static void xsyslog(BIO *bp, int priority, const char *string)
2760Sstevel@tonic-gate {
2770Sstevel@tonic-gate LPCSTR lpszStrings[2];
2780Sstevel@tonic-gate WORD evtype= EVENTLOG_ERROR_TYPE;
2790Sstevel@tonic-gate int pid = _getpid();
2800Sstevel@tonic-gate char pidbuf[DECIMAL_SIZE(pid)+4];
2810Sstevel@tonic-gate
2820Sstevel@tonic-gate switch (priority)
2830Sstevel@tonic-gate {
2840Sstevel@tonic-gate case LOG_EMERG:
2850Sstevel@tonic-gate case LOG_ALERT:
2860Sstevel@tonic-gate case LOG_CRIT:
2870Sstevel@tonic-gate case LOG_ERR:
2880Sstevel@tonic-gate evtype = EVENTLOG_ERROR_TYPE;
2890Sstevel@tonic-gate break;
2900Sstevel@tonic-gate case LOG_WARNING:
2910Sstevel@tonic-gate evtype = EVENTLOG_WARNING_TYPE;
2920Sstevel@tonic-gate break;
2930Sstevel@tonic-gate case LOG_NOTICE:
2940Sstevel@tonic-gate case LOG_INFO:
2950Sstevel@tonic-gate case LOG_DEBUG:
2960Sstevel@tonic-gate evtype = EVENTLOG_INFORMATION_TYPE;
2970Sstevel@tonic-gate break;
2980Sstevel@tonic-gate default: /* Should never happen, but set it
2990Sstevel@tonic-gate as error anyway. */
3000Sstevel@tonic-gate evtype = EVENTLOG_ERROR_TYPE;
3010Sstevel@tonic-gate break;
3020Sstevel@tonic-gate }
3030Sstevel@tonic-gate
3040Sstevel@tonic-gate sprintf(pidbuf, "[%d] ", pid);
3050Sstevel@tonic-gate lpszStrings[0] = pidbuf;
3060Sstevel@tonic-gate lpszStrings[1] = string;
3070Sstevel@tonic-gate
3080Sstevel@tonic-gate if(report_event && bp->ptr)
3090Sstevel@tonic-gate report_event(bp->ptr, evtype, 0, 1024, NULL, 2, 0,
3100Sstevel@tonic-gate lpszStrings, NULL);
3110Sstevel@tonic-gate }
3120Sstevel@tonic-gate
xcloselog(BIO * bp)3130Sstevel@tonic-gate static void xcloselog(BIO* bp)
3140Sstevel@tonic-gate {
3150Sstevel@tonic-gate if(deregister_event_source && bp->ptr)
3160Sstevel@tonic-gate deregister_event_source((HANDLE)(bp->ptr));
3170Sstevel@tonic-gate bp->ptr= NULL;
3180Sstevel@tonic-gate }
3190Sstevel@tonic-gate
3200Sstevel@tonic-gate #elif defined(OPENSSL_SYS_VMS)
3210Sstevel@tonic-gate
3220Sstevel@tonic-gate static int VMS_OPC_target = LOG_DAEMON;
3230Sstevel@tonic-gate
xopenlog(BIO * bp,char * name,int level)3240Sstevel@tonic-gate static void xopenlog(BIO* bp, char* name, int level)
3250Sstevel@tonic-gate {
3260Sstevel@tonic-gate VMS_OPC_target = level;
3270Sstevel@tonic-gate }
3280Sstevel@tonic-gate
xsyslog(BIO * bp,int priority,const char * string)3290Sstevel@tonic-gate static void xsyslog(BIO *bp, int priority, const char *string)
3300Sstevel@tonic-gate {
3310Sstevel@tonic-gate struct dsc$descriptor_s opc_dsc;
3320Sstevel@tonic-gate struct opcdef *opcdef_p;
3330Sstevel@tonic-gate char buf[10240];
3340Sstevel@tonic-gate unsigned int len;
3350Sstevel@tonic-gate struct dsc$descriptor_s buf_dsc;
3360Sstevel@tonic-gate $DESCRIPTOR(fao_cmd, "!AZ: !AZ");
3370Sstevel@tonic-gate char *priority_tag;
3380Sstevel@tonic-gate
3390Sstevel@tonic-gate switch (priority)
3400Sstevel@tonic-gate {
3410Sstevel@tonic-gate case LOG_EMERG: priority_tag = "Emergency"; break;
3420Sstevel@tonic-gate case LOG_ALERT: priority_tag = "Alert"; break;
3430Sstevel@tonic-gate case LOG_CRIT: priority_tag = "Critical"; break;
3440Sstevel@tonic-gate case LOG_ERR: priority_tag = "Error"; break;
3450Sstevel@tonic-gate case LOG_WARNING: priority_tag = "Warning"; break;
3460Sstevel@tonic-gate case LOG_NOTICE: priority_tag = "Notice"; break;
3470Sstevel@tonic-gate case LOG_INFO: priority_tag = "Info"; break;
3480Sstevel@tonic-gate case LOG_DEBUG: priority_tag = "DEBUG"; break;
3490Sstevel@tonic-gate }
3500Sstevel@tonic-gate
3510Sstevel@tonic-gate buf_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
3520Sstevel@tonic-gate buf_dsc.dsc$b_class = DSC$K_CLASS_S;
3530Sstevel@tonic-gate buf_dsc.dsc$a_pointer = buf;
3540Sstevel@tonic-gate buf_dsc.dsc$w_length = sizeof(buf) - 1;
3550Sstevel@tonic-gate
3560Sstevel@tonic-gate lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string);
3570Sstevel@tonic-gate
3580Sstevel@tonic-gate /* we know there's an 8 byte header. That's documented */
3590Sstevel@tonic-gate opcdef_p = (struct opcdef *) OPENSSL_malloc(8 + len);
3600Sstevel@tonic-gate opcdef_p->opc$b_ms_type = OPC$_RQ_RQST;
3610Sstevel@tonic-gate memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3);
3620Sstevel@tonic-gate opcdef_p->opc$l_ms_rqstid = 0;
3630Sstevel@tonic-gate memcpy(&opcdef_p->opc$l_ms_text, buf, len);
3640Sstevel@tonic-gate
3650Sstevel@tonic-gate opc_dsc.dsc$b_dtype = DSC$K_DTYPE_T;
3660Sstevel@tonic-gate opc_dsc.dsc$b_class = DSC$K_CLASS_S;
3670Sstevel@tonic-gate opc_dsc.dsc$a_pointer = (char *)opcdef_p;
3680Sstevel@tonic-gate opc_dsc.dsc$w_length = len + 8;
3690Sstevel@tonic-gate
3700Sstevel@tonic-gate sys$sndopr(opc_dsc, 0);
3710Sstevel@tonic-gate
3720Sstevel@tonic-gate OPENSSL_free(opcdef_p);
3730Sstevel@tonic-gate }
3740Sstevel@tonic-gate
xcloselog(BIO * bp)3750Sstevel@tonic-gate static void xcloselog(BIO* bp)
3760Sstevel@tonic-gate {
3770Sstevel@tonic-gate }
3780Sstevel@tonic-gate
3790Sstevel@tonic-gate #else /* Unix/Watt32 */
3800Sstevel@tonic-gate
xopenlog(BIO * bp,char * name,int level)3810Sstevel@tonic-gate static void xopenlog(BIO* bp, char* name, int level)
3820Sstevel@tonic-gate {
3830Sstevel@tonic-gate #ifdef WATT32 /* djgpp/DOS */
3840Sstevel@tonic-gate openlog(name, LOG_PID|LOG_CONS|LOG_NDELAY, level);
3850Sstevel@tonic-gate #else
3860Sstevel@tonic-gate openlog(name, LOG_PID|LOG_CONS, level);
3870Sstevel@tonic-gate #endif
3880Sstevel@tonic-gate }
3890Sstevel@tonic-gate
xsyslog(BIO * bp,int priority,const char * string)3900Sstevel@tonic-gate static void xsyslog(BIO *bp, int priority, const char *string)
3910Sstevel@tonic-gate {
3920Sstevel@tonic-gate syslog(priority, "%s", string);
3930Sstevel@tonic-gate }
3940Sstevel@tonic-gate
xcloselog(BIO * bp)3950Sstevel@tonic-gate static void xcloselog(BIO* bp)
3960Sstevel@tonic-gate {
3970Sstevel@tonic-gate closelog();
3980Sstevel@tonic-gate }
3990Sstevel@tonic-gate
4000Sstevel@tonic-gate #endif /* Unix */
4010Sstevel@tonic-gate
4020Sstevel@tonic-gate #endif /* NO_SYSLOG */
403