/*
* 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
*/
/*
*/
#include <sys/systeminfo.h>
#include "ldap_common.h"
#ifdef DEBUG
/*
* Debugging routine for printing the value of a result
* structure
*/
int
{
int i, j, k;
printf("--------------------------------------\n");
for (i = 0; i < result->entries_count; i++) {
printf("entry %d has attr_count = %d \n",
i, curEntry->attr_count);
for (j = 0; j < curEntry->attr_count; j++) {
printf("entry %d has attr_pair[%d] = %s \n",
for (k = 0;
k++)
printf("entry %d has "
"attr_pair[%d]->attrvalue[%d] = %s \n",
i, j, k,
}
printf("\n--------------------------------------\n");
}
return (1);
}
#endif
/*
*
*/
{
#ifdef DEBUG
#endif /* DEBUG */
} else {
return (NULL);
}
if (result->entries_count == 0) {
return (NULL);
} else {
}
}
/*
* _get_domain_name() passes the dn one level up from cdn, e.g.,
* a pointer pointing to "ou= ..." for the cdn's listed below:
* dn: cn=hostname+ipHostNumber="109.34.54.76", ou= ...
* dn: echo+IpServiceProtocol=udp, ou= ...
* to __ns_ldap_dn2domain() to retrieve the domain name associated
* with cdn.
*/
char *
{
char **rdns;
int nrdns;
int len = 0;
/* break the cdn into its components */
return (NULL);
/* construct parent dn */
if (len == 0)
return (NULL);
}
*pdn = '\0';
if (nrdns == 1)
else {
}
/* remove the last ',' */
}
/* get domain name */
return (domain);
}
/*
* "109.34.54.76" -> 109.34.54.76
*/
const char *
{
/* look for first " */
return ((char *)ipaddress);
ipaddress++;
/* look for last " */
return ((char *)ipaddress);
*cp++ = '\0';
return (ipaddress);
}
/*
* This function has been copied from lib/libsldap/common/ns_getalias.c
* and had some DEBUG statemants added.
*
* This function builds a new string, as identified by realfilter, by
* replacing the first occurrence of '%s' in userdata with the string
* filter provided in the Service Search Descriptor (SSD).
*
* It is used as a call back function by __ns_ldap_list() API.
*
* As an example, lets assume the caller of __ns_ldap_list() is
* accessing password information. The userdata filter would previously
* have been constructed to contain "(&(%s)(userid=fred))". And the SSD
* filter consists of "dept=sds". The new filter would result in
* "(&(dept=sds)(userid=fred))".
*/
int
char **realfilter,
const void *userdata)
{
int filterlen;
int merged = 0;
char *realfilterp;
#ifdef DEBUG
#endif /* DEBUG */
/* sanity check */
if (realfilter == NULL)
return (NS_LDAP_INVALID_PARAM);
*realfilter = NULL;
return (NS_LDAP_INVALID_PARAM);
#ifdef DEBUG
#endif /* DEBUG */
if (*realfilter == NULL)
return (NS_LDAP_MEMORY);
while (*userdatap != '\0') {
realfilterp += filterlen;
} else {
}
}
*realfilterp = '\0';
#ifdef DEBUG
#endif /* DEBUG */
return (NS_LDAP_SUCCESS);
}
static char
hex_char(int n)
{
return ("0123456789abcdef"[n & 0xf]);
}
int
{
char c;
c = *name;
switch (c) {
case '*':
case '(':
case ')':
case '\\':
return (-1);
*filter_name++ = '\\';
break;
default:
return (-1);
*filter_name++ = c;
break;
}
}
if (end <= filter_name)
return (-1);
*filter_name = '\0';
return (0);
}