|
|
Initial revision
/* aetdap.c - DAP-based DSE */
#ifndef lint
static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/dsap/common/aetdap.c,v 1.1 2018/04/24 16:12:56 root Exp $";
#endif
/*
* $Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/dsap/common/aetdap.c,v 1.1 2018/04/24 16:12:56 root Exp $
*
*
* $Log: aetdap.c,v $
* Revision 1.1 2018/04/24 16:12:56 root
* Initial revision
*
* Revision 7.1 90/07/09 14:33:47 mrose
* sync
*
* 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"
static char unbind = FALSE;
/* */
/* ARGSUSED */
static PE name2value_dap (name, qualifier, context, ontty, real_name)
char *name,
*qualifier,
*context;
int ontty;
PE *real_name;
{
char buffer[BUFSIZ];
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;
*real_name = NULLPE;
(void) sprintf (buffer, "%s@cn=%s", name, qualifier);
name = buffer;
if ( (dn=str2dn (name)) == NULLDN) {
PY_advise (NULLCP, "build of DN failed: %s", name);
out: ;
SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s", PY_pepy));
return NULLPE;
}
if ( (at = AttrT_new (DSAADDRESS_OID)) == NULLAttrT) {
dn_free (dn);
PY_advise (NULLCP, "build of attribute failed: %s",
DSAADDRESS_OID);
goto out;
}
if (! bound) {
if (bind_as_null () != DS_OK) {
PY_advise (NULLCP, "bind to directory failed");
dn_free (dn);
AttrT_free (at);
goto out;
}
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) {
PY_advise (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);
goto out;
} else {
(void) encode_IF_DistinguishedName (real_name,1,0,NULLCP,dn);
if (result.rdr_entry.ent_attr == NULLATTR) {
PY_advise (NULLCP, "No '%s' attribute in entry '%s'",
DSAADDRESS_OID, name);
if (unbind) {
bound = FALSE;
(void) ds_unbind();
}
dn_free (dn);
AttrT_free (at);
as_free (read_arg.rda_eis.eis_select);
goto out;
}
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 char * oidtable;
unbind = flag;
string_syntaxes();
acsap_lookup = name2value_dap;
if (dsap_tai_init () != OK)
LLOG (addr_log,LLOG_EXCEPTIONS,("DAP initialization failed"));
load_oid_table (oidtable);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.