亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nis_ho.c

?? package of develop dns
?? C
字號:
/* * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1996,1999 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */#if defined(LIBC_SCCS) && !defined(lint)static const char rcsid[] = "$Id: nis_ho.c,v 1.2.2.1.4.1 2004/03/09 08:33:38 marka Exp $";#endif /* LIBC_SCCS and not lint *//* Imports */#include "port_before.h"#ifndef WANT_IRS_NISstatic int __bind_irs_nis_unneeded;#else#include <sys/types.h>#include <sys/param.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>#include <arpa/nameser.h>#ifdef T_NULL#undef T_NULL			/* Silence re-definition warning of T_NULL. */#endif#include <rpc/rpc.h>#include <rpc/xdr.h>#include <rpcsvc/yp_prot.h>#include <rpcsvc/ypclnt.h>#include <ctype.h>#include <errno.h>#include <stdlib.h>#include <netdb.h>#include <resolv.h>#include <stdio.h>#include <string.h>#include <isc/memcluster.h>#include <irs.h>#include "port_after.h"#include "irs_p.h"#include "nis_p.h"/* Definitions */#define	MAXALIASES	35#define	MAXADDRS	35#if PACKETSZ > 1024#define	MAXPACKET	PACKETSZ#else#define	MAXPACKET	1024#endifstruct pvt {	int		needrewind;	char *		nis_domain;	char *		curkey_data;	int		curkey_len;	char *		curval_data;	int		curval_len;	struct hostent	host;	char *		h_addr_ptrs[MAXADDRS + 1];	char *		host_aliases[MAXALIASES + 1];	char		hostbuf[8*1024];	u_char		host_addr[16];	/* IPv4 or IPv6 */	struct __res_state  *res;	void		(*free_res)(void *);};enum do_what { do_none = 0x0, do_key = 0x1, do_val = 0x2, do_all = 0x3 };static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };static /*const*/ char hosts_byname[] = "hosts.byname";static /*const*/ char hosts_byaddr[] = "hosts.byaddr";static /*const*/ char ipnode_byname[] = "ipnode.byname";static /*const*/ char ipnode_byaddr[] = "ipnode.byaddr";static /*const*/ char yp_multi[] = "YP_MULTI_";/* Forwards */static void		ho_close(struct irs_ho *this);static struct hostent *	ho_byname(struct irs_ho *this, const char *name);static struct hostent *	ho_byname2(struct irs_ho *this, const char *name,					int af);static struct hostent *	ho_byaddr(struct irs_ho *this, const void *addr,				       int len, int af);static struct hostent *	ho_next(struct irs_ho *this);static void		ho_rewind(struct irs_ho *this);static void		ho_minimize(struct irs_ho *this);static struct __res_state * ho_res_get(struct irs_ho *this);static void		ho_res_set(struct irs_ho *this,				   struct __res_state *res,				   void (*free_res)(void *));static struct addrinfo * ho_addrinfo(struct irs_ho *this, const char *name,				     const struct addrinfo *pai);static struct hostent *	makehostent(struct irs_ho *this);static void		nisfree(struct pvt *, enum do_what);static int		init(struct irs_ho *this);/* Public */struct irs_ho *irs_nis_ho(struct irs_acc *this) {	struct irs_ho *ho;	struct pvt *pvt;	if (!(pvt = memget(sizeof *pvt))) {		errno = ENOMEM;		return (NULL);	}	memset(pvt, 0, sizeof *pvt);	if (!(ho = memget(sizeof *ho))) {		memput(pvt, sizeof *pvt);		errno = ENOMEM;		return (NULL);	}	memset(ho, 0x5e, sizeof *ho);	pvt->needrewind = 1;	pvt->nis_domain = ((struct nis_p *)this->private)->domain;	ho->private = pvt;	ho->close = ho_close;	ho->byname = ho_byname;	ho->byname2 = ho_byname2;	ho->byaddr = ho_byaddr;	ho->next = ho_next;	ho->rewind = ho_rewind;	ho->minimize = ho_minimize;	ho->res_set = ho_res_set;	ho->res_get = ho_res_get;	ho->addrinfo = ho_addrinfo;	return (ho);}/* Methods */static voidho_close(struct irs_ho *this) {	struct pvt *pvt = (struct pvt *)this->private;	ho_minimize(this);	nisfree(pvt, do_all);	if (pvt->res && pvt->free_res)		(*pvt->free_res)(pvt->res);	memput(pvt, sizeof *pvt);	memput(this, sizeof *this);}static struct hostent *ho_byname(struct irs_ho *this, const char *name) {	struct pvt *pvt = (struct pvt *)this->private;	struct hostent *hp;	if (init(this) == -1)		return (NULL);	if (pvt->res->options & RES_USE_INET6) {		hp = ho_byname2(this, name, AF_INET6);		if (hp)			return (hp);	}	return (ho_byname2(this, name, AF_INET));}static struct hostent *ho_byname2(struct irs_ho *this, const char *name, int af) {	struct pvt *pvt = (struct pvt *)this->private;	int r;	char *tmp;	UNUSED(af);		if (init(this) == -1)		return (NULL);	nisfree(pvt, do_val);	strcpy(pvt->hostbuf, yp_multi);	strncat(pvt->hostbuf, name, sizeof(pvt->hostbuf) - sizeof(yp_multi));	pvt->hostbuf[sizeof(pvt->hostbuf) - 1] = '\0';	for (r = sizeof(yp_multi) - 1; pvt->hostbuf[r] != '\0'; r++)		if (isupper((unsigned char)pvt->hostbuf[r]))			tolower(pvt->hostbuf[r]);	tmp = pvt->hostbuf;	r = yp_match(pvt->nis_domain, ipnode_byname, tmp,		     strlen(tmp), &pvt->curval_data, &pvt->curval_len);	if (r != 0) {		tmp = pvt->hostbuf + sizeof(yp_multi) - 1;		r = yp_match(pvt->nis_domain, ipnode_byname, tmp,			     strlen(tmp), &pvt->curval_data, &pvt->curval_len);	}	if (r != 0) {		tmp = pvt->hostbuf;		r = yp_match(pvt->nis_domain, hosts_byname, tmp,			     strlen(tmp), &pvt->curval_data, &pvt->curval_len);	}	if (r != 0) {		tmp = pvt->hostbuf + sizeof(yp_multi) - 1;		r = yp_match(pvt->nis_domain, hosts_byname, tmp,			     strlen(tmp), &pvt->curval_data, &pvt->curval_len);	}	if (r != 0) {		RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);		return (NULL);	}	return (makehostent(this));}static struct hostent *ho_byaddr(struct irs_ho *this, const void *addr, int len, int af) {	struct pvt *pvt = (struct pvt *)this->private;	char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];	const u_char *uaddr = addr;	int r;		if (init(this) == -1)		return (NULL);	if (af == AF_INET6 && len == IN6ADDRSZ &&	    (!memcmp(uaddr, mapped, sizeof mapped) ||	     !memcmp(uaddr, tunnelled, sizeof tunnelled))) {		/* Unmap. */		addr = (const u_char *)addr + sizeof mapped;		uaddr += sizeof mapped;		af = AF_INET;		len = INADDRSZ;	}	if (inet_ntop(af, uaddr, tmp, sizeof tmp) == NULL) {		RES_SET_H_ERRNO(pvt->res, NETDB_INTERNAL);		return (NULL);	}	nisfree(pvt, do_val);	r = yp_match(pvt->nis_domain, ipnode_byaddr, tmp, strlen(tmp),		     &pvt->curval_data, &pvt->curval_len);	if (r != 0)		r = yp_match(pvt->nis_domain, hosts_byaddr, tmp, strlen(tmp),			     &pvt->curval_data, &pvt->curval_len);	if (r != 0) {		RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);		return (NULL);	}	return (makehostent(this));}static struct hostent *ho_next(struct irs_ho *this) {	struct pvt *pvt = (struct pvt *)this->private;	struct hostent *rval;	int r;	if (init(this) == -1)		return (NULL);	do {		if (pvt->needrewind) {			nisfree(pvt, do_all);			r = yp_first(pvt->nis_domain, hosts_byaddr,				     &pvt->curkey_data, &pvt->curkey_len,				     &pvt->curval_data, &pvt->curval_len);			pvt->needrewind = 0;		} else {			char *newkey_data;			int newkey_len;			nisfree(pvt, do_val);			r = yp_next(pvt->nis_domain, hosts_byaddr,				    pvt->curkey_data, pvt->curkey_len,				    &newkey_data, &newkey_len,				    &pvt->curval_data, &pvt->curval_len);			nisfree(pvt, do_key);			pvt->curkey_data = newkey_data;			pvt->curkey_len = newkey_len;		}		if (r != 0) {			RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);			return (NULL);		}		rval = makehostent(this);	} while (rval == NULL);	return (rval);}static voidho_rewind(struct irs_ho *this) {	struct pvt *pvt = (struct pvt *)this->private;	pvt->needrewind = 1;}static voidho_minimize(struct irs_ho *this) {	struct pvt *pvt = (struct pvt *)this->private;	if (pvt->res)		res_nclose(pvt->res);}static struct __res_state *ho_res_get(struct irs_ho *this) {	struct pvt *pvt = (struct pvt *)this->private;	if (!pvt->res) {		struct __res_state *res;		res = (struct __res_state *)malloc(sizeof *res);		if (!res) {			errno = ENOMEM;			return (NULL);		}		memset(res, 0, sizeof *res);		ho_res_set(this, res, free);	}	return (pvt->res);}static voidho_res_set(struct irs_ho *this, struct __res_state *res,		void (*free_res)(void *)) {	struct pvt *pvt = (struct pvt *)this->private;	if (pvt->res && pvt->free_res) {		res_nclose(pvt->res);		(*pvt->free_res)(pvt->res);	}	pvt->res = res;	pvt->free_res = free_res;}struct nis_res_target {	struct nis_res_target *next;	int family;};/* XXX */extern struct addrinfo *hostent2addrinfo __P((struct hostent *,					      const struct addrinfo *pai));static struct addrinfo *ho_addrinfo(struct irs_ho *this, const char *name, const struct addrinfo *pai){	struct pvt *pvt = (struct pvt *)this->private;	struct hostent *hp;	struct nis_res_target q, q2, *p;	struct addrinfo sentinel, *cur;	memset(&q, 0, sizeof(q2));	memset(&q2, 0, sizeof(q2));	memset(&sentinel, 0, sizeof(sentinel));	cur = &sentinel;	switch(pai->ai_family) {	case AF_UNSPEC:		/* INET6 then INET4 */		q.family = AF_INET6;		q.next = &q2;		q2.family = AF_INET;		break;	case AF_INET6:		q.family = AF_INET6;		break;	case AF_INET:		q.family = AF_INET;		break;	default:		RES_SET_H_ERRNO(pvt->res, NO_RECOVERY); /* ??? */		return(NULL);	}	for (p = &q; p; p = p->next) {		struct addrinfo *ai;		hp = (*this->byname2)(this, name, p->family);		if (hp == NULL) {			/* byname2 should've set an appropriate error */			continue;		}		if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||		    (hp->h_addr_list[0] == NULL)) {			RES_SET_H_ERRNO(pvt->res, NO_RECOVERY);			continue;		}		ai = hostent2addrinfo(hp, pai);		if (ai) {			cur->ai_next = ai;			while (cur && cur->ai_next)				cur = cur->ai_next;		}	}	if (sentinel.ai_next == NULL)		RES_SET_H_ERRNO(pvt->res, HOST_NOT_FOUND);	return(sentinel.ai_next);}/* Private *//*ipnodes:::1             localhost127.0.0.1       localhost1.2.3.4         FOO bar1.2.6.4         FOO bar1.2.6.5         hostipnodes.byname:YP_MULTI_localhost ::1,127.0.0.1        localhostYP_MULTI_foo 1.2.3.4,1.2.6.4    FOO barYP_MULTI_bar 1.2.3.4,1.2.6.4    FOO barhost 1.2.6.5    hosthosts.byname:localhost 127.0.0.1     localhosthost 1.2.6.5    hostYP_MULTI_foo 1.2.3.4,1.2.6.4    FOO barYP_MULTI_bar 1.2.3.4,1.2.6.4    FOO bar*/static struct hostent *makehostent(struct irs_ho *this) {	struct pvt *pvt = (struct pvt *)this->private;	static const char spaces[] = " \t";	char *cp, **q, *p, *comma, *ap;	int af = 0, len = 0;	int multi = 0;	int addr = 0;	p = pvt->curval_data;	if ((cp = strpbrk(p, "#\n")) != NULL)		*cp = '\0';	if (!(cp = strpbrk(p, spaces)))		return (NULL);	*cp++ = '\0';	ap = pvt->hostbuf;	do {		if ((comma = strchr(p, ',')) != NULL) {			*comma++ = '\0';			multi = 1;		}		if ((ap + IN6ADDRSZ) > (pvt->hostbuf + sizeof(pvt->hostbuf)))			break;		if ((pvt->res->options & RES_USE_INET6) &&		    inet_pton(AF_INET6, p, ap) > 0) {			af = AF_INET6;			len = IN6ADDRSZ;		} else if (inet_pton(AF_INET, p, pvt->host_addr) > 0) {			if (pvt->res->options & RES_USE_INET6) {				map_v4v6_address((char*)pvt->host_addr, ap);				af = AF_INET6;				len = IN6ADDRSZ;			} else {				af = AF_INET;				len = INADDRSZ;			}		} else {			if (!multi)				return (NULL);			continue;		}		if (addr < MAXADDRS) {			pvt->h_addr_ptrs[addr++] = ap;			pvt->h_addr_ptrs[addr] = NULL;			ap += len;		}	} while ((p = comma) != NULL);	if (ap == pvt->hostbuf)		return (NULL);	pvt->host.h_addr_list = pvt->h_addr_ptrs;	pvt->host.h_length = len;	pvt->host.h_addrtype = af;	cp += strspn(cp, spaces);	pvt->host.h_name = cp;	q = pvt->host.h_aliases = pvt->host_aliases;	if ((cp = strpbrk(cp, spaces)) != NULL)		*cp++ = '\0';	while (cp && *cp) {		if (*cp == ' ' || *cp == '\t') {			cp++;			continue;		}		if (q < &pvt->host_aliases[MAXALIASES])			*q++ = cp;		if ((cp = strpbrk(cp, spaces)) != NULL)			*cp++ = '\0';	}	*q = NULL;	RES_SET_H_ERRNO(pvt->res, NETDB_SUCCESS);	return (&pvt->host);}static voidnisfree(struct pvt *pvt, enum do_what do_what) {	if ((do_what & do_key) && pvt->curkey_data) {		free(pvt->curkey_data);		pvt->curkey_data = NULL;	}	if ((do_what & do_val) && pvt->curval_data) {		free(pvt->curval_data);		pvt->curval_data = NULL;	}}static intinit(struct irs_ho *this) {	struct pvt *pvt = (struct pvt *)this->private;		if (!pvt->res && !ho_res_get(this))		return (-1);	if (((pvt->res->options & RES_INIT) == 0) &&	    res_ninit(pvt->res) == -1)		return (-1);	return (0);}#endif /*WANT_IRS_NIS*/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲色图清纯唯美| 午夜视黄欧洲亚洲| 麻豆精品在线播放| 国产999精品久久久久久绿帽| 91香蕉视频黄| 国产三级欧美三级日产三级99 | 91激情五月电影| 337p日本欧洲亚洲大胆色噜噜| 亚洲欧美区自拍先锋| 国模套图日韩精品一区二区| 欧美性受xxxx| 亚洲欧美在线aaa| 国产精品亚洲第一区在线暖暖韩国| 欧美日韩电影在线播放| 亚洲欧美日韩一区二区 | 秋霞午夜鲁丝一区二区老狼| 成人网男人的天堂| 亚洲精品一区二区三区香蕉 | 一区二区三区在线免费| www.欧美色图| 中文字幕在线不卡视频| 成人黄色综合网站| 中文字幕视频一区| eeuss国产一区二区三区| 国产亚洲一本大道中文在线| 精品无人码麻豆乱码1区2区| 这里只有精品视频在线观看| 日本亚洲最大的色成网站www| 欧美精品久久99| 日本欧美在线看| 日韩欧美一级二级三级| 蜜乳av一区二区三区| 日韩欧美一区二区在线视频| 免费欧美在线视频| 日韩午夜精品电影| 精品一区二区三区免费毛片爱| 欧美一级黄色大片| 国产美女视频一区| 欧美激情资源网| 91免费视频大全| 亚洲在线中文字幕| 欧美日韩国产综合视频在线观看| 天堂成人国产精品一区| 欧美一区二区福利在线| 国产成人在线观看免费网站| 国产精品成人午夜| 欧美少妇bbb| 久久精品国产久精国产| 欧美国产精品专区| 91激情在线视频| 美国十次综合导航| 欧美激情在线看| 日本精品视频一区二区三区| 日本中文字幕一区二区有限公司| 久久亚洲精精品中文字幕早川悠里| 福利视频网站一区二区三区| 亚洲欧美国产高清| 日韩精品一区二区三区中文不卡| 成人免费高清在线| 午夜视频久久久久久| 国产日韩亚洲欧美综合| 欧美日本不卡视频| eeuss鲁一区二区三区| 午夜视频久久久久久| 国产女人18水真多18精品一级做| 欧美熟乱第一页| 国产+成+人+亚洲欧洲自线| 亚洲综合网站在线观看| 亚洲精品一区二区在线观看| 色婷婷亚洲精品| 国产精品一区一区| 亚洲小少妇裸体bbw| 欧美国产精品专区| 欧美一区二区性放荡片| 色又黄又爽网站www久久| 久久国产精品免费| 亚洲一区二区三区中文字幕| 日本一区二区三区四区| 91精品国产乱码久久蜜臀| 91在线观看免费视频| 精品在线视频一区| 午夜精品视频在线观看| 中文字幕日韩一区| 国产午夜精品福利| 精品久久一区二区三区| 欧美日韩大陆一区二区| 99久久亚洲一区二区三区青草| 精久久久久久久久久久| 日产国产欧美视频一区精品| 一片黄亚洲嫩模| 中文字幕亚洲区| 国产精品三级视频| 国产欧美一区二区三区在线看蜜臀| 3atv在线一区二区三区| 欧洲中文字幕精品| 色婷婷av一区二区三区软件 | 国产伦精品一区二区三区免费迷| 亚洲成人自拍一区| 一区二区在线观看不卡| 国产精品乱码一区二区三区软件| 亚洲精品在线一区二区| 欧美成人bangbros| 91精品国模一区二区三区| 欧美视频精品在线| 欧美亚洲国产怡红院影院| 91小视频免费看| 在线亚洲人成电影网站色www| 91视频观看免费| 色94色欧美sute亚洲线路一久| 97aⅴ精品视频一二三区| 99久久精品免费| 日本韩国精品在线| 欧美亚洲丝袜传媒另类| 欧美日韩一区三区| 日韩一级大片在线观看| 欧美一区二区三区视频| 亚洲精品在线观看视频| 久久免费美女视频| 国产欧美1区2区3区| 日韩美女啊v在线免费观看| 亚洲伦理在线精品| 亚洲福利一二三区| 欧美a级理论片| 国内精品久久久久影院一蜜桃| 国产成人综合精品三级| 91丨九色丨尤物| 精品婷婷伊人一区三区三| 日韩视频免费观看高清完整版 | 国产精品免费丝袜| 亚洲色图另类专区| 天天操天天干天天综合网| 麻豆精品国产传媒mv男同 | 欧洲中文字幕精品| 日韩一区二区在线看片| 26uuuu精品一区二区| 国产精品久久久一本精品 | 日韩欧美一区中文| 欧美国产综合一区二区| 亚洲国产精品久久久久婷婷884| 麻豆精品在线播放| 97精品久久久久中文字幕| 在线电影欧美成精品| 国产精品水嫩水嫩| 午夜精品一区二区三区三上悠亚| 国产美女在线观看一区| 色婷婷一区二区| 2021久久国产精品不只是精品| 亚洲精品美国一| 国产一区二区网址| 欧美中文字幕一区| 久久久久久久久久久久电影 | 亚洲国产精品黑人久久久| 亚洲欧美日韩国产综合在线| 日本午夜一区二区| 99久久99久久精品免费观看 | 欧美日韩视频第一区| 国产日产欧美一区二区三区| 午夜精品久久久久久久蜜桃app| 国产乱子伦视频一区二区三区 | 视频一区视频二区中文| yourporn久久国产精品| 欧美一区二区久久| 亚洲一区日韩精品中文字幕| 懂色av一区二区三区免费观看| 欧美另类变人与禽xxxxx| 综合在线观看色| 国产成人在线视频免费播放| 欧美日韩黄视频| 亚洲激情在线激情| 波多野结衣精品在线| 欧美精品一区二区三区在线播放| 亚洲国产视频直播| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 久久成人羞羞网站| 欧美日韩五月天| 一区二区三区日韩欧美| proumb性欧美在线观看| 久久久久国产精品厨房| 久久99在线观看| 欧美精选一区二区| 亚洲午夜精品17c| 91国产丝袜在线播放| 国产精品久久久久久久蜜臀| 国产电影一区在线| 国产欧美一区视频| 国产成人精品综合在线观看| 日韩美一区二区三区| 日韩高清电影一区| 91精品国产欧美日韩| 亚洲va中文字幕| 在线这里只有精品| 亚洲一区二区三区在线播放| 在线亚洲高清视频| 亚洲一级在线观看| 欧美日韩成人一区二区| 丝袜美腿一区二区三区| 6080午夜不卡| 日韩av不卡在线观看| 日韩精品在线一区二区| 国内精品嫩模私拍在线|