/* aetufn.c - UFN-based DSE */
static char *rcsid
= "$Header: /f/osi/dsap/common/RCS/aetufn.c,v 7.4 91/02/22 09:18:09 mrose Interim $";
* $Header: /f/osi/dsap/common/RCS/aetufn.c,v 7.4 91/02/22 09:18:09 mrose Interim $
* Revision 7.4 91/02/22 09:18:09 mrose
* Revision 7.3 90/12/11 10:53:50 mrose
* Revision 7.2 90/10/17 11:40:51 mrose
* Revision 7.1 90/07/09 14:33:49 mrose
* Revision 7.0 90/07/06 23:18:10 mrose
* *** empty log message ***
* 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
extern struct dn_seq
*dn_seq_push ();
static DNS
ufn_interact (dns
,dn
,s
)
(void) printf ("Please select from the following (matching '%s'):\n",s
);
(void) printf (" %s [y/n] ? ",dn2ufn(dns
->dns_dn
,FALSE
));
if (gets (buf
) == NULL
) {
|| ((buf
[0] != 'y') && (buf
[0] != 'n'))) {
(void) printf ("Please type 'y' or 'n': ");
dns
-> dns_next
= result
;
static DNS
just_say_no (dns
,dn
,s
)
/* we only want good hits ! */
SLOG (addr_log
, LLOG_NOTICE
, NULLCP
,
("UFN asked for interactive response -- auto reply of NO"));
static DN username
= NULLDN
;
static char password
[DBA_MAX_PASSWD_LEN
] = "";
struct ds_bind_arg bindarg
;
struct ds_bind_arg bindresult
;
struct ds_bind_error binderr
;
bindarg
.dba_version
= DBA_VERSION_V1988
;
bindarg
.dba_dn
= username
;
if (bindarg
.dba_passwd_len
= strlen (password
))
(void) strcpy (bindarg
.dba_passwd
, password
);
if (ds_bind (&bindarg
,&binderr
,&bindresult
) != DS_OK
) {
PY_advise (NULLCP
, "unable to bind to directory (%s)",
binderr
.dbe_type
== DBE_TYPE_SECURITY
? "security error"
static char bound
= FALSE
;
static struct ds_read_arg read_arg
=
NULLDN
, /* read_arg DN */
{ /* entry info selection */
struct ds_read_result result
;
if ( (at
= AttrT_new (DSAADDRESS_OID
)) == NULLAttrT
) {
PY_advise (NULLCP
, "build of attribute failed: %s",
SLOG (addr_log
, LLOG_EXCEPTIONS
, NULLCP
, ("%s", PY_pepy
));
read_arg
.rda_common
.ca_servicecontrol
.svc_prio
= SVC_PRIO_HIGH
;
read_arg
.rda_object
= dn
;
read_arg
.rda_eis
.eis_select
= as_comp_new (AttrT_cpy (at
), NULLAV
, NULLACL_INFO
);
if (ds_read (&read_arg
,&error
,&result
) != DS_OK
) {
PY_advise (NULLCP
, "DAP lookup failed: %s",dn2str(dn
));
as_free (read_arg
.rda_eis
.eis_select
);
if (result
.rdr_entry
.ent_attr
== NULLATTR
) {
PY_advise (NULLCP
, "No '%s' attribute in entry '%s'",
DSAADDRESS_OID
,dn2str(dn
));
as_free (read_arg
.rda_eis
.eis_select
);
as_free (read_arg
.rda_eis
.eis_select
);
res_pe
= grab_pe(&result
.rdr_entry
.ent_attr
->attr_value
->avseq_av
);
as_free (result
.rdr_entry
.ent_attr
);
static char unbind
= FALSE
;
static envlist el
= NULLEL
;
static PE
name2value_ufn (name
, context
, ontty
, userdn
, passwd
, real_name
)
char * v
[20],buffer
[LINESIZE
];
dn_free (username
), username
= NULLDN
;
if ((username
= str2dn (userdn
)) == NULLDN
) {
PY_advise (NULLCP
, "invalid DN for binding: \"%s\"", userdn
);
(void) strcpy (password
, passwd
);
(void) strcpy (buffer
, name
);
if ((dnstat
= str2dn (buffer
)) == NULLDN
) {
PY_advise (NULLCP
, "invalid name");
addr
= name2psap (*(dn
= &dnstat
));
if ((n
= sstr2arg (buffer
,20,v
,",")) == NOTOK
) {
PY_advise (NULLCP
, "invalid name");
SLOG (addr_log
, LLOG_EXCEPTIONS
, NULLCP
, ("%s", PY_pepy
));
if ( ! aet_match (n
, v
, ontty
? ufn_interact
: just_say_no
, &dns
, el
,
if (PY_pepy
[0] == NULL
) {
PY_advise (NULLCP
, "unable to resolve name");
PY_advise (NULLCP
, "search failed to find anything");
if (dns
->dns_next
== NULLDNS
) {
/* Continue until one works */
(void) dnSelect (name
,&dns
,ufn_interact
,el
->Dns
);
for (; dns
!= NULLDNS
; dns
=dns
->dns_next
) {
if (addr
= name2psap (*dn
))
(void) encode_IF_DistinguishedName (real_name
, 1, 0, NULLCP
, *dn
);
&& (ps
= ps_alloc (str_open
))
&& str_setup (ps
, NULLCP
, 0, 0) != NOTOK
) {
(void) ufn_dn_print_aux (ps
, *dn
, NULLDN
, 0);
*--ps
-> ps_ptr
= NULL
, ps
-> ps_cnt
++;
(void) printf ("[ using %s ]\n", ps
-> ps_base
);
ps
-> ps_ptr
= ps
-> ps_base
, ps
-> ps_cnt
= ps
-> ps_bufsiz
;
static int inited
= FALSE
;
dsap_init ((int *)0,(char ***)0);
if (el
= read_envlist ())
if (local_dn
= str2dn (local_dit
)) {
DN dn
= local_dn
-> dn_parent
;
local_dn
-> dn_parent
= NULLDN
;
c_dn
= dn_cpy (local_dn
);
local_dn
-> dn_parent
= dn
;
if ((en
= (envlist
) calloc (1, sizeof **ep
)) == NULL
) {
SLOG (addr_log
, LLOG_EXCEPTIONS
, NULLCP
, ("out of memory"));
*ep
= en
, ep
= &en
-> Next
;
dn_seq_push (c_dn
, dn_seq_push (NULLDN
, NULLDNSEQ
)));
en
-> Upper
= en
-> Lower
= 1;
if ((en
= (envlist
) calloc (1, sizeof **ep
)) == NULL
)
*ep
= en
, ep
= &en
-> Next
;
dn_seq_push (local_dn
, dn_seq_push (NULLDN
, NULLDNSEQ
)));
en
-> Upper
= en
-> Lower
= 2;
if ((en
= (envlist
) calloc (1, sizeof **ep
)) == NULL
)
*ep
= en
, ep
= &en
-> Next
;
dn_seq_push (c_dn
, dn_seq_push (local_dn
, NULLDNSEQ
)));
en
-> Upper
= 32767, en
-> Lower
= 3;
char flag
; /* if TRUE always unbind */
if ((unbind
= flag
) && bound
) {
acsap_lookup
= name2value_ufn
;
#ifdef STANDALONE_AET_TEST
ontty
= isatty (fileno (stdin
));
(void) strcat (buffer
," ");
(void) strcat (buffer
, argv
[n
]);
isodetailor ("ufn_aet",1);
dsap_init ((int *)0,(char ***)0);
addr_log
-> ll_events
|= LLOG_ALL
, addr_log
-> ll_stat
|= LLOGTTY
;
if (pe
= name2value_ufn (buffer
, "iso ftam", ontty
, &title
)) {
if (parse_DSE_PSAPaddr (pe
, 1, NULLIP
, NULLVP
, (char *) &pas
)
fprintf (stderr
, "parse of presentation address failed: %s",
(void) printf ("%s\n", paddr2str (&pas
));
fprintf (stderr
, "directory returns no value");
(void) printf ("AETitle\n");