/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
*/
/*
* Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <lber.h>
#include <ldap.h>
#include <string.h>
#include "ldap_util.h"
#include "ldap_op.h"
#include "ldap_attr.h"
#include "ldap_ldap.h"
static __nis_value_t *
int freeRv = 0;
if (rv == 0) {
if (rv == 0)
return (0);
freeRv = 1;
}
if (freeRv)
return (val);
}
return (0);
if (t->element != 0) {
/* Evaluate t->element to get the t->attrs value */
if (eVal == 0)
return (0);
{
"%s: %s: unable to evaluate filter expression \"%s\"",
}
return (0);
}
} else {
}
&stat, 0);
if (stat != 0) {
"%s: %s: error appending \"%s\" to \"%s\"",
return (0);
}
freeBase = 1;
} else {
"%s: %s: no supplied or default search base",
return (0);
}
}
else
attrs[1] = 0;
if (ls == 0) {
"%s: %s: error building LDAP search information for \"%s?%s?%s\"",
if (freeBase)
return (0);
}
/*
* If ldapSearch returns LDAP_NO_SUCH_OBJECT, then entry that
* looked for is not there in LDAP, so return NP_LDAP_NO_VALUE
* in np_ldap_stat.
*/
if (rv == 0) {
"%s: %s: LDAP error %d (%s) for \"%s?%s?%s\"",
if (freeBase)
return (0);
}
if (freeBase)
eVal = 0;
int j;
if (eVal == 0) {
return (0);
}
break;
}
}
}
return (val);
}
/*
* Store 'val' at the LDAP location indicated by 'item'. As usual,
* val->numVals == -1 indicates deletion.
*
* The 'index' and 'numIndexes' parameters are used as follows:
*
* index < 0 || index >= numIndexes
* Illegal
*
* index >= val->numVals
* Store val->val[val->numVals-1]
*
* item->repeat == 0 || index < numIndexes
* Store val->val[index]
*
* Else (repeat != 0 && index == numIndexes-1)
* Store val->val[index...val->numVals-1]
*
* 'defDN' should be the default object DN specification, primarily
* used when the item search triple is invalid. Also, the defDN->write.base
* value is appended to the item search base if the latter is empty, or ends
* in a comma.
*
* If the item search triple is invalid, 'dn' must contain the DN(s)
* of the LDAP entry to be modified. If the search triple is valid,
* the DN(s) is(are) either:
* Derived via an LDAP search on the search triple 'attrs' or
* 'element' fields, or (if neither of those fields is set)
* assumed to be the search triple base.
*
* Returns LDAP_SUCCESS when successful, or an appropriate LDAP
* error status otherwise.
*/
int
int freeDN = 0;
char *defBase = 0;
return (LDAP_PARAM_ERROR);
ls.numFilterComps = 0;
ls.filterComp = 0;
/* If 'defDN' is NULL, we don't know where to write */
if (defDN == 0)
return (LDAP_PARAM_ERROR);
/*
* Check if we're supposed to write. Since we want the
* admin to be able to use the nisplusLDAPobjectDN attribute
*/
"%s: write not enabled for \"%s\"",
return (LDAP_SUCCESS);
}
} else {
/*
* Attempt to get a DN from the search triple.
*/
else
if (stat != 0)
return (0);
/*
* If the search triple specifies a filter, we use the
* base, scope and filter to get an entry to supply the
* DN. Otherwise, the triple.base is assumed to be the DN.
*/
int nv = 0;
if (eVal == 0) {
return (0);
}
return (0);
}
} else {
}
return (stat);
/* Look for DNs */
return (LDAP_NO_MEMORY);
}
freeDN = 1;
numDN = 1;
}
}
/* We must have at least one DN to continue */
if (freeDN)
return (LDAP_PARAM_ERROR);
}
/* Make a rule-value describing the modification */
if (rv == 0)
return (LDAP_NO_MEMORY);
if (freeDN)
return (LDAP_NO_MEMORY);
}
/*
* What's the start index in val->val[], and how many elements
* should we copy ?
*/
else
else
nix = 1;
if (freeDN)
return (LDAP_NO_MEMORY);
}
if (freeDN)
return (LDAP_NO_MEMORY);
}
}
}
} else {
/*
* We already rejected val->numvals < -1 and val->numVals == 0
* in the initial sanity check, so it must be -1. This means
* deletion, which we indicate to ldapModify() by supplying
* a NULL rule-value pointer.
*/
rv = 0;
}
/* For each DN */
for (i = 0; i < numDN; i++) {
if (stat != LDAP_SUCCESS)
break;
}
if (freeDN)
return (stat);
}