/*
* (c) Copyright 1992 by Panagiotis Tsirigotis
* (c) Sections Copyright 1998-2001 by Rob Braun
* All rights reserved. The file named COPYRIGHT specifies the terms
* and conditions for redistribution.
*/
#include "config.h"
#include <ctype.h>
#include <sys/file.h>
#include <syslog.h>
#include <netdb.h>
#include <pwd.h>
#include <grp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
#include <limits.h> /* For LONG_MIN and LONG_MAX */
#include <errno.h>
#ifdef HAVE_LOADAVG
#include <stdio.h>
#endif
#if defined(hpux) && !defined(X_OK)
#define X_OK 1
#endif
#include "str.h"
#include "parsers.h"
#include "msg.h"
#include "nvlists.h"
#include "env.h"
#include "xconfig.h"
#include "addr.h"
#include "libportable.h"
#include "timex.h"
#include "addr.h" /* check_hostname() */
#define NEW_SET( set, v1, v2 ) \
if ( (set) == NULL && \
( (set) = pset_create( (v1), (v2) ) ) == NULL ) \
{ \
out_of_memory( func ) ; \
return( FAILED ) ; \
}
static void missing_attr_msg(const char *par, const char *item)
{
parsemsg( LOG_WARNING, par,
"attribute %s expects at least 1 value and none were given.",
item );
}
/*
* Find the flags corresponding to strings in "values" and apply
* them to "*maskp" (apply means add or remove depending on "op")
* "description" describes the type of flags.
*/
static status_e parse_value_list( pset_h values,
mask_t *maskp,
const struct name_value list[],
enum assign_op op,
const char *description )
{
unsigned u ;
const struct name_value *nvp ;
const char *func = "parse_value_list" ;
for ( u=0; u<pset_count( values ); u++ )
{
const char *name = (char *) pset_pointer( values, u ) ;
nvp = nv_find_value( list, name ) ;
if ( nvp != NULL )
{
if ( op == PLUS_EQ )
M_SET( *maskp, nvp->value ) ;
else
M_CLEAR( *maskp, nvp->value ) ;
}
else
{
parsemsg( LOG_WARNING, func, "Bad %s: %s", description, name ) ;
return( FAILED );
}
}
return( OK ) ;
}
status_e type_parser( pset_h values,
struct service_config *scp,
enum assign_op op )
{
if ( pset_count( values ) >= 1 )
{
return( parse_value_list( values,
&SC_TYPE(scp), service_types, PLUS_EQ, "service type" ) ) ;
}
else
{
missing_attr_msg("type_parser", "type");
return FAILED ;
}
}
status_e flags_parser( pset_h values,
struct service_config *scp,
enum assign_op op )
{
if ( pset_count( values ) >= 1 )
{
return( parse_value_list( values,
&SC_XFLAGS(scp), service_flags, PLUS_EQ, "service flag" ) ) ;
}
else
{
missing_attr_msg("flags_parser", "flags");
return FAILED ;
}
}
status_e socket_type_parser( const pset_h values,
struct service_config *scp,
enum assign_op op )
{
const struct name_value *nvp ;
const char *type = (char *) pset_pointer( values, 0 ) ;
const char *func = "socket_type_parser" ;
nvp = nv_find_value( socket_types, type ) ;
if ( nvp != NULL )
{
SC_SOCKET_TYPE(scp) = nvp->value ;
return( OK ) ;
}
else
{
parsemsg( LOG_ERR, func, "Bad socket type: %s", type ) ;
return( FAILED ) ;
}
}
status_e rpc_version_parser( pset_h values,
struct service_config *scp,
enum assign_op op )
{
struct rpc_data *rdp = SC_RPCDATA( scp ) ;
char *version = (char *) pset_pointer( values, 0 ) ;
int min_version=0, max_version=0;
char *p = strchr( version, '-' ) ;
const char *func = "rpc_version_parser" ;
if ( p == NULL )
{
if ( parse_base10(version, &min_version) )
max_version = min_version - 1;
else
max_version = min_version;
}
else
{
*p = NUL ;
if ( parse_base10(version, &min_version) ||
parse_base10(p+1, &max_version) )
max_version = min_version - 1;
}
if ( min_version > max_version )
{
parsemsg( LOG_ERR, func, "bad version range: %s", version ) ;
return( FAILED ) ;
}
rdp->rd_min_version = min_version;
rdp->rd_max_version = max_version;
return( OK ) ;
}
status_e rpc_number_parser( pset_h values,
struct service_config *scp,
enum assign_op op )
{
int num;
if ( parse_base10((char *) pset_pointer( values, 0 ), &num) ) {
parsemsg(LOG_ERR, "rpc_number_parser", "Error parsing: %s",
(char *)pset_pointer( values, 0 ));
return( FAILED );
}
SC_RPCDATA( scp )->rd_program_number = num;
return( OK ) ;
}
status_e protocol_parser( pset_h values,
struct service_config *scp,
enum assign_op op )
{
char *proto_name = (char *) pset_pointer( values, 0 ) ;
struct protoent *pep ;
const char *func = "protocol_parser" ;
if( proto_name == NULL ) {
parsemsg( LOG_ERR, func, "Protocol name is null in %s", SC_NAME(scp) );
return( FAILED );
}
if ( ( pep = getprotobyname( proto_name ) ) == NULL )
{
parsemsg( LOG_ERR, func,
"Protocol %s not in /etc/protocols", proto_name ) ;
return( FAILED ) ;
}
SC_PROTONAME(scp) = new_string( proto_name ) ;
if ( SC_PROTONAME(scp) == NULL )
{
out_of_memory( func ) ;
return( FAILED ) ;
}
SC_PROTOVAL(scp) = pep->p_proto ;
return( OK ) ;
}
status_e wait_parser( pset_h values,
struct service_config *scp,
enum assign_op op )
{
char *val = (char *) pset_pointer( values, 0 ) ;
const char *func = "wait_parser" ;
if ( EQ( val, "yes" ) )
SC_WAIT(scp) = YES ;
else if ( EQ( val, "no" ) )
SC_WAIT(scp) = NO ;
else
{
parsemsg( LOG_ERR, func, "Bad value for wait: %s", val ) ;
return( FAILED );
}
return( OK ) ;
}
#ifdef HAVE_MDNS
status_e mdns_parser( pset_h values,
struct service_config *scp,
enum assign_op op )
{
char *val = (char *) pset_pointer( values, 0 ) ;
const char *func = "mdns_parser" ;
if ( EQ( val, "yes" ) )
SC_MDNS(scp) = YES ;
else if ( EQ( val, "no" ) )
SC_MDNS(scp) = NO ;
else
{
parsemsg( LOG_ERR, func, "Bad value for mdns: %s", val ) ;
return( FAILED );
}
return( OK ) ;
}
#endif
status_e user_parser( pset_h values,
struct service_config *scp,
enum assign_op op )
{
char *user = (char *) pset_pointer( values, 0 ) ;
const char *func = "user_parser" ;
if (parse_all_digits(user) == TRUE)
{ /* We will assume the number is a valid user. This is a workaround
for some Solaris systems that have problems doing getgr*. */
if (parse_ubase10(user, (unsigned int *)&SC_UID(scp)))
{
parsemsg( LOG_ERR, func, "Error parsing user as a number: %s", user ) ;
return( FAILED ) ;
}
SC_USER_GID(scp) = SC_UID(scp) ;
}
else
{
struct passwd *pw ;
pw = getpwnam( user ) ;
if ( pw == NULL )
{
parsemsg( LOG_ERR, func, "Unknown user: %s", user ) ;
return( FAILED ) ;
}
str_fill( pw->pw_passwd, ' ' );
SC_UID(scp) = pw->pw_uid ;
SC_USER_GID(scp) = pw->pw_gid ;
}
return( OK ) ;
}
status_e group_parser( pset_h values,
struct service_config *scp,
enum assign_op op )
{
const char *func = "group_parser" ;
char *gro
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
共198个文件
c:63个
h:61个
in:11个
超级服务xinetd最新源码下载。 xinetd提供类似于inetd+tcp_wrapper的功能,但是更加强大和安全。它能提供以下特色: * 支持对tcp、udp、RPC服务(但是当前对RPC的支持不够稳定) * 基于时间段的访问控制 * 功能完备的log功能,即可以记录连接成功也可以记录连接失败的行为 * 能有效的防止DoS攻击(Denial of Services) * 能限制同时运行的同一类型的服务器数目 * 能限制启动的所有服务器数目 * 能限制log文件大小 * 将某个服务绑定在特定的系统接口上,从而能实现只允许私有网络访问某项服务 * 能实现作为其他系统的代理。如果和ip伪装结合可以实现对内部私有网络的访问
资源推荐
资源详情
资源评论
收起资源包目录
xinetd-2.3.15.tar.gz (198个子文件)
sio.3 12KB
xlog.3 7KB
pset.3 5KB
Sprint.3 5KB
strparse.3 4KB
strprint.3 3KB
m_env.3 3KB
misc.3 2KB
psi.3 2KB
strutil.3 1KB
xconv.pl.8 4KB
itox.8 626B
AUDIT 8KB
parsers.c 38KB
confparse.c 29KB
service.c 24KB
siosup.c 23KB
parse.c 22KB
addr.c 21KB
builtins.c 17KB
sprint.c 17KB
sconf.c 15KB
reconfig.c 15KB
child.c 15KB
internals.c 13KB
signals.c 13KB
inet.c 11KB
access.c 11KB
sio.c 10KB
tcpint.c 10KB
init.c 9KB
server.c 9KB
ident.c 8KB
udpint.c 8KB
main.c 8KB
util.c 7KB
int.c 7KB
itox.c 7KB
filelog.c 6KB
redirect.c 6KB
connection.c 6KB
sensor.c 6KB
log.c 6KB
cvt.c 6KB
inet_aton.c 6KB
intcommon.c 6KB
inet_ntop.c 5KB
msg.c 5KB
retry.c 5KB
conf.c 5KB
parsesup.c 5KB
m_env.c 5KB
env.c 5KB
logctl.c 5KB
xlog.c 4KB
options.c 4KB
nvlists.c 4KB
slog.c 4KB
includedir.c 4KB
strparse.c 4KB
xtimer.c 4KB
time.c 4KB
xmdns.c 4KB
special.c 3KB
pset.c 3KB
strerror.c 3KB
fake-getaddrinfo.c 3KB
xgetloadavg.c 2KB
strprint.c 2KB
strutil.c 2KB
fake-getnameinfo.c 1KB
ops.c 1KB
util.c 1KB
misc.c 562B
strcasecmp.c 290B
difftime.c 145B
CHANGELOG 43KB
CHANGELOG 437B
CHANGELOG 229B
chargen-dgram 1KB
chargen-stream 1KB
sample.conf 5KB
empty.conf 1KB
xinetd.conf 1001B
configure 334KB
COPYRIGHT 2KB
COPYRIGHT 1KB
COPYRIGHT 1KB
COPYRIGHT 1KB
COPYRIGHT 1KB
COPYRIGHT 1KB
.cvsignore 0B
.cvsignore 0B
.cvsignore 0B
daytime-dgram 1KB
daytime-stream 1KB
discard-dgram 1KB
discard-stream 1KB
echo-dgram 1KB
echo-stream 1KB
共 198 条
- 1
- 2
资源评论
- zkpdjdjd2014-07-31资源挺好的,谢谢
- yangqingna_19862017-03-15不错,非常感谢楼主分享!
- dinghui32014-07-12可以用,非常感谢。
zieckey
- 粉丝: 73
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- NC65 UAP65 流程开发 – 业务流 – 推单 详细笔记
- 两种计算CDF累加分布函数的Matlab程序,可以选择使用 .rar
- Windows操作系统介绍.zip
- 汉森的广义t分布的matlab程序(金融)cdf.zip
- Three.js介绍.zip0002
- 人工智能BBSO算法,MATLAB实现,很基本的人工智能算法,里面有很多源程序
- 高端大气科技互联网项目融资商业计划书产品公司品牌介绍PPT模板.pptx
- Sora AI文字生成视频实操教程、由给定的图片生成视频的教程说明书,祝你一臂之力 轻松上手Sora
- 网络安全说明:网络安全方面的资料,+适合网络安全的初学者
- 【移动应用开发】HarmonyOS应用服务开发,移动购物应用
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功