Annotation of 43BSDReno/contrib/isode-beta/dsap/common/ufn_aet.c, revision 1.1.1.1

1.1       root        1: /* ufn_aei.c - user-friendly aei lookup */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/dsap/common/RCS/ufn_aet.c,v 7.1 90/07/09 14:35:17 mrose Exp $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/dsap/common/RCS/ufn_aet.c,v 7.1 90/07/09 14:35:17 mrose Exp $
                      9:  *
                     10:  *
                     11:  * $Log:       ufn_aet.c,v $
                     12:  * Revision 7.1  90/07/09  14:35:17  mrose
                     13:  * sync
                     14:  * 
                     15:  * Revision 7.0  90/06/20  08:40:43  mrose
                     16:  * *** empty log message ***
                     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: #include "quipu/ufn.h"
                     32: #include "quipu/list.h"
                     33: #include "quipu/ds_search.h"
                     34: #include "quipu/connection.h"  /* ds_search uses di_block - include this for lint !!! */
                     35: #include "quipu/dua.h"
                     36: 
                     37: extern LLog * log_dsap;
                     38: extern LLog * addr_log;
                     39: 
                     40: extern Filter ocfilter ();
                     41: extern Filter joinfilter ();
                     42: 
                     43: extern char PY_pepy[];
                     44: void   PY_advise ();
                     45: 
                     46: 
                     47: static Filter aet_filter (context)
                     48: char * context;
                     49: {
                     50: Filter a,b;
                     51: 
                     52:        if ((a = ocfilter ("ApplicationEntity")) == NULLFILTER)
                     53:                return NULLFILTER;
                     54: 
                     55:        b = filter_alloc ();
                     56:        b->flt_next = a;
                     57:        b->flt_type = FILTER_ITEM;
                     58:        b->FUITEM.fi_type = FILTERITEM_EQUALITY;
                     59:        if ((b->FUITEM.UNAVA.ava_type = AttrT_new (APPLCTX_OID)) == NULLAttrT) {
                     60:                LLOG (log_dsap,LLOG_EXCEPTIONS,("supported application context attribute unknown"))
                     61:                return NULLFILTER;
                     62:        }
                     63:        b->FUITEM.UNAVA.ava_value = str2AttrV(context,
                     64:                b->FUITEM.UNAVA.ava_type->oa_syntax);
                     65:        if (b->FUITEM.UNAVA.ava_value == NULLAttrV) {
                     66:                LLOG (log_dsap,LLOG_EXCEPTIONS,("'%s' unknown OID",context));
                     67:                return NULLFILTER;
                     68:        }
                     69: 
                     70:        return joinfilter (b,FILTER_AND);
                     71: }
                     72: 
                     73: static aet_search (base, subtree, filt, res)
                     74: DN base;
                     75: char subtree;
                     76: Filter filt;
                     77: DNS * res;
                     78: {
                     79: struct ds_search_arg search_arg;
                     80: static struct ds_search_result result;
                     81: struct DSError err;
                     82: static CommonArgs ca = default_common_args;
                     83: EntryInfo * ptr;
                     84: DNS newdns, r = NULLDNS;
                     85: 
                     86:        search_arg.sra_baseobject = base;
                     87:        search_arg.sra_filter = filt;
                     88:        if (subtree)
                     89:                search_arg.sra_subset = SRA_WHOLESUBTREE;
                     90:        else    
                     91:                search_arg.sra_subset = SRA_ONELEVEL;
                     92:        search_arg.sra_searchaliases = TRUE;
                     93:        search_arg.sra_common = ca; /* struct copy */
                     94:        search_arg.sra_eis.eis_infotypes = TRUE;
                     95:        search_arg.sra_eis.eis_allattributes = TRUE;
                     96:        search_arg.sra_eis.eis_select = NULLATTR;
                     97: 
                     98:        if (ds_search (&search_arg, &err, &result) != DS_OK) {
                     99:                log_ds_error (&err);
                    100:                ds_error_free (&err);
                    101:                return FALSE;
                    102:        }
                    103: 
                    104:        correlate_search_results (&result);
                    105: 
                    106:        if ( (result.CSR_limitproblem != LSR_NOLIMITPROBLEM) || (result.CSR_cr != NULLCONTINUATIONREF)) {
                    107:                if ( ! result.CSR_entries)
                    108:                        return FALSE;
                    109:        }
                    110: 
                    111:        for (ptr = result.CSR_entries; ptr != NULLENTRYINFO; ptr=ptr->ent_next) {
                    112:                cache_entry (ptr,FALSE,TRUE);
                    113:                newdns = dn_seq_alloc();
                    114:                newdns->dns_next = r;
                    115:                newdns->dns_dn = dn_cpy (ptr->ent_dn);
                    116:                r = newdns;
                    117:        }
                    118: 
                    119:        *res = r;
                    120: 
                    121:        return TRUE;
                    122: }
                    123: 
                    124: 
                    125: aet_match (c,v,interact,result,el,context)
                    126: int c;
                    127: char ** v;
                    128: DNS *result;
                    129: DNS (* interact) ();
                    130: envlist el;
                    131: char * context;
                    132: {
                    133: DNS ufnr = NULLDNS;
                    134: DNS newap = NULLDNS;
                    135: DNS apps = NULLDNS;
                    136: DNS dns, DNS_append();
                    137: Filter filt;
                    138: int ok = TRUE;
                    139: 
                    140:        if (!ufn_match (c,v,interact,&ufnr,el)) {
                    141:                char buffer[BUFSIZ];
                    142: 
                    143:                (void) sprintf (buffer, "ufn_match failed: %s", PY_pepy);
                    144:                (void) strcpy (PY_pepy, buffer);
                    145:                SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s", PY_pepy));
                    146:                *result = NULLDNS;
                    147:                return FALSE;
                    148:        }
                    149: 
                    150:        filt = aet_filter(context);
                    151: 
                    152:        for (dns = ufnr; dns != NULLDNS; dns=dns->dns_next) {
                    153:                newap = NULLDNS;
                    154:                if (aet_search (dns->dns_dn,FALSE,filt,&newap))
                    155:                        apps = DNS_append (apps,newap);
                    156:                else
                    157:                    ok = FALSE;
                    158:        }
                    159: 
                    160:        if ((apps == NULLDNS) && ok) {
                    161:                /* go deeper */
                    162:                for (dns = ufnr; dns != NULLDNS; dns=dns->dns_next) {
                    163:                        if (dns->dns_dn->dn_parent == NULLDN)
                    164:                                /* too high for subtree search */
                    165:                                continue;
                    166:                        newap = NULLDNS;
                    167:                        if (aet_search (dns->dns_dn,TRUE,filt,&newap))
                    168:                                apps = DNS_append (apps,newap);
                    169:                        else
                    170:                                ok = FALSE;
                    171:                }
                    172:        }
                    173: 
                    174:        if (!ok && !apps) {
                    175:            PY_advise (NULLCP,
                    176:                       "search for applicationEntity supporting \"%s\" failed",
                    177:                       context);
                    178:            SLOG (addr_log, LLOG_EXCEPTIONS, NULLCP, ("%s", PY_pepy));
                    179:        }
                    180: 
                    181:        filter_free (filt);
                    182: 
                    183:        dn_seq_free (ufnr);
                    184: 
                    185:        *result = apps;
                    186: 
                    187:        return ok;
                    188: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.