Annotation of 43BSDTahoe/new/xns/morexnslib/auth/Authcredcheck.c, revision 1.1.1.1

1.1       root        1: #include <stdio.h>
                      2: /* $Header: Authcredcheck.c,v 1.3 87/03/23 10:25:03 ed Exp $ */
                      3: 
                      4: /*
                      5:  * Copyright (c) 1986, 1987 Xerox Corporation.
                      6:  */
                      7: 
                      8: /* contains:
                      9:  * Auth_Credcheck
                     10:  */
                     11: 
                     12: /* $Log:       Authcredcheck.c,v $
                     13:  * Revision 1.3  87/03/23  10:25:03  ed
                     14:  * Minor change.
                     15:  * 
                     16:  * Revision 1.2  87/01/13  16:37:16  ed
                     17:  * Added checks for null credentials formats
                     18:  * 
                     19:  * Revision 1.1  87/01/05  11:50:10  ed
                     20:  * Initial revision
                     21:  * 
                     22:  */
                     23: #include <sys/types.h>
                     24: #include <netns/ns.h>
                     25: #include "Authentication2_defs.h"
                     26: #include <xnscourier/courier.h>
                     27: #include <xnscourier/except.h>
                     28: 
                     29: /*
                     30:  * This module contains the routine:
                     31:  * Boolean Auth_CredCheck(creds, verifier)
                     32:  *     Credentials creds;
                     33:  *     Verifier verifier;
                     34:  */
                     35: 
                     36: Boolean Auth_CredCheck(creds, verifier)
                     37:        Credentials creds;
                     38:        Verifier verifier;
                     39: {
                     40:        CourierConnection *conn;
                     41:        extern CourierConnection *Auth_GetFirstAuth();
                     42:        CheckSimpleCredentialsResults result;
                     43:        Boolean retval;
                     44:        Unspecified *bp, buffer[SPPMAXDATA];
                     45:        ThreePartName chs_name;
                     46:        Cardinal len;
                     47:        
                     48:        if ( creds.type != simpleCredentials )
                     49:                return(FALSE);
                     50: 
                     51:        if ( creds.value.length == 0 )                  /* nullCredentials */
                     52:                return(TRUE);
                     53: 
                     54:        externalize_Sequence_of_Unspecified(&creds.value, buffer);
                     55:        bp= buffer;
                     56:        bp += internalize_Cardinal(&len, bp);
                     57:        internalize_SimpleCredentials(&chs_name, bp);
                     58:        if ( chs_name.organization[0] == '\0' && chs_name.domain[0] == '\0' &&
                     59:                        chs_name.object[0] == '\0' )
                     60:                return(TRUE);                           /* is this valid ?? */
                     61: 
                     62:        if ((conn = Auth_GetFirstAuth()) == NULL) {
                     63:                fprintf(stderr,"Can't open connection to local Authentication service\n");
                     64:                return(FALSE);
                     65:        }
                     66: 
                     67:        DURING {
                     68:                result= CheckSimpleCredentials(conn, NULL, creds, verifier);
                     69:        } HANDLER {
                     70:                return(FALSE);
                     71:        } END_HANDLER;
                     72: 
                     73:        if ( result.ok == TRUE )
                     74:                retval= TRUE;
                     75:        else
                     76:                retval= FALSE;
                     77: 
                     78:        CourierClose(conn);
                     79:        return(retval);
                     80: }

unix.superglobalmegacorp.com

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