1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * CDDL HEADER START
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * The contents of this file are subject to the terms of the
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * Common Development and Distribution License (the "License").
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * You may not use this file except in compliance with the License.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * See the License for the specific language governing permissions
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * and limitations under the License.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * When distributing Covered Code, include this CDDL HEADER in each
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * If applicable, add the following below this CDDL HEADER, with the
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * fields enclosed by brackets "[]" replaced with your own identifying
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * information: Portions Copyright [yyyy] [name of copyright owner]
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * CDDL HEADER END
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * Retrieve directory information for built-in users and groups
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brownstatic directory_error_t sid_dav(directory_values_rpc *lvals,
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brownstatic directory_error_t directory_provider_builtin_populate(
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown directory_entry_rpc *pent, const wksids_table_t *wksid,
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * Retrieve information by name.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * Called indirectly through the directory_provider_static structure.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown for (i = 0; i < ids->idmap_utf8str_list_len; i++) {
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * Extract the type for this particular ID.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * Advance to the next type, if it's there, else keep
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * using this type until we run out of IDs.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * If this entry has already been handled, one way or another,
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * End-to-end error injection point.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * NEEDSWORK: should probably eliminate this for production
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown directory_error("Directory_provider_builtin.debug",
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown "Directory_provider_builtin: artificial error",
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown "Invalid ID type \"%1\"",
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown wksid = find_wksid_by_name(name, domain, idmap_id_type);
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown de = directory_provider_builtin_populate(&del[i], wksid, attrs);
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * Given a well-known name entry and a list of attributes that were
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * requested, populate the structure to return to the caller.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown llvals = calloc(nattrs, sizeof (directory_values_rpc));
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown pent->directory_entry_rpc_u.attrs.attrs_val = llvals;
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown pent->directory_entry_rpc_u.attrs.attrs_len = nattrs;
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown for (j = 0; j < nattrs; j++) {
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * We're going to refer to these a lot, so make a shorthand
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * Start by assuming no errors and that we don't have
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * the information.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States if (wksid->pid != IDMAP_SENTINEL_PID &&
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States wksid->is_user) {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States if (wksid->pid != IDMAP_SENTINEL_PID &&
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States !wksid->is_user) {
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh } else if (uu_strcaseeq(a, "distinguishedName")) {
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown "CN=%s,CN=%s,DC=%s",
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown wksid->winname, container, _idmapdstate.hostname);
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown "organizationalPerson",
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh } else if (uu_strcaseeq(a, "x-sun-canonicalName")) {
cb174861876aea6950a7ab4ce944aff84b1914cdjoyce mcintosh } else if (uu_strcaseeq(a, "x-sun-provider")) {
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown "No memory allocating return value for user lookup", NULL));
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * Given a well-known name structure, generate a binary-format SID.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * It's a bit perverse that we must take a text-format SID and turn it into
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * a binary-format SID, only to have the caller probably turn it back into
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown * text format, but SIDs are carried across LDAP in binary format.
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brownsid_dav(directory_values_rpc *lvals, const wksids_table_t *wksid)
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown de = bin_list_dav(lvals, sid, 1, sid_len(sid));
1fcced4c370617db71610fecffd5451a5894ca5eJordan Brown "No memory allocating SID for user lookup", NULL));