/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* nis/getservent.c -- "nis" backend for nsswitch "services" database
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "nis_common.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <malloc.h>
#include <netdb.h>
#include <synch.h>
#include <ctype.h>
#include <thread.h>
static int
{
char **aliasp;
return (0);
}
return (1);
}
return (1);
}
}
return (0);
}
static int
{
int name_match = 0;
/* compare name */
keyp++;
linep++;
}
return (1);
else
name_match = 1;
}
/* skip remainder of the name, if any */
linep++;
/* skip the delimiting spaces */
linep++;
/* skip port number */
linep++;
return (0);
linep++;
/* skip protocol */
linep++;
} else {
/* compare protocol */
keyp++;
linep++;
}
/* no protocol match */
return (0);
/* protocol and name match, return */
if (name_match)
return (1);
/* protocol match but name yet to be matched, so continue */
}
/* compare with the aliases */
/* skip the delimiting spaces */
linep++;
/* compare with the alias name */
keyp++;
linep++;
}
return (1);
/* skip remainder of the alias name, if any */
linep++;
}
return (0);
}
static int no_byname_map = 0;
static nss_status_t
void *a;
{
int no_map;
(void) sigfillset(&newmask);
(void) mutex_lock(&no_byname_lock);
(void) mutex_unlock(&no_byname_lock);
if (no_map == 0) {
int yp_status;
if (proto == 0) {
} else {
return (NSS_UNAVAIL);
}
}
(void) sigfillset(&newmask);
(void) mutex_lock(&no_byname_lock);
no_byname_map = 1;
(void) mutex_unlock(&no_byname_lock);
} else /* if (res == NSS_SUCCESS) <==== */ {
return (res);
}
}
/*
* use check_anme to compare service name if nss1 or nss2 and
* request is not from nscd; otherwise use check_name2
*/
else
}
static int
{
/*
* We only resorted to _nss_nis_XY_all because proto == 0, so just...
*/
}
static int
{
/* skip name */
linep++;
/* skip the delimiting spaces */
linep++;
/* compare port num */
linep++;
return (0);
return (0);
if (*numend != '\0')
return (0);
return (1);
} else
return (0);
/* compare protocol */
linep++;
keyp++;
linep++;
}
}
static nss_status_t
void *a;
{
char *key;
int len;
if (proto == 0) {
/*
* use check_port to compare service port if nss1 or
* nss2 and request is not from nscd; otherwise use
* check_port2
*/
check_port));
else
check_port2));
}
return (NSS_UNAVAIL);
}
return (res);
}
};
/*ARGSUSED*/
{
return (_nss_nis_constr(serv_ops,
"services.byname"));
}