X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fmain.c;h=119e24a9554d70cc8f1514a6e2fb5bd7b4804c8f;hb=581c1ff6c74f5eb281b5e0052b2a5ca84a7679bd;hp=a09c61dc17d12f055d67cd6fc86be8d015a28dc0;hpb=9b3a3d5fce5acdafc99d861b25b2cc8d1ae75519;p=openldap diff --git a/servers/slapd/main.c b/servers/slapd/main.c index a09c61dc17..119e24a955 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2004 The OpenLDAP Foundation. + * Copyright 1998-2006 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,6 +27,7 @@ #include +#include #include #include #include @@ -34,8 +35,6 @@ #include #include -#include "ldap_pvt.h" - #include "slap.h" #include "lutil.h" #include "ldif.h" @@ -66,7 +65,7 @@ static struct sockaddr_in bind_addr; typedef int (MainFunc) LDAP_P(( int argc, char *argv[] )); extern MainFunc slapadd, slapcat, slapdn, slapindex, slappasswd, - slaptest, slapauth; + slaptest, slapauth, slapacl; static struct { char *name; @@ -79,6 +78,13 @@ static struct { {"slappasswd", slappasswd}, {"slaptest", slaptest}, {"slapauth", slapauth}, + {"slapacl", slapacl}, + /* NOTE: new tools must be added in chronological order, + * not in alphabetical order, because for backwards + * compatibility name[4] is used to identify the + * tools; so name[4]=='a' must refer to "slapadd" and + * not to "slapauth". Alphabetical order can be used + * for tools whose name[4] is not used yet */ {NULL, NULL} }; @@ -92,38 +98,193 @@ const char Versionstr[] = OPENLDAP_PACKAGE " " OPENLDAP_VERSION " Standalone LDAP Server (slapd)"; #endif +#define CHECK_NONE 0x00 +#define CHECK_CONFIG 0x01 +static int check = CHECK_NONE; +static int version = 0; + +void *slap_tls_ctx; + #ifdef LOG_LOCAL4 +#define DEFAULT_SYSLOG_USER LOG_LOCAL4 +#endif /* LOG_LOCAL4 */ + +static int +slapd_opt_slp( const char *val, void *arg ) +{ +#ifdef HAVE_SLP + /* NULL is default */ + if ( val == NULL || strcasecmp( val, "on" ) == 0 ) { + slapd_register_slp = 1; + + } else if ( strcasecmp( val, "off" ) == 0 ) { + slapd_register_slp = 0; + + /* NOTE: add support for URL specification? */ -#define DEFAULT_SYSLOG_USER LOG_LOCAL4 - -typedef struct _str2intDispatch { - char *stringVal; - int abbr; - int intVal; -} STRDISP, *STRDISP_P; - - -/* table to compute syslog-options to integer */ -static STRDISP syslog_types[] = { - { "LOCAL0", sizeof("LOCAL0"), LOG_LOCAL0 }, - { "LOCAL1", sizeof("LOCAL1"), LOG_LOCAL1 }, - { "LOCAL2", sizeof("LOCAL2"), LOG_LOCAL2 }, - { "LOCAL3", sizeof("LOCAL3"), LOG_LOCAL3 }, - { "LOCAL4", sizeof("LOCAL4"), LOG_LOCAL4 }, - { "LOCAL5", sizeof("LOCAL5"), LOG_LOCAL5 }, - { "LOCAL6", sizeof("LOCAL6"), LOG_LOCAL6 }, - { "LOCAL7", sizeof("LOCAL7"), LOG_LOCAL7 }, - { NULL, 0, 0 } + } else { + fprintf(stderr, "unrecognized value \"%s\" for SLP option\n", val ); + return -1; + } + + return 0; + +#else + fputs( "slapd: SLP support is not available\n", stderr ); + return 0; +#endif +} + +/* + * Option helper structure: + * + * oh_nam is left-hand part of