DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T d

⟦d8350410c⟧ TextFile

    Length: 6597 (0x19c5)
    Types: TextFile
    Names: »ds_bind.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« 
        └─⟦de7628f85⟧ 
            └─⟦this⟧ »isode-6.0/dsap/net/ds_bind.c« 

TextFile

/* ds_bind.c - Establish directory association */

#ifndef lint
static char *rcsid = "$Header: /f/osi/dsap/net/RCS/ds_bind.c,v 7.1 89/11/27 10:30:17 mrose Exp $";
#endif

/*
 * $Header: /f/osi/dsap/net/RCS/ds_bind.c,v 7.1 89/11/27 10:30:17 mrose Exp $
 *
 *
 * $Log:	ds_bind.c,v $
 * Revision 7.1  89/11/27  10:30:17  mrose
 * sync
 * 
 * Revision 7.0  89/11/23  21:48:11  mrose
 * Release 6.0
 * 
 */

/*
 *                                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 "rosap.h"
#include "quipu/util.h"
#include "quipu/connection.h"
#include "quipu/oid.h"

extern  LLog    * log_dsap;
extern  int       dsap_ad;           /* Association descriptor */
extern  int       dsap_id;           /* Last id sent */
extern  char    * dsa_address;  /* address of default dsa */
struct PSAPaddr   dsa_bound;

void acs_log ();
void ros_log ();


ds_bind (arg, error, result)
    struct ds_bind_arg          *arg;
    struct ds_bind_arg          *result;
    struct ds_bind_error        *error;
{
	/* reverse compatability for bind */
	arg->dba_auth_type = DBA_AUTH_SIMPLE;	
	arg->dba_time1 = NULLCP;
	arg->dba_time2 = NULLCP;
	
	return (secure_ds_bind (arg,error,result));
}

secure_ds_bind (arg, error, result)
    struct ds_bind_arg          *arg;
    struct ds_bind_arg          *result;
    struct ds_bind_error        *error;
{
    struct PSAPaddr             *addr;

    if ((addr = str2paddr (dsa_address)) == NULLPA)
    {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("invalid name %s",dsa_address));
	return (DS_ERROR_LOCAL);
    }

    return(dap_bind(&(dsap_ad), arg, error, result, addr));
}

dap_bind (ad, arg, error, result, addr)
    int				* ad;
    struct ds_bind_arg          *arg;
    struct ds_bind_arg          *result;
    struct ds_bind_error        *error;
    struct PSAPaddr             *addr;
{
    PE                          dba_pe;
    PE                          *dba_pep = &(dba_pe);
    struct AcSAPconnect         acc_s;
    struct AcSAPconnect         *acc = &acc_s;
    struct AcSAPindication      aci_s;
    struct AcSAPindication      *aci = &aci_s;
    struct AcSAPabort           *aca = &(aci->aci_abort);
    struct PSAPctxlist          pcs;
    struct PSAPctxlist          *pc = &pcs;
    struct RoSAPindication      roi_s;
    struct RoSAPindication      *roi = &roi_s;
    struct RoSAPpreject         *rop = &(roi->roi_preject);
    OID                         a_ctx;
    OID                         p_ctx;
    OID                         acse_pci;

    DLOG(log_dsap, LLOG_DEBUG, ("dap_bind: Address: %s", paddr2str(addr,NULLNA)));

    if((acse_pci = oid_cpy(DIR_ACSE)) == NULLOID)
    {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("acse pci version 1 OID not found"));
	return NOTOK;
    }

    a_ctx = oid_cpy (DIR_ACCESS_AC);
    p_ctx = oid_cpy (DIR_ACCESS_AS);
    pc->pc_nctx = 2;
    pc->pc_ctx[0].pc_id = 1;
    pc->pc_ctx[0].pc_asn = oid_cpy(p_ctx);
    pc->pc_ctx[0].pc_atn = NULLOID;
    pc->pc_ctx[1].pc_id = 3;
    pc->pc_ctx[1].pc_asn = acse_pci;
    pc->pc_ctx[1].pc_atn = NULLOID;

    if(encode_DAS_DirectoryBindArgument(dba_pep, 0, 0, NULLCP, arg) != OK)
    {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("Couldn't encode DBA"));
	oid_free (a_ctx);
	oid_free (p_ctx);
        oid_free (pc->pc_ctx[0].pc_asn);
        oid_free (pc->pc_ctx[1].pc_asn);
	return(DS_ERROR_LOCAL);
    }
    (*dba_pep) -> pe_context = 3;


#ifdef PDU_DUMP
    pdu_dump (*dba_pep,"arg",100);
#endif

#ifdef	HEAVY_DEBUG
    if (*dba_pep != NULLPE)
	PLOG (log_dsap, print_DAS_DirectoryBindArgument, *dba_pep, "Bind Argument", 0);
#endif

    DLOG (log_dsap, LLOG_NOTICE, ("RY-BIND.REQUEST: <%s, %s, %d, %s>", oid2ode(a_ctx), 
			paddr2str(addr, NULLNA), pc->pc_nctx, oid2ode(p_ctx)));

    if (RyBind(a_ctx, addr, pc, p_ctx, *dba_pep, NOTOK, acc, aci) != OK) {
	acs_log(aca, "A-ASSOCIATE.REQUEST");
	return (DS_ERROR_CONNECT);
    }

    DLOG (log_dsap, LLOG_NOTICE, ("A-ASSOCIATE.CONFIRMATION: <%d, %s%s%s>",
	    acc->acc_sd,
	    AcErrString (acc -> acc_result), 
	    ((acc->acc_result == ACS_ACCEPT) ? "" : ", "),
	    ((acc->acc_result == ACS_ACCEPT) ? "" : AcErrString (acc -> acc_diagnostic))));

    pe_free (*dba_pep);

    if (acc -> acc_result != ACS_ACCEPT) {
	if(acc->acc_ninfo != 0) {
#ifdef HEAVY_DEBUG
	    PLOG (log_dsap, print_DAS_DirectoryBindError, acc->acc_info[0], "Bind Error",1);
#endif
	    if (decode_DAS_DirectoryBindError(acc->acc_info[0],
	    	    1, NULLIP, NULLVP, error) == OK) {
#ifdef PDU_DUMP
        	pdu_dump (acc->acc_info[0],"err",100);
#endif
		return(DS_ERROR_REMOTE);
	    } else {
	        LLOG (log_dsap, LLOG_EXCEPTIONS, ("Malformed DirectoryBindError"));
	    }
	}
	return(DS_ERROR_CONNECT);
    }

    if (acc -> acc_ninfo != 0) {
#ifdef HEAVY_DEBUG
	PLOG (log_dsap, print_DAS_DirectoryBindResult, acc->acc_info[0], "Bind Result",1);
#endif
	if(decode_DAS_DirectoryBindResult(acc->acc_info[0],
		1, NULLIP, NULLVP, result) != OK) {
	    LLOG (log_dsap, LLOG_EXCEPTIONS, ("Malformed DirectoryBindResult"));
	    return(DS_ERROR_CONNECT);
	}
#ifdef PDU_DUMP
	else
	    pdu_dump (acc->acc_info[0],"res",100);
#endif
    }

    dsa_bound = acc -> acc_connect.pc_responding;	/* struct copy */

    (*ad) = acc->acc_sd;

    ACCFREE(acc);

    if(RoSetService((*ad), RoPService, roi) == NOTOK)
    {
	ros_log(rop, "RoSetService");
	return(DS_ERROR_LOCAL);
    }

    return(DS_OK);
}

/*
	Seems that this should be a #define
*/

ds_unbind ()
{
    return(dap_unbind(dsap_ad));
}

dap_unbind (ad)
int	  ad;
{
    struct AcSAPrelease         acr_s;
    struct AcSAPrelease         *acr = &acr_s;
    struct AcSAPindication      aci_s;
    struct AcSAPindication      *aci = &aci_s;
    struct AcSAPabort           *aca = &(aci->aci_abort);

    DLOG(log_dsap, LLOG_NOTICE, ("RY-UNBIND: <%d, normal, nullpe>",
					ad));

    if (RyUnBind (ad, ACF_NORMAL, NULLPE, acr, aci) != OK) {
	acs_log(aca, "A-RELEASE.REQUEST");
	return(DS_ERROR_LOCAL);
    }

    if (!acr->acr_affirmative) {
	LLOG(log_dsap, LLOG_EXCEPTIONS, ("RY-UNBIND failed: %s", 
			AcErrString(acr->acr_reason)));
	DLOG(log_dsap, LLOG_NOTICE, ("A-ABORT.REQUEST: <%d, nullpe>", ad));
	if (AcUAbortRequest(ad, NULLPEP, 0, aci) != OK)
	    LLOG(log_dsap, LLOG_EXCEPTIONS, ("A-ABORT.REQUEST failed: <%d, %s>",
			aca->aca_source, AcErrString(aca->aca_reason)));
	ACRFREE(acr);
	return(DS_ERROR_PROVIDER);
    }


    ACRFREE(acr);

    return(DS_OK);
}