getuserattrnam.c revision 2
/*
* 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
*/
/*
*/
#include "lint.h"
#include <auth_attr.h> /* for AUTH_POLICY */
#include <deflt.h>
#include <nss_dbdefs.h> /* for NSS_BUFLEN_PASSWD */
#include <pwd.h>
#include <secdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct attrval {
char *attr;
char *prof_name;
} attrval_t;
static int
{
char *match;
char *deflt_name = "user_attr";
deflt_name = (char *)name;
}
return (1);
}
return (0); /* no match */
}
/*
* getuserattrnam - get an attribute of the user.
*
* Entry user = username.
* key = the key name of the attribute.
* where = pointer to where to return the name of
* where the attribute was found.
* = NULL, don't return where found.
* deflt = configuration file to get find a local
* default copy if no explicit attribute
* found for user.
* = NULL use AUTH_POLICY (/etc/security/policy.conf)
*
* Exit NULL = if not found or other error such as ENOMEM.
* pointer to allocated memory for the attribute requested.
* *where = NULL, if where is specified, ENOMEM.
*
* Notes
* Finds the first value associated with key for the user
* by first searching attributes directly assigned to the
* user, then attributes of the profiles of the user, and
* finally an administrator specified default in policy.conf(4).
*
* Memory for the returned value and the optional where should be
* released when no longer in use with free(3C).
*
* Not to be used to enumerate the user's profiles or authorizations.
*
*/
char *
const char *deflt)
{
void *defp;
int flags;
char *defkey;
char *deffile = AUTH_POLICY;
/* enumerate attributes for a user */
} else {
}
}
}
return (NULL);
}
return (NULL);
}
}
}
return (ret);
}
char *
{
char buf[NSS_BUFLEN_PASSWD];
return (NULL);
}
}