/*
* 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
*/
/*
*/
/*
* Retrieve directory information for built-in users and groups
*/
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <netdb.h>
#include <libuutil.h>
#include <note.h>
#include "idmapd.h"
#include "directory.h"
#include "directory_private.h"
#include <rpcsvc/idmap_prot.h>
#include "directory_server_impl.h"
#include "sidutil.h"
const wksids_table_t *wksid);
/*
* Retrieve information by name.
* Called indirectly through the directory_provider_static structure.
*/
static
{
int i;
for (i = 0; i < ids->idmap_utf8str_list_len; i++) {
int type;
/*
* Extract the type for this particular ID.
* Advance to the next type, if it's there, else keep
* using this type until we run out of IDs.
*/
types++;
/*
* If this entry has already been handled, one way or another,
* skip it.
*/
continue;
/*
* End-to-end error injection point.
* NEEDSWORK: should probably eliminate this for production
*/
directory_error("Directory_provider_builtin.debug",
"Directory_provider_builtin: artificial error",
NULL));
continue;
}
if (type == DIRECTORY_ID_SID[0])
else {
int idmap_id_type;
if (type == DIRECTORY_ID_NAME[0])
else if (type == DIRECTORY_ID_USER[0])
else if (type == DIRECTORY_ID_GROUP[0])
else {
directory_error("invalid_arg.id_type",
"Invalid ID type \"%1\"",
continue;
}
}
continue;
}
}
return (NULL);
}
/*
* Given a well-known name entry and a list of attributes that were
* requested, populate the structure to return to the caller.
*/
static
const wksids_table_t *wksid,
{
int j;
int nattrs;
goto nomem;
for (j = 0; j < nattrs; j++) {
char *a;
/*
* We're going to refer to these a lot, so make a shorthand
* copy.
*/
a = attrs->idmap_utf8str_list_val[j];
/*
* Start by assuming no errors and that we don't have
* the information.
*/
if (uu_strcaseeq(a, "uid")) {
} else if (uu_strcaseeq(a, "uidNumber")) {
}
} else if (uu_strcaseeq(a, "gidNumber")) {
}
} else if (uu_strcaseeq(a, "displayName") ||
uu_strcaseeq(a, "cn")) {
} else if (uu_strcaseeq(a, "distinguishedName")) {
char *container;
container = "Users";
} else {
container = "Builtin";
}
char *dn;
"CN=%s,CN=%s,DC=%s",
} else if (uu_strcaseeq(a, "objectClass")) {
static const char *objectClasses[] = {
"top",
"person",
"organizationalPerson",
"user",
};
} else {
static const char *objectClasses[] = {
"top",
"group",
};
}
} else if (uu_strcaseeq(a, "objectSid")) {
} else if (uu_strcaseeq(a, "x-sun-canonicalName")) {
char *canon;
} else {
}
goto nomem;
} else if (uu_strcaseeq(a, "x-sun-provider")) {
}
return (de);
}
return (NULL);
return (directory_error("ENOMEM.users",
"No memory allocating return value for user lookup", NULL));
}
/*
* Given a well-known name structure, generate a binary-format SID.
* It's a bit perverse that we must take a text-format SID and turn it into
* a binary-format SID, only to have the caller probably turn it back into
* text format, but SIDs are carried across LDAP in binary format.
*/
static
{
char *text_sid;
} else {
}
goto nomem;
goto nomem;
return (de);
return (directory_error("ENOMEM.sid_dav",
"No memory allocating SID for user lookup", NULL));
}
"builtin",
};