1*0Sstevel@tonic-gate /* crypto/bio/bss_log.c */ 2*0Sstevel@tonic-gate /* ==================================================================== 3*0Sstevel@tonic-gate * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 4*0Sstevel@tonic-gate * 5*0Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 6*0Sstevel@tonic-gate * modification, are permitted provided that the following conditions 7*0Sstevel@tonic-gate * are met: 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 10*0Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 11*0Sstevel@tonic-gate * 12*0Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 13*0Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in 14*0Sstevel@tonic-gate * the documentation and/or other materials provided with the 15*0Sstevel@tonic-gate * distribution. 16*0Sstevel@tonic-gate * 17*0Sstevel@tonic-gate * 3. All advertising materials mentioning features or use of this 18*0Sstevel@tonic-gate * software must display the following acknowledgment: 19*0Sstevel@tonic-gate * "This product includes software developed by the OpenSSL Project 20*0Sstevel@tonic-gate * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 21*0Sstevel@tonic-gate * 22*0Sstevel@tonic-gate * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 23*0Sstevel@tonic-gate * endorse or promote products derived from this software without 24*0Sstevel@tonic-gate * prior written permission. For written permission, please contact 25*0Sstevel@tonic-gate * licensing@OpenSSL.org. 26*0Sstevel@tonic-gate * 27*0Sstevel@tonic-gate * 5. Products derived from this software may not be called "OpenSSL" 28*0Sstevel@tonic-gate * nor may "OpenSSL" appear in their names without prior written 29*0Sstevel@tonic-gate * permission of the OpenSSL Project. 30*0Sstevel@tonic-gate * 31*0Sstevel@tonic-gate * 6. Redistributions of any form whatsoever must retain the following 32*0Sstevel@tonic-gate * acknowledgment: 33*0Sstevel@tonic-gate * "This product includes software developed by the OpenSSL Project 34*0Sstevel@tonic-gate * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 35*0Sstevel@tonic-gate * 36*0Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 37*0Sstevel@tonic-gate * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38*0Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 39*0Sstevel@tonic-gate * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 40*0Sstevel@tonic-gate * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 41*0Sstevel@tonic-gate * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 42*0Sstevel@tonic-gate * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43*0Sstevel@tonic-gate * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44*0Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45*0Sstevel@tonic-gate * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46*0Sstevel@tonic-gate * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47*0Sstevel@tonic-gate * OF THE POSSIBILITY OF SUCH DAMAGE. 48*0Sstevel@tonic-gate * ==================================================================== 49*0Sstevel@tonic-gate * 50*0Sstevel@tonic-gate * This product includes cryptographic software written by Eric Young 51*0Sstevel@tonic-gate * (eay@cryptsoft.com). This product includes software written by Tim 52*0Sstevel@tonic-gate * Hudson (tjh@cryptsoft.com). 53*0Sstevel@tonic-gate * 54*0Sstevel@tonic-gate */ 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gate /* 57*0Sstevel@tonic-gate Why BIO_s_log? 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate BIO_s_log is useful for system daemons (or services under NT). 60*0Sstevel@tonic-gate It is one-way BIO, it sends all stuff to syslogd (on system that 61*0Sstevel@tonic-gate commonly use that), or event log (on NT), or OPCOM (on OpenVMS). 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate */ 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate #include <stdio.h> 67*0Sstevel@tonic-gate #include <errno.h> 68*0Sstevel@tonic-gate 69*0Sstevel@tonic-gate #include "cryptlib.h" 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate #if defined(OPENSSL_SYS_WINCE) 72*0Sstevel@tonic-gate #elif defined(OPENSSL_SYS_WIN32) 73*0Sstevel@tonic-gate # include <process.h> 74*0Sstevel@tonic-gate #elif defined(OPENSSL_SYS_VMS) 75*0Sstevel@tonic-gate # include <opcdef.h> 76*0Sstevel@tonic-gate # include <descrip.h> 77*0Sstevel@tonic-gate # include <lib$routines.h> 78*0Sstevel@tonic-gate # include <starlet.h> 79*0Sstevel@tonic-gate #elif defined(__ultrix) 80*0Sstevel@tonic-gate # include <sys/syslog.h> 81*0Sstevel@tonic-gate #elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG) 82*0Sstevel@tonic-gate # include <syslog.h> 83*0Sstevel@tonic-gate #endif 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate #include <openssl/buffer.h> 86*0Sstevel@tonic-gate #include <openssl/err.h> 87*0Sstevel@tonic-gate 88*0Sstevel@tonic-gate #ifndef NO_SYSLOG 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate #if defined(OPENSSL_SYS_WIN32) 91*0Sstevel@tonic-gate #define LOG_EMERG 0 92*0Sstevel@tonic-gate #define LOG_ALERT 1 93*0Sstevel@tonic-gate #define LOG_CRIT 2 94*0Sstevel@tonic-gate #define LOG_ERR 3 95*0Sstevel@tonic-gate #define LOG_WARNING 4 96*0Sstevel@tonic-gate #define LOG_NOTICE 5 97*0Sstevel@tonic-gate #define LOG_INFO 6 98*0Sstevel@tonic-gate #define LOG_DEBUG 7 99*0Sstevel@tonic-gate 100*0Sstevel@tonic-gate #define LOG_DAEMON (3<<3) 101*0Sstevel@tonic-gate #elif defined(OPENSSL_SYS_VMS) 102*0Sstevel@tonic-gate /* On VMS, we don't really care about these, but we need them to compile */ 103*0Sstevel@tonic-gate #define LOG_EMERG 0 104*0Sstevel@tonic-gate #define LOG_ALERT 1 105*0Sstevel@tonic-gate #define LOG_CRIT 2 106*0Sstevel@tonic-gate #define LOG_ERR 3 107*0Sstevel@tonic-gate #define LOG_WARNING 4 108*0Sstevel@tonic-gate #define LOG_NOTICE 5 109*0Sstevel@tonic-gate #define LOG_INFO 6 110*0Sstevel@tonic-gate #define LOG_DEBUG 7 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate #define LOG_DAEMON OPC$M_NM_NTWORK 113*0Sstevel@tonic-gate #endif 114*0Sstevel@tonic-gate 115*0Sstevel@tonic-gate static int MS_CALLBACK slg_write(BIO *h, const char *buf, int num); 116*0Sstevel@tonic-gate static int MS_CALLBACK slg_puts(BIO *h, const char *str); 117*0Sstevel@tonic-gate static long MS_CALLBACK slg_ctrl(BIO *h, int cmd, long arg1, void *arg2); 118*0Sstevel@tonic-gate static int MS_CALLBACK slg_new(BIO *h); 119*0Sstevel@tonic-gate static int MS_CALLBACK slg_free(BIO *data); 120*0Sstevel@tonic-gate static void xopenlog(BIO* bp, char* name, int level); 121*0Sstevel@tonic-gate static void xsyslog(BIO* bp, int priority, const char* string); 122*0Sstevel@tonic-gate static void xcloselog(BIO* bp); 123*0Sstevel@tonic-gate #ifdef OPENSSL_SYS_WIN32 124*0Sstevel@tonic-gate LONG (WINAPI *go_for_advapi)() = RegOpenKeyEx; 125*0Sstevel@tonic-gate HANDLE (WINAPI *register_event_source)() = NULL; 126*0Sstevel@tonic-gate BOOL (WINAPI *deregister_event_source)() = NULL; 127*0Sstevel@tonic-gate BOOL (WINAPI *report_event)() = NULL; 128*0Sstevel@tonic-gate #define DL_PROC(m,f) (GetProcAddress( m, f )) 129*0Sstevel@tonic-gate #ifdef UNICODE 130*0Sstevel@tonic-gate #define DL_PROC_X(m,f) DL_PROC( m, f "W" ) 131*0Sstevel@tonic-gate #else 132*0Sstevel@tonic-gate #define DL_PROC_X(m,f) DL_PROC( m, f "A" ) 133*0Sstevel@tonic-gate #endif 134*0Sstevel@tonic-gate #endif 135*0Sstevel@tonic-gate 136*0Sstevel@tonic-gate static BIO_METHOD methods_slg= 137*0Sstevel@tonic-gate { 138*0Sstevel@tonic-gate BIO_TYPE_MEM,"syslog", 139*0Sstevel@tonic-gate slg_write, 140*0Sstevel@tonic-gate NULL, 141*0Sstevel@tonic-gate slg_puts, 142*0Sstevel@tonic-gate NULL, 143*0Sstevel@tonic-gate slg_ctrl, 144*0Sstevel@tonic-gate slg_new, 145*0Sstevel@tonic-gate slg_free, 146*0Sstevel@tonic-gate NULL, 147*0Sstevel@tonic-gate }; 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate BIO_METHOD *BIO_s_log(void) 150*0Sstevel@tonic-gate { 151*0Sstevel@tonic-gate return(&methods_slg); 152*0Sstevel@tonic-gate } 153*0Sstevel@tonic-gate 154*0Sstevel@tonic-gate static int MS_CALLBACK slg_new(BIO *bi) 155*0Sstevel@tonic-gate { 156*0Sstevel@tonic-gate bi->init=1; 157*0Sstevel@tonic-gate bi->num=0; 158*0Sstevel@tonic-gate bi->ptr=NULL; 159*0Sstevel@tonic-gate xopenlog(bi, "application", LOG_DAEMON); 160*0Sstevel@tonic-gate return(1); 161*0Sstevel@tonic-gate } 162*0Sstevel@tonic-gate 163*0Sstevel@tonic-gate static int MS_CALLBACK slg_free(BIO *a) 164*0Sstevel@tonic-gate { 165*0Sstevel@tonic-gate if (a == NULL) return(0); 166*0Sstevel@tonic-gate xcloselog(a); 167*0Sstevel@tonic-gate return(1); 168*0Sstevel@tonic-gate } 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate static int MS_CALLBACK slg_write(BIO *b, const char *in, int inl) 171*0Sstevel@tonic-gate { 172*0Sstevel@tonic-gate int ret= inl; 173*0Sstevel@tonic-gate char* buf; 174*0Sstevel@tonic-gate char* pp; 175*0Sstevel@tonic-gate int priority, i; 176*0Sstevel@tonic-gate static struct 177*0Sstevel@tonic-gate { 178*0Sstevel@tonic-gate int strl; 179*0Sstevel@tonic-gate char str[10]; 180*0Sstevel@tonic-gate int log_level; 181*0Sstevel@tonic-gate } 182*0Sstevel@tonic-gate mapping[] = 183*0Sstevel@tonic-gate { 184*0Sstevel@tonic-gate { 6, "PANIC ", LOG_EMERG }, 185*0Sstevel@tonic-gate { 6, "EMERG ", LOG_EMERG }, 186*0Sstevel@tonic-gate { 4, "EMR ", LOG_EMERG }, 187*0Sstevel@tonic-gate { 6, "ALERT ", LOG_ALERT }, 188*0Sstevel@tonic-gate { 4, "ALR ", LOG_ALERT }, 189*0Sstevel@tonic-gate { 5, "CRIT ", LOG_CRIT }, 190*0Sstevel@tonic-gate { 4, "CRI ", LOG_CRIT }, 191*0Sstevel@tonic-gate { 6, "ERROR ", LOG_ERR }, 192*0Sstevel@tonic-gate { 4, "ERR ", LOG_ERR }, 193*0Sstevel@tonic-gate { 8, "WARNING ", LOG_WARNING }, 194*0Sstevel@tonic-gate { 5, "WARN ", LOG_WARNING }, 195*0Sstevel@tonic-gate { 4, "WAR ", LOG_WARNING }, 196*0Sstevel@tonic-gate { 7, "NOTICE ", LOG_NOTICE }, 197*0Sstevel@tonic-gate { 5, "NOTE ", LOG_NOTICE }, 198*0Sstevel@tonic-gate { 4, "NOT ", LOG_NOTICE }, 199*0Sstevel@tonic-gate { 5, "INFO ", LOG_INFO }, 200*0Sstevel@tonic-gate { 4, "INF ", LOG_INFO }, 201*0Sstevel@tonic-gate { 6, "DEBUG ", LOG_DEBUG }, 202*0Sstevel@tonic-gate { 4, "DBG ", LOG_DEBUG }, 203*0Sstevel@tonic-gate { 0, "", LOG_ERR } /* The default */ 204*0Sstevel@tonic-gate }; 205*0Sstevel@tonic-gate 206*0Sstevel@tonic-gate if((buf= (char *)OPENSSL_malloc(inl+ 1)) == NULL){ 207*0Sstevel@tonic-gate return(0); 208*0Sstevel@tonic-gate } 209*0Sstevel@tonic-gate strncpy(buf, in, inl); 210*0Sstevel@tonic-gate buf[inl]= '\0'; 211*0Sstevel@tonic-gate 212*0Sstevel@tonic-gate i = 0; 213*0Sstevel@tonic-gate while(strncmp(buf, mapping[i].str, mapping[i].strl) != 0) i++; 214*0Sstevel@tonic-gate priority = mapping[i].log_level; 215*0Sstevel@tonic-gate pp = buf + mapping[i].strl; 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate xsyslog(b, priority, pp); 218*0Sstevel@tonic-gate 219*0Sstevel@tonic-gate OPENSSL_free(buf); 220*0Sstevel@tonic-gate return(ret); 221*0Sstevel@tonic-gate } 222*0Sstevel@tonic-gate 223*0Sstevel@tonic-gate static long MS_CALLBACK slg_ctrl(BIO *b, int cmd, long num, void *ptr) 224*0Sstevel@tonic-gate { 225*0Sstevel@tonic-gate switch (cmd) 226*0Sstevel@tonic-gate { 227*0Sstevel@tonic-gate case BIO_CTRL_SET: 228*0Sstevel@tonic-gate xcloselog(b); 229*0Sstevel@tonic-gate xopenlog(b, ptr, num); 230*0Sstevel@tonic-gate break; 231*0Sstevel@tonic-gate default: 232*0Sstevel@tonic-gate break; 233*0Sstevel@tonic-gate } 234*0Sstevel@tonic-gate return(0); 235*0Sstevel@tonic-gate } 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate static int MS_CALLBACK slg_puts(BIO *bp, const char *str) 238*0Sstevel@tonic-gate { 239*0Sstevel@tonic-gate int n,ret; 240*0Sstevel@tonic-gate 241*0Sstevel@tonic-gate n=strlen(str); 242*0Sstevel@tonic-gate ret=slg_write(bp,str,n); 243*0Sstevel@tonic-gate return(ret); 244*0Sstevel@tonic-gate } 245*0Sstevel@tonic-gate 246*0Sstevel@tonic-gate #if defined(OPENSSL_SYS_WIN32) 247*0Sstevel@tonic-gate 248*0Sstevel@tonic-gate static void xopenlog(BIO* bp, char* name, int level) 249*0Sstevel@tonic-gate { 250*0Sstevel@tonic-gate if ( !register_event_source ) 251*0Sstevel@tonic-gate { 252*0Sstevel@tonic-gate HANDLE advapi; 253*0Sstevel@tonic-gate if ( !(advapi = GetModuleHandle("advapi32")) ) 254*0Sstevel@tonic-gate return; 255*0Sstevel@tonic-gate register_event_source = (HANDLE (WINAPI *)())DL_PROC_X(advapi, 256*0Sstevel@tonic-gate "RegisterEventSource" ); 257*0Sstevel@tonic-gate deregister_event_source = (BOOL (WINAPI *)())DL_PROC(advapi, 258*0Sstevel@tonic-gate "DeregisterEventSource"); 259*0Sstevel@tonic-gate report_event = (BOOL (WINAPI *)())DL_PROC_X(advapi, 260*0Sstevel@tonic-gate "ReportEvent" ); 261*0Sstevel@tonic-gate if ( !(register_event_source && deregister_event_source && 262*0Sstevel@tonic-gate report_event) ) 263*0Sstevel@tonic-gate { 264*0Sstevel@tonic-gate register_event_source = NULL; 265*0Sstevel@tonic-gate deregister_event_source = NULL; 266*0Sstevel@tonic-gate report_event = NULL; 267*0Sstevel@tonic-gate return; 268*0Sstevel@tonic-gate } 269*0Sstevel@tonic-gate } 270*0Sstevel@tonic-gate bp->ptr= (char *)register_event_source(NULL, name); 271*0Sstevel@tonic-gate } 272*0Sstevel@tonic-gate 273*0Sstevel@tonic-gate static void xsyslog(BIO *bp, int priority, const char *string) 274*0Sstevel@tonic-gate { 275*0Sstevel@tonic-gate LPCSTR lpszStrings[2]; 276*0Sstevel@tonic-gate WORD evtype= EVENTLOG_ERROR_TYPE; 277*0Sstevel@tonic-gate int pid = _getpid(); 278*0Sstevel@tonic-gate char pidbuf[DECIMAL_SIZE(pid)+4]; 279*0Sstevel@tonic-gate 280*0Sstevel@tonic-gate switch (priority) 281*0Sstevel@tonic-gate { 282*0Sstevel@tonic-gate case LOG_EMERG: 283*0Sstevel@tonic-gate case LOG_ALERT: 284*0Sstevel@tonic-gate case LOG_CRIT: 285*0Sstevel@tonic-gate case LOG_ERR: 286*0Sstevel@tonic-gate evtype = EVENTLOG_ERROR_TYPE; 287*0Sstevel@tonic-gate break; 288*0Sstevel@tonic-gate case LOG_WARNING: 289*0Sstevel@tonic-gate evtype = EVENTLOG_WARNING_TYPE; 290*0Sstevel@tonic-gate break; 291*0Sstevel@tonic-gate case LOG_NOTICE: 292*0Sstevel@tonic-gate case LOG_INFO: 293*0Sstevel@tonic-gate case LOG_DEBUG: 294*0Sstevel@tonic-gate evtype = EVENTLOG_INFORMATION_TYPE; 295*0Sstevel@tonic-gate break; 296*0Sstevel@tonic-gate default: /* Should never happen, but set it 297*0Sstevel@tonic-gate as error anyway. */ 298*0Sstevel@tonic-gate evtype = EVENTLOG_ERROR_TYPE; 299*0Sstevel@tonic-gate break; 300*0Sstevel@tonic-gate } 301*0Sstevel@tonic-gate 302*0Sstevel@tonic-gate sprintf(pidbuf, "[%d] ", pid); 303*0Sstevel@tonic-gate lpszStrings[0] = pidbuf; 304*0Sstevel@tonic-gate lpszStrings[1] = string; 305*0Sstevel@tonic-gate 306*0Sstevel@tonic-gate if(report_event && bp->ptr) 307*0Sstevel@tonic-gate report_event(bp->ptr, evtype, 0, 1024, NULL, 2, 0, 308*0Sstevel@tonic-gate lpszStrings, NULL); 309*0Sstevel@tonic-gate } 310*0Sstevel@tonic-gate 311*0Sstevel@tonic-gate static void xcloselog(BIO* bp) 312*0Sstevel@tonic-gate { 313*0Sstevel@tonic-gate if(deregister_event_source && bp->ptr) 314*0Sstevel@tonic-gate deregister_event_source((HANDLE)(bp->ptr)); 315*0Sstevel@tonic-gate bp->ptr= NULL; 316*0Sstevel@tonic-gate } 317*0Sstevel@tonic-gate 318*0Sstevel@tonic-gate #elif defined(OPENSSL_SYS_VMS) 319*0Sstevel@tonic-gate 320*0Sstevel@tonic-gate static int VMS_OPC_target = LOG_DAEMON; 321*0Sstevel@tonic-gate 322*0Sstevel@tonic-gate static void xopenlog(BIO* bp, char* name, int level) 323*0Sstevel@tonic-gate { 324*0Sstevel@tonic-gate VMS_OPC_target = level; 325*0Sstevel@tonic-gate } 326*0Sstevel@tonic-gate 327*0Sstevel@tonic-gate static void xsyslog(BIO *bp, int priority, const char *string) 328*0Sstevel@tonic-gate { 329*0Sstevel@tonic-gate struct dsc$descriptor_s opc_dsc; 330*0Sstevel@tonic-gate struct opcdef *opcdef_p; 331*0Sstevel@tonic-gate char buf[10240]; 332*0Sstevel@tonic-gate unsigned int len; 333*0Sstevel@tonic-gate struct dsc$descriptor_s buf_dsc; 334*0Sstevel@tonic-gate $DESCRIPTOR(fao_cmd, "!AZ: !AZ"); 335*0Sstevel@tonic-gate char *priority_tag; 336*0Sstevel@tonic-gate 337*0Sstevel@tonic-gate switch (priority) 338*0Sstevel@tonic-gate { 339*0Sstevel@tonic-gate case LOG_EMERG: priority_tag = "Emergency"; break; 340*0Sstevel@tonic-gate case LOG_ALERT: priority_tag = "Alert"; break; 341*0Sstevel@tonic-gate case LOG_CRIT: priority_tag = "Critical"; break; 342*0Sstevel@tonic-gate case LOG_ERR: priority_tag = "Error"; break; 343*0Sstevel@tonic-gate case LOG_WARNING: priority_tag = "Warning"; break; 344*0Sstevel@tonic-gate case LOG_NOTICE: priority_tag = "Notice"; break; 345*0Sstevel@tonic-gate case LOG_INFO: priority_tag = "Info"; break; 346*0Sstevel@tonic-gate case LOG_DEBUG: priority_tag = "DEBUG"; break; 347*0Sstevel@tonic-gate } 348*0Sstevel@tonic-gate 349*0Sstevel@tonic-gate buf_dsc.dsc$b_dtype = DSC$K_DTYPE_T; 350*0Sstevel@tonic-gate buf_dsc.dsc$b_class = DSC$K_CLASS_S; 351*0Sstevel@tonic-gate buf_dsc.dsc$a_pointer = buf; 352*0Sstevel@tonic-gate buf_dsc.dsc$w_length = sizeof(buf) - 1; 353*0Sstevel@tonic-gate 354*0Sstevel@tonic-gate lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string); 355*0Sstevel@tonic-gate 356*0Sstevel@tonic-gate /* we know there's an 8 byte header. That's documented */ 357*0Sstevel@tonic-gate opcdef_p = (struct opcdef *) OPENSSL_malloc(8 + len); 358*0Sstevel@tonic-gate opcdef_p->opc$b_ms_type = OPC$_RQ_RQST; 359*0Sstevel@tonic-gate memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3); 360*0Sstevel@tonic-gate opcdef_p->opc$l_ms_rqstid = 0; 361*0Sstevel@tonic-gate memcpy(&opcdef_p->opc$l_ms_text, buf, len); 362*0Sstevel@tonic-gate 363*0Sstevel@tonic-gate opc_dsc.dsc$b_dtype = DSC$K_DTYPE_T; 364*0Sstevel@tonic-gate opc_dsc.dsc$b_class = DSC$K_CLASS_S; 365*0Sstevel@tonic-gate opc_dsc.dsc$a_pointer = (char *)opcdef_p; 366*0Sstevel@tonic-gate opc_dsc.dsc$w_length = len + 8; 367*0Sstevel@tonic-gate 368*0Sstevel@tonic-gate sys$sndopr(opc_dsc, 0); 369*0Sstevel@tonic-gate 370*0Sstevel@tonic-gate OPENSSL_free(opcdef_p); 371*0Sstevel@tonic-gate } 372*0Sstevel@tonic-gate 373*0Sstevel@tonic-gate static void xcloselog(BIO* bp) 374*0Sstevel@tonic-gate { 375*0Sstevel@tonic-gate } 376*0Sstevel@tonic-gate 377*0Sstevel@tonic-gate #else /* Unix/Watt32 */ 378*0Sstevel@tonic-gate 379*0Sstevel@tonic-gate static void xopenlog(BIO* bp, char* name, int level) 380*0Sstevel@tonic-gate { 381*0Sstevel@tonic-gate #ifdef WATT32 /* djgpp/DOS */ 382*0Sstevel@tonic-gate openlog(name, LOG_PID|LOG_CONS|LOG_NDELAY, level); 383*0Sstevel@tonic-gate #else 384*0Sstevel@tonic-gate openlog(name, LOG_PID|LOG_CONS, level); 385*0Sstevel@tonic-gate #endif 386*0Sstevel@tonic-gate } 387*0Sstevel@tonic-gate 388*0Sstevel@tonic-gate static void xsyslog(BIO *bp, int priority, const char *string) 389*0Sstevel@tonic-gate { 390*0Sstevel@tonic-gate syslog(priority, "%s", string); 391*0Sstevel@tonic-gate } 392*0Sstevel@tonic-gate 393*0Sstevel@tonic-gate static void xcloselog(BIO* bp) 394*0Sstevel@tonic-gate { 395*0Sstevel@tonic-gate closelog(); 396*0Sstevel@tonic-gate } 397*0Sstevel@tonic-gate 398*0Sstevel@tonic-gate #endif /* Unix */ 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gate #endif /* NO_SYSLOG */ 401