Annotation of 43BSDReno/contrib/isode-beta/dsap/x500as/qu-dec.py, revision 1.1

1.1     ! root        1: -- quipu-dec.py - additional QUIPU directory type definitions module
        !             2: 
        !             3: -- $Header: /f/osi/dsap/x500as/RCS/qu-dec.py,v 7.0 89/11/23 21:50:45 mrose Rel $
        !             4: --
        !             5: --
        !             6: -- $Log:       qu-dec.py,v $
        !             7: -- Revision 7.0  89/11/23  21:50:45  mrose
        !             8: -- Release 6.0
        !             9: -- 
        !            10: 
        !            11: --
        !            12: --                               NOTICE
        !            13: --
        !            14: --    Acquisition, use, and distribution of this module and related
        !            15: --    materials are subject to the restrictions of a license agreement.
        !            16: --    Consult the Preface in the User's Manual for the full terms of
        !            17: --    this agreement.
        !            18: --
        !            19: --
        !            20: 
        !            21: 
        !            22: Quipu
        !            23:        {
        !            24:        ccitt
        !            25:        data(9)
        !            26:        pss(2342)
        !            27:        ucl(19200300)
        !            28:        quipu(99)
        !            29:        directoryDefinitions(1)
        !            30:        }
        !            31: 
        !            32: DEFINITIONS ::=
        !            33: 
        !            34: %{
        !            35: #include <stdio.h>
        !            36: #include "quipu/util.h"
        !            37: #include "quipu/entry.h"
        !            38: #include "quipu/authen.h"
        !            39: 
        !            40: extern  LLog    * log_dsap;
        !            41: #define decode_UNIV_PrintableString parse_UNIV_PrintableString
        !            42: #define decode_UNIV_UTCTime parse_UNIV_UTCTime
        !            43: %}
        !            44: 
        !            45: PREFIXES encode decode print
        !            46: 
        !            47: BEGIN
        !            48: 
        !            49: IMPORTS
        !            50:        NameError ,
        !            51:        ServiceError ,
        !            52:        SecurityError
        !            53:                FROM DAS
        !            54:                        {
        !            55:                        joint-iso-ccitt
        !            56:                        ds(5)
        !            57:                        modules(1)
        !            58:                        directoryAbstractService(2)
        !            59:                        }
        !            60: 
        !            61:        DistinguishedName ,
        !            62:        RelativeDistinguishedName ,
        !            63:        Attribute ,
        !            64:        AttributeType
        !            65:                FROM IF
        !            66:                        {
        !            67:                        joint-iso-ccitt
        !            68:                        ds(5)
        !            69:                        modules(1)
        !            70:                        informationFramework(1)
        !            71:                        }
        !            72: 
        !            73:        AlgorithmIdentifier
        !            74:                FROM AF {
        !            75:                        joint-iso-ccitt
        !            76:                        ds(5)
        !            77:                        modules(1)
        !            78:                        authenticationFramework(7)
        !            79:                        };
        !            80: 
        !            81: -- ReliableROSData
        !            82: --     ::=
        !            83: --     SEQUENCE
        !            84: --     {
        !            85: --     rosOperation
        !            86: --             INTEGER ,
        !            87:                -- the operation being applied
        !            88: --     data
        !            89: --             ANY ,
        !            90:                -- the Operation Argument
        !            91: --     oldVersion
        !            92: --             ANY ,
        !            93:                -- data version to which operation should be applied
        !            94: --     newVersion
        !            95: --             ANY
        !            96:                -- version number which results from operation
        !            97: --     }
        !            98: 
        !            99: DECODER decode
        !           100: 
        !           101: AccessSelector [[P struct acl_info *]]
        !           102:         ::=
        !           103:         %{
        !           104:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode AccessSelector"));
        !           105:                 parm->acl_name = NULLDNSEQ;
        !           106:         %}
        !           107:         CHOICE
        !           108:         {
        !           109:         entry
        !           110:                 [0] NULL
        !           111:                 %{
        !           112:                         parm->acl_selector_type = ACL_ENTRY;
        !           113:                 %} ,
        !           114:         other
        !           115:                 [2] NULL
        !           116:                 %{
        !           117:                         parm->acl_selector_type = ACL_OTHER;
        !           118:                 %} ,
        !           119:         prefix
        !           120:                 [3] NameList [[p &(parm->acl_name)]]
        !           121:                 %{
        !           122:                         parm->acl_selector_type = ACL_PREFIX;
        !           123:                 %} ,
        !           124:         group
        !           125:                 [4] NameList [[p &(parm->acl_name)]]
        !           126:                 %{
        !           127:                         parm->acl_selector_type = ACL_GROUP;
        !           128:                 %}
        !           129:         }
        !           130:         %{
        !           131:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode AccessSelector"));
        !           132:         %}
        !           133: 
        !           134: AccessCategories [[P u_char *]]
        !           135:         ::=
        !           136:         %{
        !           137:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode AccessCategories"));
        !           138:         %}
        !           139:         ENUMERATED [[i (*parm)]]
        !           140:         {
        !           141:                 none (0) ,
        !           142:                 detect (1) ,
        !           143:                 compare (2) ,
        !           144:                 read (3) ,
        !           145:                 add (4) ,
        !           146:                 write (5)
        !           147:         }
        !           148:         %{
        !           149:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode AccessCategories"));
        !           150:         %}
        !           151: 
        !           152: ACLInfo [[P struct acl_info * *]]
        !           153: %{
        !           154: %}
        !           155:         ::=
        !           156:         %{
        !           157:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode ACLInfo"));
        !           158:         %}
        !           159:         SET OF
        !           160:                %{
        !           161:                        (*parm) = (struct acl_info *) malloc(sizeof(struct acl_info));
        !           162:                %}
        !           163:                 SEQUENCE
        !           164:                 {
        !           165:                         AccessSelector [[p (*parm)]] ,
        !           166:                         AccessCategories [[p &((*parm)->acl_categories)]]
        !           167:                 }
        !           168:                 %{
        !           169:                         parm = &((*parm)->acl_next);
        !           170:                 %}
        !           171:         %{
        !           172:                 (*parm) = NULLACL_INFO;
        !           173:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode ACLInfo"));
        !           174:         %}
        !           175: 
        !           176: AttributeACL [[P struct acl_attr *]]
        !           177: %{
        !           178: struct oid_seq  * osp;
        !           179: %}
        !           180:         ::=
        !           181:         %{
        !           182:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode AttributeACL"));
        !           183:                 parm->aa_types = NULLOIDSEQ;
        !           184:                 parm->aa_acl = acl_dflt();
        !           185:                 parm->aa_next = NULLACL_ATTR;
        !           186:         %}
        !           187:         SEQUENCE
        !           188:         {
        !           189:                 SET OF
        !           190:                        %{
        !           191:                                osp = (struct oid_seq *) malloc(sizeof(struct oid_seq));
        !           192:                                osp->oid_oid = NULLOID;
        !           193:                                osp->oid_next = NULLOIDSEQ;
        !           194:                        %}
        !           195:                        -- AttributeType
        !           196:                         OBJECT IDENTIFIER [[O osp->oid_oid]]
        !           197:                         %{
        !           198:                                parm->aa_types = oid_seq_merge(parm->aa_types, osp);
        !           199:                        %} ,
        !           200:                 ACLInfo [[p &(parm->aa_acl)]]
        !           201:                     -- DEFAULT {{other , read}, {entry, write}}
        !           202:                     OPTIONAL
        !           203:         }
        !           204:         %{
        !           205:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode AttributeACL"));
        !           206:         %}
        !           207: 
        !           208: ACLSyntax [[P struct acl *]]
        !           209: %{
        !           210: struct acl_attr **aap;
        !           211: %}
        !           212:         ::=
        !           213:         %{
        !           214:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode ACLSyntax"));
        !           215:                 parm->ac_child = acl_dflt();
        !           216:                 parm->ac_entry = acl_dflt();
        !           217:                 parm->ac_default = acl_dflt();
        !           218:                 parm->ac_attributes = NULLACL_ATTR;
        !           219:                 aap = &(parm->ac_attributes);
        !           220:         %}
        !           221:         SEQUENCE
        !           222:         {
        !           223:         childACL
        !           224:                 [0] ACLInfo [[p &(parm->ac_child)]]
        !           225:                     -- DEFAULT {{other , read}, {entry, write}} ,
        !           226:                     OPTIONAL ,
        !           227:         entryACL
        !           228:                 [1] ACLInfo [[p &(parm->ac_entry)]]
        !           229:                     -- DEFAULT {{other , read}, {entry, write}} ,
        !           230:                     OPTIONAL ,
        !           231:         defaultAttributeACL
        !           232:                 [2] ACLInfo [[p &(parm->ac_default)]]
        !           233:                     -- DEFAULT {{other , read}, {entry, write}} ,
        !           234:                     OPTIONAL ,
        !           235:                 [3] SET OF
        !           236:                        %{
        !           237:                                (*aap) = (struct acl_attr *) malloc(sizeof(struct acl_attr));
        !           238:                        %}
        !           239:                         AttributeACL [[p (*aap)]]
        !           240:                         %{
        !           241:                                 aap = &((*aap)->aa_next);
        !           242:                        %}
        !           243:                %{
        !           244:                         (*aap) = NULLACL_ATTR;
        !           245:                 %}
        !           246:         }
        !           247:         %{
        !           248:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode ACLSyntax"));
        !           249:         %}
        !           250: 
        !           251: NameList [[P struct dn_seq **]]
        !           252:         ::=
        !           253:         %{
        !           254:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode NameList"));
        !           255:                 *parm = NULLDNSEQ;
        !           256:         %}
        !           257:         SET OF
        !           258:                %{
        !           259:                        *parm = (struct dn_seq *) malloc(sizeof(struct dn_seq));
        !           260:                %}
        !           261:                 DistinguishedName [[p &((*parm)->dns_dn)]]
        !           262:                 %{
        !           263:                         parm = &((*parm)->dns_next);
        !           264:                 %}
        !           265:         %{
        !           266:                 (*parm) = NULLDNSEQ;
        !           267:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode NameList"));
        !           268:         %}
        !           269: 
        !           270: EDBInfoSyntax [[P struct edb_info *]]
        !           271:         ::=
        !           272:         %{
        !           273:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode EDBInfoSyntax"));
        !           274:                parm->edb_name = NULLDN;
        !           275:                parm->edb_getfrom = NULLDN;
        !           276:                 parm->edb_sendto = NULLDNSEQ;
        !           277:                 parm->edb_allowed = NULLDNSEQ;
        !           278:         %}
        !           279:         SEQUENCE
        !           280:         {
        !           281:         edb
        !           282:                 DistinguishedName [[p &(parm->edb_name)]] ,
        !           283:         getFromDSA
        !           284:                 DistinguishedName [[p &(parm->edb_getfrom)]]
        !           285:                    OPTIONAL ,
        !           286:         sendToDSAs
        !           287:                %{
        !           288:                        DLOG(log_dsap, LLOG_PDUS, ("decode sendToDSAs"));
        !           289:                %}
        !           290:                 NameList [[p &(parm->edb_sendto)]] ,
        !           291:        getEDBAllowed
        !           292:                %{
        !           293:                        DLOG(log_dsap, LLOG_PDUS, ("decode getEDBAllowed"));
        !           294:                %}
        !           295:                NameList [[p &(parm->edb_allowed)]]
        !           296:         }
        !           297:         %{
        !           298:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode EDBInfoSyntax"));
        !           299:         %}
        !           300: 
        !           301: TreeStructureSyntax [[P struct tree_struct **]]
        !           302: %{
        !           303: AttributeType    at_tmp;
        !           304: OID     oid_tmp;
        !           305: int    is_first;
        !           306: objectclass * oc_add();
        !           307: %}
        !           308:         ::=
        !           309:         %{
        !           310:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode TreeStructureSyntax"));
        !           311:                is_first = 1;
        !           312:         %}
        !           313:         SET
        !           314:        {
        !           315:        mandatoryObjectClasses
        !           316:                [1] SET OF
        !           317:                        OBJECT IDENTIFIER [[O oid_tmp]]
        !           318:                        %{
        !           319:                                if(is_first != 0)
        !           320:                                {
        !           321:                                        (*parm) = tree_struct_alloc();
        !           322:                                        if (((*parm)->tree_object = oid2oc(oid_tmp)) == NULLOBJECTCLASS)
        !           323:                                                (*parm)->tree_object = oc_add (oid_tmp);
        !           324:                                        is_first = 0;
        !           325:                                }
        !           326:                                else
        !           327:                                {
        !           328:                                        LLOG(log_dsap, LLOG_EXCEPTIONS, ("Multiple mandatory object classes"));
        !           329:                                }
        !           330:                        %} ,
        !           331:        optionalObjectClasses
        !           332:                [2] SET OF
        !           333:                        OBJECT IDENTIFIER
        !           334:                    OPTIONAL ,
        !           335:        permittedRDNs
        !           336:                [3] SET OF
        !           337:                        SET OF
        !           338:                                AttributeType [[p & at_tmp]]
        !           339:                                %{
        !           340:                                %}
        !           341:        }
        !           342:         %{
        !           343:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode TreeStructureSyntax"));
        !           344:         %}
        !           345: 
        !           346: EntryDataBlock [[P struct entry **]]
        !           347: %{
        !           348: struct entry    **ent_tmp;
        !           349: %}
        !           350:         ::=
        !           351:         %{
        !           352:                 DLOG(log_dsap, LLOG_TRACE, ("About to decode EntryDataBlock"));
        !           353:                 (*parm) = NULLENTRY;
        !           354:                 ent_tmp = parm;
        !           355:         %}
        !           356:         SEQUENCE OF
        !           357:                %{
        !           358:                        (*ent_tmp) = entry_alloc();
        !           359:                        (*ent_tmp)->e_leaf = TRUE;
        !           360:                        (*ent_tmp)->e_complete = TRUE;
        !           361:                        (*ent_tmp)->e_data = E_TYPE_SLAVE;
        !           362:                %}
        !           363:                 RelativeEntry [[p (*ent_tmp)]]
        !           364:                 %{
        !           365:                         ent_tmp = &((*ent_tmp)->e_sibling);
        !           366:                 %}
        !           367:         %{
        !           368:                 (*ent_tmp) = NULLENTRY;
        !           369:                 DLOG(log_dsap, LLOG_TRACE, ("Done decode EntryDataBlock"));
        !           370:         %}
        !           371: 
        !           372: RelativeEntry [[P struct entry *]]
        !           373: %{
        !           374: Attr_Sequence     as_tmp;
        !           375: %}
        !           376:         ::=
        !           377:         %{
        !           378:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode RelativeEntry"));
        !           379:                 parm->e_name = NULLRDN;
        !           380:                 parm->e_attributes = NULLATTR;
        !           381:         %}
        !           382:         SEQUENCE
        !           383:         {
        !           384:                 RelativeDistinguishedName [[p &(parm->e_name)]] ,
        !           385:                 SET OF
        !           386:                        %{
        !           387:                                as_tmp = as_comp_alloc();
        !           388:                                as_tmp->attr_value = NULLAV;
        !           389:                                as_tmp->attr_acl = NULLACL_INFO;
        !           390:                                as_tmp->attr_link = NULLATTR;
        !           391:                        %}
        !           392:                         Attribute [[p as_tmp]]
        !           393:                         %{
        !           394:                                 parm->e_attributes = as_merge(parm->e_attributes, as_tmp);
        !           395:                         %}
        !           396:         }
        !           397:         %{
        !           398:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode RelativeEntry"));
        !           399:         %}
        !           400: 
        !           401: EDBVersion [[P char **]]
        !           402: %{
        !           403: %}
        !           404:        ::=
        !           405:         %{
        !           406:                 DLOG(log_dsap, LLOG_PDUS, ("About to decode EDBVersion"));
        !           407:                (*parm) = NULLCP;
        !           408:         %}
        !           409:        UTCTime [[s (*parm)]]
        !           410:        %{
        !           411:                if((*parm) == NULLCP)
        !           412:                    LLOG(log_dsap, LLOG_EXCEPTIONS, ("NULL CP Version!"));
        !           413: 
        !           414:                 DLOG(log_dsap, LLOG_PDUS, ("Done decode EDBVersion"));
        !           415:        %}
        !           416: 
        !           417: GetEntryDataBlockArgument [[P struct getedb_arg *]]
        !           418:        ::=
        !           419:         %{
        !           420:                 DLOG(log_dsap, LLOG_TRACE, ("About to decode GetEntryDataBlockArgument"));
        !           421:                parm->ga_entry = NULLDN;
        !           422:                parm->ga_version = NULL;
        !           423:                parm->get_next = NULL_GETARG;
        !           424:         %}
        !           425:        SET
        !           426:        {
        !           427:        entry
        !           428:                [0] DistinguishedName [[p &(parm->ga_entry)]] ,
        !           429:        sendIfMoreRecentThan
        !           430:                [1] EDBVersion [[p &(parm->ga_version)]]
        !           431:                    OPTIONAL
        !           432:                        -- if omitted, send in any case
        !           433:        }
        !           434:         %{
        !           435:                 DLOG(log_dsap, LLOG_TRACE, ("Done decode GetEntryDataBlockArgument"));
        !           436:         %}
        !           437: 
        !           438: GetEntryDataBlockResult [[P struct getedb_result *]]
        !           439:        ::=
        !           440:         %{
        !           441:                 DLOG(log_dsap, LLOG_TRACE, ("About to decode GetEntryDataBlockResult"));
        !           442:                parm->gr_version = NULL;
        !           443:                parm->gr_edb = NULLENTRY;
        !           444:                parm->gr_next = NULL_GETRESULT;
        !           445:         %}
        !           446:        SEQUENCE
        !           447:        {
        !           448:        versionHeld
        !           449:                [0] EDBVersion [[p &(parm->gr_version)]] ,
        !           450:                [1] EntryDataBlock [[p &(parm->gr_edb)]]
        !           451:                    OPTIONAL
        !           452:        }
        !           453:         %{
        !           454:                 DLOG(log_dsap, LLOG_TRACE, ("Done decode GetEntryDataBlockResult"));
        !           455:         %}
        !           456: 
        !           457: ProtectedPassword [[P struct protected_password **]]
        !           458: %{
        !           459: struct alg_id alg;
        !           460: %}
        !           461:        ::=
        !           462:        %{
        !           463:                DLOG(log_dsap, LLOG_TRACE, ("About to decode ProtectedPassword"));
        !           464:                (*parm) = (struct protected_password *)
        !           465:                        calloc(1, sizeof(**parm));
        !           466:                if ((*parm) == (struct protected_password *) 0)
        !           467:                        return (NOTOK);
        !           468:        (*parm)->protected =  (char) 0;
        !           469:        (*parm)->time1 = NULLCP;
        !           470:        (*parm)->time2 = NULLCP;
        !           471:        (*parm)->random1 = (struct random_number *) 0;
        !           472:        (*parm)->random2 = (struct random_number *) 0;
        !           473:        %}
        !           474:        SEQUENCE
        !           475:        {
        !           476:        algorithm [0] AlgorithmIdentifier [[p &alg]]
        !           477:                OPTIONAL,
        !           478:        salt [1] SET
        !           479:                {
        !           480:                time1 [0] UTCTime [[s (*parm)->time1]] OPTIONAL,
        !           481:                time2 [1] UTCTime [[s (*parm)->time2]] OPTIONAL,
        !           482:                random1 [2] BIT STRING OPTIONAL,
        !           483:                random2 [3] BIT STRING OPTIONAL
        !           484:                } 
        !           485:                %{
        !           486:                (*parm)->protected = (char) 1;
        !           487:                %} 
        !           488:                OPTIONAL,
        !           489:        password [2] OCTET STRING [[o (*parm)->passwd $ (*parm)->n_octets]]
        !           490:        }
        !           491:        %{
        !           492:                DLOG(log_dsap, LLOG_TRACE, ("Done decode ProtectedPassword"));
        !           493:        %}
        !           494: END

unix.superglobalmegacorp.com

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