#pragma ident "%Z%%M% %I% %E% SMI"
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*/
/*
*/
#if 0
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#endif
#include "ldap-int.h"
static void **
int lencall )
{
char *attr;
int rc;
void **vals;
if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
return( NULL ); /* punt */
}
return( NULL );
}
/* skip sequence, dn, sequence of, and snag the first attr */
return( NULL );
}
NSLDAPI_FREE( attr );
if ( rc != 0 ) {
while ( 1 ) {
return( NULL );
}
if ( rc == 0 ) {
NSLDAPI_FREE( attr );
break;
}
NSLDAPI_FREE( attr );
}
}
/*
* if we get this far, we've found the attribute and are sitting
* just before the set of values.
*/
if ( lencall ) {
} else {
}
if ( rc == LBER_ERROR ) {
} else {
rc = LDAP_SUCCESS;
}
}
/* For language-sensitive attribute matching, we are looking for a
language tag that looks like one of the following:
cn
cn;lang-en
cn;lang-en-us
cn;lang-ja
cn;lang-ja-JP-kanji
The base language specification consists of two letters following
"lang-". After that, there may be additional language-specific
narrowings preceded by a "-". In our processing we go from the
specific to the general, preferring a complete subtype match, but
accepting a partial one. For example:
For a request for "cn;lang-en-us", we would return cn;lang-en-us
if present, otherwise cn;lang-en if present, otherwise cn.
Besides the language subtype, there may be other subtypes:
cn;lang-ja;binary (Unlikely!)
cn;lang-ja;phonetic
If not in the target, they are ignored. If they are in the target,
they must be in the attribute to match.
*/
typedef struct {
int start;
int length;
static int
{
int nSubtypes = 0;
int ind = 0;
char *nextToken;
int langIndex;
int targetLen;
int subtypeStart;
*baseLenp = 0;
*nsubtypes = 0;
/* Parse past base attribute */
}
else {
*baseLenp = subtypeStart;
}
ind = subtypeStart;
/* How many subtypes? */
nextToken++;
/* If there was a previous lang tag, this is illegal! */
if ( langIndex != LANG_SUBTYPE_INDEX_NONE ) {
return langIndex;
}
else {
}
} else {
nSubtypes++;
}
}
/* No language subtype? */
if ( langIndex < 0 )
return langIndex;
/* Allocate array of non-language subtypes */
if ( nSubtypes > 0 ) {
* nSubtypes );
return LANG_SUBTYPE_INDEX_NONE; /* Error */
}
}
ind = 0;
nSubtypes = 0;
ind = subtypeStart;
int len;
nextToken++;
}
else {
}
int i;
return LANG_SUBTYPE_INDEX_NONE; /* Error */
}
for( i = 0; i < len; i++ )
}
else {
nSubtypes++;
}
}
return langIndex;
}
static int
{
int langIndex;
int baseLen;
char *lang;
int nsubtypes;
int mismatch = 0;
int i;
/* Get all subtypes in the attribute name */
/* Check if there any required non-language subtypes which are
not in this attribute */
for( i = 0; i < ntargetTypes; i++ ) {
int j;
for( j = 0; j < nsubtypes; j++ ) {
break;
}
if ( j >= nsubtypes ) {
mismatch = 1;
break;
}
}
if ( mismatch ) {
NSLDAPI_FREE( subtypes );
NSLDAPI_FREE( lang );
return -1;
}
/* If there was no language subtype... */
if ( langIndex < 0 ) {
NSLDAPI_FREE( subtypes );
NSLDAPI_FREE( lang );
if ( LANG_SUBTYPE_INDEX_NONE == langIndex )
return 0;
else
return -1;
}
/* Okay, now check the language subtag */
i = 0;
while( targetLang[i] && lang[i] &&
i++;
/* The total length can't be longer than the requested subtype */
/* If the found subtype is shorter than the requested one, the next
character in the requested one should be "-" */
match = i;
}
return match;
}
{
int i = 0;
int rc;
i++;
return rc;
}
static void **
{
int rc;
int langIndex;
int nsubtypes;
int bestMatch = 0;
int len;
if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
return( NULL );
}
return( NULL );
}
/* A language check was requested, so see if there really is a
language subtype in the attribute spec */
if ( langIndex < 0 ) {
NSLDAPI_FREE( subtypes );
}
return vals;
} else {
/* Get just the base attribute name */
if (baseTarget == NULL) {
return( NULL );
}
baseTarget[len] = 0;
}
/* Process all attributes in the entry */
while ( 1 ) {
int foundMatch = 0;
NSLDAPI_FREE( attr );
if ( firstAttr ) {
firstAttr = 0;
/* skip sequence, dn, sequence of, and snag the first attr */
break;
}
} else {
break;
}
}
if ( vals )
NSLDAPI_FREE( vals );
foundMatch = 1;
NSLDAPI_FREE( bestType );
}
}
if ( foundMatch ) {
if ( lencall ) {
} else {
}
} else {
}
}
NSLDAPI_FREE( lang );
NSLDAPI_FREE( subtypes );
NSLDAPI_FREE( bestType );
} else {
rc = LDAP_SUCCESS;
}
return( vals );
}
char **
{
}
struct berval **
{
1 ) );
}
char **
char **type )
{
}
struct berval **
char **type )
{
}