|
|
1.1 root 1: /* dsapcontexts.c - Directory context checking routines */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/dsap/net/RCS/dsapcontexts.c,v 7.0 90/07/26 14:45:50 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/dsap/net/RCS/dsapcontexts.c,v 7.0 90/07/26 14:45:50 mrose Exp $
9: *
10: *
11: * $Log: dsapcontexts.c,v $
12: * Revision 7.0 90/07/26 14:45:50 mrose
13: * *** empty log message ***
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 "quipu/util.h"
31: #include "quipu/dsap.h"
32: #include "tsap.h"
33:
34: extern LLog * log_dsap;
35: #ifndef NO_STATS
36: extern LLog * log_stat;
37: #endif
38:
39:
40: extern OID acse_pci;
41: extern OID x500_da_as;
42: extern OID x500_ds_as;
43: extern OID quipu_ds_as;
44: extern OID x500_da_ac;
45: extern OID x500_ds_ac;
46: extern OID quipu_ds_ac;
47: extern struct PSAPctxlist * x500_da_pcdl;
48: extern struct PSAPctxlist * x500_ds_pcdl;
49: extern struct PSAPctxlist * quipu_ds_pcdl;
50:
51: int select_context (app_ctx)
52: OID app_ctx;
53: {
54: if(oid_cmp(app_ctx, x500_da_ac) == 0)
55: {
56: return(DS_CTX_X500_DAP);
57: }
58:
59: if(oid_cmp(app_ctx, x500_ds_ac) == 0)
60: {
61: return(DS_CTX_X500_DSP);
62: }
63:
64: if(oid_cmp(app_ctx, quipu_ds_ac) == 0)
65: {
66: return(DS_CTX_QUIPU_DSP);
67: }
68:
69: return (NOTOK);
70: }
71:
72: /* ARGSUSED */
73: int judge_ctxlist(req_ctxlist, ok_ctxlist)
74: struct PSAPctxlist * req_ctxlist;
75: struct PSAPctxlist * ok_ctxlist;
76: {
77: int ctxlist_notok = OK;
78: int i;
79: int j;
80: OID ok_asn;
81: OID req_asn;
82:
83: DLOG (log_dsap, LLOG_TRACE, ("judge_ctxlist"));
84:
85: for(i=0; i<req_ctxlist->pc_nctx; i++)
86: {
87: DLOG (log_dsap, LLOG_DEBUG, ("Context (%d): id=%d, %s",
88: i,
89: req_ctxlist->pc_ctx[i].pc_id,
90: oid2ode (req_ctxlist->pc_ctx[i].pc_asn)));
91:
92: if(req_ctxlist->pc_ctx[i].pc_result == PC_ACCEPT)
93: req_ctxlist->pc_ctx[i].pc_result = PC_REJECTED;
94: }
95:
96: for(j=0; j<ok_ctxlist->pc_nctx; j++)
97: {
98: ok_asn = ok_ctxlist->pc_ctx[j].pc_asn;
99: for(i=0; i<req_ctxlist->pc_nctx; i++)
100: {
101: if((req_asn = req_ctxlist->pc_ctx[i].pc_asn) == NULLOID) {
102: LLOG (log_dsap,LLOG_EXCEPTIONS,( "Reject: asn is NULLOID"));
103: continue;
104: }
105:
106: if((oid_cmp(req_asn, ok_asn) == 0))
107: break;
108: }
109: if(i < req_ctxlist->pc_nctx) {
110: req_ctxlist->pc_ctx[i].pc_result = PC_ACCEPT;
111: } else {
112: LLOG (log_dsap, LLOG_EXCEPTIONS, ("Missing Context: %s", oid2ode (ok_asn)));
113: ctxlist_notok = NOTOK;
114: }
115: }
116:
117: #ifdef DEBUG
118: for(i=0; i<req_ctxlist->pc_nctx; i++)
119: {
120: DLOG(log_dsap, LLOG_DEBUG, ("ctx[%d] id = %d, res = %d.", i,
121: req_ctxlist->pc_ctx[i].pc_id,
122: req_ctxlist->pc_ctx[i].pc_result));
123:
124: if(req_ctxlist->pc_ctx[i].pc_result == PC_REJECTED)
125: DLOG (log_dsap, LLOG_DEBUG, ("Context Rejected: id=%d, %s",
126: req_ctxlist->pc_ctx[i].pc_id,
127: oid2ode (req_ctxlist->pc_ctx[i].pc_asn)));
128:
129: }
130: #endif
131:
132: return(ctxlist_notok);
133: }
134:
135: int find_ctx_id(pcdl, ctx_oid)
136: struct PSAPctxlist * pcdl;
137: OID ctx_oid;
138: {
139: int i;
140:
141: DLOG (log_dsap, LLOG_TRACE, ("find_ctx_id"));
142:
143: for(i=0; i<pcdl->pc_nctx; i++)
144: {
145: if(oid_cmp(ctx_oid, pcdl->pc_ctx[i].pc_asn) == 0)
146: break;
147: }
148:
149: if(i < pcdl->pc_nctx)
150: return(pcdl->pc_ctx[i].pc_id);
151:
152: LLOG(log_dsap, LLOG_EXCEPTIONS, ("Couldn't find context identifier %s", sprintoid(ctx_oid)));
153:
154: return(NOTOK);
155: }
156:
157: int check_dap_ctxlist (ctxlist)
158: struct PSAPctxlist * ctxlist;
159: {
160: if (judge_ctxlist (ctxlist, x500_da_pcdl) != OK)
161: return (NOTOK);
162:
163: return (find_ctx_id (ctxlist, x500_da_as));
164: }
165:
166: int check_dsp_ctxlist (ctxlist)
167: struct PSAPctxlist * ctxlist;
168: {
169: if (judge_ctxlist (ctxlist, x500_ds_pcdl) != OK)
170: return (NOTOK);
171:
172: return (find_ctx_id (ctxlist, x500_ds_as));
173: }
174:
175: int check_qsp_ctxlist (ctxlist)
176: struct PSAPctxlist * ctxlist;
177: {
178: if (judge_ctxlist (ctxlist, quipu_ds_pcdl) != OK)
179: return (NOTOK);
180:
181: return (find_ctx_id (ctxlist, quipu_ds_as));
182: }
183:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.