DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T a

⟦a52912dc6⟧ TextFile

    Length: 3568 (0xdf0)
    Types: TextFile
    Names: »acsapdap.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« 
        └─⟦de7628f85⟧ 
            └─⟦this⟧ »isode-6.0/dsap/net/acsapdap.c« 

TextFile

/* acsapdap.c - DAP-based DSE */

#ifndef	lint
static char *rcsid = "$Header: /f/osi/dsap/net/RCS/acsapdap.c,v 7.0 89/11/23 21:48:08 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/dsap/net/RCS/acsapdap.c,v 7.0 89/11/23 21:48:08 mrose Rel $
 *
 *
 * $Log:	acsapdap.c,v $
 * Revision 7.0  89/11/23  21:48:08  mrose
 * Release 6.0
 * 
 */

/*
 *				  NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */


/* LINTLIBRARY */

#include "quipu/util.h"
#include "quipu/read.h"
#include "quipu/dua.h"
#include "quipu/bind.h"
#include "tailor.h"
#include "config.h"

static char unbind;
static bind_as_null ();

PE	name2value_dap (name, attribute, real_name)
char   *name,
       *attribute;
PE     *real_name;
{
DN dn;
AttributeType at;
static int bound = FALSE;
extern char * oidtable;
extern PE grab_pe();
PE res_pe;
static struct ds_read_arg read_arg = 
	{
		default_common_args,
		NULLDN,   /* read_arg DN */
		{       /* entry info selection */
			FALSE,
			NULLATTR,
			EIS_ATTRIBUTESANDVALUES
		}
	};
struct DSError  error;
struct ds_read_result result;

	if ( (dn=str2dn (name)) == NULLDN) {
		SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
		      ("build of DN failed: %s", name));
		return (NULLPE);
	}

	if ( (at = AttrT_new (attribute)) == NULLAttrT) {
		dn_free (dn);
		SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
		      ("build of attribute failed: %s", attribute));
		return (NULLPE);
	}

	if (! bound) {
		if (bind_as_null () != DS_OK) {
			SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
			      ("bind to directory failed"));
			dn_free (dn);
			AttrT_free (at);
			return (NULLPE);
		}
		bound = TRUE;
	}

	read_arg.rda_common.ca_servicecontrol.svc_prio = SVC_PRIO_HIGH;
	read_arg.rda_object = dn;
	read_arg.rda_eis.eis_select = as_comp_new (AttrT_cpy (at), NULLAV, NULLACL_INFO);

	if (ds_read (&read_arg,&error,&result) != DS_OK) {
		SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
		      ("DAP lookup failed: %s",name));
		log_ds_error (&error);
		ds_error_free (&error);
		if (unbind) {
			bound = FALSE;
			(void) ds_unbind();
		}
		dn_free (dn);
		AttrT_free (at);
		as_free (read_arg.rda_eis.eis_select);
		return (NULLPE);
	} else {
		(void) encode_IF_DistinguishedName (real_name,1,0,NULLCP,dn);
		if (result.rdr_entry.ent_attr == NULLATTR) {
			SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP,
			      ("No '%s' attribute in entry '%s'",attribute,name));
			if (unbind) {
				bound = FALSE;
				(void) ds_unbind();
			}
			dn_free (dn);
			AttrT_free (at);
			as_free (read_arg.rda_eis.eis_select);
			return (NULLPE);
		}
		if (unbind) {
			bound = FALSE;
			(void) ds_unbind();
		}
		dn_free (dn);
		AttrT_free (at);
		as_free (read_arg.rda_eis.eis_select);
		res_pe = grab_pe(&result.rdr_entry.ent_attr->attr_value->avseq_av);
		as_free (result.rdr_entry.ent_attr);
		return (res_pe);
	}
}


static bind_as_null ()
{
struct ds_bind_arg bindarg;
struct ds_bind_arg bindresult;
struct ds_bind_error binderr;

	bindarg.dba_version = DBA_VERSION_V1988;
	bindarg.dba_passwd_len = 0;
	bindarg.dba_dn = NULLDN;

	return (ds_bind (&bindarg,&binderr,&bindresult)) ;
}


set_lookup_dap (flag)
char flag;		/* if TRUE always unbind */
{
extern PE (*acsap_lookup)();
extern char * oidtable;

	unbind = flag;
	string_syntaxes();

	acsap_lookup = name2value_dap;

	if (dsap_tai_init () != OK) 
		LLOG (addr_log,LLOG_EXCEPTIONS,("DAP Initialisation failed\n"));

	load_oid_table (oidtable);
}