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

1.1       root        1: /* control.c - */
                      2: 
                      3: #ifndef lint
                      4: static char *rcsid = "$Header: /f/osi/quipu/RCS/control.c,v 7.2 90/07/09 14:45:31 mrose Exp $";
                      5: #endif
                      6: 
                      7: /*
                      8:  * $Header: /f/osi/quipu/RCS/control.c,v 7.2 90/07/09 14:45:31 mrose Exp $
                      9:  *
                     10:  *
                     11:  * $Log:       control.c,v $
                     12:  * Revision 7.2  90/07/09  14:45:31  mrose
                     13:  * sync
                     14:  * 
                     15:  * Revision 7.1  90/03/15  11:18:45  mrose
                     16:  * quipu-sync
                     17:  * 
                     18:  * Revision 7.0  89/11/23  22:16:58  mrose
                     19:  * Release 6.0
                     20:  * 
                     21:  */
                     22: 
                     23: /*
                     24:  *                                NOTICE
                     25:  *
                     26:  *    Acquisition, use, and distribution of this module and related
                     27:  *    materials are subject to the restrictions of a license agreement.
                     28:  *    Consult the Preface in the User's Manual for the full terms of
                     29:  *    this agreement.
                     30:  *
                     31:  */
                     32: 
                     33: 
                     34: /* the routine dsa_control is called when the modifyentry operation
                     35:    is performed, with and 'add attribute' request and the attribute type
                     36:    is 'control'.  The value decides what to control
                     37:    This is strictly non standard, but gives the dua control of the dsa.
                     38: */
                     39: 
                     40: #include "quipu/util.h"
                     41: #include "quipu/entry.h"
                     42: #include "quipu/dsp.h"
                     43: #include "quipu/ds_error.h"
                     44: #include "tailor.h"
                     45: 
                     46: extern LLog * log_dsap;
                     47: #ifndef NO_STATS
                     48: extern LLog * log_stat;
                     49: #endif
                     50: 
                     51: dsa_control (as,error,dn)
                     52: Attr_Sequence as;
                     53: struct DSError *error;
                     54: DN dn;
                     55: {
                     56: char * str;
                     57: DN dn2;
                     58: Entry theentry;
                     59: extern Entry database_root;
                     60: SFD attempt_restart();
                     61: 
                     62:        if ( ! manager(dn) ) {
                     63:                error->dse_type = DSE_SECURITYERROR;
                     64:                error->ERR_SECURITY.DSE_sc_problem = DSE_SC_ACCESSRIGHTS;
                     65:                return (DS_ERROR_REMOTE);
                     66:        }
                     67: 
                     68:        str = (char *) as->attr_value->avseq_av.av_struct;
                     69: 
                     70: #ifndef NO_STATS
                     71:        LLOG (log_stat,LLOG_NOTICE,("DSA control: %s",str));
                     72: #endif
                     73: 
                     74:        switch (*str) {
                     75:        case 'd':       /* -dump <directory> */
                     76:                str = SkipSpace (++str);
                     77: /* 
                     78:                directory_dump (str, database_root);
                     79: */
                     80:                return (DS_OK);
                     81:        case 't':       /* -tailor <string> */
                     82:                str = SkipSpace (++str);
                     83:                if (dsa_tai_string (str) == OK) {
                     84:                        isodexport (NULLCP);
                     85:                        return (DS_OK);
                     86:                }
                     87:                break;
                     88:        case 'a':       /* -abort */
                     89:                LLOG (log_dsap,LLOG_FATAL,("*** abort signal ***"));
                     90:                stop_listeners();
                     91:                exit(0);
                     92:        case 'b':       /* -restart */
                     93:                LLOG (log_dsap,LLOG_FATAL,("*** restart signal ***"));
                     94:                attempt_restart (NOTOK);
                     95:                exit(0);                /* should not be reached */
                     96:        case 'r':       /* -refresh <entry> */
                     97:                str = SkipSpace (++str);
                     98:                if (lexequ (str,"root") == 0)
                     99:                    dn2= NULLDN;
                    100:                else
                    101:                    if ((dn2 = str2dn (str)) == NULLDN)
                    102:                        break;
                    103: 
                    104:                if (refresh_from_disk (dn2) == OK)
                    105:                        return (DS_OK);
                    106:                break;
                    107:        case 'f':       /* -resync <entry> */
                    108:                str = SkipSpace (++str);
                    109:                if (lexequ (str,"root") == 0)
                    110:                    dn2= NULLDN;
                    111:                else
                    112:                    if ((dn2 = str2dn (str)) == NULLDN)
                    113:                        break;
                    114: 
                    115:                if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY)
                    116: #ifdef TURBO_DISK
                    117:                        if ( turbo_writeall(theentry->e_child) == OK )
                    118:                                return (DS_OK);
                    119: #else
                    120:                        if (journal (theentry->e_child) == OK)
                    121:                                return (DS_OK);
                    122: #endif
                    123:                break;
                    124:        case 'l':       /* -lock <entry> */
                    125:                str = SkipSpace (++str);
                    126:                if (lexequ (str,"root") == 0)
                    127:                        dn2 = NULLDN;
                    128:                else if ((dn2 = str2dn (str)) == NULLDN)
                    129:                        break;
                    130: 
                    131:                if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY) {
                    132:                        theentry->e_lock = TRUE;
                    133:                        return (DS_OK);
                    134:                }
                    135:                break;
                    136:        case 'u':       /* -unlock <entry> */
                    137:                str = SkipSpace (++str);
                    138:                if (lexequ (str,"root") == 0)
                    139:                        dn2 = NULLDN;
                    140:                else if ((dn2 = str2dn (str)) == NULLDN)
                    141:                        break;
                    142: 
                    143:                if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY) {
                    144:                        theentry->e_lock = FALSE;
                    145:                        return (DS_OK);
                    146:                }
                    147:                break;
                    148:        case 's':       /* -slave */
                    149:                /*
                    150:                 * When we go async return of OK will mean that a getedb
                    151:                 * operation has been scheduled, NOT that it has succeeded.
                    152:                 */
                    153:                str = SkipSpace (++str);
                    154:                if (*str == NULL) {
                    155:                    slave_update();
                    156:                    return DS_OK;
                    157:                }
                    158: 
                    159:                if (lexequ (str, "root") == 0)
                    160:                        dn2 = NULLDN;
                    161:                else if ((dn2 = str2dn (str)) == NULLDN)
                    162:                        break;
                    163: 
                    164:                if (update_aux (dn2, dn2 == NULLDN) == OK)
                    165:                        return DS_OK;
                    166:                break;
                    167:        default:
                    168:                break;
                    169:        }
                    170: 
                    171:        error->dse_type = DSE_SERVICEERROR;
                    172:        error->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNWILLINGTOPERFORM;
                    173:        return (DS_ERROR_REMOTE);
                    174: }

unix.superglobalmegacorp.com

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