Back to index

openldap  2.4.31
Classes | Defines | Typedefs | Enumerations | Functions
config.h File Reference
#include <ac/string.h>

Go to the source code of this file.

Classes

struct  ConfigTable
struct  ConfigOCs
struct  config_reply_s
struct  config_args_s
union  config_args_s.values
struct  config_args_s.values.v_dn

Defines

#define ARGS_USERLAND   0x00000fff
#define ARGS_TYPES   0x0000f000
#define ARG_INT   0x00001000
#define ARG_LONG   0x00002000
#define ARG_BER_LEN_T   0x00003000
#define ARG_ON_OFF   0x00004000
#define ARG_STRING   0x00005000
#define ARG_BERVAL   0x00006000
#define ARG_DN   0x00007000
#define ARG_UINT   0x00008000
#define ARG_ATDESC   0x00009000
#define ARG_ULONG   0x0000a000
#define ARGS_SYNTAX   0xffff0000
#define ARG_IGNORED   0x00080000
#define ARG_PRE_BI   0x00100000
#define ARG_PRE_DB   0x00200000
#define ARG_DB   0x00400000 /* Only applies to DB */
#define ARG_MAY_DB   0x00800000 /* May apply to DB */
#define ARG_PAREN   0x01000000
#define ARG_NONZERO   0x02000000
#define ARG_NO_INSERT   0x04000000 /* no arbitrary inserting */
#define ARG_NO_DELETE   0x08000000 /* no runtime deletes */
#define ARG_UNIQUE   0x10000000
#define ARG_QUOTE   0x20000000 /* wrap with quotes before parsing */
#define ARG_OFFSET   0x40000000
#define ARG_MAGIC   0x80000000
#define ARG_BAD_CONF   0xdead0000 /* overload return values */
#define cr_msg   reply.msg
#define SLAP_CONFIG_EMIT   0x2000 /* emit instead of set */
#define SLAP_CONFIG_ADD   0x4000 /* config file add vs LDAP add */
#define CONFIG_ONLINE_ADD(ca)   (!((ca)->lineno))
#define value_int   values.v_int
#define value_uint   values.v_uint
#define value_long   values.v_long
#define value_ulong   values.v_ulong
#define value_ber_t   values.v_ber_t
#define value_string   values.v_string
#define value_bv   values.v_bv
#define value_dn   values.v_dn.vdn_dn
#define value_ndn   values.v_dn.vdn_ndn
#define value_ad   values.v_ad
#define config_slurp_shadow(c)   config_shadow((c), SLAP_DBFLAG_SLURP_SHADOW)
#define config_sync_shadow(c)   config_shadow((c), SLAP_DBFLAG_SYNC_SHADOW)
#define config_check_userland(last)   assert( ( ( (last) - 1 ) & ARGS_USERLAND ) == ( (last) - 1 ) );
#define SLAP_X_ORDERED_FMT   "{%d}"

Typedefs

typedef LDAP_BEGIN_DECL struct
ConfigTable 
ConfigTable
typedef struct CfEntryInfo CfEntryInfo
typedef intConfigLDAPadd )(CfEntryInfo *parent, Entry *child, struct config_args_s *ca)
typedef intConfigCfAdd )(Operation *op, SlapReply *rs, Entry *parent, struct config_args_s *ca)
typedef struct ConfigOCs ConfigOCs
typedef intConfigDriver )(struct config_args_s *c)
typedef struct config_args_s ConfigArgs

Enumerations

enum  ConfigType {
  Cft_Abstract = 0, Cft_Global, Cft_Module, Cft_Schema,
  Cft_Backend, Cft_Database, Cft_Overlay, Cft_Misc
}

Functions

int config_fp_parse_line (ConfigArgs *c)
int config_register_schema (ConfigTable *ct, ConfigOCs *co)
int config_del_vals (ConfigTable *cf, ConfigArgs *c)
int config_get_vals (ConfigTable *ct, ConfigArgs *c)
int config_add_vals (ConfigTable *ct, ConfigArgs *c)
void init_config_argv (ConfigArgs *c)
int init_config_attrs (ConfigTable *ct)
int init_config_ocs (ConfigOCs *ocs)
int config_parse_vals (ConfigTable *ct, ConfigArgs *c, int valx)
int config_parse_add (ConfigTable *ct, ConfigArgs *c, int valx)
int read_config_file (const char *fname, int depth, ConfigArgs *cf, ConfigTable *cft)
ConfigTableconfig_find_keyword (ConfigTable *ct, ConfigArgs *c)
Entryconfig_build_entry (Operation *op, SlapReply *rs, CfEntryInfo *parent, ConfigArgs *c, struct berval *rdn, ConfigOCs *main, ConfigOCs *extra)
Listenerconfig_check_my_url (const char *url, LDAPURLDesc *lud)
int config_shadow (ConfigArgs *c, slap_mask_t flag)
 LDAP_SLAPD_V (slap_verbmasks *) slap_ldap_response_code
int slap_ldap_response_code_register (struct berval *bv, int err)
 LDAP_SLAPD_V (ConfigTable) olcDatabaseDummy[]

Class Documentation

struct ConfigTable

Definition at line 24 of file config.h.

Collaboration diagram for ConfigTable:
Class Members
AttributeDescription * ad
void * arg_item
unsigned int arg_type
const char * attribute
int length
int max_args
int min_args
const char * name
void * notify
const char * what
struct CfEntryInfo

Definition at line 82 of file config.h.

Collaboration diagram for CfEntryInfo:
Class Members
BackendDB * ce_be
BackendInfo * ce_bi
Entry * ce_entry
struct CfEntryInfo * ce_kids
struct CfEntryInfo * ce_parent
void * ce_private
struct CfEntryInfo * ce_sibs
ConfigType ce_type
struct ConfigOCs

Definition at line 109 of file config.h.

Collaboration diagram for ConfigOCs:
Class Members
ConfigCfAdd * co_cfadd
const char * co_def
ConfigLDAPadd * co_ldadd
struct berval * co_name
ObjectClass * co_oc
ConfigTable * co_table
ConfigType co_type
struct config_reply_s

Definition at line 124 of file config.h.

Class Members
int err
char msg
struct config_args_s

Definition at line 129 of file config.h.

Collaboration diagram for config_args_s:
Class Members
int argc
char ** argv
int argv_size
BackendDB * be
BackendInfo * bi
Entry * ca_entry
Operation * ca_op
void * ca_private
ConfigDriver * cleanup
int depth
const char * fname
char * line
int lineno
char log
int op
ConfigReply reply
BerVarray rvalue_nvals
BerVarray rvalue_vals
ConfigType table
char * tline
int type
union config_args_s values
int valx
union config_args_s.values

Definition at line 143 of file config.h.

Class Members
AttributeDescription * v_ad
ber_len_t v_ber_t
values v_dn
int v_int
long v_long
char * v_string
unsigned v_uint
unsigned long v_ulong
struct config_args_s.values.v_dn

Definition at line 151 of file config.h.


Define Documentation

#define ARG_ATDESC   0x00009000

Definition at line 61 of file config.h.

#define ARG_BAD_CONF   0xdead0000 /* overload return values */

Definition at line 79 of file config.h.

#define ARG_BER_LEN_T   0x00003000

Definition at line 55 of file config.h.

#define ARG_BERVAL   0x00006000

Definition at line 58 of file config.h.

#define ARG_DB   0x00400000 /* Only applies to DB */

Definition at line 68 of file config.h.

#define ARG_DN   0x00007000

Definition at line 59 of file config.h.

#define ARG_IGNORED   0x00080000

Definition at line 65 of file config.h.

#define ARG_INT   0x00001000

Definition at line 53 of file config.h.

#define ARG_LONG   0x00002000

Definition at line 54 of file config.h.

#define ARG_MAGIC   0x80000000

Definition at line 77 of file config.h.

#define ARG_MAY_DB   0x00800000 /* May apply to DB */

Definition at line 69 of file config.h.

#define ARG_NO_DELETE   0x08000000 /* no runtime deletes */

Definition at line 73 of file config.h.

#define ARG_NO_INSERT   0x04000000 /* no arbitrary inserting */

Definition at line 72 of file config.h.

#define ARG_NONZERO   0x02000000

Definition at line 71 of file config.h.

#define ARG_OFFSET   0x40000000

Definition at line 76 of file config.h.

#define ARG_ON_OFF   0x00004000

Definition at line 56 of file config.h.

#define ARG_PAREN   0x01000000

Definition at line 70 of file config.h.

#define ARG_PRE_BI   0x00100000

Definition at line 66 of file config.h.

#define ARG_PRE_DB   0x00200000

Definition at line 67 of file config.h.

#define ARG_QUOTE   0x20000000 /* wrap with quotes before parsing */

Definition at line 75 of file config.h.

#define ARG_STRING   0x00005000

Definition at line 57 of file config.h.

#define ARG_UINT   0x00008000

Definition at line 60 of file config.h.

#define ARG_ULONG   0x0000a000

Definition at line 62 of file config.h.

#define ARG_UNIQUE   0x10000000

Definition at line 74 of file config.h.

#define ARGS_SYNTAX   0xffff0000

Definition at line 64 of file config.h.

#define ARGS_TYPES   0x0000f000

Definition at line 52 of file config.h.

#define ARGS_USERLAND   0x00000fff

Definition at line 49 of file config.h.

#define config_check_userland (   last)    assert( ( ( (last) - 1 ) & ARGS_USERLAND ) == ( (last) - 1 ) );

Definition at line 214 of file config.h.

#define CONFIG_ONLINE_ADD (   ca)    (!((ca)->lineno))

Definition at line 176 of file config.h.

Definition at line 210 of file config.h.

Definition at line 211 of file config.h.

#define cr_msg   reply.msg

Definition at line 138 of file config.h.

#define SLAP_CONFIG_ADD   0x4000 /* config file add vs LDAP add */

Definition at line 161 of file config.h.

#define SLAP_CONFIG_EMIT   0x2000 /* emit instead of set */

Definition at line 160 of file config.h.

#define SLAP_X_ORDERED_FMT   "{%d}"

Definition at line 217 of file config.h.

#define value_ad   values.v_ad

Definition at line 187 of file config.h.

#define value_ber_t   values.v_ber_t

Definition at line 182 of file config.h.

#define value_bv   values.v_bv

Definition at line 184 of file config.h.

#define value_dn   values.v_dn.vdn_dn

Definition at line 185 of file config.h.

#define value_int   values.v_int

Definition at line 178 of file config.h.

#define value_long   values.v_long

Definition at line 180 of file config.h.

#define value_ndn   values.v_dn.vdn_ndn

Definition at line 186 of file config.h.

#define value_string   values.v_string

Definition at line 183 of file config.h.

#define value_uint   values.v_uint

Definition at line 179 of file config.h.

#define value_ulong   values.v_ulong

Definition at line 181 of file config.h.


Typedef Documentation

typedef struct CfEntryInfo CfEntryInfo
typedef struct config_args_s ConfigArgs
typedef int( ConfigCfAdd)(Operation *op, SlapReply *rs, Entry *parent, struct config_args_s *ca)

Definition at line 100 of file config.h.

typedef int( ConfigDriver)(struct config_args_s *c)

Definition at line 122 of file config.h.

typedef int( ConfigLDAPadd)(CfEntryInfo *parent, Entry *child, struct config_args_s *ca)

Definition at line 96 of file config.h.

typedef struct ConfigOCs ConfigOCs

Enumeration Type Documentation

enum ConfigType
Enumerator:
Cft_Abstract 
Cft_Global 
Cft_Module 
Cft_Schema 
Cft_Backend 
Cft_Database 
Cft_Overlay 
Cft_Misc 

Definition at line 38 of file config.h.


Function Documentation

Definition at line 407 of file config.c.

                                                      {
       int rc, arg_type;

       arg_type = Conf->arg_type;
       if(arg_type == ARG_IGNORED) {
              Debug(LDAP_DEBUG_CONFIG, "%s: keyword <%s> ignored\n",
                     c->log, Conf->name, 0);
              return(0);
       }
       rc = config_check_vals( Conf, c, 0 );
       if ( rc ) return rc;
       return config_set_vals( Conf, c );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Entry* config_build_entry ( Operation op,
SlapReply rs,
CfEntryInfo parent,
ConfigArgs c,
struct berval rdn,
ConfigOCs main,
ConfigOCs extra 
)

Definition at line 6393 of file bconfig.c.

{
       Entry *e = entry_alloc();
       CfEntryInfo *ce = ch_calloc( 1, sizeof(CfEntryInfo) );
       struct berval val;
       struct berval ad_name;
       AttributeDescription *ad = NULL;
       int rc;
       char *ptr;
       const char *text = "";
       Attribute *oc_at;
       struct berval pdn;
       ObjectClass *oc;
       CfEntryInfo *ceprev = NULL;

       Debug( LDAP_DEBUG_TRACE, "config_build_entry: \"%s\"\n", rdn->bv_val, 0, 0);
       e->e_private = ce;
       ce->ce_entry = e;
       ce->ce_type = main->co_type;
       ce->ce_parent = parent;
       if ( parent ) {
              pdn = parent->ce_entry->e_nname;
              if ( parent->ce_kids && parent->ce_kids->ce_type <= ce->ce_type )
                     for ( ceprev = parent->ce_kids; ceprev->ce_sibs &&
                            ceprev->ce_type <= ce->ce_type;
                            ceprev = ceprev->ce_sibs );
       } else {
              BER_BVZERO( &pdn );
       }

       ce->ce_private = c->ca_private;
       ce->ce_be = c->be;
       ce->ce_bi = c->bi;

       build_new_dn( &e->e_name, &pdn, rdn, NULL );
       ber_dupbv( &e->e_nname, &e->e_name );

       attr_merge_normalize_one(e, slap_schema.si_ad_objectClass,
              main->co_name, NULL );
       if ( extra )
              attr_merge_normalize_one(e, slap_schema.si_ad_objectClass,
                     extra->co_name, NULL );
       ptr = strchr(rdn->bv_val, '=');
       ad_name.bv_val = rdn->bv_val;
       ad_name.bv_len = ptr - rdn->bv_val;
       rc = slap_bv2ad( &ad_name, &ad, &text );
       if ( rc ) {
              goto fail;
       }
       val.bv_val = ptr+1;
       val.bv_len = rdn->bv_len - (val.bv_val - rdn->bv_val);
       attr_merge_normalize_one(e, ad, &val, NULL );

       oc = main->co_oc;
       c->table = main->co_type;
       if ( oc->soc_required ) {
              rc = config_build_attrs( e, oc->soc_required, ad, main->co_table, c );
              if ( rc ) goto fail;
       }

       if ( oc->soc_allowed ) {
              rc = config_build_attrs( e, oc->soc_allowed, ad, main->co_table, c );
              if ( rc ) goto fail;
       }

       if ( extra ) {
              oc = extra->co_oc;
              c->table = extra->co_type;
              if ( oc->soc_required ) {
                     rc = config_build_attrs( e, oc->soc_required, ad, extra->co_table, c );
                     if ( rc ) goto fail;
              }

              if ( oc->soc_allowed ) {
                     rc = config_build_attrs( e, oc->soc_allowed, ad, extra->co_table, c );
                     if ( rc ) goto fail;
              }
       }

       oc_at = attr_find( e->e_attrs, slap_schema.si_ad_objectClass );
       rc = structural_class(oc_at->a_vals, &oc, NULL, &text, c->cr_msg,
              sizeof(c->cr_msg), op ? op->o_tmpmemctx : NULL );
       if ( rc != LDAP_SUCCESS ) {
fail:
              Debug( LDAP_DEBUG_ANY,
                     "config_build_entry: build \"%s\" failed: \"%s\"\n",
                     rdn->bv_val, text, 0);
              return NULL;
       }
       attr_merge_normalize_one(e, slap_schema.si_ad_structuralObjectClass, &oc->soc_cname, NULL );
       if ( op ) {
              op->ora_e = e;
              op->ora_modlist = NULL;
              slap_add_opattrs( op, NULL, NULL, 0, 0 );
              if ( !op->o_noop ) {
                     SlapReply rs2 = {REP_RESULT};
                     op->o_bd->be_add( op, &rs2 );
                     rs->sr_err = rs2.sr_err;
                     rs_assert_done( &rs2 );
                     if ( ( rs2.sr_err != LDAP_SUCCESS ) 
                                   && (rs2.sr_err != LDAP_ALREADY_EXISTS) ) {
                            goto fail;
                     }
              }
       }
       if ( ceprev ) {
              ce->ce_sibs = ceprev->ce_sibs;
              ceprev->ce_sibs = ce;
       } else if ( parent ) {
              ce->ce_sibs = parent->ce_kids;
              parent->ce_kids = ce;
       }

       return e;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Listener* config_check_my_url ( const char *  url,
LDAPURLDesc lud 
)

Definition at line 2373 of file config.c.

{
       Listener **l = slapd_get_listeners();
       int i, isMe;

       /* Try a straight compare with Listener strings */
       for ( i=0; l && l[i]; i++ ) {
              if ( !strcasecmp( url, l[i]->sl_url.bv_val )) {
                     return l[i];
              }
       }

       isMe = 0;
       /* If hostname is empty, or is localhost, or matches
        * our hostname, this url refers to this host.
        * Compare it against listeners and ports.
        */
       if ( !lud->lud_host || !lud->lud_host[0] ||
              !strncasecmp("localhost", lud->lud_host,
                     STRLENOF("localhost")) ||
              !strcasecmp( global_host, lud->lud_host )) {

              for ( i=0; l && l[i]; i++ ) {
                     LDAPURLDesc *lu2;
                     ldap_url_parse( l[i]->sl_url.bv_val, &lu2 );
                     do {
                            if ( strcasecmp( lud->lud_scheme,
                                   lu2->lud_scheme ))
                                   break;
                            if ( lud->lud_port != lu2->lud_port )
                                   break;
                            /* Listener on ANY address */
                            if ( !lu2->lud_host || !lu2->lud_host[0] ) {
                                   isMe = 1;
                                   break;
                            }
                            /* URL on ANY address */
                            if ( !lud->lud_host || !lud->lud_host[0] ) {
                                   isMe = 1;
                                   break;
                            }
                            /* Listener has specific host, must
                             * match it
                             */
                            if ( !strcasecmp( lud->lud_host,
                                   lu2->lud_host )) {
                                   isMe = 1;
                                   break;
                            }
                     } while(0);
                     ldap_free_urldesc( lu2 );
                     if ( isMe ) {
                            return l[i];
                     }
              }
       }
       return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 422 of file config.c.

{
       int rc = 0;

       /* If there is no handler, just ignore it */
       if ( cf->arg_type & ARG_MAGIC ) {
              c->argv[0] = cf->ad->ad_cname.bv_val;
              c->op = LDAP_MOD_DELETE;
              c->type = cf->arg_type & ARGS_USERLAND;
              rc = (*((ConfigDriver*)cf->arg_item))(c);
       }
       return rc;
}

Here is the caller graph for this function:

Definition at line 114 of file config.c.

                                                                   {
       int i;

       for(i = 0; Conf[i].name; i++)
              if( (Conf[i].length && (!strncasecmp(c->argv[0], Conf[i].name, Conf[i].length))) ||
                     (!strcasecmp(c->argv[0], Conf[i].name)) ) break;
       if ( !Conf[i].name ) return NULL;
       return Conf+i;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2236 of file config.c.

{
       char *token;
       static char *const hide[] = {
              "rootpw", "replica", "syncrepl",  /* in slapd */
              "acl-bind", "acl-method", "idassert-bind",  /* in back-ldap */
              "acl-passwd", "bindpw",  /* in back-<ldap/meta> */
              "pseudorootpw",  /* in back-meta */
              "dbpasswd",  /* in back-sql */
              NULL
       };
       char *quote_ptr;
       int i = (int)(sizeof(hide)/sizeof(hide[0])) - 1;

       c->tline = ch_strdup(c->line);
       token = strtok_quote(c->tline, " \t", &quote_ptr);

       if(token) for(i = 0; hide[i]; i++) if(!strcasecmp(token, hide[i])) break;
       if(quote_ptr) *quote_ptr = ' ';
       Debug(LDAP_DEBUG_CONFIG, "line %d (%s%s)\n", c->lineno,
              hide[i] ? hide[i] : c->line, hide[i] ? " ***" : "");
       if(quote_ptr) *quote_ptr = '\0';

       for(;; token = strtok_quote(NULL, " \t", &quote_ptr)) {
              if(c->argc >= c->argv_size) {
                     char **tmp;
                     tmp = ch_realloc(c->argv, (c->argv_size + ARGS_STEP) * sizeof(*c->argv));
                     if(!tmp) {
                            Debug(LDAP_DEBUG_ANY, "line %d: out of memory\n", c->lineno, 0, 0);
                            return -1;
                     }
                     c->argv = tmp;
                     c->argv_size += ARGS_STEP;
              }
              if(token == NULL)
                     break;
              c->argv[c->argc++] = token;
       }
       c->argv[c->argc] = NULL;
       return(0);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 437 of file config.c.

{
       int rc = 0;
       struct berval bv;
       void *ptr;

       if ( cf->arg_type & ARG_IGNORED ) {
              return 1;
       }

       memset(&c->values, 0, sizeof(c->values));
       c->rvalue_vals = NULL;
       c->rvalue_nvals = NULL;
       c->op = SLAP_CONFIG_EMIT;
       c->type = cf->arg_type & ARGS_USERLAND;

       if ( cf->arg_type & ARG_MAGIC ) {
              rc = (*((ConfigDriver*)cf->arg_item))(c);
              if ( rc ) return rc;
       } else {
              if ( cf->arg_type & ARG_OFFSET ) {
                     if (c->be && c->table == Cft_Database)
                            ptr = c->be->be_private;
                     else if ( c->bi )
                            ptr = c->bi->bi_private;
                     else
                            return 1;
                     ptr = (void *)((char *)ptr + (long)cf->arg_item);
              } else {
                     ptr = cf->arg_item;
              }
              
              switch(cf->arg_type & ARGS_TYPES) {
              case ARG_ON_OFF:
              case ARG_INT: c->value_int = *(int *)ptr; break;
              case ARG_UINT:       c->value_uint = *(unsigned *)ptr; break;
              case ARG_LONG:       c->value_long = *(long *)ptr; break;
              case ARG_ULONG:      c->value_ulong = *(unsigned long *)ptr; break;
              case ARG_BER_LEN_T:  c->value_ber_t = *(ber_len_t *)ptr; break;
              case ARG_STRING:
                     if ( *(char **)ptr )
                            c->value_string = ch_strdup(*(char **)ptr);
                     break;
              case ARG_BERVAL:
                     c->value_bv = *((struct berval *)ptr); break;
              case ARG_ATDESC:
                     c->value_ad = *(AttributeDescription **)ptr; break;
              }
       }
       if ( cf->arg_type & ARGS_TYPES) {
              bv.bv_len = 0;
              bv.bv_val = c->log;
              switch(cf->arg_type & ARGS_TYPES) {
              case ARG_INT: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%d", c->value_int); break;
              case ARG_UINT: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%u", c->value_uint); break;
              case ARG_LONG: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%ld", c->value_long); break;
              case ARG_ULONG: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%lu", c->value_ulong); break;
              case ARG_BER_LEN_T: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%ld", c->value_ber_t); break;
              case ARG_ON_OFF: bv.bv_len = snprintf(bv.bv_val, sizeof( c->log ), "%s",
                     c->value_int ? "TRUE" : "FALSE"); break;
              case ARG_STRING:
                     if ( c->value_string && c->value_string[0]) {
                            ber_str2bv( c->value_string, 0, 0, &bv);
                     } else {
                            return 1;
                     }
                     break;
              case ARG_BERVAL:
                     if ( !BER_BVISEMPTY( &c->value_bv )) {
                            bv = c->value_bv;
                     } else {
                            return 1;
                     }
                     break;
              case ARG_ATDESC:
                     if ( c->value_ad ) {
                            bv = c->value_ad->ad_cname;
                     } else {
                            return 1;
                     }
                     break;
              default:
                     bv.bv_val = NULL;
                     break;
              }
              if (bv.bv_val == c->log && bv.bv_len >= sizeof( c->log ) ) {
                     return 1;
              }
              if (( cf->arg_type & ARGS_TYPES ) == ARG_STRING ) {
                     ber_bvarray_add(&c->rvalue_vals, &bv);
              } else if ( !BER_BVISNULL( &bv ) ) {
                     value_add_one(&c->rvalue_vals, &bv);
              }
              /* else: maybe c->rvalue_vals already set? */
       }
       return rc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int config_parse_add ( ConfigTable ct,
ConfigArgs c,
int  valx 
)

Definition at line 671 of file config.c.

{
       int    rc = 0;

       snprintf( c->log, sizeof( c->log ), "%s: value #%d",
              ct->ad->ad_cname.bv_val, valx );
       c->argc = 1;
       c->argv[0] = ct->ad->ad_cname.bv_val;

       if ( ( ct->arg_type & ARG_QUOTE ) && c->line[ 0 ] != '"' ) {
              c->argv[c->argc] = c->line;
              c->argc++;
              c->argv[c->argc] = NULL;
              c->tline = NULL;
       } else {
              config_parse_ldif( c );
       }
       c->op = LDAP_MOD_ADD;
       rc = config_add_vals( ct, c );
       ch_free( c->tline );

       return rc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int config_parse_vals ( ConfigTable ct,
ConfigArgs c,
int  valx 
)

Definition at line 643 of file config.c.

{
       int    rc = 0;

       snprintf( c->log, sizeof( c->log ), "%s: value #%d",
              ct->ad->ad_cname.bv_val, valx );
       c->argc = 1;
       c->argv[0] = ct->ad->ad_cname.bv_val;

       if ( ( ct->arg_type & ARG_QUOTE ) && c->line[ 0 ] != '"' ) {
              c->argv[c->argc] = c->line;
              c->argc++;
              c->argv[c->argc] = NULL;
              c->tline = NULL;
       } else {
              config_parse_ldif( c );
       }
       rc = config_check_vals( ct, c, 1 );
       ch_free( c->tline );
       c->tline = NULL;

       if ( rc )
              rc = LDAP_CONSTRAINT_VIOLATION;

       return rc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4141 of file bconfig.c.

                                                        {
       int i;

       i = init_config_attrs( ct );
       if ( i ) return i;

       /* set up the objectclasses */
       i = init_config_ocs( ocs );
       if ( i ) return i;

       for (i=0; ocs[i].co_def; i++) {
              if ( ocs[i].co_oc ) {
                     ocs[i].co_name = &ocs[i].co_oc->soc_cname;
                     if ( !ocs[i].co_table )
                            ocs[i].co_table = ct;
                     avl_insert( &CfOcTree, &ocs[i], CfOc_cmp, avl_dup_error );
              }
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int config_shadow ( ConfigArgs c,
slap_mask_t  flag 
)

Definition at line 3662 of file bconfig.c.

{
       char   *notallowed = NULL;

       if ( c->be == frontendDB ) {
              notallowed = "frontend";

       } else if ( SLAP_MONITOR(c->be) ) {
              notallowed = "monitor";
       }

       if ( notallowed != NULL ) {
              Debug( LDAP_DEBUG_ANY, "%s: %s database cannot be shadow.\n", c->log, notallowed, 0 );
              return 1;
       }

       if ( SLAP_SHADOW(c->be) ) {
              /* if already shadow, only check consistency */
              if ( ( SLAP_DBFLAGS(c->be) & flag ) != flag ) {
                     Debug( LDAP_DEBUG_ANY, "%s: inconsistent shadow flag 0x%lx.\n",
                            c->log, flag, 0 );
                     return 1;
              }

       } else {
              SLAP_DBFLAGS(c->be) |= (SLAP_DBFLAG_SHADOW | flag);
              if ( !SLAP_MULTIMASTER( c->be ))
                     SLAP_DBFLAGS(c->be) |= SLAP_DBFLAG_SINGLE_SHADOW;
       }

       return 0;
}

Definition at line 108 of file config.c.

{
       c->argv = ch_calloc( ARGS_STEP + 1, sizeof( *c->argv ) );
       c->argv_size = ARGS_STEP + 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 536 of file config.c.

                                   {
       int i, code;

       for (i=0; ct[i].name; i++ ) {
              if ( !ct[i].attribute ) continue;
              code = register_at( ct[i].attribute, &ct[i].ad, 1 );
              if ( code ) {
                     fprintf( stderr, "init_config_attrs: register_at failed\n" );
                     return code;
              }
       }

       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 552 of file config.c.

                                  {
       int i, code;

       for (i=0;ocs[i].co_def;i++) {
              code = register_oc( ocs[i].co_def, &ocs[i].co_oc, 1 );
              if ( code ) {
                     fprintf( stderr, "init_config_ocs: register_oc failed\n" );
                     return code;
              }
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int read_config_file ( const char *  fname,
int  depth,
ConfigArgs cf,
ConfigTable cft 
)

Definition at line 696 of file config.c.

{
       FILE *fp;
       ConfigTable *ct;
       ConfigArgs *c;
       int rc;
       struct stat s;

       c = ch_calloc( 1, sizeof( ConfigArgs ) );
       if ( c == NULL ) {
              return 1;
       }

       if ( depth ) {
              memcpy( c, cf, sizeof( ConfigArgs ) );
       } else {
              c->depth = depth; /* XXX */
              c->bi = NULL;
              c->be = NULL;
       }

       c->valx = -1;
       c->fname = fname;
       init_config_argv( c );

       if ( stat( fname, &s ) != 0 ) {
              ldap_syslog = 1;
              Debug(LDAP_DEBUG_ANY,
                  "could not stat config file \"%s\": %s (%d)\n",
                  fname, strerror(errno), errno);
              ch_free( c );
              return(1);
       }

       if ( !S_ISREG( s.st_mode ) ) {
              ldap_syslog = 1;
              Debug(LDAP_DEBUG_ANY,
                  "regular file expected, got \"%s\"\n",
                  fname, 0, 0 );
              ch_free( c );
              return(1);
       }

       fp = fopen( fname, "r" );
       if ( fp == NULL ) {
              ldap_syslog = 1;
              Debug(LDAP_DEBUG_ANY,
                  "could not open config file \"%s\": %s (%d)\n",
                  fname, strerror(errno), errno);
              ch_free( c );
              return(1);
       }

       Debug(LDAP_DEBUG_CONFIG, "reading config file %s\n", fname, 0, 0);

       fp_getline_init(c);

       c->tline = NULL;

       while ( fp_getline( fp, c ) ) {
              /* skip comments and blank lines */
              if ( c->line[0] == '#' || c->line[0] == '\0' ) {
                     continue;
              }

              snprintf( c->log, sizeof( c->log ), "%s: line %d",
                            c->fname, c->lineno );

              c->argc = 0;
              ch_free( c->tline );
              if ( config_fp_parse_line( c ) ) {
                     rc = 1;
                     goto done;
              }

              if ( c->argc < 1 ) {
                     Debug( LDAP_DEBUG_ANY, "%s: bad config line.\n",
                            c->log, 0, 0);
                     rc = 1;
                     goto done;
              }

              c->op = SLAP_CONFIG_ADD;

              ct = config_find_keyword( cft, c );
              if ( ct ) {
                     c->table = Cft_Global;
                     rc = config_add_vals( ct, c );
                     if ( !rc ) continue;

                     if ( rc & ARGS_USERLAND ) {
                            /* XXX a usertype would be opaque here */
                            Debug(LDAP_DEBUG_CONFIG, "%s: unknown user type <%s>\n",
                                   c->log, c->argv[0], 0);
                            rc = 1;
                            goto done;

                     } else if ( rc == ARG_BAD_CONF ) {
                            rc = 1;
                            goto done;
                     }
                     
              } else if ( c->bi && !c->be ) {
                     rc = SLAP_CONF_UNKNOWN;
                     if ( c->bi->bi_cf_ocs ) {
                            ct = config_find_keyword( c->bi->bi_cf_ocs->co_table, c );
                            if ( ct ) {
                                   c->table = c->bi->bi_cf_ocs->co_type;
                                   rc = config_add_vals( ct, c );
                            }
                     }
                     if ( c->bi->bi_config && rc == SLAP_CONF_UNKNOWN ) {
                            rc = (*c->bi->bi_config)(c->bi, c->fname, c->lineno,
                                   c->argc, c->argv);
                     }
                     if ( rc ) {
                            switch(rc) {
                            case SLAP_CONF_UNKNOWN:
                                   Debug( LDAP_DEBUG_ANY, "%s: unknown directive "
                                          "<%s> inside backend info definition.\n",
                                          c->log, *c->argv, 0);
                            default:
                                   rc = 1;
                                   goto done;
                            }
                     }

              } else if ( c->be && c->be != frontendDB ) {
                     rc = SLAP_CONF_UNKNOWN;
                     if ( c->be->be_cf_ocs ) {
                            ct = config_find_keyword( c->be->be_cf_ocs->co_table, c );
                            if ( ct ) {
                                   c->table = c->be->be_cf_ocs->co_type;
                                   rc = config_add_vals( ct, c );
                            }
                     }
                     if ( c->be->be_config && rc == SLAP_CONF_UNKNOWN ) {
                            rc = (*c->be->be_config)(c->be, c->fname, c->lineno,
                                   c->argc, c->argv);
                     }
                     if ( rc == SLAP_CONF_UNKNOWN && SLAP_ISGLOBALOVERLAY( frontendDB ) )
                     {
                            /* global overlays may need 
                             * definitions inside other databases...
                             */
                            rc = (*frontendDB->be_config)( frontendDB,
                                   c->fname, (int)c->lineno, c->argc, c->argv );
                     }

                     switch ( rc ) {
                     case 0:
                            break;

                     case SLAP_CONF_UNKNOWN:
                            Debug( LDAP_DEBUG_ANY, "%s: unknown directive "
                                   "<%s> inside backend database definition.\n",
                                   c->log, *c->argv, 0);
                            
                     default:
                            rc = 1;
                            goto done;
                     }

              } else if ( frontendDB->be_config ) {
                     rc = (*frontendDB->be_config)( frontendDB,
                            c->fname, (int)c->lineno, c->argc, c->argv);
                     if ( rc ) {
                            switch(rc) {
                            case SLAP_CONF_UNKNOWN:
                                   Debug( LDAP_DEBUG_ANY, "%s: unknown directive "
                                          "<%s> inside global database definition.\n",
                                          c->log, *c->argv, 0);

                            default:
                                   rc = 1;
                                   goto done;
                            }
                     }
                     
              } else {
                     Debug( LDAP_DEBUG_ANY, "%s: unknown directive "
                            "<%s> outside backend info and database definitions.\n",
                            c->log, *c->argv, 0);
                     rc = 1;
                     goto done;
              }
       }

       rc = 0;

done:
       if ( cf ) {
              cf->be = c->be;
              cf->bi = c->bi;
       }
       ch_free(c->tline);
       fclose(fp);
       ch_free(c->argv);
       ch_free(c);
       return(rc);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int slap_ldap_response_code_register ( struct berval bv,
int  err 
)

Definition at line 1239 of file config.c.

Here is the call graph for this function: