Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
openssl
提交
0849d138
O
openssl
项目概览
btwise
/
openssl
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
openssl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0849d138
编写于
2月 22, 1999
作者:
B
Ben Laurie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add syslogging BIO.
上级
e527ba09
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
251 addition
and
2 deletion
+251
-2
CHANGES
CHANGES
+3
-0
crypto/bio/Makefile.ssl
crypto/bio/Makefile.ssl
+2
-2
crypto/bio/bio.h
crypto/bio/bio.h
+2
-0
crypto/bio/bss_log.c
crypto/bio/bss_log.c
+244
-0
未找到文件。
CHANGES
浏览文件 @
0849d138
...
...
@@ -5,6 +5,9 @@
Changes between 0.9.1c and 0.9.2
*) Add cool BIO that does syslog (or event log on NT).
[Arne Ansper <arne@ats.cyber.ee>, integrated by Ben Laurie]
*) Add support for new TLS ciphersuites, TLS_RSA_EXPORT56_WITH_RC4_56_MD5,
TLS_RSA_EXPORT56_WITH_RC2_CBC_56_MD5 and
TLS_RSA_EXPORT56_WITH_DES_CBC_SHA, as specified in "56-bit Export Cipher
...
...
crypto/bio/Makefile.ssl
浏览文件 @
0849d138
...
...
@@ -26,12 +26,12 @@ LIBSRC= bio_lib.c bio_cb.c $(ERRC).c \
bss_mem.c bss_null.c bss_fd.c
\
bss_file.c bss_sock.c bss_conn.c
\
bf_null.c bf_buff.c b_print.c b_dump.c
\
b_sock.c bss_acpt.c bf_nbio.c
b_sock.c bss_acpt.c bf_nbio.c
bss_log.c
LIBOBJ
=
bio_lib.o bio_cb.o
$(ERRC)
.o
\
bss_mem.o bss_null.o bss_fd.o
\
bss_file.o bss_sock.o bss_conn.o
\
bf_null.o bf_buff.o b_print.o b_dump.o
\
b_sock.o bss_acpt.o bf_nbio.o
b_sock.o bss_acpt.o bf_nbio.o
bss_log.o
SRC
=
$(LIBSRC)
...
...
crypto/bio/bio.h
浏览文件 @
0849d138
...
...
@@ -508,6 +508,7 @@ BIO_METHOD *BIO_s_socket(void);
BIO_METHOD
*
BIO_s_connect
(
void
);
BIO_METHOD
*
BIO_s_accept
(
void
);
BIO_METHOD
*
BIO_s_fd
(
void
);
BIO_METHOD
*
BIO_s_log
(
void
);
BIO_METHOD
*
BIO_s_null
(
void
);
BIO_METHOD
*
BIO_f_null
(
void
);
BIO_METHOD
*
BIO_f_buffer
(
void
);
...
...
@@ -574,6 +575,7 @@ BIO_METHOD *BIO_s_socket();
BIO_METHOD
*
BIO_s_connect
();
BIO_METHOD
*
BIO_s_accept
();
BIO_METHOD
*
BIO_s_fd
();
BIO_METHOD
*
BIO_s_log
();
BIO_METHOD
*
BIO_s_null
();
BIO_METHOD
*
BIO_f_null
();
BIO_METHOD
*
BIO_f_buffer
();
...
...
crypto/bio/bss_log.c
0 → 100644
浏览文件 @
0849d138
/* crypto/bio/bss_log.c */
/* ====================================================================
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
/*
Why BIO_s_log?
BIO_s_log is useful for system daemons (or services under NT).
It is one-way BIO, it sends all stuff to syslogd (or event log
under NT).
*/
#include <stdio.h>
#include <errno.h>
#ifndef WIN32
#include <syslog.h>
#endif
#include "cryptlib.h"
#include "buffer.h"
#include "err.h"
#ifndef NOPROTO
static
int
MS_CALLBACK
slg_write
(
BIO
*
h
,
char
*
buf
,
int
num
);
static
int
MS_CALLBACK
slg_puts
(
BIO
*
h
,
char
*
str
);
static
long
MS_CALLBACK
slg_ctrl
(
BIO
*
h
,
int
cmd
,
long
arg1
,
char
*
arg2
);
static
int
MS_CALLBACK
slg_new
(
BIO
*
h
);
static
int
MS_CALLBACK
slg_free
(
BIO
*
data
);
#else
static
int
MS_CALLBACK
slg_write
();
static
int
MS_CALLBACK
slg_puts
();
static
long
MS_CALLBACK
slg_ctrl
();
static
int
MS_CALLBACK
slg_new
();
static
int
MS_CALLBACK
slg_free
();
#endif
static
int
xopenlog
(
BIO
*
bp
,
char
*
name
,
int
level
);
static
int
xcloselog
(
BIO
*
bp
);
static
BIO_METHOD
methods_slg
=
{
BIO_TYPE_MEM
,
"syslog"
,
slg_write
,
NULL
,
slg_puts
,
NULL
,
slg_ctrl
,
slg_new
,
slg_free
,
};
BIO_METHOD
*
BIO_s_log
()
{
return
(
&
methods_slg
);
}
static
int
MS_CALLBACK
slg_new
(
bi
)
BIO
*
bi
;
{
bi
->
init
=
1
;
bi
->
num
=
0
;
bi
->
ptr
=
NULL
;
#ifndef WIN32
xopenlog
(
bi
,
"application"
,
LOG_DAEMON
);
#else
xopenlog
(
bi
,
"application"
,
0
);
#endif
return
(
1
);
}
static
int
MS_CALLBACK
slg_free
(
a
)
BIO
*
a
;
{
if
(
a
==
NULL
)
return
(
0
);
xcloselog
(
a
);
return
(
1
);
}
static
int
MS_CALLBACK
slg_write
(
b
,
in
,
inl
)
BIO
*
b
;
char
*
in
;
int
inl
;
{
int
ret
=
inl
;
char
*
buf
=
in
;
char
*
pp
;
#if defined(WIN32)
LPTSTR
lpszStrings
[
1
];
WORD
evtype
=
EVENTLOG_ERROR_TYPE
;
#else
int
priority
;
#endif
if
((
buf
=
(
char
*
)
Malloc
(
inl
+
1
))
==
NULL
){
return
(
0
);
}
strncpy
(
buf
,
in
,
inl
);
buf
[
inl
]
=
'\0'
;
#if defined(WIN32)
if
(
strncmp
(
buf
,
"ERR "
,
4
)
==
0
){
evtype
=
EVENTLOG_ERROR_TYPE
;
pp
=
buf
+
4
;
}
else
if
(
strncmp
(
buf
,
"WAR "
,
4
)
==
0
){
evtype
=
EVENTLOG_WARNING_TYPE
;
pp
=
buf
+
4
;
}
else
if
(
strncmp
(
buf
,
"INF "
,
4
)
==
0
){
evtype
=
EVENTLOG_INFORMATION_TYPE
;
pp
=
buf
+
4
;
}
else
{
evtype
=
EVENTLOG_ERROR_TYPE
;
pp
=
buf
;
}
lpszStrings
[
0
]
=
pp
;
if
(
b
->
ptr
)
ReportEvent
(
b
->
ptr
,
evtype
,
0
,
1024
,
NULL
,
1
,
0
,
lpszStrings
,
NULL
);
#else
if
(
strncmp
(
buf
,
"ERR "
,
4
)
==
0
){
priority
=
LOG_ERR
;
pp
=
buf
+
4
;
}
else
if
(
strncmp
(
buf
,
"WAR "
,
4
)
==
0
){
priority
=
LOG_WARNING
;
pp
=
buf
+
4
;
}
else
if
(
strncmp
(
buf
,
"INF "
,
4
)
==
0
){
priority
=
LOG_INFO
;
pp
=
buf
+
4
;
}
else
{
priority
=
LOG_ERR
;
pp
=
buf
;
}
syslog
(
priority
,
"%s"
,
pp
);
#endif
Free
(
buf
);
return
(
ret
);
}
static
long
MS_CALLBACK
slg_ctrl
(
b
,
cmd
,
num
,
ptr
)
BIO
*
b
;
int
cmd
;
long
num
;
char
*
ptr
;
{
switch
(
cmd
)
{
case
BIO_CTRL_SET
:
xcloselog
(
b
);
xopenlog
(
b
,
ptr
,
num
);
break
;
default:
break
;
}
return
(
0
);
}
static
int
MS_CALLBACK
slg_puts
(
bp
,
str
)
BIO
*
bp
;
char
*
str
;
{
int
n
,
ret
;
n
=
strlen
(
str
);
ret
=
slg_write
(
bp
,
str
,
n
);
return
(
ret
);
}
static
int
xopenlog
(
BIO
*
bp
,
char
*
name
,
int
level
)
{
#if defined(WIN32)
if
((
bp
->
ptr
=
(
char
*
)
RegisterEventSource
(
NULL
,
name
))
==
NULL
){
return
(
0
);
}
#else
openlog
(
name
,
LOG_PID
|
LOG_CONS
,
level
);
#endif
return
(
1
);
}
static
int
xcloselog
(
BIO
*
bp
)
{
#if defined(WIN32)
if
(
bp
->
ptr
)
DeregisterEventSource
((
HANDLE
)(
bp
->
ptr
));
bp
->
ptr
=
NULL
;
#else
closelog
();
#endif
return
(
1
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录