📄 attribute.c
字号:
/* attribute.c - */#ifndef lintstatic char *rcsid = "$Header: /xtel/isode/isode/dsap/common/RCS/attribute.c,v 9.0 1992/06/16 12:12:39 isode Rel $";#endif/* * $Header: /xtel/isode/isode/dsap/common/RCS/attribute.c,v 9.0 1992/06/16 12:12:39 isode Rel $ * * * $Log: attribute.c,v $ * Revision 9.0 1992/06/16 12:12:39 isode * Release 8.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/entry.h"#include "quipu/ds_error.h"#include "quipu/oid.h"#include "quipu/malloc.h"AttributeType at_certificate;AttributeType at_p_password;AttributeType at_password;AttributeType at_acl;AttributeType at_control;AttributeType at_dsa_control;AttributeType at_schema;AttributeType at_applctx;AttributeType at_edbinfo;AttributeType at_masterdsa;AttributeType at_slavedsa;AttributeType at_relaydsa;AttributeType at_dsaaddress;AttributeType at_version;AttributeType at_inherit;AttributeType at_subord;AttributeType at_xref;AttributeType at_nssr;AttributeType at_listen;AttributeType at_searchacl;AttributeType at_listacl;AttributeType at_authpolicy;OID alias_oc;OID quipu_dsa_oid;OID extern_obj_oid;extern AttributeType at_objectclass;extern AttributeType at_alias;extern LLog * log_dsap;extern short acl_sntx;extern AV_Sequence oc_avs();Attr_Sequence entry_find_type();check_dsa_known_oids (){ /* set pointers to special attributes */ check_known_oids (); at_password = AttrT_new (PASSWORD_OID); at_control = AttrT_new (CONTROL_OID); at_dsa_control = AttrT_new (DSA_CONTROL_OID); at_acl = AttrT_new (ACL_OID); at_applctx = AttrT_new (APPLCTX_OID); at_schema = AttrT_new (SCHEMA_OID); at_edbinfo = AttrT_new (EDBINFO_OID); at_masterdsa = AttrT_new (MASTERDSA_OID); at_slavedsa = AttrT_new (SLAVEDSA_OID); at_relaydsa = AttrT_new (RELAYDSA_OID); at_dsaaddress = AttrT_new (DSAADDRESS_OID); at_version = AttrT_new (VERSION_OID); at_p_password = AttrT_new (PROTECTED_OID); at_certificate = AttrT_new (CERTIFICATE_OID); at_inherit = AttrT_new (INHERIT_OID); at_searchacl = AttrT_new (SEARCHACL_OID); at_listacl = AttrT_new (LISTACL_OID); at_authpolicy = AttrT_new (AUTHPOLICY_OID); at_subord = AttrT_new (SUBORD_OID); at_xref = AttrT_new (XREF_OID); at_nssr = AttrT_new (NSSR_OID); at_listen = AttrT_new (LISTEN_OID); alias_oc = oid_cpy (str2oid (ALIAS_OC)); quipu_dsa_oid = oid_cpy (str2oid(QUIPU_DSA)); extern_obj_oid = oid_cpy (str2oid(EXTERNOBJECT));}real_unravel_attribute (eptr,error)Entry eptr;struct DSError * error;{register Attr_Sequence as;Attr_Sequence ias;RDN new_rdn, rdn_test;AttributeType at;AV_Sequence avs;struct acl * acl = (struct acl *) NULL;extern oid_cmp ();int rdn_print(); /* take rdn's and make sure an attribute, if not add it in */ for (new_rdn = eptr->e_name; new_rdn != NULLRDN; new_rdn = new_rdn->rdn_next) { if (new_rdn->rdn_at != NULLTABLE_ATTR) new_rdn->rdn_av.av_syntax = new_rdn->rdn_at->oa_syntax; if (new_rdn->rdn_av.av_syntax == 0) { /* Check we know about local RDNs syntax */ if (eptr->e_data == E_DATA_MASTER) /* X.501 9.6.2 ! */#ifndef STRICT_X500 /* Allow if it a primative type ! */ if ( ((PE)new_rdn->rdn_av.av_struct)->pe_form != PE_FORM_PRIM)#endif { LLOG (log_dsap, LLOG_EXCEPTIONS, ("RDN of unknown attribute syntax")); error->dse_type = DSE_UPDATEERROR; error->ERR_UPDATE.DSE_up_problem = DSE_UP_NAMINGVIOLATION; return NOTOK; } } for (rdn_test = eptr->e_name; rdn_test != new_rdn; rdn_test = rdn_test->rdn_next) /* check for repeated attribute in RDN */ if (AttrT_cmp (new_rdn->rdn_at, rdn_test->rdn_at) == 0) { LLOG (log_dsap, LLOG_EXCEPTIONS, ("RDN with two AVAs of same attribute type")); error->dse_type = DSE_UPDATEERROR; error->ERR_UPDATE.DSE_up_problem = DSE_UP_NAMINGVIOLATION; return NOTOK; } if ((as = as_find_type (eptr->e_attributes,new_rdn->rdn_at)) == NULLATTR) { SET_HEAP (new_rdn->rdn_at); at = AttrT_cpy (new_rdn->rdn_at); avs = avs_comp_new (AttrV_cpy(&new_rdn->rdn_av)); as = as_comp_new (at, avs, NULLACL_INFO); eptr->e_attributes = as_merge (eptr->e_attributes,as); RESTORE_HEAP; } else { for (avs=as->attr_value; avs!=NULLAV; avs=avs->avseq_next) if (AttrV_cmp (&new_rdn->rdn_av,&avs->avseq_av) == 0) break; if (avs == NULLAV) { SET_HEAP (new_rdn->rdn_at); avs = avs_comp_new (AttrV_cpy(&new_rdn->rdn_av)); as->attr_value = avs_merge (as->attr_value,avs); RESTORE_HEAP; } } } /* now get special attributes into structure */ /* first reset pointers - incase deleted. */ eptr->e_alias = NULLDN; if (eptr->e_dsainfo) free ((char *) eptr->e_dsainfo); eptr->e_dsainfo = NULLDSA; eptr->e_external = 0; eptr->e_master = NULLAV; eptr->e_slave = NULLAV; eptr->e_leaf = TRUE; eptr->e_oc = NULLAV; eptr->e_sacl = NULLAV; eptr->e_lacl = NULLAV; eptr->e_authp = NULLAUTHP;#ifdef notyet /* Should free this, but would need recursive inheritance setting */ if (eptr->e_inherit) avs_free (eptr->e_inherit);#endif eptr->e_inherit = NULLAV; if ((as = entry_find_type (eptr,at_objectclass)) == NULLATTR) { /* Might inherit it ! */ set_inheritance (eptr); if ((as = entry_find_type (eptr,at_objectclass)) == NULLATTR) { pslog (log_dsap,LLOG_EXCEPTIONS, "Object class attribute missing", rdn_print, (caddr_t)eptr->e_name); error->dse_type = DSE_UPDATEERROR; error->ERR_UPDATE.DSE_up_problem = DSE_UP_OBJECTCLASSVIOLATION; return (NOTOK); } eptr->e_oc = as->attr_value; } else { set_inheritance (eptr); eptr->e_oc = as->attr_value; /* order swapped ! */ } if (as = entry_find_type (eptr,at_acl)) { if (as->attr_value) { /* How can this be null ? */ eptr->e_acl = (struct acl *) as->attr_value->avseq_av.av_struct; acl = eptr->e_acl; if (acl->ac_child == NULLACL_INFO) acl->ac_child = acl_default (); if (acl->ac_entry == NULLACL_INFO) acl->ac_entry = acl_default (); if (acl->ac_default == NULLACL_INFO) acl->ac_default = acl_default (); } } else eptr->e_acl = NULLACL; if (as = entry_find_type (eptr,at_edbinfo)) { if (eptr->e_dsainfo == NULLDSA) { eptr->e_dsainfo = (struct dsa_info *) smalloc (sizeof (struct dsa_info)); bzero ((char *)eptr->e_dsainfo,sizeof (struct dsa_info)); } eptr->e_dsainfo->dsa_attr = as->attr_value; } if (as = entry_find_type (eptr,at_dsaaddress)) { if (eptr->e_dsainfo == NULLDSA) { eptr->e_dsainfo = (struct dsa_info *) smalloc (sizeof (struct dsa_info)); bzero ((char *)eptr->e_dsainfo,sizeof (struct dsa_info)); } eptr->e_dsainfo->dsa_addr = (struct PSAPaddr *) as->attr_value->avseq_av.av_struct; if ((as->attr_value->avseq_next) && (eptr->e_data == E_DATA_MASTER)) pslog (log_dsap,LLOG_EXCEPTIONS, "WARNING: multi valued presentationAddress (only one will be used)", rdn_print, (caddr_t)eptr->e_name); } if (as = entry_find_type (eptr,at_masterdsa)) { eptr->e_master = as->attr_value; eptr->e_leaf = FALSE; } if (as = entry_find_type (eptr,at_slavedsa)) { eptr->e_slave = as->attr_value; eptr->e_leaf = FALSE; } if (as = entry_find_type (eptr,at_alias)) eptr->e_alias = (DN) as->attr_value->avseq_av.av_struct; if (as = entry_find_type (eptr,at_searchacl)) { eptr->e_sacl = as->attr_value; } if (as = entry_find_type (eptr,at_listacl)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -