nis_ng.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 1997-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* 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 INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM 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.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#endif
/* Imports */
#include "port_before.h"
#ifndef WANT_IRS_NIS
static int __bind_irs_nis_unneeded;
#else
#include <isc/assertions.h>
#include <ctype.h>
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <resolv.h>
#include <isc/memcluster.h>
#include <irs.h>
#include "port_after.h"
#include "irs_p.h"
#include "nis_p.h"
/* Definitions */
struct tmpgrp {
const char * name;
const char * host;
const char * user;
const char * domain;
};
struct pvt {
char * nis_domain;
char * tmpgroup;
};
/* Forward */
const char **, const char **);
const char *, const char *,
const char *, const char *);
static void ng_minimize(struct irs_ng *);
static void add_group_to_list(struct pvt *, const char *, int);
static void add_tuple_to_list(struct pvt *, const char *, char *);
/* Public */
struct irs_ng *
return (NULL);
}
return (NULL);
}
return (ng);
}
/* Methods */
static void
}
static int
return (0);
return (1);
}
static int
{
break;
}
}
static void
/* Either hand back or free the existing list. */
goto reset;
}
}
static void
/* NOOP */
}
/* Private */
static void
int vlen, r;
char *nametmp;
/* Don't add the same group to the list more than once. */
return;
if (r == 0) {
if (np)
*np++ = '\0';
if (*cp == '(')
else
}
}
}
static void
if (!tmp)
return;
/* Name */
/* Host */
goto cleanup;
*np++ = '\0';
/* User */
goto cleanup;
*np++ = '\0';
/* Domain */
goto cleanup;
*np++ = '\0';
/*
* Empty string in file means wildcard, but
* NULL string in return value means wildcard.
*/
/* Add to list (LIFO). */
return;
}
static void
}
}
}
#endif /*WANT_IRS_NIS*/