|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T g
Length: 4786 (0x12b2)
Types: TextFile
Names: »get_dsa_psap.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
└─⟦eba4602b1⟧ »./isode-5.0.tar.Z«
└─⟦d3ac74d73⟧
└─⟦this⟧ »isode-5.0/quipu/get_dsa_psap.c«
/* get_dsa_psap.c - Get DSA psap given its distinguished name */
#ifndef lint
static char *rcsid = "$Header: /f/osi/quipu/RCS/get_dsa_psap.c,v 6.0 89/03/18 23:41:37 mrose Rel $";
#endif
/*
* $Header: /f/osi/quipu/RCS/get_dsa_psap.c,v 6.0 89/03/18 23:41:37 mrose Rel $
*
*
* $Log: get_dsa_psap.c,v $
* Revision 6.0 89/03/18 23:41:37 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.
*
*/
/* this routine is used to read the psap of a dsa given its distinguished
name. This is called during the DSA initialisation, to find the name
THIS dsa.
*/
#include "quipu/util.h"
#include "quipu/read.h"
#include "quipu/entry.h"
#include "quipu/dua.h"
#include "quipu/bind.h"
DN super_user;
Entry read_dsa_info_remote ();
extern LLog * log_dsap;
DN mydsadn = NULLDN;
extern struct dn_seq * dn_seq_push();
extern struct dn_seq * dn_seq_pop();
extern char remote_lookup;
#ifndef NO_STATS
extern LLog * log_stat;
extern int dn_print ();
#endif
static struct dn_seq * get_dn_list = NULLDNSEQ;
struct PSAPaddr * get_dsa_psap (dn)
DN dn;
{
struct DSError error;
Entry dsa_entry;
Entry my_entry;
struct PSAPaddr *pa = NULLPA;
LLOG (log_dsap,LLOG_TRACE,("in get_dsa_psap"));
dn_decode (dn);
if (dn_in_dnseq (dn,get_dn_list) == TRUE)
goto out; /* primative loop detection */
get_dn_list = dn_seq_push (dn, get_dn_list);
/* if asking about me, use my cached entry */
if (dn_cmp (dn,mydsadn) == 0) {
if ((my_entry = local_find_entry (mydsadn ,TRUE)) == NULLENTRY)
fatal (-81,"My entry has gone\n");
pa = my_entry->e_dsainfo->dsa_addr;
goto out;
}
if ((dsa_entry = really_find_entry (dn,&error,TRUE)) == NULLENTRY) {
if (error.dse_type != DSE_REFERRAL) {
log_ds_error (&error);
ds_error_free (&error);
goto out;
}
} else if (dsa_entry->e_dsainfo != NULLDSA) {
pa = dsa_entry->e_dsainfo->dsa_addr;
goto out;
}
/* we have not got the LOCAL DSA's EDB, contact another DSA */
dsa_entry = read_dsa_info_remote (dn,
&(error.ERR_REFERRAL.DSE_ref_candidates->cr_accesspoints.ap_address));
if (dsa_entry == NULLENTRY)
goto out;
pa = dsa_entry->e_dsainfo->dsa_addr;
out:;
if (get_dn_list != NULLDNSEQ) {
get_dn_list = dn_seq_pop(get_dn_list);
}
return (pa);
}
Entry read_dsa_info_remote (dn,addr)
DN dn;
struct PSAPaddr *addr;
{
static struct ds_read_arg read_arg =
{
default_common_args,
NULLDN,
{ /* entry info selection */
TRUE,
NULLATTR,
EIS_ATTRIBUTESANDVALUES
}
};
struct DSError error;
struct ds_read_result result;
extern Entry current_entry;
static struct ds_bind_arg bindarg;
static struct ds_bind_arg bindresult;
static struct ds_bind_error binderr;
int ad;
/* read address of remote DSA */
/* Do synchronus read for now */
/* Async read eventually */
LLOG (log_dsap,LLOG_TRACE,("in read remote"));
if (!remote_lookup)
return (NULLENTRY);
LLOG (log_dsap,LLOG_TRACE,("doing read remote"));
#ifndef NO_STATS
dn_decode (dn);
pslog (log_stat,LLOG_NOTICE,"remote address lookup",dn_print,(caddr_t)dn);
#endif
/*
* Would bind properly but it can lead to loops with the current set up.
* Bind as null instead.
make_dsa_bind_arg (&bindarg);
*/
bindarg.dba_version = DBA_VERSION_V1988;
bindarg.dba_dn = NULLDN;
bindarg.dba_passwd[0] = 0;
bindarg.dba_passwd_len = 0;
if (dap_bind (&ad, &bindarg, &binderr, &bindresult,addr) != OK) {
DLOG (log_dsap, LLOG_DEBUG, ("Remote bind failure (DSA info)"));
return (NULLENTRY);
}
read_arg.rda_object = dn;
if (dap_read (ad, 1,&read_arg, &error, &result) != DS_OK) {
log_ds_error (&error);
ds_error_free (&error);
(void) dap_unbind (ad);
DLOG (log_dsap, LLOG_DEBUG, ("Remote read failure (DSA info)"));
return (NULLENTRY);
}
cache_entry (&(result.rdr_entry), TRUE, EIS_ATTRIBUTESANDVALUES);
if (unravel_attribute (current_entry,&error,TRUE) != OK) {
log_ds_error (&error);
ds_error_free (&error);
DLOG (log_dsap, LLOG_DEBUG, ("Unravel failure (DSA info)"));
return (NULLENTRY);
}
(void) dap_unbind (ad);
return (current_entry);
}
make_dsa_bind_arg (arg)
struct ds_bind_arg *arg;
{
Entry my_entry;
arg->dba_version = DBA_VERSION_V1988;
arg->dba_dn = mydsadn;
if ((my_entry = local_find_entry (mydsadn ,TRUE)) == NULLENTRY)
fatal (82,"My entry has gone -> can't bind");
if ( (my_entry != NULLENTRY) && (my_entry->e_passwd != NULLCP)) {
(void) strncpy (arg->dba_passwd,my_entry->e_passwd,DBA_MAX_PASSWD_LEN);
arg->dba_passwd_len = strlen (my_entry->e_passwd);
} else {
arg->dba_passwd[0] = 0;
arg->dba_passwd_len = 0;
}
}