/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
OPENLDAP_PACKAGE " " OPENLDAP_VERSION " Standalone LDAP Server (slapd)";
#endif
-#define CHECK_NONE 0x00
-#define CHECK_CONFIG 0x01
+#define CHECK_NONE 0x00
+#define CHECK_CONFIG 0x01
+#define CHECK_LOGLEVEL 0x02
static int check = CHECK_NONE;
static int version = 0;
int level = 0;
if ( strcmp( optarg, "?" ) == 0 ) {
- rc = loglevel_print( stdout );
- goto destroy;
+ check |= CHECK_LOGLEVEL;
+ break;
}
no_detach = 1;
case 's': /* set syslog level */
if ( strcmp( optarg, "?" ) == 0 ) {
- rc = loglevel_print( stdout );
- goto destroy;
+ check |= CHECK_LOGLEVEL;
+ break;
}
if ( parse_debug_level( optarg, &ldap_syslog, &syslog_unknowns ) ) {
Debug( LDAP_DEBUG_ANY, "%s", Versionstr, 0, 0 );
+ global_host = ldap_pvt_get_fqdn( NULL );
+
if( check == CHECK_NONE && slapd_daemon_init( urls ) != 0 ) {
rc = 1;
SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 16 );
syslog_unknowns = NULL;
if ( rc )
goto destroy;
+ }
+
+ if ( check & CHECK_LOGLEVEL ) {
+ rc = 0;
+ goto destroy;
}
if ( check & CHECK_CONFIG ) {
rc |= slap_shutdown( NULL );
destroy:
+ if ( check & CHECK_LOGLEVEL ) {
+ (void)loglevel_print( stdout );
+ }
/* remember an error during destroy */
rc |= slap_destroy();