__set_authtoken_attr.c revision 36e852a172cba914383d7341c988128b2c667fbd
/*
* 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 <nsswitch.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include "passwdutil.h"
int
{
attrlist *p;
int repositories;
int i;
void *buf; /* workspace for repository specific funcs */
int err = PWU_NOT_FOUND;
/* Can't set name uid or flag */
switch (p->type) {
case ATTR_NAME:
case ATTR_UID:
case ATTR_FLAG:
return (EINVAL);
}
}
if (repositories == 0)
return (PWU_SYSTEM_ERROR);
/*
* updating requires that either
* - PAM_REPOSITORY is set: we know what to update
* - PAM_REPOSITORY is not set, but we recognize the nsswitch.conf
* passwd: entry
*/
return (PWU_REPOSITORY_ERROR);
/*
* Loop over selected repositories to update
* We should update the remote repositories first, FILES last.
*/
for (i = REP_LAST; i; i >>= 1) {
if (repositories & i) {
return (err);
}
}
if (buf) {
}
if (err == PWU_SUCCESS) {
rep_success = i; /* this rep succeeded */
updated |= i;
break;
}
}
}
if (buf)
if (updated_reps)
/*
* err contains either
* PWU_SUCCESS : everyting went OK
* PWU_NOT_FOUND : none of the repositories contained the user
* error-code : the specific error that occurred
*/
if (rep_success != REP_NOREP) {
return (PWU_SUCCESS);
} else {
return (err);
}
}