]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/main.c
implement search timeout when the remote server does not respond in the specified...
[openldap] / servers / slapd / main.c
index e3693d02ed7828f91efb8f16526f6e8f9f83a105..1b653c6d51caf6d465ec458cd3769186e15d7ee5 100644 (file)
@@ -1,7 +1,7 @@
 /* $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
@@ -98,8 +98,9 @@ const char Versionstr[] =
        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;
 
@@ -503,8 +504,8 @@ int main( int argc, char **argv )
                        int     level = 0;
 
                        if ( strcmp( optarg, "?" ) == 0 ) {
-                               rc = loglevel_print( stdout );
-                               goto destroy;
+                               check |= CHECK_LOGLEVEL;
+                               break;
                        }
 
                        no_detach = 1;
@@ -564,8 +565,8 @@ int main( int argc, char **argv )
 
                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 ) ) {
@@ -765,6 +766,11 @@ unhandled_option:;
                syslog_unknowns = NULL;
                if ( rc )
                        goto destroy;
+       }       
+
+       if ( check & CHECK_LOGLEVEL ) {
+               rc = 0;
+               goto destroy;
        }
 
        if ( check & CHECK_CONFIG ) {
@@ -824,6 +830,12 @@ unhandled_option:;
        }
 #endif
 
+#ifdef HAVE_CYRUS_SASL
+       if( global_host == NULL ) {
+               global_host = ldap_pvt_get_fqdn( NULL );
+       }
+#endif
+
        (void) SIGNAL( LDAP_SIGUSR1, slap_sig_wake );
        (void) SIGNAL( LDAP_SIGUSR2, slap_sig_shutdown );
 
@@ -935,6 +947,9 @@ shutdown:
        rc |= slap_shutdown( NULL );
 
 destroy:
+       if ( check & CHECK_LOGLEVEL ) {
+               (void)loglevel_print( stdout );
+       }
        /* remember an error during destroy */
        rc |= slap_destroy();