Annotation of 43BSDTahoe/new/xns/examples/filing_common/unixcreds.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char *rcsid = "$Header: unixcreds.c,v 1.2 87/04/01 10:12:52 ed Exp $";
        !             3: #endif lint
        !             4: 
        !             5: /*
        !             6:  * Copyright (c) 1986, 1987 Xerox Corporation.
        !             7:  */
        !             8: 
        !             9: /* $Log:       unixcreds.c,v $
        !            10:  * Revision 1.2  87/04/01  10:12:52  ed
        !            11:  * added Filing version 5.
        !            12:  * 
        !            13:  * Revision 1.1  87/01/14  11:28:25  ed
        !            14:  * Initial revision
        !            15:  * 
        !            16:  */
        !            17: 
        !            18: #include <stdio.h>
        !            19: #include <sys/types.h>
        !            20: #include <netns/ns.h>
        !            21: #include <netns/sp.h>
        !            22: #ifdef FILING4
        !            23: #include "filingV4.h"
        !            24: #include "clearinghouseV2.h"
        !            25: #include "authenticationV2.h"
        !            26: #endif FILING4
        !            27: #ifdef FILING5
        !            28: #include "filingV5.h"
        !            29: #include "clearinghouseV2.h"
        !            30: #include "authenticationV2.h"
        !            31: #endif FILING5
        !            32: #ifdef FILING6
        !            33: #include "filingV6.h"
        !            34: #include "clearinghouseV3.h"
        !            35: #include "authenticationV3.h"
        !            36: #endif FILING6
        !            37: #ifdef FILINGSUBSET1
        !            38: #include "filingsubsetV1.h"
        !            39: #include "clearinghouseV3.h"
        !            40: #include "authenticationV3.h"
        !            41: #endif FILINGSUBSET1
        !            42: #include <xnscourier/filing_server.h>
        !            43: #include <xnscourier/CH.h>
        !            44: 
        !            45: extern char *AttrToString();
        !            46: 
        !            47: #ifdef DEBUG
        !            48: FILE *msgs;
        !            49: #endif DEBUG
        !            50: 
        !            51: get_name_and_pwd(creds, name, pwd)
        !            52: FILING_SecondaryCredentials *creds;
        !            53: char *name;
        !            54: char *pwd;
        !            55: 
        !            56: {
        !            57:        int i;
        !            58:        FILING_SecondaryItem *item;
        !            59:        Boolean gotname= FALSE, gotpwd= FALSE;
        !            60:        char *user, *pass;
        !            61: 
        !            62:         if ( creds->designator != FILING_simple ) {
        !            63:                        ReturnAuthenticationError(FILING_secondaryCredentialsRequired);
        !            64:                        /* NOT REACHED */
        !            65:        }
        !            66: 
        !            67: #ifdef DEBUG
        !            68:        fprintf(msgs, "%n secondary types\n", creds->FILING_simple_case.length);
        !            69: #endif DEBUG
        !            70: 
        !            71:        if ( creds->FILING_simple_case.length <= 0 ) {
        !            72:                ReturnAuthenticationError(FILING_secondaryCredentialsRequired);
        !            73:                /* NOT REACHED */
        !            74:        }
        !            75: 
        !            76:        for ( i= 0 ; i < creds->FILING_simple_case.length ; i++ ) {
        !            77:                item= &creds->FILING_simple_case.sequence[i];
        !            78: 
        !            79:                if ( item->type == FILING_userName ) {
        !            80:                        gotname= TRUE;
        !            81:                        user= AttrToString(item);
        !            82:                        strcpy(name, user);
        !            83:                        clear_String(&user);
        !            84:                } else if ( item->type == FILING_userPassword ) {
        !            85:                        gotpwd= TRUE;
        !            86:                        pass= AttrToString(item);
        !            87:                        strcpy(pwd, pass);
        !            88:                        clear_String(&pass);
        !            89:                } else {
        !            90:                        ReturnAuthenticationError(FILING_secondaryCredentialsTypeInvalid);
        !            91:                        /* NOT REACHED */
        !            92:                }
        !            93: 
        !            94:        }
        !            95: 
        !            96:        if ( !gotname && !gotpwd ) {
        !            97:                ReturnAuthenticationError(FILING_secondaryCredentialsRequired);
        !            98:                /* NOT REACHED */
        !            99:        }
        !           100: 
        !           101:        return(-1);
        !           102: }

unix.superglobalmegacorp.com

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