/*
* 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(LINT) && !defined(CODECENTER)
#endif
/* Imports */
#include "port_before.h"
#include <resolv.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <irs.h>
#include <isc/memcluster.h>
#include "port_after.h"
#include "irs_p.h"
#include "lcl_p.h"
/* Definitions */
/*
* XXX Warning XXX
* This code is a hack-and-slash special. It realy needs to be
* rewritten with things like strdup, and realloc in mind.
* More reasonable data structures would not be a bad thing.
*/
/*%
* Static Variables and functions used by setnetgrent(), getnetgrent() and
* endnetgrent().
*
* There are two linked lists:
* \li linelist is just used by setnetgrent() to parse the net group file via.
* parse_netgrp()
* \li netgrp is the list of entries for the current netgroup
*/
struct linelist {
};
struct ng_old_struct {
};
struct pvt {
struct {
char *grname;
} grouphead;
};
/* Forward */
const char **, const char **);
const char *, const char *,
const char *);
static void ng_minimize(struct irs_ng *);
static int parse_netgrp(struct irs_ng *, const char*);
/* Public */
struct irs_ng *
return (NULL);
}
return (NULL);
}
return (ng);
}
/* Methods */
static void
}
/*%
* Parse the netgroup file looking for the netgroup and build the list
* of netgrp structures. Let parse_netgrp() and read_for_group() do
* most of the work.
*/
static void
}
}
}
}
/*%
* Get the next netgroup off the list.
*/
static int
const char **domain)
{
return (1);
}
return (0);
}
/*%
* Search for a match in a netgroup.
*/
static int
{
return (1);
}
return (0);
}
static void
}
}
/* Private */
/*%
* endnetgrent() - cleanup
*/
static void
while (lp) {
}
}
while (gp) {
}
}
/*%
* Parse the netgroup file setting up the linked lists.
*/
static int
/*
* First, see if the line has already been read in.
*/
while (lp) {
break;
}
return (1);
/*fprintf(stderr, "Cycle in netgroup %s\n", lp->l_groupname);*/
return (1);
} else
while (*pos != '\0') {
if (*pos == '(') {
return (1);
}
pos++;
spos++;
*epos = '\0';
} else
if (len > 0) {
= (char *)
return (1);
}
spos,
len + 1);
}
} else
goto errout;
}
} else {
return (1);
}
}
break;
pos++;
}
return (0);
/*fprintf(stderr, "Bad netgroup %s at ..%s\n", lp->l_groupname,
spos);*/
return (1);
}
/*%
* Read the netgroup file and save lines until the line for the netgroup
* is found. Return 1 if eof is encountered.
*/
static struct linelist *
if (*pos == '#')
continue;
pos++;
*pos != '\0')
pos++;
pos++;
return (NULL);
}
return (NULL);
}
olen = 0;
/*
* Loop around handling line continuations.
*/
do {
len--;
len--;
cont = 1;
} else
cont = 0;
if (len > 0) {
if (olen > 0)
return (NULL);
}
if (olen > 0) {
}
}
if (cont) {
} else
cont = 0;
}
} while (cont);
/*
* If this is the one we wanted, we are done.
*/
return (lp);
}
}
return (NULL);
}
/*! \file */