/*
* 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
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <errno.h>
#include <stdlib.h>
#include <pwd.h>
#include <shadow.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <nss_dbdefs.h>
#include "passwdutil.h"
/* from files_attr.c */
void **buf);
/*
* nss function pointer table, used by passwdutil_init to initialize
* the global Repository-OPerations table "rops"
*/
NULL, /* checkhistory */
NULL, /* update */
NULL, /* putpwnam */
NULL, /* user_to_authenticate */
NULL, /* lock */
NULL /* unlock */
};
/*
* this structure defines the buffer used to keep state between
*/
struct pwbuf {
char *pwd_scratch;
char *spwd_scratch;
char *rep_name;
};
/*
* We should use sysconf, but there is no sysconf name for SHADOW
* so we use these from nss_dbdefs
*/
/*
* nss_getpwnam(name, items, rep, buf)
*
*/
/*ARGSUSED*/
int
{
attrlist *p;
return (PWU_NOMEM);
/*
* we need for the items we need to update
*/
switch (p->type) {
case ATTR_NAME:
case ATTR_UID:
case ATTR_GID:
case ATTR_AGE:
case ATTR_COMMENT:
case ATTR_GECOS:
case ATTR_HOMEDIR:
case ATTR_SHELL:
return (PWU_NOMEM);
}
break;
case ATTR_PASSWD:
case ATTR_LSTCHG:
case ATTR_MIN:
case ATTR_MAX:
case ATTR_WARN:
case ATTR_INACT:
case ATTR_EXPIRE:
case ATTR_FLAG:
case ATTR_LOCK_ACCOUNT:
case ATTR_EXPIRE_PASSWORD:
case ATTR_FAILED_LOGINS:
return (PWU_NOMEM);
}
break;
case ATTR_REP_NAME:
/* get the compat names (REP_COMPAT_*) */
break;
default:
/*
* Some other repository might have different values
* so we ignore those.
*/
break;
}
}
goto error;
}
PWD_SCRATCH_SIZE) == NULL) {
err = PWU_NOT_FOUND;
goto error;
}
}
goto error;
}
SPW_SCRATCH_SIZE) == NULL) {
err = PWU_NOT_FOUND;
goto error;
}
}
/* pwbuf->rep_name tells us where the user in fact comes from */
if (repositories != REP_ERANGE) {
/* can we find the user locally? */
PWD_SCRATCH_SIZE) != NULL)
else if (repositories & REP_COMPAT_LDAP)
else if (repositories & REP_COMPAT_NIS)
else
} else
return (PWU_SUCCESS);
return (err);
}
/*
* nss_getattr(name, items, rep)
*
* Get attributes specified in list 'items'
*/
int
{
attrlist *w;
int res = 0;
if (res != PWU_SUCCESS)
return (res);
switch (w->type) {
case ATTR_NAME:
break;
case ATTR_COMMENT:
break;
case ATTR_GECOS:
break;
case ATTR_HOMEDIR:
break;
case ATTR_SHELL:
break;
/*
* Nothing special needs to be done for
* server policy
*/
case ATTR_PASSWD:
break;
case ATTR_AGE:
break;
case ATTR_REP_NAME:
break;
/* integer values */
case ATTR_UID:
break;
case ATTR_GID:
break;
case ATTR_LSTCHG:
break;
case ATTR_MIN:
break;
case ATTR_MAX:
break;
case ATTR_WARN:
break;
case ATTR_INACT:
break;
case ATTR_EXPIRE:
break;
case ATTR_FLAG:
break;
case ATTR_FAILED_LOGINS:
break;
default:
break;
}
}
return (res);
}