Commit | Line | Data |
---|---|---|
48435ab0 WJ |
1 | /* acsapdse.c - application entity info -- directory service interface */ |
2 | ||
3 | #ifndef lint | |
4 | static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapdse.c,v 7.4 91/02/22 09:14:06 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/acsap/RCS/acsapdse.c,v 7.4 91/02/22 09:14:06 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: acsapdse.c,v $ | |
12 | * Revision 7.4 91/02/22 09:14:06 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.3 90/12/11 10:51:56 mrose | |
16 | * lock-and-load | |
17 | * | |
18 | * Revision 7.2 90/07/09 14:30:29 mrose | |
19 | * sync | |
20 | * | |
21 | * Revision 7.1 90/07/01 21:01:53 mrose | |
22 | * pepsy | |
23 | * | |
24 | * Revision 7.0 89/11/23 21:21:47 mrose | |
25 | * Release 6.0 | |
26 | * | |
27 | */ | |
28 | ||
29 | /* | |
30 | * NOTICE | |
31 | * | |
32 | * Acquisition, use, and distribution of this module and related | |
33 | * materials are subject to the restrictions of a license agreement. | |
34 | * Consult the Preface in the User's Manual for the full terms of | |
35 | * this agreement. | |
36 | * | |
37 | */ | |
38 | ||
39 | ||
40 | /* LINTLIBRARY */ | |
41 | ||
42 | #include <stdio.h> | |
43 | #include "DSE-types.h" | |
44 | #include "psap.h" | |
45 | #include "isoaddrs.h" | |
46 | #include "tailor.h" | |
47 | ||
48 | /* \f DATA */ | |
49 | ||
50 | static AEInfo aeis; | |
51 | static struct PSAPaddr pas; | |
52 | ||
53 | extern PE name2value_dase (); | |
54 | ||
55 | PE (*acsap_lookup) () = name2value_dase; | |
56 | ||
57 | /* \f */ | |
58 | ||
59 | AEI str2aei_dse (string, context, ontty, userdn, passwd) | |
60 | char *string, | |
61 | *context, | |
62 | *userdn, | |
63 | *passwd; | |
64 | int ontty; | |
65 | { | |
66 | char *alias, | |
67 | name[BUFSIZ]; | |
68 | PE pe; | |
69 | register AEI aei = &aeis; | |
70 | register struct PSAPaddr *pa = &pas; | |
71 | static int first_time = 1; | |
72 | ||
73 | if (first_time) | |
74 | first_time = 0; | |
75 | else { | |
76 | AEIFREE (aei); | |
77 | } | |
78 | bzero ((char *) aei, sizeof *aei); | |
79 | ||
80 | if ((alias = alias2name (string)) == NULL) | |
81 | alias = string; | |
82 | (void) strcpy (name, alias); | |
83 | ||
84 | if (acsap_lookup == NULL) { | |
85 | PY_advise (NULLCP, "str2aei_dse: acsap_lookup function not set"); | |
86 | SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s", PY_pepy)); | |
87 | return NULLAEI; | |
88 | } | |
89 | ||
90 | bzero ((char *) pa, sizeof *pa); | |
91 | if (pe = (*acsap_lookup) (name, context, ontty, userdn, passwd, | |
92 | &aei -> aei_ap_title)) { | |
93 | if (parse_DSE_PSAPaddr (pe, 1, NULLIP, NULLVP, (char *) pa) == NOTOK) { | |
94 | SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, | |
95 | ("parse of presentationAddress failed: %s", PY_pepy)); | |
96 | } | |
97 | else | |
98 | PLOG (addr_log, print_DSE_PSAPaddr, pe, "address", 1); | |
99 | ||
100 | pe_free (pe); | |
101 | } | |
102 | else | |
103 | SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, | |
104 | ("directory returns no value")); | |
105 | ||
106 | return (aei -> aei_ap_title ? aei : NULLAEI); | |
107 | } | |
108 | ||
109 | /* \f */ | |
110 | ||
111 | struct PSAPaddr *aei2addr_dse (aei) | |
112 | AEI aei; | |
113 | { | |
114 | register struct PSAPaddr *pa; | |
115 | ||
116 | if (aei != &aeis) { | |
117 | SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, | |
118 | ("aei2addr_dse cache miss on %s", sprintaei (aei))); | |
119 | ||
120 | return NULLPA; | |
121 | } | |
122 | ||
123 | return ((pa = &pas) -> pa_addr.sa_addr.ta_naddr > 0 ? pa : NULLPA); | |
124 | } |