getgraent.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 1990 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI" /* c2 secure */
#include <stdio.h>
#include <grp.h>
#include <grpadj.h>
extern void rewind();
extern long strtol();
extern int strlen();
extern int strcmp();
extern int fclose();
extern char *strcpy();
extern char *calloc();
extern char *malloc();
static struct gradata {
char *domain;
char *yp;
int yplen;
char *oldyp;
int oldyplen;
struct list {
char *name;
} *minuslist; /* list of - items */
struct group_adjunct interpgra;
struct group_adjunct *sv;
static char *GROUPADJ = "/etc/security/group.adjunct";
static struct group_adjunct *interpret();
static struct group_adjunct *interpretwithsave();
static struct group_adjunct *save();
static struct group_adjunct *getnamefromyellow();
static struct group_adjunct *getgidfromyellow();
static struct gradata *
_gradata()
{
if (g == 0) {
gradata = g;
}
return (g);
}
#ifdef NOT_DEFINED
struct group_adjunct *
register gid;
{
return NULL;
}
#endif NOT_DEFINED
struct group_adjunct *
register char *name;
{
struct group_adjunct *gra;
setgraent();
if (g == 0)
return (0);
if (!g->grfa)
return NULL;
continue;
endgraent();
return (gra);
}
}
endgraent();
return (NULL);
}
void
{
if (g == NULL)
return;
(void) yp_get_default_domain(&g->domain);
if (!g->grfa)
else
if (g->yp)
}
void
{
if (g == 0)
return;
if (g->grfa) {
}
if (g->yp)
}
struct group_adjunct *
fgetgraent(f)
FILE *f;
{
return(NULL);
}
static char *
grskip(p,c)
register char *p;
register c;
{
while(*p && *p != c && *p != '\n') ++p;
if (*p == '\n')
*p = '\0';
else if (*p != '\0')
*p++ = '\0';
return(p);
}
struct group_adjunct *
{
static struct group_adjunct *savegra;
struct group_adjunct *gra;
if (g == 0)
return (0);
(void) yp_get_default_domain(&g->domain);
}
return(NULL);
if (g->yp) {
return(NULL);
if (onminuslist(gra))
goto again;
else
return (gra);
}
return(NULL);
return(NULL);
switch(line1[0]) {
case '+':
goto again;
}
/*
* else look up this entry in NIS
*/
goto again;
else if (onminuslist(gra))
goto again;
else
return (gra);
break;
case '-':
goto again;
break;
default:
if (onminuslist(gra))
goto again;
return (gra);
break;
}
/*NOTREACHED*/
}
static struct group_adjunct *
char *val;
{
register char *p;
if (g == 0)
return (0);
p = g->interpline;
p = grskip(p,':');
/* we are going to the NIS - fix the
* rest of the struct as much as is needed
*/
return (&g->interpgra);
}
g->interpgra.gra_passwd = p;
while(*p && *p != '\n') p++;
*p = '\0';
return (&g->interpgra);
}
static
freeminuslist() {
if (g == 0)
return;
}
}
static struct group_adjunct *
char *val;
struct group_adjunct *savegra;
{
struct group_adjunct *gra;
if (g == 0)
return (0);
return (NULL);
return (gra);
}
static
struct group_adjunct *gra;
{
register char *nm;
if (g == 0)
return 0;
return 1;
return 0;
}
static
{
int reason;
int keylen;
if (g == 0)
return;
#ifdef DEBUG
#endif
}
if (g->oldyp)
}
static
{
int reason;
int keylen;
if (g == 0)
return;
#ifdef DEBUG
#endif
}
if (g->oldyp)
}
static struct group_adjunct *
char *name;
struct group_adjunct *savegra;
{
struct group_adjunct *gra;
int reason;
char *val;
int vallen;
if (g == 0)
return (NULL);
#ifdef DEBUG
#endif
return NULL;
}
else {
return NULL;
return gra;
}
}
static
char *name;
{
char *buf;
if (g == 0)
return;
}
/*
* save away psswd field, which is the only
* one which can be specified in a local + entry to override the
* value in the NIS
*/
static struct group_adjunct *
struct group_adjunct *gra;
{
if (g == 0)
return 0;
/*
* free up stuff from last time around
*/
if (g->sv) {
}
return g->sv;
}
static
char line1[];
struct group_adjunct **grap;
char *name;
{
struct group_adjunct *savegra;
switch(line1[0]) {
case '+':
if (gra) {
return 1;
}
else
return 0;
}
if (gra) {
return 1;
}
else
return 0;
}
break;
case '-':
return 1;
}
break;
default:
return 1;
}
return 0;
}