/*
* 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
*/
/*
*/
/*
* Some helper routines for directory lookup. These offer functions that
* you could implement yourself on top of the generic routines, but since
* they're a common request we implement them here. (Well, OK, we cheat a bit
* and call an internal routine to do the dirty work to reduce code
* duplication, but you could still implement them using the generic routines.)
*/
#include <stdio.h>
#include <string.h>
#include <libuutil.h>
#include <rpcsvc/idmap_prot.h>
#include "directory.h"
#include "directory_private.h"
#include "directory_library_impl.h"
#include "sidutil.h"
/*
* Given a username, return a text-form SID.
*
* The SID must be free()ed by the caller.
*
* d, if non-NULL, specifies an existing directory-search context.
* If NULL, a temporary one will be created.
*/
directory_t d,
char *name,
char *type,
char **sid,
{
static char *attrs[] = {
"objectSid",
"objectClass",
NULL,
};
struct ret_sid {
char **objectClass;
} *ret_sid;
/* Prep for error cases. */
*classes = 0;
if (d == NULL) {
goto out;
} else {
d1 = d;
}
goto out;
goto out;
}
goto out;
goto nomem;
}
goto out;
"Insufficient memory retrieving data about SID", NULL);
out:
if (d == NULL)
return (de);
}
directory_t d,
char *name,
char **sid,
{
classes));
}
{
NULL));
}
{
NULL));
}
/*
* Given a name or text-format SID, return a user@domain.
*
* The user@domain returned must be free()ed by the caller.
*
* Returns NULL and sets *name to NULL if no error occurred but the specified
* entity does not exist.
*
* d, if non-NULL, specifies an existing directory-search context.
* If NULL, a temporary one will be created.
*/
static
directory_t d,
char *id,
char *id_type,
char **canon,
{
/*
* Attributes required to generate a canonical name, in named-list and
* structure form.
*/
static char *attrs[] = {
"x-sun-canonicalName",
"objectClass",
NULL,
};
struct canon_name_ret {
char **x_sun_canonicalName;
char **objectClass;
} *ret_name;
/* Prep for error cases. */
*classes = 0;
if (d == NULL) {
goto out;
} else {
d1 = d;
}
goto out;
goto out;
}
goto out;
goto nomem;
}
goto out;
"Insufficient memory retrieving data about name", NULL);
out:
if (d == NULL)
return (de);
}
directory_t d,
char *sid,
char **canon,
{
classes));
}
directory_t d,
char *name,
char **canon,
{
classes));
}
{
return (
}
{
return (
}
{
return (B_TRUE);
}
return (B_FALSE);
}
{
}
return (ret);
}