getpwaent.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 1991 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 <pwdadj.h>
#include <pwd.h>
extern void rewind();
extern long strtol();
extern int strcmp();
extern int strlen();
extern int fclose();
extern char *strcpy();
extern char *strncpy();
extern char *calloc();
extern char *malloc();
static struct _pwajunk {
char *_yp;
int _yplen;
char *_oldyp;
int _oldyplen;
struct list {
char *name;
} *_minuslist;
struct passwd _interppasswd;
struct passwd_adjunct _apwadj;
char *_domain;
static char *PASSWDADJ = "/etc/security/passwd.adjunct";
static struct passwd_adjunct *interpret();
static struct passwd_adjunct *interpretwithsave();
static struct passwd_adjunct *save();
static struct passwd_adjunct *getnamefromyellow();
static struct _pwajunk *
_pwajunk()
{
if (__pwajunk == 0)
return (__pwajunk);
}
struct passwd_adjunct *
register char *name;
{
struct passwd_adjunct *pwadj;
if (_pwa == 0)
return (0);
setpwaent();
if (!pwfadj)
return NULL;
continue;
endpwaent();
return pwadj;
}
}
endpwaent();
return NULL;
}
#ifdef NOT_INCLUDED
struct passwd_adjunct *
register uid;
{
/*
* provided for consistency even though there is no uid in
* the adjunct file.
*/
if (_pwa == 0)
return (0);
return NULL;
}
#endif NOT_INCLUDED
void
{
if (_pwa == 0)
return;
(void) yp_get_default_domain(&domain );
}
else
if (yp)
}
void
{
if (_pwa == 0)
return;
}
if (yp)
endnetgrent();
}
struct passwd_adjunct *
{
static struct passwd_adjunct *savepwadj;
struct passwd_adjunct *pwadj;
char *user;
char *mach;
char *dom;
if (_pwa == 0)
return (0);
(void) yp_get_default_domain(&domain );
}
return (NULL);
}
for (;;) {
if (yp) {
return(NULL);
if (!onminuslist(pwadj)) {
return(pwadj);
}
if (user) {
return(pwadj);
}
}
} else {
endnetgrent();
return(NULL);
}
return(NULL);
switch(line[0]) {
case '+':
/* include the whole NIS database */
} else {
}
} else {
/*
* else look up this entry in NIS
*/
return(pwadj);
}
}
break;
case '-':
/* everybody was subtracted */
return(NULL);
}
if (user) {
}
}
endnetgrent();
} else {
}
break;
default:
if (!onminuslist(pwadj)) {
return(pwadj);
}
break;
}
}
}
}
static
char line1[];
struct passwd_adjunct **pwadjp;
char *name;
{
struct passwd_adjunct *savepwadj;
if (_pwa == 0)
return (0);
switch(line1[0]) {
case '+':
if (pwadj) {
return 1;
}
else
return 0;
}
if (pwadj) {
return 1;
}
}
return 0;
}
if (pwadj) {
return 1;
}
else
return 0;
}
break;
case '-':
return 1;
}
}
return 1;
}
break;
default:
return 1;
}
return 0;
}
static
{
int reason;
char *key;
int keylen;
if (_pwa == 0)
return;
if (reason) {
#ifdef DEBUG
#endif
}
if (oldyp)
}
static
{
int reason;
char *key;
int keylen;
if (_pwa == 0)
return;
if (reason) {
#ifdef DEBUG
#endif
}
if (oldyp)
}
static struct passwd_adjunct *
char *name;
struct passwd_adjunct *savepwadj;
{
struct passwd_adjunct *pwadj;
int reason;
char *val;
int vallen;
if (_pwa == 0)
return (0);
if (reason) {
#ifdef DEBUG
#endif
return NULL;
} else {
return NULL;
return pwadj;
}
}
static struct passwd_adjunct *
char *val;
struct passwd_adjunct *savepwadj;
{
struct passwd_adjunct *pwadj;
if (_pwa == 0)
return (0);
return NULL;
return pwadj;
}
static char *
pwskip(p)
register char *p;
{
while(*p && *p != ':' && *p != '\n')
++p;
if (*p == '\n')
*p = '\0';
else if (*p != '\0')
*p++ = '\0';
return(p);
}
static struct passwd_adjunct *
char *val;
{
register char *p;
char *field;
if (_pwa == 0)
return (0);
p = interpline;
p = pwskip(p);
/* we are going to the NIS - fix the
* rest of the struct as much as is needed
*/
return (&apwadj);
}
apwadj.pwa_passwd = p;
p = pwskip(p);
field = p;
p = pwskip(p);
field = p;
p = pwskip(p);
field = p;
p = pwskip(p);
field = p;
p = pwskip(p);
return NULL;
field = p;
(void) pwskip(p);
p = apwadj.pwa_passwd;
while (*p && *p != ',')
p++;
if (*p)
*p = '\0';
return NULL;
return(&apwadj);
}
static
freeminuslist() {
if (_pwa == 0)
return;
}
}
static
char *name;
{
char *buf;
if (_pwa == 0)
return;
}
/*
* save away the psswd field, which is the only one which can be
* specified in a local + entry to override the value in the NIS
* for passwd.adjunct
*/
static struct passwd_adjunct *
struct passwd_adjunct *pwadj;
{
static struct passwd_adjunct *sv;
if (_pwa == 0)
return (0);
/* free up stuff from last call */
if (sv) {
}
return sv;
}
static
struct passwd_adjunct *pwadj;
{
register char *nm;
if (_pwa == 0)
return 0;
return(1);
}
}
return(0);
}