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

⟦ad5a3ff1c⟧ TextFile

    Length: 3662 (0xe4e)
    Types: TextFile
    Names: »acsapdap.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.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 6.0 89/03/18 23:28:12 mrose Rel $";
#endif

/* 
 * $Header: /f/osi/dsap/net/RCS/acsapdap.c,v 6.0 89/03/18 23:28:12 mrose Rel $
 *
 *
 * $Log:	acsapdap.c,v $
 * Revision 6.0  89/03/18  23:28:12  mrose
 * Release 5.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;
static int inited = FALSE;
extern char * oidtable;
extern PE grab_pe();
PE res_pe;
int i=1;
char * vec [1];
char ** vecptr;
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 ( ! inited) {
		vec [0] = "dap";
		vecptr = &vec[0];
		dsap_init (&i,&vecptr);	/* load tables etc */
		inited = TRUE;
	}

	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 (addr_log);
		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)) ;
}

#ifdef DSAP
/* prevent this being called if DSAP not defined */

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

	unbind = flag;
	acsap_lookup = name2value_dap;
}
#endif