Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • openldap/openldap
  • hyc/openldap
  • ryan/openldap
  • iboukris/openldap
  • ondra/openldap
  • sshanks-kx/openldap
  • blaggacao/openldap
  • pbrezina/openldap
  • quanah/openldap
  • dragos_h/openldap
  • lorenz/openldap
  • tsaarni/openldap
  • fei.ding/openldap
  • orent/openldap
  • arrowplum/openldap
  • barchiesi/openldap
  • jotik/openldap
  • hamano/openldap
  • ingovoss/openldap
  • henson/openldap
  • jlrine2/openldap
  • howeverAT/openldap
  • nivanova/openldap
  • orbea/openldap
  • rdubner/openldap
  • smckinney/openldap
  • jklowden/openldap
  • dpa-openldap/openldap
  • rouzier/openldap
  • orgads/openldap
  • ffontaine/openldap
  • jiaqingz/openldap
  • dcoutadeur/openldap
  • begeragus/openldap
  • pubellit/openldap
  • glandium/openldap
  • facboy/openldap
  • thesamesam/openldap
  • Johan/openldap
  • fkooman/openldap
  • gburd/openldap
  • h-homma/openldap
  • sgallagher/openldap
  • ahmed_zaki/openldap
  • gnoe/openldap
  • mid/openldap
  • clan/openldap
47 results
Show changes
Commits on Source (14)
Showing
with 38634 additions and 1402 deletions
Making and Installing the U-M LDAP Distribution
Making and Installing the OpenLDAP Distribution
===============================================
** It is recommended that you read or at least skim through ALL of the
** instructions in this file before attempting to build the software.
This file provides brief instructions on how to build and install
OpenLDAP on UNIX (and UNIX-like) system. More detailed information
and instructions can be found in The OpenLDAP Administrator's Guide
(available from http://www.openldap.org/doc/).
If you want to build binaries for more than one platform from a single
source tree, skip ahead to the "Building LDAP For More Than One Platform"
section near the end of this file. If you are planning to run slapd,
you should read the "SLAPD and SLURPD Administrator's Guide", found in
the doc/guides/ directory within the distribution.
It is recommended that you read, or at least skim through, ALL of the
instructions in this file before attempting to build the software.
If you simply want to build LDAP for a single machine platform, follow
these steps:
It is also recommended you review the Frequently Asked Questions
(http://www.openldap.org/faq/) pages, in particular the Installation
section (http://www.openldap.org/faq/index.cgi?file=8) and Platform
Hints (http://www.openldap.org/faq/index.cgi?file=9) should be
examined.
1. untar the distribution and cd to the top:
Making and Installing the OpenLDAP Distribution
-----------------------------------------------
% zcat ldap-3.3.tar.Z | tar xf -
% cd ldap-3.3
1. Unpack the distribution and change directory:
If you are reading this file, you probably have already done this!
% tar xfz openldap-VERSION.tgz
% cd openldap-VERSION
(replacing VERSION with the appropriate version string). If you
are reading this file, you probably have already done this!
2. edit the files Make-common and include/ldapconfig.h.edit to configure
the software for your site (the files are well-commented):
2. Type:
% vi Make-common
% vi include/ldapconfig.h.edit
% ./configure --help
Note that you should NOT need to edit the Makefile located at the
top of the distribution.
to list available configuration options.
If you just want to see if things will build, you can leave the
configuration alone and change it later.
The configure script uses environmental variables for determining
compiler/linker options including:
If you have the ISODE package built and want to build the
LDAP-to-X.500 server (ldapd), be sure to uncomment the appropriate
lines near the end of the Make-common file. By default only the
stand-alone server, LDAP libraries and client software are built.
Variable Description Example
CC C compiler gcc
CFLAGS C flags -O -g
CPPFLAGS cpp flags -I/path/include -Ddef
LDFLAGS ld flags -L/usr/local/lib
LIBS libraries -llib
PATH command path /usr/local/bin:/usr/bin:/bin
3. make the software:
3. Configure the build system
% make
% [env settings] ./configure [options]
If all goes well, then make will figure out what platform you are on,
pick a compiler to use, construct Makefiles, and build everything.
If you see a message like "unknown platform..." LDAP has probably not
been set up to build on your machine. See the file build/PORTS for
hints on what to do in that case.
If all goes well, the configure script with automatically detect
the appropriate settings. However, you may need to specify
options and/or environment variables to obtain desired results.
Note that if your make does not use the Bourne (sh) shell by
default when executing internal scripts (reportedly the case on SGI
machines at least), you will need to run the make explicitly from
within a Bourne shell. If you a syntax error such as "Missing ]"
when you do the make under your usual shell, try this:
4. Build dependencies
% sh
$ make
% make depend
If you don't like the some of the platform-specific options chosen
by the automatic build process (such as the compiler to use, etc),
you can intervene and edit them before anything is actually compiled
by explicitly doing a "make platform" step, editing the .make-platform
file (actually a link to the file to be edited), and then doing a
regular make:
5. Build the system
% make platform
% vi .make-platform
% make
% make
If you want to choose the build platform yourself from among those that
the distribution supports, cd to the appropriate directory underneath
build/platforms and make from there. For example, if you are on a
machine running SunOS 4.1.4 and you want to force the use of the cc
compiler, you would do this:
If all goes well, the system will build as configured. If not,
return to step 3 after reviewing the configuration settings. You
may want to consult the Platform Hints subsection of the FAQ if
you have not done so already.
% cd build/platforms/sunos4-cc
% make
6. Test the standalone system
If you want to run some simple tests after the build is complete, you
can do this:
This step requires the standalone LDAP server, slapd(8), with
LDBM support.
% make test
% make test
4. install the binaries and man pages. You may need to be superuser to
do this (depending on where you are installing things):
If all goes well, the system has been built as configured. If
not, return to step 4 after reviewing your configuration
settings. You may want to consult the Installation section of
the FAQ if you have not done so already.
% su
# make install
7. install the binaries and man pages. You may need to be come the
super-user (e.g. root) to do this (depending on where you are
installing things):
That's it! See the man pages for the individual clients for information
on configuring and using them. Eventually you will probably want to
edit the configuration files used by the various clients (installed in
the LDAP etc directory). The files are:
% su root -c 'make install'
ldapfilter.conf - search filter configuration
ldapfriendly - mapping of X.500 names to human-friendly names
ldapsearchprefs.conf - search object definitions
ldaptemplates.conf - display template definitions
8. That's it!
There are section 5 man pages for all of these files.
See the OpenLDAP Administrator's Guide and the manual pages for the
individual applications for configuration and use information. You may
also want to edit the configuration files used by the various
components. These configuration files are located in the OpenLDAP
configuration directory (normally /usr/local/etc/openldap).
ldap.conf client defaults
slapd.conf Standalone LDAP daemon
schema/*.schema Schema Definitions
Building LDAP For More Than One Platform
End of OpenLDAP INSTALL file.
It is now possible to build LDAP for more than one platform from the same
source tree. This is accomplished by some rules in the Makefiles that
create a shadow (linked) directory tree where the binaries are placed.
$OpenLDAP: pkg/openldap-guide/release/install.sdf,v 1.16 2002/02/18
17:09:26 kurt Exp $
Follow these steps for each different platform:
1. move to the directory that matches the platform and compiler you
want to build for and type make. The directories are all located
underneath the build/platforms directory. If your platform is not
there, you may need to do a port - see the build/PORTS file for
more information. For a Sun running SunOS 4.1.4, you might do
this:
% cd build/platforms/sunos4-cc
% make links
This will create a linked source area.
2. move to the new directory and make as for a single platform. Follow steps
1-4 above to accomplish this. For example:
% cd obj-sunos4-cc
% make
That's all there is to it. You can also create the linked source area(s)
by just typing "make links" at the top of the distribution, in which case
the Makefile will try to automatically determine the platform and
compiler.
End of LDAP INSTALL file.
UM-LDAP 3.3 README file
OpenLDAP 2.1 ALPHA README
For a description of what this distribution contains, see the
ANNOUNCEMENT file in this directory.
This is the UM-LDAP version 3.3 distribution. For a description of
what this distribution contains, see the ANNOUNCEMENT file in this
directory. For a description of changes from previous releases,
see the CHANGES file in this directory. For a more detailed
description of how to make and install the distribution, see the
INSTALL file in this directory. For more information on making and
installing slapd, see the "SLAPD and SLURPD Administrator's Guide"
in the doc/guides/ directory.
This is a 2.1 alpha release.
It is NOT intended for general use.
MAKING AND INSTALLING THE DISTRIBUTION
You should be able to make and install the distribution with a pretty
standard default configuration by typing the following commands
REQUIRED SOFTWARE
Build OpenLDAP requires a number of software packages to be
preinstalled. Additional information regarding prerequisite
software can be found in the OpenLDAP Administrator's Guide.
Base system (libraries and tools):
Standard C compiler (required)
Cyrus SASL 1.5 (recommended)
OpenSSL 0.9 (recommended)
POSIX REGEX software (required)
% make
% su
# make install
SLAPD:
BDB backend requires Sleepycat Berkeley DB 4.0 or better
LDBM backend supports this and other compatible database manager
in this directory. This should produce something that basically
works.
SLURPD:
LTHREAD compatible thread package
[POSIX threads, Mach Cthreads, select others]
You will probably want to do a little configuration to suit your
site, though. There are two files you might want to edit:
CLIENTS/CONTRIB ware:
Depends on package. See per package README.
Make-common This file contains definitions for
where things will be installed, where
to find various things, etc. If you
want to build an ldap server, you'll
definitely need to edit this file
include/ldapconfig.h.edit This file contains #defines used
by many parts of the distribution.
You'll at least want to change
DEFAULT_BASE.
MAKING AND INSTALLING THE DISTRIBUTION
Please see the INSTALL file for basic instructions. More
detailed instructions can be found in the OpenLDAP
Admnistrator's Guide (see DOCUMENTATION section).
See the INSTALL file in this directory for more information.
DOCUMENTATION
There are man pages for most programs in the distribution and
routines in the various libraries. See ldap(3) for details.
There are man pages for most programs in the distribution and
routines in the various libraries. See ldap(3) for details.
The OpenLDAP website is available and contains the latest LDAP
news, releases announcements, pointers to other LDAP resources,
etc.. It is located at:
http://www.OpenLDAP.org/
There is a postscript version of an administrator's guide for
slapd in doc/guides/slapd.ps.
The OpenLDAP Administrator's Guide and other documentation
is available at:
http://www.openldap.org/doc/
There is an LDAP homepage available that contains the latest
LDAP news, releases announcements, pointers to other LDAP resources,
etc. You can access it at this URL:
The OpenLDAP Software FAQ is available at:
http://www.openldap.org/faq/index.cgi
http://www.umich.edu/~rsug/ldap/
FEEDBACK / PROBLEM REPORTS
SUPPORT / FEEDBACK / PROBLEM REPORTS / DISCUSSIONS
OpenLDAP is user supported. If you have problems, please
review the OpenLDAP FAQ <http://www.openldap.org/faq/> and
archives of the OpenLDAP-software and OpenLDAP-bugs mailing
lists <http://www.openldap.org/lists/>. If you cannot find
the answer, please enquire on the OpenLDAP-software list.
We would appreciate any feedback you can provide. If you have
problems, report them to this address:
Issues, such as bug reports, should be reported using our
our Issue Tracking System <http://www.OpenLDAP.com/its/> or
by sending mail to OpenLDAP-its@OpenLDAP.org. Do not use
this system for software enquiries. Please direct these
to an appropriate mailing list.
ldap-support@umich.edu
---
$OpenLDAP$
This diff is collapsed.
#! /bin/sh
# $OpenLDAP$
## Copyright 2000-2002 The OpenLDAP Foundation
## COPYING RESTRICTIONS APPLY. See COPYRIGHT File in top level directory
## of this package for details.
#
ol_package=OpenLDAP
ol_major=2
ol_minor=1
ol_patch=0alpha
ol_api_inc=20199
ol_api_lib=2:99:0
if test $ol_patch != X ; then
ol_version=${ol_major}.${ol_minor}.${ol_patch}
ol_type=Release
elif test $ol_minor != X ; then
ol_version=${ol_major}.${ol_minor}.${ol_patch}
ol_type=Engineering
else
ol_version=${ol_major}.${ol_minor}
ol_type=Devel
ol_api_lib=0:0:0
fi
ol_string="${ol_package} ${ol_version}-${ol_type}"
echo OL_PACKAGE=\"${ol_package}\"
echo OL_MAJOR=$ol_major
echo OL_MINOR=$ol_minor
echo OL_PATCH=$ol_patch
echo OL_API_INC=$ol_api_inc
echo OL_API_LIB=$ol_api_lib
echo OL_VERSION=$ol_version
echo OL_TYPE=$ol_type
echo OL_STRING=\"${ol_string}\"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* $OpenLDAP$ */
/*
* Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License. A copy of this license is available at
* http://www.OpenLDAP.org/license.html or in file LICENSE in the
* top-level directory of the distribution.
*/
/*
* ldap_pvt_uc.h - Header for Unicode functions.
* These are meant to be used by the OpenLDAP distribution only.
* These should be named ldap_pvt_....()
*/
#ifndef _LDAP_PVT_UC_H
#define _LDAP_PVT_UC_H 1
#include <lber.h> /* get ber_slen_t */
#ifdef _MSC_VER
#include "../libraries/liblunicode/ucdata/ucdata.h"
#else
#include "../libraries/liblunicode/ucdata.h"
#endif
LDAP_BEGIN_DECL
/*
* UTF-8 (in utf-8.c)
*/
typedef short ldap_ucs2_t;
/* UCDATA uses UCS-2 passed in an unsigned long */
typedef unsigned long ldap_unicode_t;
#define ldap_utf8_to_unicode( p ) ldap_utf8_to_ucs4((p))
#define ldap_unicode_to_utf8( c, buf ) ldap_ucs4_to_ucs4((c),(buf))
/* returns the number of bytes in the UTF-8 string */
LDAP_F (ber_len_t) ldap_utf8_bytes( const char * );
/* returns the number of UTF-8 characters in the string */
LDAP_F (ber_len_t) ldap_utf8_chars( const char * );
/* returns the length (in bytes) of the UTF-8 character */
LDAP_F (int) ldap_utf8_offset( const char * );
/* returns the length (in bytes) indicated by the UTF-8 character */
LDAP_F (int) ldap_utf8_charlen( const char * );
/* returns the length (in bytes) indicated by the UTF-8 character
* also checks that shortest possible encoding was used
*/
LDAP_F (int) ldap_utf8_charlen2( const char * );
/* copies a UTF-8 character and returning number of bytes copied */
LDAP_F (int) ldap_utf8_copy( char *, const char *);
/* returns pointer of next UTF-8 character in string */
LDAP_F (char*) ldap_utf8_next( const char * );
/* returns pointer of previous UTF-8 character in string */
LDAP_F (char*) ldap_utf8_prev( const char * );
/* primitive ctype routines -- not aware of non-ascii characters */
LDAP_F (int) ldap_utf8_isascii( const char * );
LDAP_F (int) ldap_utf8_isalpha( const char * );
LDAP_F (int) ldap_utf8_isalnum( const char * );
LDAP_F (int) ldap_utf8_isdigit( const char * );
LDAP_F (int) ldap_utf8_isxdigit( const char * );
LDAP_F (int) ldap_utf8_isspace( const char * );
/* span characters not in set, return bytes spanned */
LDAP_F (ber_len_t) ldap_utf8_strcspn( const char* str, const char *set);
/* span characters in set, return bytes spanned */
LDAP_F (ber_len_t) ldap_utf8_strspn( const char* str, const char *set);
/* return first occurance of character in string */
LDAP_F (char *) ldap_utf8_strchr( const char* str, const char *chr);
/* return first character of set in string */
LDAP_F (char *) ldap_utf8_strpbrk( const char* str, const char *set);
/* reentrant tokenizer */
LDAP_F (char*) ldap_utf8_strtok( char* sp, const char* sep, char **last);
/* Optimizations */
LDAP_V (const char) ldap_utf8_lentab[128];
LDAP_V (const char) ldap_utf8_mintab[32];
#define LDAP_UTF8_ISASCII(p) ( !(*(unsigned char *)(p) & 0x80 ) )
#define LDAP_UTF8_CHARLEN(p) ( LDAP_UTF8_ISASCII(p) \
? 1 : ldap_utf8_lentab[*(unsigned char *)(p) ^ 0x80] )
/* This is like CHARLEN but additionally validates to make sure
* the char used the shortest possible encoding.
* 'l' is used to temporarily hold the result of CHARLEN.
*/
#define LDAP_UTF8_CHARLEN2(p, l) ( ( ( l = LDAP_UTF8_CHARLEN( p )) < 3 || \
( ldap_utf8_mintab[*(unsigned char *)(p) & 0x1f] & (p)[1] ) ) ? \
l : 0 )
#define LDAP_UTF8_OFFSET(p) ( LDAP_UTF8_ISASCII(p) \
? 1 : ldap_utf8_offset((p)) )
#define LDAP_UTF8_COPY(d,s) ( LDAP_UTF8_ISASCII(s) \
? (*(d) = *(s), 1) : ldap_utf8_copy((d),(s)) )
#define LDAP_UTF8_NEXT(p) ( LDAP_UTF8_ISASCII(p) \
? (char *)(p)+1 : ldap_utf8_next((p)) )
#define LDAP_UTF8_INCR(p) ((p) = LDAP_UTF8_NEXT(p))
/* For symmetry */
#define LDAP_UTF8_PREV(p) (ldap_utf8_prev((p)))
#define LDAP_UTF8_DECR(p) ((p)=LDAP_UTF8_PREV((p)))
/* these probably should be renamed */
LDAP_LUNICODE_F(int) ucstrncmp(
const ldap_unicode_t *,
const ldap_unicode_t *,
ber_len_t );
LDAP_LUNICODE_F(int) ucstrncasecmp(
const ldap_unicode_t *,
const ldap_unicode_t *,
ber_len_t );
LDAP_LUNICODE_F(ldap_unicode_t *) ucstrnchr(
const ldap_unicode_t *,
ber_len_t,
ldap_unicode_t );
LDAP_LUNICODE_F(ldap_unicode_t *) ucstrncasechr(
const ldap_unicode_t *,
ber_len_t,
ldap_unicode_t );
LDAP_LUNICODE_F(void) ucstr2upper(
ldap_unicode_t *,
ber_len_t );
#define LDAP_UTF8_CASEFOLD 0x1U
#define LDAP_UTF8_NOCASEFOLD 0x0U
LDAP_LUNICODE_F(char *) UTF8normalize(
struct berval *,
unsigned );
LDAP_LUNICODE_F(struct berval *) UTF8bvnormalize(
struct berval *,
struct berval *,
unsigned );
LDAP_LUNICODE_F(int) UTF8normcmp(
const char *,
const char *,
unsigned );
LDAP_LUNICODE_F(int) UTF8bvnormcmp(
struct berval *,
struct berval *,
unsigned );
LDAP_END_DECL
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* $OpenLDAP$ */
/*
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
/* at.c - routines for dealing with attribute types */
#include "portable.h"
#include <stdio.h>
#include <ac/ctype.h>
#include <ac/errno.h>
#include <ac/socket.h>
#include <ac/string.h>
#include <ac/time.h>
#include "ldap_pvt.h"
#include "slap.h"
int is_at_syntax(
AttributeType *at,
const char *oid )
{
for( ; at != NULL; at = at->sat_sup ) {
if( at->sat_syntax_oid ) {
return ( strcmp( at->sat_syntax_oid, oid ) == 0 );
}
}
return 0;
}
int is_at_subtype(
AttributeType *sub,
AttributeType *sup )
{
for( ; sub != NULL; sub = sub->sat_sup ) {
if( sub == sup ) return 1;
}
return 0;
}
struct aindexrec {
struct berval air_name;
AttributeType *air_at;
};
static Avlnode *attr_index = NULL;
static AttributeType *attr_list = NULL;
static int
attr_index_cmp(
struct aindexrec *air1,
struct aindexrec *air2
)
{
int i = air1->air_name.bv_len - air2->air_name.bv_len;
if (i)
return i;
return (strcasecmp( air1->air_name.bv_val, air2->air_name.bv_val ));
}
static int
attr_index_name_cmp(
struct berval *type,
struct aindexrec *air
)
{
int i = type->bv_len - air->air_name.bv_len;
if (i)
return i;
return (strncasecmp( type->bv_val, air->air_name.bv_val,
type->bv_len ));
}
AttributeType *
at_find(
const char *name
)
{
struct berval bv;
bv.bv_val = (char *)name;
bv.bv_len = strlen( name );
return at_bvfind( &bv );
}
AttributeType *
at_bvfind(
struct berval *name
)
{
struct aindexrec *air;
air = (struct aindexrec *) avl_find( attr_index, name,
(AVL_CMP) attr_index_name_cmp );
return air != NULL ? air->air_at : NULL;
}
int
at_append_to_list(
AttributeType *sat,
AttributeType ***listp
)
{
AttributeType **list;
AttributeType **list1;
int size;
list = *listp;
if ( !list ) {
size = 2;
list = ch_calloc(size, sizeof(AttributeType *));
if ( !list ) {
return -1;
}
} else {
size = 0;
list1 = *listp;
while ( *list1 ) {
size++;
list1++;
}
size += 2;
list1 = ch_realloc(list, size*sizeof(AttributeType *));
if ( !list1 ) {
return -1;
}
list = list1;
}
list[size-2] = sat;
list[size-1] = NULL;
*listp = list;
return 0;
}
int
at_delete_from_list(
int pos,
AttributeType ***listp
)
{
AttributeType **list;
AttributeType **list1;
int i;
int j;
if ( pos < 0 ) {
return -2;
}
list = *listp;
for ( i=0; list[i]; i++ )
;
if ( pos >= i ) {
return -2;
}
for ( i=pos, j=pos+1; list[j]; i++, j++ ) {
list[i] = list[j];
}
list[i] = NULL;
/* Tell the runtime this can be shrinked */
list1 = ch_realloc(list, (i+1)*sizeof(AttributeType **));
if ( !list1 ) {
return -1;
}
*listp = list1;
return 0;
}
int
at_find_in_list(
AttributeType *sat,
AttributeType **list
)
{
int i;
if ( !list ) {
return -1;
}
for ( i=0; list[i]; i++ ) {
if ( sat == list[i] ) {
return i;
}
}
return -1;
}
void
at_destroy( void )
{
AttributeType *a, *n;
avl_free(attr_index, ldap_memfree);
for (a=attr_list; a; a=n) {
n = a->sat_next;
if (a->sat_subtypes) ldap_memfree(a->sat_subtypes);
ad_destroy(a->sat_ad);
ldap_pvt_thread_mutex_destroy(&a->sat_ad_mutex);
ldap_attributetype_free((LDAPAttributeType *)a);
}
if ( slap_schema.si_at_undefined )
ad_destroy(slap_schema.si_at_undefined->sat_ad);
}
static int
at_insert(
AttributeType *sat,
const char **err
)
{
AttributeType **atp;
struct aindexrec *air;
char **names;
atp = &attr_list;
while ( *atp != NULL ) {
atp = &(*atp)->sat_next;
}
*atp = sat;
if ( sat->sat_oid ) {
air = (struct aindexrec *)
ch_calloc( 1, sizeof(struct aindexrec) );
air->air_name.bv_val = sat->sat_oid;
air->air_name.bv_len = strlen(sat->sat_oid);
air->air_at = sat;
if ( avl_insert( &attr_index, (caddr_t) air,
(AVL_CMP) attr_index_cmp,
(AVL_DUP) avl_dup_error ) ) {
*err = sat->sat_oid;
ldap_memfree(air);
return SLAP_SCHERR_DUP_ATTR;
}
/* FIX: temporal consistency check */
at_bvfind(&air->air_name);
}
if ( (names = sat->sat_names) ) {
while ( *names ) {
air = (struct aindexrec *)
ch_calloc( 1, sizeof(struct aindexrec) );
air->air_name.bv_val = *names;
air->air_name.bv_len = strlen(*names);
air->air_at = sat;
if ( avl_insert( &attr_index, (caddr_t) air,
(AVL_CMP) attr_index_cmp,
(AVL_DUP) avl_dup_error ) ) {
*err = *names;
ldap_memfree(air);
return SLAP_SCHERR_DUP_ATTR;
}
/* FIX: temporal consistency check */
at_bvfind(&air->air_name);
names++;
}
}
return 0;
}
int
at_add(
LDAPAttributeType *at,
const char **err
)
{
AttributeType *sat;
MatchingRule *mr;
Syntax *syn;
int code;
char *cname;
char *oid;
if ( !OID_LEADCHAR( at->at_oid[0] )) {
/* Expand OID macros */
oid = oidm_find( at->at_oid );
if ( !oid ) {
*err = at->at_oid;
return SLAP_SCHERR_OIDM;
}
if ( oid != at->at_oid ) {
ldap_memfree( at->at_oid );
at->at_oid = oid;
}
}
if ( at->at_syntax_oid && !OID_LEADCHAR( at->at_syntax_oid[0] )) {
/* Expand OID macros */
oid = oidm_find( at->at_syntax_oid );
if ( !oid ) {
*err = at->at_syntax_oid;
return SLAP_SCHERR_OIDM;
}
if ( oid != at->at_syntax_oid ) {
ldap_memfree( at->at_syntax_oid );
at->at_syntax_oid = oid;
}
}
if ( at->at_names && at->at_names[0] ) {
int i;
for( i=0; at->at_names[i]; i++ ) {
if( !slap_valid_descr( at->at_names[i] ) ) {
*err = at->at_names[i];
return SLAP_SCHERR_BAD_DESCR;
}
}
cname = at->at_names[0];
} else if ( at->at_oid ) {
cname = at->at_oid;
} else {
*err = "";
return SLAP_SCHERR_ATTR_INCOMPLETE;
}
*err = cname;
if ( !at->at_usage && at->at_no_user_mod ) {
/* user attribute must be modifable */
return SLAP_SCHERR_ATTR_BAD_USAGE;
}
if ( at->at_collective ) {
if( at->at_usage ) {
/* collective attributes cannot be operational */
return SLAP_SCHERR_ATTR_BAD_USAGE;
}
if( at->at_single_value ) {
/* collective attributes cannot be single-valued */
return SLAP_SCHERR_ATTR_BAD_USAGE;
}
/* collective attributes not supported */
return SLAP_SCHERR_NOT_SUPPORTED;
}
sat = (AttributeType *) ch_calloc( 1, sizeof(AttributeType) );
AC_MEMCPY( &sat->sat_atype, at, sizeof(LDAPAttributeType));
sat->sat_cname.bv_val = cname;
sat->sat_cname.bv_len = strlen( cname );
ldap_pvt_thread_mutex_init(&sat->sat_ad_mutex);
if ( at->at_sup_oid ) {
AttributeType *supsat = at_find(at->at_sup_oid);
if ( (supsat == NULL ) ) {
*err = at->at_sup_oid;
return SLAP_SCHERR_ATTR_NOT_FOUND;
}
sat->sat_sup = supsat;
if ( at_append_to_list(sat, &supsat->sat_subtypes) ) {
return SLAP_SCHERR_OUTOFMEM;
}
if ( sat->sat_usage != supsat->sat_usage ) {
/* subtypes must have same usage as their SUP */
return SLAP_SCHERR_ATTR_BAD_USAGE;
}
}
/*
* Inherit definitions from superiors. We only check the
* direct superior since that one has already inherited from
* its own superiorss
*/
if ( sat->sat_sup ) {
sat->sat_syntax = sat->sat_sup->sat_syntax;
sat->sat_equality = sat->sat_sup->sat_equality;
sat->sat_approx = sat->sat_sup->sat_approx;
sat->sat_ordering = sat->sat_sup->sat_ordering;
sat->sat_substr = sat->sat_sup->sat_substr;
}
if ( at->at_syntax_oid ) {
if ( (syn = syn_find(sat->sat_syntax_oid)) ) {
sat->sat_syntax = syn;
} else {
*err = sat->sat_syntax_oid;
return SLAP_SCHERR_SYN_NOT_FOUND;
}
} else if ( sat->sat_syntax == NULL ) {
return SLAP_SCHERR_ATTR_INCOMPLETE;
}
if ( sat->sat_equality_oid ) {
if ( (mr = mr_find(sat->sat_equality_oid)) ) {
sat->sat_equality = mr;
sat->sat_approx = mr->smr_associated;
} else {
*err = sat->sat_equality_oid;
return SLAP_SCHERR_MR_NOT_FOUND;
}
}
if ( sat->sat_ordering_oid ) {
if ( (mr = mr_find(sat->sat_ordering_oid)) ) {
sat->sat_ordering = mr;
} else {
*err = sat->sat_ordering_oid;
return SLAP_SCHERR_MR_NOT_FOUND;
}
}
if ( sat->sat_substr_oid ) {
if ( (mr = mr_find(sat->sat_substr_oid)) ) {
sat->sat_substr = mr;
} else {
*err = sat->sat_substr_oid;
return SLAP_SCHERR_MR_NOT_FOUND;
}
}
code = at_insert(sat,err);
return code;
}
#ifdef LDAP_DEBUG
static int
at_index_printnode( struct aindexrec *air )
{
printf("%s = %s\n",
air->air_name.bv_val,
ldap_attributetype2str(&air->air_at->sat_atype) );
return( 0 );
}
static void
at_index_print( void )
{
printf("Printing attribute type index:\n");
(void) avl_apply( attr_index, (AVL_APPLY) at_index_printnode,
0, -1, AVL_INORDER );
}
#endif
#if defined( SLAPD_SCHEMA_DN )
int
at_schema_info( Entry *e )
{
struct berval vals[2];
AttributeType *at;
AttributeDescription *ad_attributeTypes = slap_schema.si_ad_attributeTypes;
vals[1].bv_val = NULL;
for ( at = attr_list; at; at = at->sat_next ) {
if ( ldap_attributetype2bv( &at->sat_atype, vals ) == NULL ) {
return -1;
}
#if 0
Debug( LDAP_DEBUG_TRACE, "Merging at [%ld] %s\n",
(long) vals[0].bv_len, vals[0].bv_val, 0 );
#endif
attr_merge( e, ad_attributeTypes, vals );
ldap_memfree( vals[0].bv_val );
}
return 0;
}
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.