/*
* 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
*/
/*
*
* files/netmasks.c -- "files" backend for nsswitch "netmasks" database
*/
/*
* contains mappings from 32 bit network internet addresses to their
* corresponding 32 bit mask internet addresses. The addresses are in dotted
* internet address form.
*/
#include "files_common.h"
#include <string.h>
#include <nss_dbdefs.h>
#include <ctype.h>
/*
* Validate 'files' netmasks entry. The comparison objects are in IPv4
* internet address format.
*/
static int
{
int addrlen;
/* skip leading spaces */
linep++;
linep++;
return (0);
(in_addr_t)0xffffffffU)
return (0);
== (in_addr_t)0xffffffffU)
return (0);
}
return (0);
}
static nss_status_t
void *a;
{
/*
* use the buffer passed in if result is to be returned
* in /etc file format
*/
}
} else {
/* the frontend expects the netmask data only */
if (res == NSS_SUCCESS) {
char *m;
int l = 0;
/* skip trailing spaces */
while (s < m && isspace(*m))
m--;
for (; s <= m; m--) {
if (isspace(*m))
break;
l++;
}
m++;
*(s + l) = '\0';
}
}
return (res);
}
};
/*ARGSUSED*/
{
return (_nss_files_constr(netmasks_ops,
sizeof (netmasks_ops) / sizeof (netmasks_ops[0]),
}