Annotation of 43BSDReno/contrib/isode-beta/quipu/eis_select.c, revision 1.1

1.1     ! root        1: /* eis_select.c - */
        !             2: 
        !             3: #ifndef lint
        !             4: static char *rcsid = "$Header: /f/osi/quipu/RCS/eis_select.c,v 7.1 90/07/09 14:46:08 mrose Exp $";
        !             5: #endif
        !             6: 
        !             7: /*
        !             8:  * $Header: /f/osi/quipu/RCS/eis_select.c,v 7.1 90/07/09 14:46:08 mrose Exp $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       eis_select.c,v $
        !            12:  * Revision 7.1  90/07/09  14:46:08  mrose
        !            13:  * sync
        !            14:  * 
        !            15:  * Revision 7.0  89/11/23  22:17:29  mrose
        !            16:  * Release 6.0
        !            17:  * 
        !            18:  */
        !            19: 
        !            20: /*
        !            21:  *                                NOTICE
        !            22:  *
        !            23:  *    Acquisition, use, and distribution of this module and related
        !            24:  *    materials are subject to the restrictions of a license agreement.
        !            25:  *    Consult the Preface in the User's Manual for the full terms of
        !            26:  *    this agreement.
        !            27:  *
        !            28:  */
        !            29: 
        !            30: 
        !            31: #include "quipu/util.h"
        !            32: #include "quipu/commonarg.h"
        !            33: #include "quipu/entry.h"
        !            34: 
        !            35: extern LLog * log_dsap;
        !            36: 
        !            37: #define EIS_SELECT eis.eis_select
        !            38: 
        !            39: static Attr_Sequence  cpy_as_comp_type ();
        !            40: static Attr_Sequence  cpy_as_comp ();
        !            41: 
        !            42: Attr_Sequence eis_select (eis,entryptr,dn, qctx)
        !            43: EntryInfoSelection eis;
        !            44: Entry entryptr;
        !            45: DN dn;
        !            46: char qctx;     /* If TRUE - it is a Quipu context association */
        !            47:                /* So treat as if "-allattributes -typesandvalves" */
        !            48:                /* Plus - make sure the ACL is sent             */
        !            49: {
        !            50: Attr_Sequence result = NULLATTR;
        !            51: register Attr_Sequence trail;
        !            52: register Attr_Sequence temp;
        !            53: Attr_Sequence temp2;
        !            54: register Attr_Sequence eptr;
        !            55: DN node;
        !            56: extern AttributeType at_acl;
        !            57: 
        !            58:        DLOG (log_dsap,LLOG_TRACE,("eis_select"));
        !            59: 
        !            60:        node = get_copy_dn (entryptr);
        !            61: 
        !            62:        if (eis.eis_allattributes || qctx) {
        !            63:            for(temp=entryptr->e_attributes; temp != NULLATTR; temp=temp->attr_link) {
        !            64: 
        !            65:                if ( ! (qctx && (AttrT_cmp (at_acl,temp->attr_type) == 0)))
        !            66:                        if ( (temp->attr_acl != NULLACL_INFO) && 
        !            67:                                (check_acl(dn,ACL_READ,temp->attr_acl,node ) != OK ))
        !            68:                                        continue;
        !            69: 
        !            70:                if ((eis.eis_infotypes == EIS_ATTRIBUTETYPESONLY) && !qctx)
        !            71:                        temp2 = cpy_as_comp_type (temp);
        !            72:                else
        !            73:                        temp2 = cpy_as_comp (temp);
        !            74: 
        !            75:                if (result == NULLATTR) {
        !            76:                        result = temp2;
        !            77:                        trail = result;
        !            78:                } else {
        !            79:                        trail->attr_link = temp2;
        !            80:                        trail = temp2;
        !            81:                }
        !            82:            }
        !            83:        } else {
        !            84:            for(eptr=EIS_SELECT; eptr != NULLATTR; eptr=eptr->attr_link) {
        !            85: 
        !            86:                if ((temp = as_find_type (entryptr->e_attributes,eptr->attr_type)) == NULLATTR)
        !            87:                        continue;
        !            88: 
        !            89:                if ( (temp->attr_acl != NULLACL_INFO)&& (check_acl(dn,ACL_READ,temp->attr_acl,node ) != OK ))
        !            90:                        continue;
        !            91: 
        !            92:                if (eis.eis_infotypes == EIS_ATTRIBUTETYPESONLY)
        !            93:                        temp2 = cpy_as_comp_type (temp);
        !            94:                else
        !            95:                        temp2 = cpy_as_comp (temp);
        !            96: 
        !            97:                if (result == NULLATTR) {
        !            98:                        result = temp2;
        !            99:                        trail = result;
        !           100:                } else {
        !           101:                        trail->attr_link = temp2;
        !           102:                        trail = temp2;
        !           103:                }
        !           104:            }
        !           105:        }
        !           106:        dn_free (node);
        !           107: 
        !           108:        return (result);
        !           109: }
        !           110: 
        !           111: static Attr_Sequence  cpy_as_comp (as)
        !           112: Attr_Sequence  as;
        !           113: {
        !           114: Attr_Sequence ptr;
        !           115: 
        !           116:        if (as==NULLATTR) {
        !           117:                LLOG (log_dsap,LLOG_EXCEPTIONS,("copy of null as"));
        !           118:                return (NULLATTR);
        !           119:        }
        !           120:        ptr = as_comp_alloc();
        !           121:        ptr->attr_type = AttrT_cpy (as->attr_type);
        !           122:        ptr->attr_value = avs_cpy (as->attr_value);
        !           123:        ptr->attr_link = NULLATTR;
        !           124:        ptr->attr_acl = NULLACL_INFO;
        !           125: 
        !           126:        return (ptr);
        !           127: }
        !           128: 
        !           129: 
        !           130: static Attr_Sequence  cpy_as_comp_type (as)
        !           131: Attr_Sequence  as;
        !           132: {
        !           133: Attr_Sequence ptr;
        !           134: 
        !           135:        if (as==NULLATTR) {
        !           136:                LLOG (log_dsap,LLOG_EXCEPTIONS,("copy of null as"));
        !           137:                return (NULLATTR);
        !           138:        }
        !           139:        ptr = as_comp_alloc();
        !           140:        ptr->attr_type = AttrT_cpy (as->attr_type);
        !           141:        ptr->attr_value = NULLAV;
        !           142:        ptr->attr_link = NULLATTR;
        !           143:        ptr->attr_acl = NULLACL_INFO;
        !           144:        return (ptr);
        !           145: }
        !           146: 
        !           147: 
        !           148: 
        !           149: eis_check (eis,entryptr,dn)
        !           150: EntryInfoSelection eis;
        !           151: Entry entryptr;
        !           152: DN dn;
        !           153: {
        !           154: register Attr_Sequence temp;
        !           155: register Attr_Sequence as;
        !           156: DN node;
        !           157: 
        !           158:        DLOG (log_dsap,LLOG_TRACE,("eis_check"));
        !           159: 
        !           160:        node = get_copy_dn (entryptr);
        !           161: 
        !           162:        if (eis.eis_allattributes) {
        !           163:            for(temp=entryptr->e_attributes; temp != NULLATTR; temp=temp->attr_link)
        !           164:                if (temp->attr_acl != NULLACL_INFO)
        !           165:                        if (check_acl(NULLDN,ACL_READ,temp->attr_acl,node ) != OK )
        !           166:                                if (check_acl(dn,ACL_READ,temp->attr_acl,node ) == OK ) {
        !           167:                                        dn_free (node);
        !           168:                                        return NOTOK;
        !           169:                                }
        !           170:        } else {
        !           171:            for(temp=EIS_SELECT; temp != NULLATTR; temp=temp->attr_link) {
        !           172:                if ((as = as_find_type (entryptr->e_attributes,temp->attr_type)) == NULLATTR)
        !           173:                        continue;
        !           174:                if (as->attr_acl != NULLACL_INFO)
        !           175:                        if (check_acl(NULLDN,ACL_READ,as->attr_acl,node ) != OK )
        !           176:                                if (check_acl(dn,ACL_READ,as->attr_acl,node ) == OK ) {
        !           177:                                        dn_free (node);
        !           178:                                        return NOTOK;
        !           179:                                }
        !           180:            }
        !           181:        }
        !           182:        dn_free (node);
        !           183:        return OK;
        !           184: }
        !           185: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.