Esempio n. 1
0
struct netent *
getnetent(void)
{
	nss_XbyY_buf_t	*b;
	struct netent	*res = 0;

	if ((b = GETBUF()) != 0) {
		res = getnetent_r(b->result, b->buffer, b->buflen);
	}
	return (res);
}
Esempio n. 2
0
struct netent *
getnetent(void)
{
	struct netdata *nd;
	struct netent *rval;
	int ret_h_errno;

	if ((nd = __netdata_init()) == NULL)
		return (NULL);
	if (getnetent_r(&nd->net, nd->data, sizeof(nd->data), &rval,
	    &ret_h_errno) != 0)
		return (NULL);
	return (rval);
}
Esempio n. 3
0
struct netent *getnetbyname_r(const char *name, struct netent *result,
							  char *buf, int bufsize)
{
	char **alias;

	pthread_mutex_lock(&net_iterate_lock);
	setnetent(0);
	while ((result = getnetent_r(result, buf, bufsize)) != NULL) {
		/* Check the entry's name and aliases against the given name. */
		if (strcmp(result->n_name, name) == 0)
			break;
		for (alias = result->n_aliases; *alias != 0; alias++) {
			if (strcmp(*alias, name) == 0)
				break;
		}
	}
	pthread_mutex_unlock(&net_iterate_lock);
	return result;
}