Annotation of 43BSDReno/contrib/isode-beta/quipu/dish/list.c, revision 1.1.1.1

1.1       root        1: /* list.c - */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/list.c,v 7.0 89/11/23 22:20:11 mrose Rel $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/quipu/dish/RCS/list.c,v 7.0 89/11/23 22:20:11 mrose Rel $
                      9:  *
                     10:  *
                     11:  * $Log:       list.c,v $
                     12:  * Revision 7.0  89/11/23  22:20:11  mrose
                     13:  * Release 6.0
                     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: #include "quipu/util.h"
                     29: #include "quipu/list.h"
                     30: #include "quipu/sequence.h"
                     31: 
                     32: extern DN       dn;
                     33: 
                     34: #define        OPT     (!frompipe || rps -> ps_byteno == 0 ? opt : rps)
                     35: #define        RPS     (!frompipe || opt -> ps_byteno == 0 ? rps : opt)
                     36: extern char    frompipe;
                     37: extern PS      opt, rps;
                     38: 
                     39: extern char    move_flag;
                     40: 
                     41: extern int      sizelimit;
                     42: char  list_show;
                     43: 
                     44: call_list (argc, argv)
                     45: int             argc;
                     46: char          **argv;
                     47: {
                     48:        struct ds_list_arg list_arg;
                     49:        struct ds_list_result result;
                     50:        struct list_cache *ptr;
                     51:        struct DSError  error;
                     52:        int             x;
                     53:        char            nocacheflag = FALSE;
                     54:        extern  int     copy_flag;
                     55: 
                     56:        list_show = TRUE;
                     57:        move_flag = FALSE;
                     58: 
                     59:        list_arg.lsa_common.ca_servicecontrol.svc_sizelimit = sizelimit;
                     60: 
                     61:        if ((argc = service_control (OPT, argc, argv, &list_arg.lsa_common)) == -1)
                     62:                return;
                     63: 
                     64:        for (x = 1; x < argc; x++) {
                     65: 
                     66:                if (test_arg (argv[x], "-nocache",4))
                     67:                        nocacheflag = TRUE;
                     68:                else if (test_arg (argv[x], "-noshow",4))
                     69:                        list_show = FALSE;
                     70:                else if (test_arg (argv[x], "-move",2))
                     71:                        move_flag = TRUE;
                     72:                else if (test_arg (argv[x], "-nomove",3))
                     73:                        move_flag = FALSE;
                     74:                else if (move (argv[x]) == OK)
                     75:                        continue;
                     76:                else {
                     77:                        ps_printf (OPT,"Unknown option %s\n",argv[x]);
                     78:                        Usage (argv[0]);
                     79:                        return;
                     80:                }
                     81: 
                     82:        }
                     83: 
                     84:        list_arg.lsa_object = dn;
                     85: 
                     86:        if ((!nocacheflag) && copy_flag)
                     87:                if ((ptr = find_list_cache (dn,list_arg.lsa_common.ca_servicecontrol.svc_sizelimit)) != NULLCACHE) {
                     88:                        print_list_subordinates (ptr->list_subs, ptr->list_problem);
                     89:                        consolidate_move();
                     90:                        return;
                     91:                }
                     92: 
                     93:        if (rebind () != OK)
                     94:                return;
                     95: 
                     96:        /* Strong authentication */
                     97:        if (list_arg.lsa_common.ca_security != (struct security_parms *) 0)
                     98:        {
                     99:        int encode_DAS_ListArgumentData();
                    100:        struct signature *sign_operation();
                    101: 
                    102:        list_arg.lsa_common.ca_sig = 
                    103:                sign_operation((caddr_t)&list_arg, encode_DAS_ListArgumentData);
                    104:        }
                    105: 
                    106:        while (ds_list (&list_arg, &error, &result) != DS_OK) { /* deal with error */
                    107:                if (dish_error (OPT, &error) == 0)
                    108:                        return;
                    109:                list_arg.lsa_object = error.ERR_REFERRAL.DSE_ref_candidates->cr_name;
                    110:        }
                    111: 
                    112:        if (result.lsr_common.cr_aliasdereferenced) {
                    113:                ps_print (RPS, "(Alias dereferenced - ");
                    114:                dn_print (RPS, result.lsr_object, EDBOUT);
                    115:                dn_free (result.lsr_object);
                    116:                ps_print (RPS, ")\n");
                    117:        }
                    118:        print_list_subordinates (result.lsr_subordinates, result.lsr_limitproblem);
                    119: 
                    120:        cache_list (result.lsr_subordinates, result.lsr_limitproblem,dn,
                    121:        list_arg.lsa_common.ca_servicecontrol.svc_sizelimit);
                    122: 
                    123:        subords_free (result.lsr_subordinates);
                    124: 
                    125:        consolidate_move();
                    126: }
                    127: 
                    128: print_list_subordinates (ptr, prob)
                    129: struct subordinate *ptr;
                    130: int             prob;
                    131: {
                    132: DN adn;
                    133: DN newdn;
                    134: int seqno;
                    135: extern char * result_sequence;
                    136: 
                    137:        adn = dn_cpy (dn);
                    138:        newdn = dn_comp_new (rdn_comp_new(NULLAttrT,NULLAttrV));        
                    139:        if (adn != NULLDN)
                    140:                dn_append (adn,newdn);
                    141:        else {
                    142:                dn_free(adn);
                    143:                adn = newdn;
                    144:        }
                    145: 
                    146:        if (result_sequence)
                    147:                set_sequence (result_sequence);
                    148: 
                    149:        if (ptr == NULLSUBORD)
                    150:                if (list_show)
                    151:                        ps_print (RPS,"No children\n");
                    152: 
                    153:        for (; ptr != NULLSUBORD; ptr = ptr->sub_next) {
                    154:                rdn_free (newdn->dn_rdn);
                    155:                dn_comp_fill (newdn,rdn_cpy(ptr->sub_rdn));
                    156:                seqno = add_sequence (adn);
                    157:                if (seqno != 0)
                    158:                        ps_printf (RPS,"%-3d ",seqno);
                    159:                if (list_show)
                    160:                        rdn_print (RPS, ptr->sub_rdn, READOUT);
                    161:                ps_print (RPS, "\n");
                    162:        }
                    163: 
                    164:        dn_free (adn);
                    165: 
                    166:        if (prob != LSR_NOLIMITPROBLEM)
                    167:                if (list_show)
                    168:                        ps_print (RPS, "(Limit problem)\n");
                    169: 
                    170: }

unix.superglobalmegacorp.com

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