|
|
BSD 4.3reno
/* control.c - */
#ifndef lint
static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/quipu/control.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $";
#endif
/*
* $Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/quipu/control.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $
*
*
* $Log: control.c,v $
* Revision 1.1.1.1 2018/04/24 16:12:56 root
* BSD 4.3reno
*
* Revision 7.2 90/07/09 14:45:31 mrose
* sync
*
* Revision 7.1 90/03/15 11:18:45 mrose
* quipu-sync
*
* Revision 7.0 89/11/23 22:16:58 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.
*
*/
/* the routine dsa_control is called when the modifyentry operation
is performed, with and 'add attribute' request and the attribute type
is 'control'. The value decides what to control
This is strictly non standard, but gives the dua control of the dsa.
*/
#include "quipu/util.h"
#include "quipu/entry.h"
#include "quipu/dsp.h"
#include "quipu/ds_error.h"
#include "tailor.h"
extern LLog * log_dsap;
#ifndef NO_STATS
extern LLog * log_stat;
#endif
dsa_control (as,error,dn)
Attr_Sequence as;
struct DSError *error;
DN dn;
{
char * str;
DN dn2;
Entry theentry;
extern Entry database_root;
SFD attempt_restart();
if ( ! manager(dn) ) {
error->dse_type = DSE_SECURITYERROR;
error->ERR_SECURITY.DSE_sc_problem = DSE_SC_ACCESSRIGHTS;
return (DS_ERROR_REMOTE);
}
str = (char *) as->attr_value->avseq_av.av_struct;
#ifndef NO_STATS
LLOG (log_stat,LLOG_NOTICE,("DSA control: %s",str));
#endif
switch (*str) {
case 'd': /* -dump <directory> */
str = SkipSpace (++str);
/*
directory_dump (str, database_root);
*/
return (DS_OK);
case 't': /* -tailor <string> */
str = SkipSpace (++str);
if (dsa_tai_string (str) == OK) {
isodexport (NULLCP);
return (DS_OK);
}
break;
case 'a': /* -abort */
LLOG (log_dsap,LLOG_FATAL,("*** abort signal ***"));
stop_listeners();
exit(0);
case 'b': /* -restart */
LLOG (log_dsap,LLOG_FATAL,("*** restart signal ***"));
attempt_restart (NOTOK);
exit(0); /* should not be reached */
case 'r': /* -refresh <entry> */
str = SkipSpace (++str);
if (lexequ (str,"root") == 0)
dn2= NULLDN;
else
if ((dn2 = str2dn (str)) == NULLDN)
break;
if (refresh_from_disk (dn2) == OK)
return (DS_OK);
break;
case 'f': /* -resync <entry> */
str = SkipSpace (++str);
if (lexequ (str,"root") == 0)
dn2= NULLDN;
else
if ((dn2 = str2dn (str)) == NULLDN)
break;
if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY)
#ifdef TURBO_DISK
if ( turbo_writeall(theentry->e_child) == OK )
return (DS_OK);
#else
if (journal (theentry->e_child) == OK)
return (DS_OK);
#endif
break;
case 'l': /* -lock <entry> */
str = SkipSpace (++str);
if (lexequ (str,"root") == 0)
dn2 = NULLDN;
else if ((dn2 = str2dn (str)) == NULLDN)
break;
if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY) {
theentry->e_lock = TRUE;
return (DS_OK);
}
break;
case 'u': /* -unlock <entry> */
str = SkipSpace (++str);
if (lexequ (str,"root") == 0)
dn2 = NULLDN;
else if ((dn2 = str2dn (str)) == NULLDN)
break;
if ((theentry = local_find_entry (dn2,FALSE)) != NULLENTRY) {
theentry->e_lock = FALSE;
return (DS_OK);
}
break;
case 's': /* -slave */
/*
* When we go async return of OK will mean that a getedb
* operation has been scheduled, NOT that it has succeeded.
*/
str = SkipSpace (++str);
if (*str == NULL) {
slave_update();
return DS_OK;
}
if (lexequ (str, "root") == 0)
dn2 = NULLDN;
else if ((dn2 = str2dn (str)) == NULLDN)
break;
if (update_aux (dn2, dn2 == NULLDN) == OK)
return DS_OK;
break;
default:
break;
}
error->dse_type = DSE_SERVICEERROR;
error->ERR_SERVICE.DSE_sv_problem = DSE_SV_UNWILLINGTOPERFORM;
return (DS_ERROR_REMOTE);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.