/* ftamacl.c - FPM: encode/decode access control lists (SETs of AC elements) */
static char *rcsid
= "$Header: /f/osi/ftam/RCS/ftamacl.c,v 7.3 91/02/22 09:22:36 mrose Interim $";
* $Header: /f/osi/ftam/RCS/ftamacl.c,v 7.3 91/02/22 09:22:36 mrose Interim $
* Revision 7.3 91/02/22 09:22:36 mrose
* Revision 7.2 90/08/14 14:27:59 mrose
* Revision 7.1 90/03/23 10:53:55 mrose
* Revision 7.0 89/11/23 21:53:22 mrose
* 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
struct type_FTAM_Access__Control__List
*acl2fpm (fsb
, fe
, fti
)
register struct ftamblk
*fsb
;
register struct FTAMacelement
*fe
;
struct FTAMindication
*fti
;
struct type_FTAM_Access__Control__List
*fpmp
;
register struct type_FTAM_Access__Control__List
*fpm
,
register struct type_FTAM_Access__Control__Element
*ace
;
fpmp
= NULL
, fpc
= &fpmp
;
for (; fe
; fe
= fe
-> fe_next
) {
if ((fpm
= (struct type_FTAM_Access__Control__List
*)
calloc (1, sizeof *fpm
)) == NULL
) {
(void) ftamlose (fti
, FS_GEN (fsb
), 1, NULLCP
, "out of memory");
free_FTAM_Access__Control__List (fpmp
);
*fpc
= fpm
, fpc
= &fpm
-> next
;
if ((ace
= (struct type_FTAM_Access__Control__Element
*)
calloc (1, sizeof *ace
)) == NULL
)
fpm
-> Access__Control__Element
= ace
;
if (fe
-> fe_actions
& FA_PERM_TRAVERSAL
) {
(void) ftamlose (fti
, FS_GEN (fsb
), 0, NULLCP
,
"bad value for action-list");
if ((ace
-> action__list
= bits2fpm (fsb
, frequested_pairs
,
fe
-> fe_actions
, fti
)) == NULL
)
if (conctl_present (&fe
-> fe_concurrency
)
&& (ace
-> concurrency__access
=
conacc2fpm (fsb
, &fe
-> fe_concurrency
, fti
))
&& (ace
-> identity
= str2qb (fe
-> fe_identity
,
strlen (fe
-> fe_identity
), 1))
if (passes_present (&fe
-> fe_passwords
)
&& (ace
-> passwords
= pass2fpm (fsb
, &fe
-> fe_passwords
, fti
))
if ((ace
-> location
= (struct type_ACS_AE__title
*)
calloc (1, sizeof *ace
-> location
))
if (ace
-> location
-> title
= fe
-> fe_aet
-> aei_ap_title
)
ace
-> location
-> title
-> pe_refcnt
++;
if (ace
-> location
-> qualifier
= fe
-> fe_aet
-> aei_ae_qualifier
)
ace
-> location
-> qualifier
-> pe_refcnt
++;
int fpm2acl (fsb
, fpm
, fe
, fti
)
register struct ftamblk
*fsb
;
register struct type_FTAM_Access__Control__List
*fpm
;
register struct FTAMacelement
**fe
;
struct FTAMindication
*fti
;
register struct FTAMacelement
*fc
,
register struct type_FTAM_Access__Control__Element
*ace
;
for (; fpm
; fpm
= fpm
-> next
) {
ace
= fpm
-> Access__Control__Element
;
if ((fc
= (struct FTAMacelement
*) calloc (1, sizeof *fc
)) == NULL
) {
(void) ftamlose (fti
, FS_GEN (fsb
), 1, NULLCP
, "out of memory");
*fe
= fc
, fe
= &fc
-> fe_next
;
if (fpm2bits (fsb
, frequested_pairs
, ace
-> action__list
,
&fc
-> fe_actions
, fti
) == NOTOK
)
FCINIT (&fc
-> fe_concurrency
);
if (ace
-> concurrency__access
&& fpm2conacc (fsb
, ace
-> concurrency__access
,
&fc
-> fe_concurrency
, fti
) == NOTOK
)
&& (fc
-> fe_identity
= qb2str (ace
-> identity
)) == NULL
)
&& fpm2pass (fsb
, ace
-> passwords
, &fc
-> fe_passwords
, fti
)
if ((fc
-> fe_aet
= (AEI
) calloc (1, sizeof *fc
-> fe_aet
))
if (ace
-> location
-> title
&& (fc
-> fe_aet
-> aei_ap_title
= pe_cpy (ace
-> location
-> title
)) == NULLPE
)
if (ace
-> location
-> qualifier
&& (fc
-> fe_aet
-> aei_ae_qualifier
= pe_cpy (ace
-> location
-> qualifier
))