File:  [CSRG BSD Unix] / 43BSDTahoe / new / xns / morexnslib / auth / Authcredcheck.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:58 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43tahoe
BSD 4.3tahoe

#include <stdio.h>
/* $Header: /var/lib/cvsd/repos/CSRG/43BSDTahoe/new/xns/morexnslib/auth/Authcredcheck.c,v 1.1.1.1 2018/04/24 16:12:58 root Exp $ */

/*
 * Copyright (c) 1986, 1987 Xerox Corporation.
 */

/* contains:
 * Auth_Credcheck
 */

/* $Log: Authcredcheck.c,v $
/* Revision 1.1.1.1  2018/04/24 16:12:58  root
/* BSD 4.3tahoe
/*
 * Revision 1.3  87/03/23  10:25:03  ed
 * Minor change.
 * 
 * Revision 1.2  87/01/13  16:37:16  ed
 * Added checks for null credentials formats
 * 
 * Revision 1.1  87/01/05  11:50:10  ed
 * Initial revision
 * 
 */
#include <sys/types.h>
#include <netns/ns.h>
#include "Authentication2_defs.h"
#include <xnscourier/courier.h>
#include <xnscourier/except.h>

/*
 * This module contains the routine:
 * Boolean Auth_CredCheck(creds, verifier)
 *	Credentials creds;
 *	Verifier verifier;
 */

Boolean Auth_CredCheck(creds, verifier)
	Credentials creds;
	Verifier verifier;
{
	CourierConnection *conn;
	extern CourierConnection *Auth_GetFirstAuth();
	CheckSimpleCredentialsResults result;
	Boolean retval;
	Unspecified *bp, buffer[SPPMAXDATA];
	ThreePartName chs_name;
	Cardinal len;
	
	if ( creds.type != simpleCredentials )
		return(FALSE);

	if ( creds.value.length == 0 )			/* nullCredentials */
		return(TRUE);

	externalize_Sequence_of_Unspecified(&creds.value, buffer);
	bp= buffer;
	bp += internalize_Cardinal(&len, bp);
	internalize_SimpleCredentials(&chs_name, bp);
	if ( chs_name.organization[0] == '\0' && chs_name.domain[0] == '\0' &&
			chs_name.object[0] == '\0' )
		return(TRUE);				/* is this valid ?? */

	if ((conn = Auth_GetFirstAuth()) == NULL) {
		fprintf(stderr,"Can't open connection to local Authentication service\n");
		return(FALSE);
	}

	DURING {
		result= CheckSimpleCredentials(conn, NULL, creds, verifier);
	} HANDLER {
		return(FALSE);
	} END_HANDLER;

	if ( result.ok == TRUE )
		retval= TRUE;
	else
		retval= FALSE;

	CourierClose(conn);
	return(retval);
}

unix.superglobalmegacorp.com

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