|
|
1.1 root 1: /* aetdap.c - DAP-based DSE */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/dsap/common/RCS/aetdap.c,v 7.1 90/07/09 14:33:47 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/dsap/common/RCS/aetdap.c,v 7.1 90/07/09 14:33:47 mrose Exp $
9: *
10: *
11: * $Log: aetdap.c,v $
12: * Revision 7.1 90/07/09 14:33:47 mrose
13: * sync
14: *
15: * Revision 7.0 89/11/23 21:48:08 mrose
16: * Release 6.0
17: *
18: */
19:
20: /*
21: * NOTICE
22: *
23: * Acquisition, use, and distribution of this module and related
24: * materials are subject to the restrictions of a license agreement.
25: * Consult the Preface in the User's Manual for the full terms of
26: * this agreement.
27: *
28: */
29:
30:
31: /* LINTLIBRARY */
32:
33: #include "quipu/util.h"
34: #include "quipu/read.h"
35: #include "quipu/dua.h"
36: #include "quipu/bind.h"
37: #include "tailor.h"
38:
39:
40: static char unbind = FALSE;
41:
42: /* */
43:
44: /* ARGSUSED */
45:
46: static PE name2value_dap (name, qualifier, context, ontty, real_name)
47: char *name,
48: *qualifier,
49: *context;
50: int ontty;
51: PE *real_name;
52: {
53: char buffer[BUFSIZ];
54: DN dn;
55: AttributeType at;
56: static int bound = FALSE;
57: extern char * oidtable;
58: extern PE grab_pe();
59: PE res_pe;
60: static struct ds_read_arg read_arg =
61: {
62: default_common_args,
63: NULLDN, /* read_arg DN */
64: { /* entry info selection */
65: FALSE,
66: NULLATTR,
67: EIS_ATTRIBUTESANDVALUES
68: }
69: };
70: struct DSError error;
71: struct ds_read_result result;
72:
73: *real_name = NULLPE;
74:
75: (void) sprintf (buffer, "%s@cn=%s", name, qualifier);
76: name = buffer;
77:
78: if ( (dn=str2dn (name)) == NULLDN) {
79: PY_advise (NULLCP, "build of DN failed: %s", name);
80: out: ;
81: SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s", PY_pepy));
82: return NULLPE;
83: }
84:
85: if ( (at = AttrT_new (DSAADDRESS_OID)) == NULLAttrT) {
86: dn_free (dn);
87: PY_advise (NULLCP, "build of attribute failed: %s",
88: DSAADDRESS_OID);
89: goto out;
90: }
91:
92: if (! bound) {
93: if (bind_as_null () != DS_OK) {
94: PY_advise (NULLCP, "bind to directory failed");
95: dn_free (dn);
96: AttrT_free (at);
97: goto out;
98: }
99: bound = TRUE;
100: }
101:
102: read_arg.rda_common.ca_servicecontrol.svc_prio = SVC_PRIO_HIGH;
103: read_arg.rda_object = dn;
104: read_arg.rda_eis.eis_select = as_comp_new (AttrT_cpy (at), NULLAV, NULLACL_INFO);
105:
106: if (ds_read (&read_arg,&error,&result) != DS_OK) {
107: PY_advise (NULLCP, "DAP lookup failed: %s",name);
108: log_ds_error (&error);
109: ds_error_free (&error);
110: if (unbind) {
111: bound = FALSE;
112: (void) ds_unbind();
113: }
114: dn_free (dn);
115: AttrT_free (at);
116: as_free (read_arg.rda_eis.eis_select);
117: goto out;
118: } else {
119: (void) encode_IF_DistinguishedName (real_name,1,0,NULLCP,dn);
120: if (result.rdr_entry.ent_attr == NULLATTR) {
121: PY_advise (NULLCP, "No '%s' attribute in entry '%s'",
122: DSAADDRESS_OID, name);
123: if (unbind) {
124: bound = FALSE;
125: (void) ds_unbind();
126: }
127: dn_free (dn);
128: AttrT_free (at);
129: as_free (read_arg.rda_eis.eis_select);
130: goto out;
131: }
132: if (unbind) {
133: bound = FALSE;
134: (void) ds_unbind();
135: }
136: dn_free (dn);
137: AttrT_free (at);
138: as_free (read_arg.rda_eis.eis_select);
139: res_pe = grab_pe(&result.rdr_entry.ent_attr->attr_value->avseq_av);
140: as_free (result.rdr_entry.ent_attr);
141: return (res_pe);
142: }
143: }
144:
145: /* */
146:
147: static bind_as_null ()
148: {
149: struct ds_bind_arg bindarg;
150: struct ds_bind_arg bindresult;
151: struct ds_bind_error binderr;
152:
153: bindarg.dba_version = DBA_VERSION_V1988;
154: bindarg.dba_passwd_len = 0;
155: bindarg.dba_dn = NULLDN;
156:
157: return (ds_bind (&bindarg,&binderr,&bindresult)) ;
158: }
159:
160: /* */
161:
162: set_lookup_dap (flag)
163: char flag; /* if TRUE always unbind */
164: {
165: extern char * oidtable;
166:
167: unbind = flag;
168: string_syntaxes();
169:
170: acsap_lookup = name2value_dap;
171:
172: if (dsap_tai_init () != OK)
173: LLOG (addr_log,LLOG_EXCEPTIONS,("DAP initialization failed"));
174:
175: load_oid_table (oidtable);
176: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.