|
|
Initial revision
/* dsapcontexts.c - Directory context checking routines */
#ifndef lint
static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/dsap/net/dsapcontexts.c,v 1.1 2018/04/24 16:12:56 root Exp $";
#endif
/*
* $Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/dsap/net/dsapcontexts.c,v 1.1 2018/04/24 16:12:56 root Exp $
*
*
* $Log: dsapcontexts.c,v $
* Revision 1.1 2018/04/24 16:12:56 root
* Initial revision
*
* Revision 7.0 90/07/26 14:45:50 mrose
* *** empty log message ***
*
*/
/*
* NOTICE
*
* 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
* this agreement.
*
*/
/* LINTLIBRARY */
#include "quipu/util.h"
#include "quipu/dsap.h"
#include "tsap.h"
extern LLog * log_dsap;
#ifndef NO_STATS
extern LLog * log_stat;
#endif
extern OID acse_pci;
extern OID x500_da_as;
extern OID x500_ds_as;
extern OID quipu_ds_as;
extern OID x500_da_ac;
extern OID x500_ds_ac;
extern OID quipu_ds_ac;
extern struct PSAPctxlist * x500_da_pcdl;
extern struct PSAPctxlist * x500_ds_pcdl;
extern struct PSAPctxlist * quipu_ds_pcdl;
int select_context (app_ctx)
OID app_ctx;
{
if(oid_cmp(app_ctx, x500_da_ac) == 0)
{
return(DS_CTX_X500_DAP);
}
if(oid_cmp(app_ctx, x500_ds_ac) == 0)
{
return(DS_CTX_X500_DSP);
}
if(oid_cmp(app_ctx, quipu_ds_ac) == 0)
{
return(DS_CTX_QUIPU_DSP);
}
return (NOTOK);
}
/* ARGSUSED */
int judge_ctxlist(req_ctxlist, ok_ctxlist)
struct PSAPctxlist * req_ctxlist;
struct PSAPctxlist * ok_ctxlist;
{
int ctxlist_notok = OK;
int i;
int j;
OID ok_asn;
OID req_asn;
DLOG (log_dsap, LLOG_TRACE, ("judge_ctxlist"));
for(i=0; i<req_ctxlist->pc_nctx; i++)
{
DLOG (log_dsap, LLOG_DEBUG, ("Context (%d): id=%d, %s",
i,
req_ctxlist->pc_ctx[i].pc_id,
oid2ode (req_ctxlist->pc_ctx[i].pc_asn)));
if(req_ctxlist->pc_ctx[i].pc_result == PC_ACCEPT)
req_ctxlist->pc_ctx[i].pc_result = PC_REJECTED;
}
for(j=0; j<ok_ctxlist->pc_nctx; j++)
{
ok_asn = ok_ctxlist->pc_ctx[j].pc_asn;
for(i=0; i<req_ctxlist->pc_nctx; i++)
{
if((req_asn = req_ctxlist->pc_ctx[i].pc_asn) == NULLOID) {
LLOG (log_dsap,LLOG_EXCEPTIONS,( "Reject: asn is NULLOID"));
continue;
}
if((oid_cmp(req_asn, ok_asn) == 0))
break;
}
if(i < req_ctxlist->pc_nctx) {
req_ctxlist->pc_ctx[i].pc_result = PC_ACCEPT;
} else {
LLOG (log_dsap, LLOG_EXCEPTIONS, ("Missing Context: %s", oid2ode (ok_asn)));
ctxlist_notok = NOTOK;
}
}
#ifdef DEBUG
for(i=0; i<req_ctxlist->pc_nctx; i++)
{
DLOG(log_dsap, LLOG_DEBUG, ("ctx[%d] id = %d, res = %d.", i,
req_ctxlist->pc_ctx[i].pc_id,
req_ctxlist->pc_ctx[i].pc_result));
if(req_ctxlist->pc_ctx[i].pc_result == PC_REJECTED)
DLOG (log_dsap, LLOG_DEBUG, ("Context Rejected: id=%d, %s",
req_ctxlist->pc_ctx[i].pc_id,
oid2ode (req_ctxlist->pc_ctx[i].pc_asn)));
}
#endif
return(ctxlist_notok);
}
int find_ctx_id(pcdl, ctx_oid)
struct PSAPctxlist * pcdl;
OID ctx_oid;
{
int i;
DLOG (log_dsap, LLOG_TRACE, ("find_ctx_id"));
for(i=0; i<pcdl->pc_nctx; i++)
{
if(oid_cmp(ctx_oid, pcdl->pc_ctx[i].pc_asn) == 0)
break;
}
if(i < pcdl->pc_nctx)
return(pcdl->pc_ctx[i].pc_id);
LLOG(log_dsap, LLOG_EXCEPTIONS, ("Couldn't find context identifier %s", sprintoid(ctx_oid)));
return(NOTOK);
}
int check_dap_ctxlist (ctxlist)
struct PSAPctxlist * ctxlist;
{
if (judge_ctxlist (ctxlist, x500_da_pcdl) != OK)
return (NOTOK);
return (find_ctx_id (ctxlist, x500_da_as));
}
int check_dsp_ctxlist (ctxlist)
struct PSAPctxlist * ctxlist;
{
if (judge_ctxlist (ctxlist, x500_ds_pcdl) != OK)
return (NOTOK);
return (find_ctx_id (ctxlist, x500_ds_as));
}
int check_qsp_ctxlist (ctxlist)
struct PSAPctxlist * ctxlist;
{
if (judge_ctxlist (ctxlist, quipu_ds_pcdl) != OK)
return (NOTOK);
return (find_ctx_id (ctxlist, quipu_ds_as));
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.