1N/A/*
1N/A * CDDL HEADER START
1N/A *
1N/A * The contents of this file are subject to the terms of the
1N/A * Common Development and Distribution License (the "License").
1N/A * You may not use this file except in compliance with the License.
1N/A *
1N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
1N/A * or http://www.opensolaris.org/os/licensing.
1N/A * See the License for the specific language governing permissions
1N/A * and limitations under the License.
1N/A *
1N/A * When distributing Covered Code, include this CDDL HEADER in each
1N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1N/A * If applicable, add the following below this CDDL HEADER, with the
1N/A * fields enclosed by brackets "[]" replaced with your own identifying
1N/A * information: Portions Copyright [yyyy] [name of copyright owner]
1N/A *
1N/A * CDDL HEADER END
1N/A */
1N/A/*
1N/A * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
1N/A */
1N/A
1N/A#include <stdio.h>
1N/A#include <string.h>
1N/A#include "../../../lib/libsldap/common/ns_sldap.h"
1N/A
1N/Avoid
1N/A_printEntry(ns_ldap_entry_t *entry) {
1N/A int j, k;
1N/A char *cp;
1N/A for (j = 0; j < entry->attr_count; j++) {
1N/A cp = entry->attr_pair[j]->attrname;
1N/A if (j == 0) {
1N/A (void) fprintf(stdout, "%s: %s\n", cp,
1N/A entry->attr_pair[j]->attrvalue[0]);
1N/A } else {
1N/A for (k = 0; (k < entry->attr_pair[j]->value_count) &&
1N/A (entry->attr_pair[j]->attrvalue[k]); k++) {
1N/A char *val;
1N/A /* not base64 most of the time */
1N/A char *colon = "";
1N/A
1N/A val = entry->attr_pair[j]->attrvalue[k];
1N/A /*
1N/A * Skip the base64 tag, if any. Use
1N/A * double colons to indicate base64.
1N/A */
1N/A if (memcmp(val, NS_LDAP_BASE64_TAG,
1N/A NS_LDAP_BASE64_TAG_LEN) == 0) {
1N/A val = val + NS_LDAP_BASE64_TAG_LEN;
1N/A colon = ":";
1N/A }
1N/A
1N/A (void) fprintf(stdout, "\t%s:%s %s\n",
1N/A cp, colon, val);
1N/A }
1N/A }
1N/A }
1N/A}
1N/A
1N/Avoid
1N/A_printResult(ns_ldap_result_t *result) {
1N/A ns_ldap_entry_t *curEntry;
1N/A int i;
1N/A
1N/A if (result == NULL) {
1N/A return;
1N/A }
1N/A curEntry = result->entry;
1N/A for (i = 0; i < result->entries_count; i++) {
1N/A if (i != 0)
1N/A (void) fprintf(stdout, "\n");
1N/A _printEntry(curEntry);
1N/A curEntry = curEntry->next;
1N/A }
1N/A}