⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config_parse.c

📁 sock protocol ,it is useful!
💻 C
📖 第 1 页 / 共 4 页
字号:
			config.resolveprotocol = RESOLVEPROTOCOL_TCP;#endif /* !HAVE_NO_RESOLVESTUFF */	}break;case 75:#line 634 "config_parse.y"{			config.resolveprotocol = RESOLVEPROTOCOL_UDP;	}break;case 77:#line 642 "config_parse.y"{#if HAVE_LIBWRAP && SOCKS_SERVER			config.srchost.nomismatch = 1;	}break;case 78:#line 646 "config_parse.y"{			config.srchost.nounknown = 1;#else		yyerror("srchostoption requires libwrap");#endif	}break;case 82:#line 662 "config_parse.y"{		ADDMETHOD(AUTHMETHOD_NONE);	}break;case 83:#line 665 "config_parse.y"{		yyerror("GSSAPI not supported");	}break;case 84:#line 668 "config_parse.y"{		ADDMETHOD(AUTHMETHOD_UNAME);	}break;case 85:#line 671 "config_parse.y"{#if HAVE_LIBWRAP && SOCKS_SERVER		ADDMETHOD(AUTHMETHOD_RFC931);#else /* !HAVE_LIBWRAP */		yyerror("method rfc931 requires libwrap");#endif /* !HAVE_LIBWRAP */	}break;case 88:#line 687 "config_parse.y"{#if SOCKS_SERVER		rule.src = src;		rule.dst = dst;		addclientrule(&rule);		bzero(&src, sizeof(src));		bzero(&dst, sizeof(dst));		rule = ruleinit;		src.atype = SOCKS_ADDR_IPV4;		dst.atype = SOCKS_ADDR_IPV4;#endif	}break;case 92:#line 709 "config_parse.y"{ yyval.string = NULL; }break;case 94:#line 713 "config_parse.y"{#if SOCKS_SERVER		rule.src = src;		rule.dst = dst;		addsocksrule(&rule);		bzero(&src, sizeof(src));		bzero(&dst, sizeof(dst));		rule = ruleinit;		src.atype	= SOCKS_ADDR_IPV4;		dst.atype	= SOCKS_ADDR_IPV4;#endif	}break;case 102:#line 740 "config_parse.y"{ yyval.string = NULL; }break;case 104:#line 744 "config_parse.y"{#if SOCKS_SERVER		rule.verdict	= VERDICT_BLOCK;		command			= &rule.state.command;		methodv			= rule.state.methodv;		methodc			= &rule.state.methodc;		protocol			= &rule.state.protocol;		proxyprotocol	= &rule.state.proxyprotocol;		userbase			= &rule.user;	}break;case 105:#line 754 "config_parse.y"{		rule.verdict	= VERDICT_PASS;		command			= &rule.state.command;		methodv			= rule.state.methodv;		methodc			= &rule.state.methodc;		protocol			= &rule.state.protocol;		proxyprotocol	= &rule.state.proxyprotocol;		userbase			= &rule.user;#endif	}break;case 107:#line 769 "config_parse.y"{			command->bind = 1;	}break;case 108:#line 772 "config_parse.y"{			command->connect = 1;	}break;case 109:#line 775 "config_parse.y"{			command->udpassociate = 1;	}break;case 110:#line 781 "config_parse.y"{			command->bindreply = 1;	}break;case 111:#line 785 "config_parse.y"{			command->udpreply = 1;	}break;case 115:#line 797 "config_parse.y"{		protocol->tcp = 1;	}break;case 116:#line 800 "config_parse.y"{		protocol->udp = 1;	}break;case 121:#line 816 "config_parse.y"{#if SOCKS_SERVER	rule.log.connect = 1;	}break;case 122:#line 820 "config_parse.y"{			rule.log.data = 1;	}break;case 123:#line 823 "config_parse.y"{			rule.log.disconnect = 1;	}break;case 124:#line 826 "config_parse.y"{			rule.log.error = 1;	}break;case 125:#line 829 "config_parse.y"{			rule.log.iooperation = 1;#endif	}break;case 128:#line 840 "config_parse.y"{#if HAVE_LIBWRAP && SOCKS_SERVER		struct request_info request;		char libwrap[LIBWRAPBUF];		if (strlen(yyvsp[0].string) >= sizeof(rule.libwrap))			yyerror("libwrap line too long, make LIBWRAPBUF bigger");		strcpy(rule.libwrap, yyvsp[0].string);		/* libwrap modifies the passed buffer. */		SASSERTX(strlen(rule.libwrap) < sizeof(libwrap));		strcpy(libwrap, rule.libwrap);		++dry_run;		request_init(&request, RQ_FILE, -1, RQ_DAEMON, __progname, 0);		if (setjmp(tcpd_buf) != 0)			yyerror("bad libwrap line");		process_options(libwrap, &request);		--dry_run;#else /* !HAVE_LIBWRAP */		yyerror("libwrap support not compiled in");#endif	}break;case 137:#line 885 "config_parse.y"{ yyval.string = NULL; }break;case 139:#line 889 "config_parse.y"{		addressinit(&src);	}break;case 140:#line 895 "config_parse.y"{		addressinit(&dst);	}break;case 141:#line 901 "config_parse.y"{#if SOCKS_CLIENT		addressinit(&gw);#endif	}break;case 147:#line 920 "config_parse.y"{		*atype = SOCKS_ADDR_IPV4;		if (inet_aton(yyvsp[0].string, ipaddr) != 1)			yyerror("bad address");	}break;case 148:#line 929 "config_parse.y"{		if (atoi(yyvsp[0].string) < 0 || atoi(yyvsp[0].string) > 32)			yyerror("bad netmask");		netmask->s_addr		= atoi(yyvsp[0].string) == 0 ? 0 : htonl(0xffffffff << (32 - atoi(yyvsp[0].string)));	}break;case 149:#line 936 "config_parse.y"{			if (!inet_aton(yyvsp[0].string, netmask))				yyerror("bad netmask");	}break;case 150:#line 942 "config_parse.y"{		*atype = SOCKS_ADDR_DOMAIN;		if (strlen(yyvsp[0].string) >= MAXHOSTNAMELEN)			yyerror("domain too long");		strcpy(domain, yyvsp[0].string);	}break;case 151:#line 951 "config_parse.y"{		*atype = SOCKS_ADDR_DOMAIN;		if (strlen(yyvsp[0].string) >= MAXHOSTNAMELEN)			yyerror("domain too long");		strcpy(domain, yyvsp[0].string);#if SOCKS_CLIENT		route.state.direct = 1;#endif	}break;case 152:#line 964 "config_parse.y"{ yyval.string = NULL; }break;case 158:#line 977 "config_parse.y"{		*port_tcp	= htons((in_port_t)atoi(yyvsp[0].string));		*port_udp	= htons((in_port_t)atoi(yyvsp[0].string));	}break;case 159:#line 983 "config_parse.y"{		struct servent	*service;		struct protocol_t	protocolunset;		int set;		bzero(&protocolunset, sizeof(protocolunset));		/* set all protocols if none set, default. */		if (memcmp(protocol, &protocolunset, sizeof(*protocol)) == 0) {			memset(protocol, UCHAR_MAX, sizeof(*protocol));			set = 0;		}		else			set = 1;		if (protocol->tcp) {			if ((service = getservbyname(yyvsp[0].string, "tcp")) == NULL) {				if (set)					yyerror("bad servicename for tcp");				else					*port_tcp = htons(0);			}			else				*port_tcp = (in_port_t)service->s_port;		}		if (protocol->udp) {			if ((service = getservbyname(yyvsp[0].string, "udp")) == NULL) {				if (set)					yyerror("bad servicename for udp");				else					*port_udp = htons(0);			}			else				*port_udp = (in_port_t)service->s_port;		}		/* check we got both protocol ports set right. */		if (*port_tcp == htons(0) && *port_udp == htons(0))			yyerror("bad service name for tcp/udp");		if (*port_tcp == htons(0))			*port_tcp = *port_udp;		else if (*port_udp == htons(0))			*port_udp = *port_tcp;	}break;case 160:#line 1031 "config_parse.y"{		ruleaddress->portend = htons((in_port_t)atoi(yyvsp[0].string));		ruleaddress->operator = range;	}break;case 161:#line 1037 "config_parse.y"{		*operator = string2operator(yyvsp[0].string);	}break;#line 1660 "y.tab.c"    }    yyssp -= yym;    yystate = *yyssp;    yyvsp -= yym;    yym = yylhs[yyn];    if (yystate == 0 && yym == 0)    {#if YYDEBUG        if (yydebug)            printf("%sdebug: after reduction, shifting from state 0 to\ state %d\n", YYPREFIX, YYFINAL);#endif        yystate = YYFINAL;        *++yyssp = YYFINAL;        *++yyvsp = yyval;        if (yychar < 0)        {            if ((yychar = yylex()) < 0) yychar = 0;#if YYDEBUG            if (yydebug)            {                yys = 0;                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];                if (!yys) yys = "illegal-symbol";                printf("%sdebug: state %d, reading %d (%s)\n",                        YYPREFIX, YYFINAL, yychar, yys);            }#endif        }        if (yychar == 0) goto yyaccept;        goto yyloop;    }    if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)        yystate = yytable[yyn];    else        yystate = yydgoto[yym];#if YYDEBUG    if (yydebug)        printf("%sdebug: after reduction, shifting from state %d \to state %d\n", YYPREFIX, *yyssp, yystate);#endif    if (yyssp >= yysslim && yygrowstack())    {        goto yyoverflow;    }    *++yyssp = yystate;    *++yyvsp = yyval;    goto yyloop;yyoverflow:    yyerror("yacc stack overflow");yyabort:    return (1);yyaccept:    return (0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -