/*
* 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 <alloca.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <nss_dbdefs.h>
#include <deflt.h>
#include <auth_attr.h>
#include <prof_attr.h>
#include <user_attr.h>
}
static kva_t *get_default_attrs(const char *);
static void free_default_attrs(kva_t *);
/*
* Enumeration functions for auths and profiles; the enumeration functions
* take a callback with four arguments:
* const char * profile name (or NULL unless wantattr is false)
* kva_t * attributes (or NULL unless wantattr is true)
* void * context
* void * pointer to the result
* When the call back returns non-zero, the enumeration ends.
* The function might be NULL but only for profiles as we are always collecting
* all the profiles.
* Both the auths and the profiles arguments may be NULL.
*
* These should be the only implementation of the algorithm of "finding me
* all the profiles/athorizations/keywords/etc.
*/
static struct dfltplcy {
char *attr;
const char *defkw;
} dfltply[] = {
/* CONSUSER MUST BE FIRST! */
};
/*
* Enumerate profiles from listed profiles.
*/
static int _auth_match_noun(const char *, const char *, size_t, const char *);
int
{
char *profiles;
int i;
int res = 0;
return (0);
return (0);
for (i = 0; i < *pcnt; i++)
goto cont;
return (-1);
/* Add it */
break;
/* find the profiles for this profile */
}
}
if (res != 0)
return (res);
cont:
continue;
}
return (res);
}
/*
* Enumerate all attributes associated with a username and the profiles
* associated with the user.
*/
static int
{
int res = 0;
int cnt = 0;
return (-1);
if (wantattr)
if (res == 0) {
}
}
if (res != 0) {
return (res);
}
}
if (res == 0) {
}
}
return (res);
}
/*
* Enumerate profiles with a username argument.
*/
int
{
}
/*
* Enumerate attributes with a username argument.
*/
int
{
}
/*
* Enumerate authorizations in the "auths" argument.
*/
static int
{
int res = 0;
return (0);
if (res != 0)
return (res);
}
return (res);
}
/*
* Magic struct and function to allow using the _enum_attrs functions to
* enumerate the authorizations.
*/
typedef struct ccomm2auth {
int (*cb)(const char *, void *, void *);
void *ctxt;
} ccomm2auth;
/*ARGSUSED*/
static int
{
char *auths;
/* Note: PROFATTR_AUTHS_KW is equal to USERATTR_AUTHS_KW */
}
/*
* Enumerate authorizations for username.
*/
int
int (*cb)(const char *, void *, void *),
{
return (-1);
}
int
{
char *grant;
char *pattern_noun;
char *slash;
/*
* If the specified authorization has a trailing object
* and the current authorization we're checking also has
* a trailing object, the object names must match.
*
* If there is no object name failure, then we must
* check for an exact match of the two authorizations
*/
return (0);
} else if ((auth_len == pattern_len) &&
return (1);
}
}
/*
* If the wildcard is not in the last position in the string, don't
* match against it.
*/
return (0);
/*
* If the strings are identical up to the wildcard and auth does not
* end in "grant", then we have a match.
*/
return (1);
}
}
return (0);
}
int
{
}
static int
{
char *authname_noun;
char *slash;
} else {
}
/* exact match, we're done */
*resp = 1;
return (1);
auth_len, authname_noun)) {
*resp = 1;
return (1);
}
}
return (0);
}
int
{
int auth_granted = 0;
return (0);
&auth_granted);
return (auth_granted);
}
static int
{
return (0);
}
return (0);
}
return (0);
}
}
static void
{
int i;
}
/*
* Return the default attributes; this are ignored when a STOP profile
* was found.
*/
static kva_t *
{
void *defp;
int i;
return (NULL);
goto return_null;
continue;
goto return_null;
}
(void) defclose_r(defp);
return (kva);
(void) defclose_r(defp);
return (NULL);
}