|
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 d
Length: 6191 (0x182f) Types: TextFile Names: »ds_init.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« └─⟦de7628f85⟧ └─⟦this⟧ »isode-6.0/quipu/ds_init.c«
/* ds_init.c - initialise the DSA */ #ifndef lint static char *rcsid = "$Header: /f/osi/quipu/RCS/ds_init.c,v 7.0 89/11/23 22:17:08 mrose Rel $"; #endif /* * $Header: /f/osi/quipu/RCS/ds_init.c,v 7.0 89/11/23 22:17:08 mrose Rel $ * * * $Log: ds_init.c,v $ * Revision 7.0 89/11/23 22:17: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. * */ #include "quipu/util.h" #include "quipu/read.h" #include "quipu/dua.h" #include "quipu/connection.h" #include "quipu/entry.h" AV_Sequence super_user; Entry subtree_load (); Entry make_path (); extern LLog * log_dsap; extern DN mydsadn; static Entry load_dsa_cache_entry(), load_dsa_remote_entry(); dsa_init () { Attr_Sequence as; AttributeType manager; extern char * mydsaname; DN str2dn(); extern char * treedir; extern char * get_entry_passwd(); struct edb_info * dsainfo; AV_Sequence avs; Entry newentry; extern char * new_version(); extern char * quipuversion, * TidyString(); extern int parse_status; Entry my_entry, rem_entry; extern IFP unrav_fn; extern IFP schema_fn; int real_unravel_attribute (); int real_check_schema (); char loadstate = TRUE; extern Entry database_root; check_dsa_known_oids (); unrav_fn = (IFP) real_unravel_attribute; schema_fn = (IFP) real_check_schema; if (( manager = AttrT_new (MANAGER_OID)) == NULLAttrT) fatal (-1,"Manager - unknown attribute - check oid tables"); LLOG (log_dsap,LLOG_NOTICE,("dsa name %s",mydsaname)); if ((mydsadn = str2dn (mydsaname)) == NULLDN) { fatal (-2,"Invalid dsa name"); } if ((my_entry = load_dsa_cache_entry (mydsadn)) == NULLENTRY) { if (parse_status != 0) fatal (-3,"can't load my entry"); LLOG (log_dsap,LLOG_NOTICE,("Can't find my own entry - trying another DSA")); if ((my_entry = load_dsa_remote_entry (mydsadn)) == NULLENTRY) fatal (-4,"can't get my own entry!"); else { if (journal (my_entry) != OK) fatal (-4,"Can't write my entry"); } } else if (my_entry->e_data == E_TYPE_CACHE_FROM_MASTER) if ((rem_entry = load_dsa_remote_entry (mydsadn)) != NULLENTRY) { if (rem_entry->e_parent != NULLENTRY) rem_entry->e_parent->e_edbversion = new_version(); if (journal (rem_entry) != OK) fatal (-4,"Can't re-write my entry"); my_entry = rem_entry; } if (get_entry_passwd (my_entry->e_attributes) == NULLCP) /* This is not a fatal error, but some remote operations may fail */ LLOG(log_dsap,LLOG_EXCEPTIONS,("Can't find my own PASSWORD")); if (my_entry->e_dsainfo != NULLDSA) { /* get manager attribute */ if ((as = as_find_type(my_entry->e_attributes,manager)) == NULLATTR ) fatal (-5,"Manager attribute missing in my own entry"); AttrT_free (manager); super_user = avs_cpy ((AV_Sequence)as->attr_value); if (strcmp(my_entry->e_dsainfo->dsa_version,TidyString (strdup (quipuversion))) != 0) LLOG(log_dsap,LLOG_EXCEPTIONS,("WARNING: version number wrong (expecting '%s', got '%s') !!",quipuversion,my_entry->e_dsainfo->dsa_version)); if (quipu_ctx_supported(my_entry) != 2) LLOG(log_dsap,LLOG_EXCEPTIONS,("WARNING: I don't appear to support the QUIPU Context !!!")); } else fatal (-6,"No edbinfo attribute in my own entry"); if (parse_status != 0) loadstate = FALSE; for (avs = my_entry->e_dsainfo->dsa_attr ; avs != NULLAV; avs=avs->avseq_next) { if (avs->avseq_av.av_struct == NULL) continue; dsainfo = (struct edb_info *) avs->avseq_av.av_struct; newentry = make_path (dsainfo->edb_name); (void) subtree_load (newentry,dsainfo->edb_name); if (parse_status != 0) loadstate = FALSE; } if (loadstate == FALSE) fatal (-7,"DSA Halted"); if (database_root->e_child != NULLENTRY) database_root->e_data = database_root->e_child->e_data; return (OK); } static Entry load_dsa_cache_entry(dn) DN dn; { DN ptr,trail = NULLDN; Entry newentry; for (ptr=dn; ptr->dn_parent != NULLDN; ptr=ptr->dn_parent) trail = ptr; if (trail == NULLDN) { database_root = subtree_load (NULLENTRY,NULLDN); return (local_find_entry (dn,TRUE)); } trail->dn_parent = NULLDN; newentry = make_path (dn); (void) subtree_load (newentry,dn); trail->dn_parent = ptr; return (local_find_entry (dn,TRUE)); } static Entry load_dsa_remote_entry(dn) DN dn; { static struct ds_read_arg read_arg = { default_common_args, NULLDN, { /* entry info selection */ TRUE, NULLATTR, EIS_ATTRIBUTESANDVALUES } }; struct ds_read_result result; struct DSError error; extern Entry current_entry; static struct ds_bind_arg bindarg; static struct ds_bind_arg bindresult; static struct ds_bind_error binderr; int ad, id; extern struct PSAPaddr *parent_psap(); struct PSAPaddr * addr; #ifndef NO_STATS extern LLog * log_stat; extern dn_print (); (void) dn_decode (dn); pslog (log_stat,LLOG_NOTICE,"SYNC DAP remote entry lookup",dn_print,(caddr_t)dn); #endif /* read from of remote DSA */ /* Do synchronus read for now */ /* Async read eventually */ make_dsa_bind_arg (&bindarg); if ((addr = parent_psap ()) == NULLPA) { LLOG (log_dsap,LLOG_EXCEPTIONS,("No parent or quipu-db defined - check quiputailor")); return (NULLENTRY); } if (dap_bind (&ad, &bindarg, &binderr, &bindresult,addr) != OK) { LLOG (log_dsap,LLOG_EXCEPTIONS,("Can't bind to remote DSA thus can't read my own entry")); bind_arg_free (&bindarg); return (NULLENTRY); } bind_arg_free (&bindarg); bind_arg_free (&bindresult); read_arg.rda_object = dn; id = 1; if (dap_read (ad, &id,&read_arg, &error, &result) != DS_OK) { log_ds_error (&error); LLOG (log_dsap,LLOG_EXCEPTIONS,("Remote DSA failed on lookup of my address")); (void) dap_unbind (ad); return (NULLENTRY); } cache_entry (&(result.rdr_entry), TRUE, EIS_ATTRIBUTESANDVALUES); if (unravel_attribute (current_entry,&error,TRUE) != OK) { log_ds_error (&error); LLOG (log_dsap, LLOG_EXCEPTIONS, ("Remote copy of my entry is wrong!")); return (NULLENTRY); } (void) dap_unbind (ad); return (current_entry); }