]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/main.c
Plug mutex/rwlock leaks (destroy them)
[openldap] / servers / slapd / main.c
index e2ffda2c7c0d1582f3b27b0e13a3551fdd14b6c9..0cb0de16606e73a787e6f3ecac77ca3b8fc36c88 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2009 The OpenLDAP Foundation.
+ * Copyright 1998-2010 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -99,6 +99,9 @@ const char Versionstr[] =
        OPENLDAP_PACKAGE " " OPENLDAP_VERSION " Standalone LDAP Server (slapd)";
 #endif
 
+extern OverlayInit slap_oinfo[];
+extern BackendInfo slap_binfo[];
+
 #define        CHECK_NONE      0x00
 #define        CHECK_CONFIG    0x01
 #define        CHECK_LOGLEVEL  0x02
@@ -270,7 +273,18 @@ parse_debug_level( const char *arg, int *levelp, char ***unknowns )
                ldap_charray_free( levels );
 
        } else {
-               if ( lutil_atoix( &level, arg, 0 ) != 0 ) {
+               int rc;
+
+               if ( arg[0] == '-' ) {
+                       rc = lutil_atoix( &level, arg, 0 );
+               } else {
+                       unsigned ulevel;
+
+                       rc = lutil_atoux( &ulevel, arg, 0 );
+                       level = (int)ulevel;
+               }
+
+               if ( rc ) {
                        fprintf( stderr,
                                "unrecognized log level "
                                "\"%s\"\n", arg );
@@ -329,7 +343,8 @@ usage( char *name )
 #if defined(HAVE_SETUID) && defined(HAVE_SETGID)
                "\t-u user\t\tUser (id or name) to run as\n"
 #endif
-               "\t-V\t\tprint version info (-VV only)\n"
+               "\t-V\t\tprint version info (-VV exit afterwards, -VVV print\n"
+               "\t\t\tinfo about static overlays and backends)\n"
     );
 }
 
@@ -673,6 +688,21 @@ unhandled_option:;
 
        if ( version ) {
                fprintf( stderr, "%s\n", Versionstr );
+               if ( version > 2 ) {
+                       if ( slap_oinfo[0].ov_type ) {
+                               fprintf( stderr, "Included static overlays:\n");
+                               for ( i= 0 ; slap_oinfo[i].ov_type; i++ ) {
+                                       fprintf( stderr, "    %s\n", slap_oinfo[i].ov_type );
+                               }
+                       }
+                       if ( slap_binfo[0].bi_type ) {
+                               fprintf( stderr, "Included static backends:\n");
+                               for ( i= 0 ; slap_binfo[i].bi_type; i++ ) {
+                                       fprintf( stderr, "    %s\n", slap_binfo[i].bi_type );
+                               }
+                       }
+               }
+
                if ( version > 1 ) goto stop;
        }
 
@@ -700,6 +730,7 @@ unhandled_option:;
        Debug( LDAP_DEBUG_ANY, "%s", Versionstr, 0, 0 );
 
        global_host = ldap_pvt_get_fqdn( NULL );
+       ber_str2bv( global_host, 0, 0, &global_host_bv );
 
        if( check == CHECK_NONE && slapd_daemon_init( urls ) != 0 ) {
                rc = 1;