1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * 4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci */ 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci/* 11e1051a39Sopenharmony_ci * Why BIO_s_log? 12e1051a39Sopenharmony_ci * 13e1051a39Sopenharmony_ci * BIO_s_log is useful for system daemons (or services under NT). It is 14e1051a39Sopenharmony_ci * one-way BIO, it sends all stuff to syslogd (on system that commonly use 15e1051a39Sopenharmony_ci * that), or event log (on NT), or OPCOM (on OpenVMS). 16e1051a39Sopenharmony_ci * 17e1051a39Sopenharmony_ci */ 18e1051a39Sopenharmony_ci 19e1051a39Sopenharmony_ci#include <stdio.h> 20e1051a39Sopenharmony_ci#include <errno.h> 21e1051a39Sopenharmony_ci 22e1051a39Sopenharmony_ci#include "bio_local.h" 23e1051a39Sopenharmony_ci#include "internal/cryptlib.h" 24e1051a39Sopenharmony_ci 25e1051a39Sopenharmony_ci#if defined(OPENSSL_SYS_WINCE) 26e1051a39Sopenharmony_ci#elif defined(OPENSSL_SYS_WIN32) 27e1051a39Sopenharmony_ci#elif defined(OPENSSL_SYS_VMS) 28e1051a39Sopenharmony_ci# include <opcdef.h> 29e1051a39Sopenharmony_ci# include <descrip.h> 30e1051a39Sopenharmony_ci# include <lib$routines.h> 31e1051a39Sopenharmony_ci# include <starlet.h> 32e1051a39Sopenharmony_ci/* Some compiler options may mask the declaration of "_malloc32". */ 33e1051a39Sopenharmony_ci# if __INITIAL_POINTER_SIZE && defined _ANSI_C_SOURCE 34e1051a39Sopenharmony_ci# if __INITIAL_POINTER_SIZE == 64 35e1051a39Sopenharmony_ci# pragma pointer_size save 36e1051a39Sopenharmony_ci# pragma pointer_size 32 37e1051a39Sopenharmony_civoid *_malloc32(__size_t); 38e1051a39Sopenharmony_ci# pragma pointer_size restore 39e1051a39Sopenharmony_ci# endif /* __INITIAL_POINTER_SIZE == 64 */ 40e1051a39Sopenharmony_ci# endif /* __INITIAL_POINTER_SIZE && defined 41e1051a39Sopenharmony_ci * _ANSI_C_SOURCE */ 42e1051a39Sopenharmony_ci#elif defined(__DJGPP__) && defined(OPENSSL_NO_SOCK) 43e1051a39Sopenharmony_ci# define NO_SYSLOG 44e1051a39Sopenharmony_ci#elif (!defined(MSDOS) || defined(WATT32)) && !defined(OPENSSL_SYS_VXWORKS) && !defined(NO_SYSLOG) 45e1051a39Sopenharmony_ci# include <syslog.h> 46e1051a39Sopenharmony_ci#endif 47e1051a39Sopenharmony_ci 48e1051a39Sopenharmony_ci#include <openssl/buffer.h> 49e1051a39Sopenharmony_ci#include <openssl/err.h> 50e1051a39Sopenharmony_ci 51e1051a39Sopenharmony_ci#ifndef NO_SYSLOG 52e1051a39Sopenharmony_ci 53e1051a39Sopenharmony_ci# if defined(OPENSSL_SYS_WIN32) 54e1051a39Sopenharmony_ci# define LOG_EMERG 0 55e1051a39Sopenharmony_ci# define LOG_ALERT 1 56e1051a39Sopenharmony_ci# define LOG_CRIT 2 57e1051a39Sopenharmony_ci# define LOG_ERR 3 58e1051a39Sopenharmony_ci# define LOG_WARNING 4 59e1051a39Sopenharmony_ci# define LOG_NOTICE 5 60e1051a39Sopenharmony_ci# define LOG_INFO 6 61e1051a39Sopenharmony_ci# define LOG_DEBUG 7 62e1051a39Sopenharmony_ci 63e1051a39Sopenharmony_ci# define LOG_DAEMON (3<<3) 64e1051a39Sopenharmony_ci# elif defined(OPENSSL_SYS_VMS) 65e1051a39Sopenharmony_ci/* On VMS, we don't really care about these, but we need them to compile */ 66e1051a39Sopenharmony_ci# define LOG_EMERG 0 67e1051a39Sopenharmony_ci# define LOG_ALERT 1 68e1051a39Sopenharmony_ci# define LOG_CRIT 2 69e1051a39Sopenharmony_ci# define LOG_ERR 3 70e1051a39Sopenharmony_ci# define LOG_WARNING 4 71e1051a39Sopenharmony_ci# define LOG_NOTICE 5 72e1051a39Sopenharmony_ci# define LOG_INFO 6 73e1051a39Sopenharmony_ci# define LOG_DEBUG 7 74e1051a39Sopenharmony_ci 75e1051a39Sopenharmony_ci# define LOG_DAEMON OPC$M_NM_NTWORK 76e1051a39Sopenharmony_ci# endif 77e1051a39Sopenharmony_ci 78e1051a39Sopenharmony_cistatic int slg_write(BIO *h, const char *buf, int num); 79e1051a39Sopenharmony_cistatic int slg_puts(BIO *h, const char *str); 80e1051a39Sopenharmony_cistatic long slg_ctrl(BIO *h, int cmd, long arg1, void *arg2); 81e1051a39Sopenharmony_cistatic int slg_new(BIO *h); 82e1051a39Sopenharmony_cistatic int slg_free(BIO *data); 83e1051a39Sopenharmony_cistatic void xopenlog(BIO *bp, char *name, int level); 84e1051a39Sopenharmony_cistatic void xsyslog(BIO *bp, int priority, const char *string); 85e1051a39Sopenharmony_cistatic void xcloselog(BIO *bp); 86e1051a39Sopenharmony_ci 87e1051a39Sopenharmony_cistatic const BIO_METHOD methods_slg = { 88e1051a39Sopenharmony_ci BIO_TYPE_MEM, 89e1051a39Sopenharmony_ci "syslog", 90e1051a39Sopenharmony_ci bwrite_conv, 91e1051a39Sopenharmony_ci slg_write, 92e1051a39Sopenharmony_ci NULL, /* slg_write_old, */ 93e1051a39Sopenharmony_ci NULL, /* slg_read, */ 94e1051a39Sopenharmony_ci slg_puts, 95e1051a39Sopenharmony_ci NULL, 96e1051a39Sopenharmony_ci slg_ctrl, 97e1051a39Sopenharmony_ci slg_new, 98e1051a39Sopenharmony_ci slg_free, 99e1051a39Sopenharmony_ci NULL, /* slg_callback_ctrl */ 100e1051a39Sopenharmony_ci}; 101e1051a39Sopenharmony_ci 102e1051a39Sopenharmony_ciconst BIO_METHOD *BIO_s_log(void) 103e1051a39Sopenharmony_ci{ 104e1051a39Sopenharmony_ci return &methods_slg; 105e1051a39Sopenharmony_ci} 106e1051a39Sopenharmony_ci 107e1051a39Sopenharmony_cistatic int slg_new(BIO *bi) 108e1051a39Sopenharmony_ci{ 109e1051a39Sopenharmony_ci bi->init = 1; 110e1051a39Sopenharmony_ci bi->num = 0; 111e1051a39Sopenharmony_ci bi->ptr = NULL; 112e1051a39Sopenharmony_ci xopenlog(bi, "application", LOG_DAEMON); 113e1051a39Sopenharmony_ci return 1; 114e1051a39Sopenharmony_ci} 115e1051a39Sopenharmony_ci 116e1051a39Sopenharmony_cistatic int slg_free(BIO *a) 117e1051a39Sopenharmony_ci{ 118e1051a39Sopenharmony_ci if (a == NULL) 119e1051a39Sopenharmony_ci return 0; 120e1051a39Sopenharmony_ci xcloselog(a); 121e1051a39Sopenharmony_ci return 1; 122e1051a39Sopenharmony_ci} 123e1051a39Sopenharmony_ci 124e1051a39Sopenharmony_cistatic int slg_write(BIO *b, const char *in, int inl) 125e1051a39Sopenharmony_ci{ 126e1051a39Sopenharmony_ci int ret = inl; 127e1051a39Sopenharmony_ci char *buf; 128e1051a39Sopenharmony_ci char *pp; 129e1051a39Sopenharmony_ci int priority, i; 130e1051a39Sopenharmony_ci static const struct { 131e1051a39Sopenharmony_ci int strl; 132e1051a39Sopenharmony_ci char str[10]; 133e1051a39Sopenharmony_ci int log_level; 134e1051a39Sopenharmony_ci } mapping[] = { 135e1051a39Sopenharmony_ci { 136e1051a39Sopenharmony_ci 6, "PANIC ", LOG_EMERG 137e1051a39Sopenharmony_ci }, 138e1051a39Sopenharmony_ci { 139e1051a39Sopenharmony_ci 6, "EMERG ", LOG_EMERG 140e1051a39Sopenharmony_ci }, 141e1051a39Sopenharmony_ci { 142e1051a39Sopenharmony_ci 4, "EMR ", LOG_EMERG 143e1051a39Sopenharmony_ci }, 144e1051a39Sopenharmony_ci { 145e1051a39Sopenharmony_ci 6, "ALERT ", LOG_ALERT 146e1051a39Sopenharmony_ci }, 147e1051a39Sopenharmony_ci { 148e1051a39Sopenharmony_ci 4, "ALR ", LOG_ALERT 149e1051a39Sopenharmony_ci }, 150e1051a39Sopenharmony_ci { 151e1051a39Sopenharmony_ci 5, "CRIT ", LOG_CRIT 152e1051a39Sopenharmony_ci }, 153e1051a39Sopenharmony_ci { 154e1051a39Sopenharmony_ci 4, "CRI ", LOG_CRIT 155e1051a39Sopenharmony_ci }, 156e1051a39Sopenharmony_ci { 157e1051a39Sopenharmony_ci 6, "ERROR ", LOG_ERR 158e1051a39Sopenharmony_ci }, 159e1051a39Sopenharmony_ci { 160e1051a39Sopenharmony_ci 4, "ERR ", LOG_ERR 161e1051a39Sopenharmony_ci }, 162e1051a39Sopenharmony_ci { 163e1051a39Sopenharmony_ci 8, "WARNING ", LOG_WARNING 164e1051a39Sopenharmony_ci }, 165e1051a39Sopenharmony_ci { 166e1051a39Sopenharmony_ci 5, "WARN ", LOG_WARNING 167e1051a39Sopenharmony_ci }, 168e1051a39Sopenharmony_ci { 169e1051a39Sopenharmony_ci 4, "WAR ", LOG_WARNING 170e1051a39Sopenharmony_ci }, 171e1051a39Sopenharmony_ci { 172e1051a39Sopenharmony_ci 7, "NOTICE ", LOG_NOTICE 173e1051a39Sopenharmony_ci }, 174e1051a39Sopenharmony_ci { 175e1051a39Sopenharmony_ci 5, "NOTE ", LOG_NOTICE 176e1051a39Sopenharmony_ci }, 177e1051a39Sopenharmony_ci { 178e1051a39Sopenharmony_ci 4, "NOT ", LOG_NOTICE 179e1051a39Sopenharmony_ci }, 180e1051a39Sopenharmony_ci { 181e1051a39Sopenharmony_ci 5, "INFO ", LOG_INFO 182e1051a39Sopenharmony_ci }, 183e1051a39Sopenharmony_ci { 184e1051a39Sopenharmony_ci 4, "INF ", LOG_INFO 185e1051a39Sopenharmony_ci }, 186e1051a39Sopenharmony_ci { 187e1051a39Sopenharmony_ci 6, "DEBUG ", LOG_DEBUG 188e1051a39Sopenharmony_ci }, 189e1051a39Sopenharmony_ci { 190e1051a39Sopenharmony_ci 4, "DBG ", LOG_DEBUG 191e1051a39Sopenharmony_ci }, 192e1051a39Sopenharmony_ci { 193e1051a39Sopenharmony_ci 0, "", LOG_ERR 194e1051a39Sopenharmony_ci } 195e1051a39Sopenharmony_ci /* The default */ 196e1051a39Sopenharmony_ci }; 197e1051a39Sopenharmony_ci 198e1051a39Sopenharmony_ci if (inl < 0) 199e1051a39Sopenharmony_ci return 0; 200e1051a39Sopenharmony_ci if ((buf = OPENSSL_malloc(inl + 1)) == NULL) { 201e1051a39Sopenharmony_ci ERR_raise(ERR_LIB_BIO, ERR_R_MALLOC_FAILURE); 202e1051a39Sopenharmony_ci return 0; 203e1051a39Sopenharmony_ci } 204e1051a39Sopenharmony_ci memcpy(buf, in, inl); 205e1051a39Sopenharmony_ci buf[inl] = '\0'; 206e1051a39Sopenharmony_ci 207e1051a39Sopenharmony_ci i = 0; 208e1051a39Sopenharmony_ci while (strncmp(buf, mapping[i].str, mapping[i].strl) != 0) 209e1051a39Sopenharmony_ci i++; 210e1051a39Sopenharmony_ci priority = mapping[i].log_level; 211e1051a39Sopenharmony_ci pp = buf + mapping[i].strl; 212e1051a39Sopenharmony_ci 213e1051a39Sopenharmony_ci xsyslog(b, priority, pp); 214e1051a39Sopenharmony_ci 215e1051a39Sopenharmony_ci OPENSSL_free(buf); 216e1051a39Sopenharmony_ci return ret; 217e1051a39Sopenharmony_ci} 218e1051a39Sopenharmony_ci 219e1051a39Sopenharmony_cistatic long slg_ctrl(BIO *b, int cmd, long num, void *ptr) 220e1051a39Sopenharmony_ci{ 221e1051a39Sopenharmony_ci switch (cmd) { 222e1051a39Sopenharmony_ci case BIO_CTRL_SET: 223e1051a39Sopenharmony_ci xcloselog(b); 224e1051a39Sopenharmony_ci xopenlog(b, ptr, num); 225e1051a39Sopenharmony_ci break; 226e1051a39Sopenharmony_ci default: 227e1051a39Sopenharmony_ci break; 228e1051a39Sopenharmony_ci } 229e1051a39Sopenharmony_ci return 0; 230e1051a39Sopenharmony_ci} 231e1051a39Sopenharmony_ci 232e1051a39Sopenharmony_cistatic int slg_puts(BIO *bp, const char *str) 233e1051a39Sopenharmony_ci{ 234e1051a39Sopenharmony_ci int n, ret; 235e1051a39Sopenharmony_ci 236e1051a39Sopenharmony_ci n = strlen(str); 237e1051a39Sopenharmony_ci ret = slg_write(bp, str, n); 238e1051a39Sopenharmony_ci return ret; 239e1051a39Sopenharmony_ci} 240e1051a39Sopenharmony_ci 241e1051a39Sopenharmony_ci# if defined(OPENSSL_SYS_WIN32) 242e1051a39Sopenharmony_ci 243e1051a39Sopenharmony_cistatic void xopenlog(BIO *bp, char *name, int level) 244e1051a39Sopenharmony_ci{ 245e1051a39Sopenharmony_ci if (check_winnt()) 246e1051a39Sopenharmony_ci bp->ptr = RegisterEventSourceA(NULL, name); 247e1051a39Sopenharmony_ci else 248e1051a39Sopenharmony_ci bp->ptr = NULL; 249e1051a39Sopenharmony_ci} 250e1051a39Sopenharmony_ci 251e1051a39Sopenharmony_cistatic void xsyslog(BIO *bp, int priority, const char *string) 252e1051a39Sopenharmony_ci{ 253e1051a39Sopenharmony_ci LPCSTR lpszStrings[2]; 254e1051a39Sopenharmony_ci WORD evtype = EVENTLOG_ERROR_TYPE; 255e1051a39Sopenharmony_ci char pidbuf[DECIMAL_SIZE(DWORD) + 4]; 256e1051a39Sopenharmony_ci 257e1051a39Sopenharmony_ci if (bp->ptr == NULL) 258e1051a39Sopenharmony_ci return; 259e1051a39Sopenharmony_ci 260e1051a39Sopenharmony_ci switch (priority) { 261e1051a39Sopenharmony_ci case LOG_EMERG: 262e1051a39Sopenharmony_ci case LOG_ALERT: 263e1051a39Sopenharmony_ci case LOG_CRIT: 264e1051a39Sopenharmony_ci case LOG_ERR: 265e1051a39Sopenharmony_ci evtype = EVENTLOG_ERROR_TYPE; 266e1051a39Sopenharmony_ci break; 267e1051a39Sopenharmony_ci case LOG_WARNING: 268e1051a39Sopenharmony_ci evtype = EVENTLOG_WARNING_TYPE; 269e1051a39Sopenharmony_ci break; 270e1051a39Sopenharmony_ci case LOG_NOTICE: 271e1051a39Sopenharmony_ci case LOG_INFO: 272e1051a39Sopenharmony_ci case LOG_DEBUG: 273e1051a39Sopenharmony_ci evtype = EVENTLOG_INFORMATION_TYPE; 274e1051a39Sopenharmony_ci break; 275e1051a39Sopenharmony_ci default: 276e1051a39Sopenharmony_ci /* 277e1051a39Sopenharmony_ci * Should never happen, but set it 278e1051a39Sopenharmony_ci * as error anyway. 279e1051a39Sopenharmony_ci */ 280e1051a39Sopenharmony_ci evtype = EVENTLOG_ERROR_TYPE; 281e1051a39Sopenharmony_ci break; 282e1051a39Sopenharmony_ci } 283e1051a39Sopenharmony_ci 284e1051a39Sopenharmony_ci sprintf(pidbuf, "[%lu] ", GetCurrentProcessId()); 285e1051a39Sopenharmony_ci lpszStrings[0] = pidbuf; 286e1051a39Sopenharmony_ci lpszStrings[1] = string; 287e1051a39Sopenharmony_ci 288e1051a39Sopenharmony_ci ReportEventA(bp->ptr, evtype, 0, 1024, NULL, 2, 0, lpszStrings, NULL); 289e1051a39Sopenharmony_ci} 290e1051a39Sopenharmony_ci 291e1051a39Sopenharmony_cistatic void xcloselog(BIO *bp) 292e1051a39Sopenharmony_ci{ 293e1051a39Sopenharmony_ci if (bp->ptr) 294e1051a39Sopenharmony_ci DeregisterEventSource((HANDLE) (bp->ptr)); 295e1051a39Sopenharmony_ci bp->ptr = NULL; 296e1051a39Sopenharmony_ci} 297e1051a39Sopenharmony_ci 298e1051a39Sopenharmony_ci# elif defined(OPENSSL_SYS_VMS) 299e1051a39Sopenharmony_ci 300e1051a39Sopenharmony_cistatic int VMS_OPC_target = LOG_DAEMON; 301e1051a39Sopenharmony_ci 302e1051a39Sopenharmony_cistatic void xopenlog(BIO *bp, char *name, int level) 303e1051a39Sopenharmony_ci{ 304e1051a39Sopenharmony_ci VMS_OPC_target = level; 305e1051a39Sopenharmony_ci} 306e1051a39Sopenharmony_ci 307e1051a39Sopenharmony_cistatic void xsyslog(BIO *bp, int priority, const char *string) 308e1051a39Sopenharmony_ci{ 309e1051a39Sopenharmony_ci struct dsc$descriptor_s opc_dsc; 310e1051a39Sopenharmony_ci 311e1051a39Sopenharmony_ci/* Arrange 32-bit pointer to opcdef buffer and malloc(), if needed. */ 312e1051a39Sopenharmony_ci# if __INITIAL_POINTER_SIZE == 64 313e1051a39Sopenharmony_ci# pragma pointer_size save 314e1051a39Sopenharmony_ci# pragma pointer_size 32 315e1051a39Sopenharmony_ci# define OPCDEF_TYPE __char_ptr32 316e1051a39Sopenharmony_ci# define OPCDEF_MALLOC _malloc32 317e1051a39Sopenharmony_ci# else /* __INITIAL_POINTER_SIZE == 64 */ 318e1051a39Sopenharmony_ci# define OPCDEF_TYPE char * 319e1051a39Sopenharmony_ci# define OPCDEF_MALLOC OPENSSL_malloc 320e1051a39Sopenharmony_ci# endif /* __INITIAL_POINTER_SIZE == 64 [else] */ 321e1051a39Sopenharmony_ci 322e1051a39Sopenharmony_ci struct opcdef *opcdef_p; 323e1051a39Sopenharmony_ci 324e1051a39Sopenharmony_ci# if __INITIAL_POINTER_SIZE == 64 325e1051a39Sopenharmony_ci# pragma pointer_size restore 326e1051a39Sopenharmony_ci# endif /* __INITIAL_POINTER_SIZE == 64 */ 327e1051a39Sopenharmony_ci 328e1051a39Sopenharmony_ci char buf[10240]; 329e1051a39Sopenharmony_ci unsigned int len; 330e1051a39Sopenharmony_ci struct dsc$descriptor_s buf_dsc; 331e1051a39Sopenharmony_ci $DESCRIPTOR(fao_cmd, "!AZ: !AZ"); 332e1051a39Sopenharmony_ci char *priority_tag; 333e1051a39Sopenharmony_ci 334e1051a39Sopenharmony_ci switch (priority) { 335e1051a39Sopenharmony_ci case LOG_EMERG: 336e1051a39Sopenharmony_ci priority_tag = "Emergency"; 337e1051a39Sopenharmony_ci break; 338e1051a39Sopenharmony_ci case LOG_ALERT: 339e1051a39Sopenharmony_ci priority_tag = "Alert"; 340e1051a39Sopenharmony_ci break; 341e1051a39Sopenharmony_ci case LOG_CRIT: 342e1051a39Sopenharmony_ci priority_tag = "Critical"; 343e1051a39Sopenharmony_ci break; 344e1051a39Sopenharmony_ci case LOG_ERR: 345e1051a39Sopenharmony_ci priority_tag = "Error"; 346e1051a39Sopenharmony_ci break; 347e1051a39Sopenharmony_ci case LOG_WARNING: 348e1051a39Sopenharmony_ci priority_tag = "Warning"; 349e1051a39Sopenharmony_ci break; 350e1051a39Sopenharmony_ci case LOG_NOTICE: 351e1051a39Sopenharmony_ci priority_tag = "Notice"; 352e1051a39Sopenharmony_ci break; 353e1051a39Sopenharmony_ci case LOG_INFO: 354e1051a39Sopenharmony_ci priority_tag = "Info"; 355e1051a39Sopenharmony_ci break; 356e1051a39Sopenharmony_ci case LOG_DEBUG: 357e1051a39Sopenharmony_ci priority_tag = "DEBUG"; 358e1051a39Sopenharmony_ci break; 359e1051a39Sopenharmony_ci } 360e1051a39Sopenharmony_ci 361e1051a39Sopenharmony_ci buf_dsc.dsc$b_dtype = DSC$K_DTYPE_T; 362e1051a39Sopenharmony_ci buf_dsc.dsc$b_class = DSC$K_CLASS_S; 363e1051a39Sopenharmony_ci buf_dsc.dsc$a_pointer = buf; 364e1051a39Sopenharmony_ci buf_dsc.dsc$w_length = sizeof(buf) - 1; 365e1051a39Sopenharmony_ci 366e1051a39Sopenharmony_ci lib$sys_fao(&fao_cmd, &len, &buf_dsc, priority_tag, string); 367e1051a39Sopenharmony_ci 368e1051a39Sopenharmony_ci /* We know there's an 8-byte header. That's documented. */ 369e1051a39Sopenharmony_ci opcdef_p = OPCDEF_MALLOC(8 + len); 370e1051a39Sopenharmony_ci opcdef_p->opc$b_ms_type = OPC$_RQ_RQST; 371e1051a39Sopenharmony_ci memcpy(opcdef_p->opc$z_ms_target_classes, &VMS_OPC_target, 3); 372e1051a39Sopenharmony_ci opcdef_p->opc$l_ms_rqstid = 0; 373e1051a39Sopenharmony_ci memcpy(&opcdef_p->opc$l_ms_text, buf, len); 374e1051a39Sopenharmony_ci 375e1051a39Sopenharmony_ci opc_dsc.dsc$b_dtype = DSC$K_DTYPE_T; 376e1051a39Sopenharmony_ci opc_dsc.dsc$b_class = DSC$K_CLASS_S; 377e1051a39Sopenharmony_ci opc_dsc.dsc$a_pointer = (OPCDEF_TYPE) opcdef_p; 378e1051a39Sopenharmony_ci opc_dsc.dsc$w_length = len + 8; 379e1051a39Sopenharmony_ci 380e1051a39Sopenharmony_ci sys$sndopr(opc_dsc, 0); 381e1051a39Sopenharmony_ci 382e1051a39Sopenharmony_ci OPENSSL_free(opcdef_p); 383e1051a39Sopenharmony_ci} 384e1051a39Sopenharmony_ci 385e1051a39Sopenharmony_cistatic void xcloselog(BIO *bp) 386e1051a39Sopenharmony_ci{ 387e1051a39Sopenharmony_ci} 388e1051a39Sopenharmony_ci 389e1051a39Sopenharmony_ci# else /* Unix/Watt32 */ 390e1051a39Sopenharmony_ci 391e1051a39Sopenharmony_cistatic void xopenlog(BIO *bp, char *name, int level) 392e1051a39Sopenharmony_ci{ 393e1051a39Sopenharmony_ci# ifdef WATT32 /* djgpp/DOS */ 394e1051a39Sopenharmony_ci openlog(name, LOG_PID | LOG_CONS | LOG_NDELAY, level); 395e1051a39Sopenharmony_ci# else 396e1051a39Sopenharmony_ci openlog(name, LOG_PID | LOG_CONS, level); 397e1051a39Sopenharmony_ci# endif 398e1051a39Sopenharmony_ci} 399e1051a39Sopenharmony_ci 400e1051a39Sopenharmony_cistatic void xsyslog(BIO *bp, int priority, const char *string) 401e1051a39Sopenharmony_ci{ 402e1051a39Sopenharmony_ci syslog(priority, "%s", string); 403e1051a39Sopenharmony_ci} 404e1051a39Sopenharmony_ci 405e1051a39Sopenharmony_cistatic void xcloselog(BIO *bp) 406e1051a39Sopenharmony_ci{ 407e1051a39Sopenharmony_ci closelog(); 408e1051a39Sopenharmony_ci} 409e1051a39Sopenharmony_ci 410e1051a39Sopenharmony_ci# endif /* Unix */ 411e1051a39Sopenharmony_ci 412e1051a39Sopenharmony_ci#else /* NO_SYSLOG */ 413e1051a39Sopenharmony_ciconst BIO_METHOD *BIO_s_log(void) 414e1051a39Sopenharmony_ci{ 415e1051a39Sopenharmony_ci return NULL; 416e1051a39Sopenharmony_ci} 417e1051a39Sopenharmony_ci#endif /* NO_SYSLOG */ 418