Annotation of 43BSDReno/contrib/isode-beta/ftam/ftampass.c, revision 1.1.1.1

1.1       root        1: /* ftampass.c - FPM: encode/decode access passwords */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/ftam/RCS/ftampass.c,v 7.0 89/11/23 21:53:44 mrose Rel $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/ftam/RCS/ftampass.c,v 7.0 89/11/23 21:53:44 mrose Rel $
                      9:  *
                     10:  *
                     11:  * $Log:       ftampass.c,v $
                     12:  * Revision 7.0  89/11/23  21:53:44  mrose
                     13:  * Release 6.0
                     14:  * 
                     15:  */
                     16: 
                     17: /*
                     18:  *                               NOTICE
                     19:  *
                     20:  *    Acquisition, use, and distribution of this module and related
                     21:  *    materials are subject to the restrictions of a license agreement.
                     22:  *    Consult the Preface in the User's Manual for the full terms of
                     23:  *    this agreement.
                     24:  *
                     25:  */
                     26: 
                     27: 
                     28: /* LINTLIBRARY */
                     29: 
                     30: #include <stdio.h>
                     31: #include "fpkt.h"
                     32: 
                     33: /*  */
                     34: 
                     35: struct type_FTAM_Access__Passwords *pass2fpm (fsb, fp, fti)
                     36: register struct ftamblk *fsb;
                     37: register struct FTAMpasswords *fp;
                     38: struct FTAMindication *fti;
                     39: {
                     40:     register struct type_FTAM_Access__Passwords *fpm;
                     41: 
                     42:     if ((fpm = (struct type_FTAM_Access__Passwords *)
                     43:                    calloc (1, sizeof *fpm)) == NULL) {
                     44: no_mem: ;
                     45:        (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
                     46:        if (fpm)
                     47:            free_FTAM_Access__Passwords (fpm);
                     48:        return NULL;
                     49:     }
                     50: 
                     51: #define        dopass(s,t,u) \
                     52: { \
                     53:     if ((fpm -> s = (struct type_FTAM_Password *) \
                     54:                            calloc (1, sizeof *fpm -> s)) \
                     55:            == NULL) \
                     56:        goto no_mem; \
                     57:     fpm -> s -> offset = type_FTAM_Password_binary; \
                     58:     if ((fpm -> s -> un.binary = str2qb (fp -> t, fp -> u, 1)) == NULL) \
                     59:        goto no_mem; \
                     60: }
                     61: 
                     62:     dopass (read__password, fp_read, fp_readlen);
                     63:     dopass (insert__password, fp_insert, fp_insertlen);
                     64:     dopass (replace__password, fp_replace, fp_replacelen);
                     65:     dopass (extend__password, fp_extend, fp_extendlen);
                     66:     dopass (erase__password, fp_erase, fp_eraselen);
                     67:     dopass (read__attribute__password, fp_readattr, fp_readattrlen);
                     68:     dopass (change__attribute__password, fp_chngattr, fp_chngattrlen);
                     69:     dopass (delete__password, fp_delete, fp_deletelen);
                     70: 
                     71: #undef dopass
                     72: 
                     73:     return fpm;
                     74: }
                     75: 
                     76: /*  */
                     77: 
                     78: int    fpm2pass (fsb, fpm, fp, fti)
                     79: register struct ftamblk *fsb;
                     80: register struct type_FTAM_Access__Passwords *fpm;
                     81: register struct FTAMpasswords *fp;
                     82: struct FTAMindication *fti;
                     83: {
                     84:     register struct qbuf *qb;
                     85: 
                     86:     bzero ((char *) fp, sizeof *fp);
                     87: 
                     88: /* both choices of this structure are qbuf's, so... */
                     89: #define        dopass(s,t,u) \
                     90: { \
                     91:     qb = fpm -> s -> un.graphic; \
                     92:  \
                     93:     if ((fp -> t = qb2str (qb)) == NULL) \
                     94:        goto no_mem; \
                     95:     fp -> u = qb -> qb_len; \
                     96: }
                     97: 
                     98:     dopass (read__password, fp_read, fp_readlen);
                     99:     dopass (insert__password, fp_insert, fp_insertlen);
                    100:     dopass (replace__password, fp_replace, fp_replacelen);
                    101:     dopass (extend__password, fp_extend, fp_extendlen);
                    102:     dopass (erase__password, fp_erase, fp_eraselen);
                    103:     dopass (read__attribute__password, fp_readattr, fp_readattrlen);
                    104:     dopass (change__attribute__password, fp_chngattr, fp_chngattrlen);
                    105:     dopass (delete__password, fp_delete, fp_deletelen);
                    106: 
                    107: #undef dopass
                    108: 
                    109:     return OK;
                    110: 
                    111: no_mem: ;
                    112:     FPFREE (fp);
                    113:     return ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
                    114: }

unix.superglobalmegacorp.com

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