|
|
1.1 ! root 1: /* dsapbind2.c - DSAP: DirectoryBind mapping onto ABSTRACT-BIND */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/dsap/net/RCS/dsapbind2.c,v 7.0 90/07/26 14:45:49 mrose Exp $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/dsap/net/RCS/dsapbind2.c,v 7.0 90/07/26 14:45:49 mrose Exp $ ! 9: * ! 10: * ! 11: * $Log: dsapbind2.c,v $ ! 12: * Revision 7.0 90/07/26 14:45:49 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 "logger.h" ! 31: #include "quipu/dsap.h" ! 32: ! 33: extern LLog * log_dsap; ! 34: ! 35: /* D-BIND.INDICATION */ ! 36: ! 37: /* ARGSUSED */ ! 38: ! 39: int DBindInit (vecp, vec, ds, di) ! 40: int vecp; ! 41: char **vec; ! 42: struct DSAPstart * ds; ! 43: struct DSAPindication * di; ! 44: { ! 45: int result; ! 46: struct RoNOTindication rni_s; ! 47: struct RoNOTindication * rni = &(rni_s); ! 48: struct AcSAPstart * acs = &(ds->ds_start); ! 49: struct ds_bind_arg * bind_arg = &(ds->ds_bind_arg); ! 50: ! 51: if (result = RoBindInit (vecp, vec, acs, rni) != OK) ! 52: { ! 53: return (ronot2dsaplose (di, "D-BIND.INDICATION", rni)); ! 54: } ! 55: ! 56: /* ADT: Generalised context checking support would be useful */ ! 57: ! 58: /* Check application context and set flag in ds->ds_ctx */ ! 59: ! 60: ds->ds_sd = acs->acs_sd; ! 61: ! 62: switch (ds->ds_ctx = select_context (acs->acs_context)) ! 63: { ! 64: case DS_CTX_X500_DAP: ! 65: if ((ds->ds_pctx_id = check_dap_ctxlist (&(acs->acs_start.ps_ctxlist))) == NOTOK) ! 66: { ! 67: LLOG(log_dsap,LLOG_EXCEPTIONS, ("Unacceptable Abstract Syntaxes for X.500 DAP")); ! 68: (void) RoBindReject (acs, ACS_TRANSIENT, ACS_USER_NOREASON, rni); ! 69: return (dsaplose (di, DA_PCDL, NULLCP, "DAP BIND INDICATION")); ! 70: } ! 71: break; ! 72: ! 73: case DS_CTX_X500_DSP: ! 74: if ((ds->ds_pctx_id = check_dsp_ctxlist (&(acs->acs_start.ps_ctxlist))) == NOTOK) ! 75: { ! 76: LLOG(log_dsap,LLOG_EXCEPTIONS, ("Unacceptable Abstract Syntaxes for X.500 DSP")); ! 77: (void) RoBindReject (acs, ACS_TRANSIENT, ACS_USER_NOREASON, rni); ! 78: return (dsaplose (di, DA_PCDL, NULLCP, "DSP BIND INDICATION")); ! 79: } ! 80: break; ! 81: ! 82: case DS_CTX_QUIPU_DSP: ! 83: if ((ds->ds_pctx_id = check_qsp_ctxlist (&(acs->acs_start.ps_ctxlist))) == NOTOK) ! 84: { ! 85: LLOG(log_dsap,LLOG_EXCEPTIONS, ("Unacceptable Abstract Syntaxes for QUIPU DSP")); ! 86: (void) RoBindReject (acs, ACS_TRANSIENT, ACS_USER_NOREASON, rni); ! 87: return (dsaplose (di, DA_PCDL, NULLCP, "QSP BIND INDICATION")); ! 88: } ! 89: break; ! 90: ! 91: case NOTOK: ! 92: default: ! 93: (void) RoBindReject(acs, ACS_TRANSIENT, ACS_CONTEXT, rni); ! 94: return (dsaplose (di, DA_APP_CONTEXT, NULLCP, "BIND INDICATION")); ! 95: } ! 96: ! 97: /* ! 98: * Most applications would dispatch on the context established, ! 99: * but since all directory protocols have the same Bind Argument ! 100: * we just fall through... ! 101: */ ! 102: ! 103: /* Decode bind argument */ ! 104: if ((acs->acs_ninfo != 1) || (acs->acs_info[0] == NULLPE)) ! 105: { ! 106: (void) RoBindReject (acs, ACS_TRANSIENT, ACS_USER_NOREASON, rni); ! 107: return (dsaplose (di, DA_ARG_DEC, NULLCP, "BIND INDICATION")); ! 108: } ! 109: ! 110: bind_arg = &(ds->ds_bind_arg); ! 111: if (decode_DAS_DirectoryBindArgument (acs->acs_info[0], ! 112: 1, NULLCP, NULLIP, bind_arg) != OK) ! 113: { ! 114: (void) RoBindReject (acs, ACS_TRANSIENT, ACS_USER_NOREASON, rni); ! 115: return (dsaplose (di, DA_ARG_DEC, NULLCP, "BIND INDICATION")); ! 116: } ! 117: ! 118: DLOG(log_dsap,LLOG_DEBUG, ("Bind Argument decoded")); ! 119: ! 120: return (result); ! 121: } ! 122: ! 123: /* ARGSUSED */ ! 124: ! 125: /* D-BIND.RESULT */ ! 126: ! 127: int DBindResult (sd, context, respondtitle, ! 128: respondaddr, ctxlist, defctxresult, prequirements, ! 129: srequirements, isn, settings, ref, bind_res, pctx_id, di) ! 130: int sd; ! 131: OID context; ! 132: AEI respondtitle; ! 133: struct PSAPaddr * respondaddr; ! 134: struct PSAPctxlist * ctxlist; ! 135: int defctxresult; ! 136: int prequirements; ! 137: int srequirements; ! 138: long isn; ! 139: int settings; ! 140: struct SSAPref * ref; ! 141: struct ds_bind_arg * bind_res; ! 142: int pctx_id; ! 143: struct DSAPindication * di; ! 144: { ! 145: int result; ! 146: PE bindrespe; ! 147: struct RoNOTindication rni_s; ! 148: struct RoNOTindication * rni = &(rni_s); ! 149: ! 150: if (encode_DAS_DirectoryBindResult (&(bindrespe), 1, NULLIP, NULLCP, ! 151: bind_res) != OK) ! 152: { ! 153: /* RoBindReject ?? */ ! 154: return (dsaplose (di, DA_RES_ENC, NULLCP, "BIND RESULT")); ! 155: } ! 156: bindrespe->pe_context = pctx_id; ! 157: ! 158: result = RoBindResult (sd, context, respondtitle, ! 159: respondaddr, ctxlist, defctxresult, prequirements, ! 160: srequirements, isn, settings, ref, bindrespe, rni); ! 161: ! 162: if (bindrespe != NULLPE) ! 163: { ! 164: pe_free (bindrespe); ! 165: } ! 166: ! 167: if (result == NOTOK) ! 168: { ! 169: /* Have an RoNOTindication, need to return DSAPindication */ ! 170: return (ronot2dsaplose (di, "RO-BIND.RESULT", rni)); ! 171: } ! 172: ! 173: return (result); ! 174: } ! 175: ! 176: /* ARGSUSED */ ! 177: ! 178: /* D-BIND.ERROR */ ! 179: ! 180: int DBindError (sd, context, respondtitle, respondaddr, ctxlist, ! 181: defctxresult, prequirements, srequirements, isn, settings, ! 182: ref, bind_err, pctx_id, di) ! 183: int sd; ! 184: OID context; ! 185: AEI respondtitle; ! 186: struct PSAPaddr * respondaddr; ! 187: struct PSAPctxlist * ctxlist; ! 188: int defctxresult; ! 189: int prequirements; ! 190: int srequirements; ! 191: long isn; ! 192: int settings; ! 193: struct SSAPref * ref; ! 194: struct ds_bind_error * bind_err; ! 195: int pctx_id; ! 196: struct DSAPindication * di; ! 197: { ! 198: int result; ! 199: PE binderrpe; ! 200: struct RoNOTindication rni_s; ! 201: struct RoNOTindication * rni = &(rni_s); ! 202: ! 203: if (encode_DAS_DirectoryBindError (&(binderrpe), 1, NULLIP, NULLCP, ! 204: bind_err) != OK) ! 205: { ! 206: /* RoBindReject ?? */ ! 207: return (dsaplose (di, DA_ERR_ENC, NULLCP, "BIND ERROR")); ! 208: } ! 209: binderrpe->pe_context = pctx_id; ! 210: ! 211: result = RoBindError (sd, context, ! 212: respondtitle, respondaddr, ctxlist, defctxresult, ! 213: prequirements, srequirements, isn, settings, ref, ! 214: binderrpe, rni); ! 215: ! 216: if (binderrpe != NULLPE) ! 217: { ! 218: pe_free (binderrpe); ! 219: } ! 220: ! 221: if (result == NOTOK) ! 222: { ! 223: return (ronot2dsaplose (di, "RO-BIND.ERROR", rni)); ! 224: } ! 225: ! 226: return (result); ! 227: } ! 228: ! 229: /* ARGSUSED */ ! 230: ! 231: /* D-BIND.REJECT */ ! 232: ! 233: int DBindReject (ds, status, reason, di) ! 234: struct DSAPstart * ds; ! 235: int status; ! 236: int reason; ! 237: struct DSAPindication * di; ! 238: { ! 239: int result; ! 240: struct AcSAPstart * acs = &(ds->ds_start); ! 241: struct RoNOTindication rni_s; ! 242: struct RoNOTindication * rni = &(rni_s); ! 243: ! 244: result = RoBindReject (acs, status, reason, rni); ! 245: ! 246: if (result == NOTOK) ! 247: { ! 248: return (ronot2dsaplose (di, "RO-BIND.ERROR", rni)); ! 249: } ! 250: ! 251: return (result); ! 252: } ! 253:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.