static char *passwd_salt;
static char *logfileName;
+static BerVarray authz_rewrites;
#ifdef LDAP_SLAPI
int slapi_plugins_used = 0;
{ "security", "factors", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
&config_security, "( OLcfgAt:59 NAME 'olcSecurity' "
"SYNTAX OMsDirectoryString )", NULL, NULL },
- { "sizelimit", "limit", 2, 2, 0, ARG_MAY_DB|ARG_MAGIC|CFG_SIZE,
+ { "sizelimit", "limit", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC|CFG_SIZE,
&config_sizelimit, "( OLcfgAt:60 NAME 'olcSizeLimit' "
"SYNTAX OMsInteger )", NULL, NULL },
{ "sockbuf_max_incoming", "max", 2, 2, 0, ARG_LONG,
{ "threads", "count", 2, 2, 0, ARG_INT|ARG_MAGIC|CFG_THREADS,
&config_generic, "( OLcfgAt:66 NAME 'olcThreads' "
"SYNTAX OMsInteger )", NULL, NULL },
- { "timelimit", "limit", 2, 2, 0, ARG_MAY_DB|ARG_MAGIC|CFG_TIME,
+ { "timelimit", "limit", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC|CFG_TIME,
&config_timelimit, "( OLcfgAt:67 NAME 'olcTimeLimit' "
"SYNTAX OMsInteger )", NULL, NULL },
{ "TLSCACertificateFile", NULL, 0, 0, 0,
break;
#endif
#ifdef LDAP_SLAPI
- case CFG_PLUGIN: /* FIXME */
+ case CFG_PLUGIN:
slapi_int_plugin_unparse( c->be, &c->rvalue_vals );
if ( !c->rvalue_vals ) rc = 1;
break;
#endif
#ifdef SLAP_AUTH_REWRITE
- case CFG_REWRITE: /* FIXME */
- rc = 1;
+ case CFG_REWRITE:
+ if ( authz_rewrites ) {
+ struct berval bv, idx;
+ char ibuf[32];
+ int i;
+
+ idx.bv_val = ibuf;
+ for ( i=0; !BER_BVISNULL( &authz_rewrites[i] ); i++ ) {
+ idx.bv_len = sprintf( idx.bv_val, "{%d}", i );
+ bv.bv_len = idx.bv_len + authz_rewrites[i].bv_len;
+ bv.bv_val = ch_malloc( bv.bv_len + 1 );
+ strcpy( bv.bv_val, idx.bv_val );
+ strcpy( bv.bv_val+idx.bv_len, authz_rewrites[i].bv_val );
+ ber_bvarray_add( &c->rvalue_vals, &bv );
+ }
+ }
+ if ( !c->rvalue_vals ) rc = 1;
break;
#endif
default:
#endif
#ifdef SLAP_AUTH_REWRITE
- case CFG_REWRITE:
+ case CFG_REWRITE: {
+ struct berval bv;
if(slap_sasl_rewrite_config(c->fname, c->lineno, c->argc, c->argv))
return(1);
+ ber_str2bv( c->line, 0, 1, &bv );
+ ber_bvarray_add( &authz_rewrites, &bv );
+ }
break;
#endif
int i, rc = 0;
char *next;
struct slap_limits_set *lim = &c->be->be_def_limit;
- if (c->emit) { /* FIXME */
- return 1;
+ if (c->emit) {
+ struct berval bv = BER_BVNULL;
+ limits_unparse_one( lim, SLAP_LIMIT_SIZE, &bv );
+ if ( !BER_BVISEMPTY( &bv ))
+ ber_bvarray_add( &c->rvalue_vals, &bv );
+ else
+ rc = 1;
+ return rc;
}
for(i = 1; i < c->argc; i++) {
if(!strncasecmp(c->argv[i], "size", 4)) {
char *next;
struct slap_limits_set *lim = &c->be->be_def_limit;
if (c->emit) {
- return 1; /* FIXME */
+ struct berval bv = BER_BVNULL;
+ limits_unparse_one( lim, SLAP_LIMIT_TIME, &bv );
+ if ( !BER_BVISEMPTY( &bv ))
+ ber_bvarray_add( &c->rvalue_vals, &bv );
+ else
+ rc = 1;
+ return rc;
}
for(i = 1; i < c->argc; i++) {
if(!strncasecmp(c->argv[i], "time", 4)) {
#include <ac/string.h>
#include "slap.h"
+#include "lutil.h"
/* define to get an error if requesting limit higher than hard */
#undef ABOVE_HARD_LIMIT_IS_ERROR
return 0;
}
+void
+limits_unparse_one( struct slap_limits_set *lim, int which, struct berval *bv )
+{
+ char buf[8192], *ptr;
+
+ ptr = buf;
+ if ( which & SLAP_LIMIT_TIME ) {
+ if ( lim->lms_t_soft != SLAPD_DEFAULT_TIMELIMIT ) {
+ ptr = lutil_strcopy( ptr, " time.soft=" );
+ if ( lim->lms_t_soft == -1 )
+ ptr = lutil_strcopy( ptr, "unlimited" );
+ else
+ ptr += sprintf( ptr, "%d", lim->lms_t_soft );
+ *ptr++ = ' ';
+ }
+ if ( lim->lms_t_hard ) {
+ ptr = lutil_strcopy( ptr, " time.hard=" );
+ if ( lim->lms_t_hard == -1 )
+ ptr = lutil_strcopy( ptr, "unlimited" );
+ else
+ ptr += sprintf( ptr, "%d", lim->lms_t_hard );
+ *ptr++ = ' ';
+ }
+ }
+ if ( which & SLAP_LIMIT_SIZE ) {
+ if ( lim->lms_s_soft != SLAPD_DEFAULT_SIZELIMIT ) {
+ ptr = lutil_strcopy( ptr, " size.soft=" );
+ if ( lim->lms_s_soft == -1 )
+ ptr = lutil_strcopy( ptr, "unlimited" );
+ else
+ ptr += sprintf( ptr, "%d", lim->lms_s_soft );
+ *ptr++ = ' ';
+ }
+ if ( lim->lms_s_hard ) {
+ ptr = lutil_strcopy( ptr, " size.hard=" );
+ if ( lim->lms_s_soft == -1 )
+ ptr = lutil_strcopy( ptr, "unlimited" );
+ else
+ ptr += sprintf( ptr, "%d", lim->lms_s_hard );
+ *ptr++ = ' ';
+ }
+ if ( lim->lms_s_unchecked != -1 ) {
+ ptr = lutil_strcopy( ptr, " size.unchecked=" );
+ if ( lim->lms_s_unchecked == 0 )
+ ptr = lutil_strcopy( ptr, "disabled" );
+ else
+ ptr += sprintf( ptr, "%d", lim->lms_s_unchecked );
+ *ptr++ = ' ';
+ }
+ if ( lim->lms_s_pr_hide ) {
+ ptr = lutil_strcopy( ptr, " size.pr=noEstimate " );
+ }
+ if ( lim->lms_s_pr ) {
+ ptr = lutil_strcopy( ptr, " size.pr=" );
+ if ( lim->lms_s_pr == -1 )
+ ptr = lutil_strcopy( ptr, "unlimited" );
+ else
+ ptr += sprintf( ptr, "%d", lim->lms_s_pr );
+ *ptr++ = ' ';
+ }
+ if ( lim->lms_s_pr_total ) {
+ ptr = lutil_strcopy( ptr, " size.prtotal=" );
+ if ( lim->lms_s_pr_total == -1 )
+ ptr = lutil_strcopy( ptr, "unlimited" );
+ else if ( lim->lms_s_pr_total == -2 )
+ ptr = lutil_strcopy( ptr, "disabled" );
+ else
+ ptr += sprintf( ptr, "%d", lim->lms_s_pr_total );
+ *ptr++ = ' ';
+ }
+ }
+ if ( ptr != buf ) {
+ ptr--;
+ *ptr = '\0';
+ bv->bv_len = ptr - buf - 1;
+ ber_str2bv( buf+1, bv->bv_len, 1, bv );
+ }
+}
int
limits_check( Operation *op, SlapReply *rs )