Annotation of 43BSDReno/contrib/isode-beta/ftam/ftamacl.c, revision 1.1

1.1     ! root        1: /* ftamacl.c - FPM: encode/decode access control lists (SETs of AC elements) */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/ftam/RCS/ftamacl.c,v 7.1 90/03/23 10:53:55 mrose Exp $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/ftam/RCS/ftamacl.c,v 7.1 90/03/23 10:53:55 mrose Exp $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       ftamacl.c,v $
        !            12:  * Revision 7.1  90/03/23  10:53:55  mrose
        !            13:  * update
        !            14:  * 
        !            15:  * Revision 7.0  89/11/23  21:53:22  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: /* LINTLIBRARY */
        !            32: 
        !            33: #include <stdio.h>
        !            34: #include "fpkt.h"
        !            35: 
        !            36: /*  */
        !            37: 
        !            38: struct type_FTAM_Access__Control__List *acl2fpm (fsb, fe, fti)
        !            39: register struct ftamblk *fsb;
        !            40: register struct FTAMacelement *fe;
        !            41: struct FTAMindication *fti;
        !            42: {
        !            43:     struct type_FTAM_Access__Control__List *fpmp;
        !            44:     register struct type_FTAM_Access__Control__List  *fpm,
        !            45:                                                    **fpc;
        !            46:     register struct type_FTAM_Access__Control__Element *ace;
        !            47: 
        !            48:     fpmp = NULL, fpc = &fpmp;
        !            49:     for (; fe; fe = fe -> fe_next) {
        !            50:        if ((fpm = (struct type_FTAM_Access__Control__List *)
        !            51:                        calloc (1, sizeof *fpm)) == NULL) {
        !            52: no_mem: ;
        !            53:            (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
        !            54: out: ;
        !            55:            if (fpmp)
        !            56:                free_FTAM_Access__Control__List (fpmp);
        !            57:            return NULL;
        !            58:        }
        !            59:        *fpc = fpm;
        !            60: 
        !            61:        if ((ace = (struct type_FTAM_Access__Control__Element *)
        !            62:                        calloc (1, sizeof *ace)) == NULL)
        !            63:            goto no_mem;
        !            64:        fpm -> Access__Control__Element = ace;
        !            65: 
        !            66:        if (fe -> fe_actions & FA_PERM_TRAVERSAL) {
        !            67:            (void) ftamlose (fti, FS_GEN (fsb), 0, NULLCP,
        !            68:                             "bad value for action-list");
        !            69:            goto out;
        !            70:        }
        !            71:        if ((ace -> action__list = bits2fpm (fsb, frequested_pairs,
        !            72:                                             fe -> fe_actions, fti)) == NULL)
        !            73:            goto out;
        !            74: 
        !            75:        if (conctl_present (&fe -> fe_concurrency)
        !            76:                && (ace -> concurrency__access =
        !            77:                                conacc2fpm (fsb, &fe -> fe_concurrency, fti))
        !            78:                        == NULL)
        !            79:            goto out;
        !            80: 
        !            81:        if (fe -> fe_identity
        !            82:                && (ace -> identity = str2qb (fe -> fe_identity,
        !            83:                                              strlen (fe -> fe_identity), 1))
        !            84:                        == NULL)
        !            85:            goto no_mem;
        !            86: 
        !            87:        if (passes_present (&fe -> fe_passwords)
        !            88:                && (ace -> passwords = pass2fpm (fsb, &fe -> fe_passwords, fti))
        !            89:                        == NULL)
        !            90:            goto out;
        !            91: 
        !            92:        if (fe -> fe_aet) {
        !            93:            if ((ace -> location = (struct type_ACS_AE__title *)
        !            94:                                        calloc (1, sizeof *ace -> location))
        !            95:                    == NULL)
        !            96:                goto no_mem;
        !            97:            if (ace -> location -> title = fe -> fe_aet -> aei_ap_title)
        !            98:                ace -> location -> title -> pe_refcnt++;
        !            99:            if (ace -> location -> qualifier = fe -> fe_aet -> aei_ae_qualifier)
        !           100:                ace -> location -> qualifier -> pe_refcnt++;
        !           101:        }
        !           102: 
        !           103:        fpc = &fpm -> next;
        !           104:     }
        !           105: 
        !           106:     return fpmp;
        !           107: }
        !           108: 
        !           109: /*  */
        !           110: 
        !           111: int    fpm2acl (fsb, fpm, fe, fti)
        !           112: register struct ftamblk *fsb;
        !           113: register struct type_FTAM_Access__Control__List *fpm;
        !           114: register struct FTAMacelement **fe;
        !           115: struct FTAMindication *fti;
        !           116: {
        !           117:     register struct FTAMacelement *fc,
        !           118:                                 **fl;
        !           119:     register struct type_FTAM_Access__Control__Element *ace;
        !           120: 
        !           121:     *(fl = fe) = NULL;
        !           122: 
        !           123:     for (; fpm; fpm = fpm -> next) {
        !           124:        ace = fpm -> Access__Control__Element;
        !           125: 
        !           126:        if ((fc = (struct FTAMacelement *) calloc (1, sizeof *fc)) == NULL) {
        !           127: no_mem: ;
        !           128:            (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
        !           129: out: ;
        !           130:            if (fc = *fl)
        !           131:                FEFREE (fc);
        !           132:            return NOTOK;
        !           133:        }
        !           134: 
        !           135:        if (fpm2bits (fsb, frequested_pairs, ace -> action__list,
        !           136:                      &fc -> fe_actions, fti) == NOTOK)
        !           137:            goto out;
        !           138: 
        !           139:        FCINIT (&fc -> fe_concurrency);
        !           140:        if (ace -> concurrency__access
        !           141:                && fpm2conacc (fsb, ace -> concurrency__access,
        !           142:                               &fc -> fe_concurrency, fti) == NOTOK)
        !           143:            goto out;
        !           144: 
        !           145:        if (ace -> identity
        !           146:                && (fc -> fe_identity = qb2str (ace -> identity)) == NULL)
        !           147:            goto no_mem;
        !           148: 
        !           149:        if (ace -> passwords
        !           150:                && fpm2pass (fsb, ace -> passwords, &fc -> fe_passwords, fti)
        !           151:                        == NOTOK)
        !           152:            goto out;
        !           153: 
        !           154:        if (ace -> location) {
        !           155:            if ((fc -> fe_aet = (AEI) calloc (1, sizeof *fc -> fe_aet))
        !           156:                    == NULL)
        !           157:                goto no_mem;
        !           158:            if (ace -> location -> title
        !           159:                    && (fc -> fe_aet -> aei_ap_title
        !           160:                                = pe_cpy (ace -> location -> title)) == NULLPE)
        !           161:                goto no_mem;
        !           162:            if (ace -> location -> qualifier
        !           163:                    && (fc -> fe_aet -> aei_ae_qualifier
        !           164:                                = pe_cpy (ace -> location -> qualifier))
        !           165:                            == NULLPE)
        !           166:                goto no_mem;
        !           167:        }
        !           168: 
        !           169:        fe = &((*fe) -> fe_next);
        !           170:     }
        !           171: 
        !           172:     return OK;
        !           173: }

unix.superglobalmegacorp.com

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