/*
* 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
*/
/*
*/
/*
* Server-side support for directory information lookup functions.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <malloc.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
#include <libuutil.h>
#include <note.h>
#include "idmapd.h"
#include "directory.h"
#include "directory_private.h"
#include <rpcsvc/idmap_prot.h>
#include "directory_library_impl.h"
#include "directory_server_impl.h"
#include "sized_array.h"
/*
* Here's a list of all of the modules that provide directory
* information. In the fullness of time this should probably be
* a plugin-able switch mechanism.
* Note that the list is in precedence order.
*/
extern struct directory_provider_static directory_provider_builtin;
extern struct directory_provider_static directory_provider_nsswitch;
extern struct directory_provider_static directory_provider_ad;
};
/*
* This is the entry point for all directory lookup service requests.
*/
{
int nids;
int i;
entries = (directory_entry_rpc *)
goto nomem;
for (i = 0; i < nids; i++) {
directory_error("invalid_arg.id.too_long",
"Identifier too long", NULL));
}
}
&attrs);
goto err;
}
return (TRUE);
"Insufficient memory retrieving directory data", NULL);
err:
return (
}
/*
* Split name into {domain, name}.
* Suggest allocating name and domain on the stack, same size as id,
* using variable length arrays.
*/
void
{
char *p;
} else {
}
}
/*
* Given a list of strings, return a set of directory attribute values.
*
* Mark that the attribute was found.
*
* Note that the terminating \0 is *not* included in the result, because
* that's the way that strings come from LDAP.
* (Note also that the client side stuff adds in a terminating \0.)
*
* Note that on error the array may have been partially populated and will
* need to be cleaned up by the caller. This is normally not a problem
* because the caller will need to clean up several such arrays.
*/
{
int i;
if (n == 0) {
/* LOOP */;
}
goto nomem;
for (i = 0; i < n; i++) {
int len;
goto nomem;
}
return (NULL);
return (directory_error("ENOMEM.str_list_dav",
"Insufficient memory copying values"));
}
/*
* Given a list of unsigned integers, return a set of string directory
* attribute values.
*
* Mark that the attribute was found.
*
* Note that the terminating \0 is *not* included in the result, because
* that's the way that strings come from LDAP.
* (Note also that the client side stuff adds in a terminating \0.)
*
* Note that on error the array may have been partially populated and will
* need to be cleaned up by the caller. This is normally not a problem
* because the caller will need to clean up several such arrays.
*/
{
int i;
goto nomem;
for (i = 0; i < n; i++) {
int len;
goto nomem;
}
return (NULL);
return (directory_error("ENOMEM.uint_list_dav",
"Insufficient memory copying values"));
}
/*
* Given a list of fixed-length binary chunks, return a set of binary
* directory attribute values.
*
* Mark that the attribute was found.
*
* Note that on error the array may have been partially populated and will
* need to be cleaned up by the caller. This is normally not a problem
* because the caller will need to clean up several such arrays.
*/
{
int i;
goto nomem;
for (i = 0; i < n; i++) {
goto nomem;
}
return (NULL);
return (directory_error("ENOMEM.bin_list_dav",
"Insufficient memory copying values"));
}
/*
* Set up to return an error on a particular directory entry.
* Note that the caller need not (and in fact must not) free
* the directory_error_t; it will be freed when the directory entry
* list is freed.
*/
void
{
}