]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Expose slapTool for use elsewhere
authorOndřej Kuzník <ondra@mistotebe.net>
Tue, 13 Apr 2021 10:37:31 +0000 (11:37 +0100)
committerOndřej Kuzník <ondra@mistotebe.net>
Wed, 14 Apr 2021 17:17:59 +0000 (18:17 +0100)
servers/slapd/slap.h
servers/slapd/slapcommon.c
servers/slapd/slapcommon.h
servers/slapd/slappasswd.c
servers/slapd/slapschema.c

index e85816e46c73cd66e34cd3af9f16dd4f0fae9c45..335b2b268eb9792eba4ff51a3acfb1370de90ee6 100644 (file)
@@ -1612,6 +1612,22 @@ LDAP_SLAPD_V (int) slapMode;
 #define SB_TLS_ON              1
 #define SB_TLS_CRITICAL                2
 
+enum slaptool {
+       SLAPADD=1,      /* LDIF -> database tool */
+       SLAPCAT,        /* database -> LDIF tool */
+       SLAPDN,         /* DN check w/ syntax tool */
+       SLAPINDEX,      /* database index tool */
+       SLAPMODIFY,     /* database modify tool */
+       SLAPPASSWD,     /* password generation tool */
+       SLAPSCHEMA,     /* schema checking tool */
+       SLAPTEST,       /* slapd.conf test tool */
+       SLAPAUTH,       /* test authz-regexp and authc/authz stuff */
+       SLAPACL,        /* test acl */
+       SLAPLAST
+};
+
+LDAP_SLAPD_V(enum slaptool) slapTool;
+
 typedef struct slap_keepalive {
        int sk_idle;
        int sk_probes;
index be24359a92c4dbd3d2ac935c91130e3003ca5059..09b221546623eeb6fc4f3f63d81f6e542f102224 100644 (file)
@@ -39,6 +39,7 @@
 #include "ldif.h"
 
 tool_vars tool_globals;
+enum slaptool slapTool;
 
 #ifdef CSRIMALLOC
 static char *leakfilename;
@@ -671,6 +672,7 @@ slap_tool_init(
         * initialize stuff and figure out which backend we're dealing with
         */
 
+       slapTool = tool;
        rc = slap_init( mode, progname );
        if ( rc != 0 ) {
                fprintf( stderr, "%s: slap_init failed!\n", progname );
index 744e1af0214b7e7866e96fd0b2d993a58950aff9..bd4054b6ca60717ddd67819c42f042b4f1d86474 100644 (file)
 #define SLAPD_TOOLS 1
 #include "slap.h"
 
-enum slaptool {
-       SLAPADD=1,      /* LDIF -> database tool */
-       SLAPCAT,        /* database -> LDIF tool */
-       SLAPDN,         /* DN check w/ syntax tool */
-       SLAPINDEX,      /* database index tool */
-       SLAPMODIFY,     /* database modify tool */
-       SLAPPASSWD,     /* password generation tool */
-       SLAPSCHEMA,     /* schema checking tool */
-       SLAPTEST,       /* slapd.conf test tool */
-       SLAPAUTH,       /* test authz-regexp and authc/authz stuff */
-       SLAPACL,        /* test acl */
-       SLAPLAST
-};
-
 typedef struct tool_vars {
        Backend *tv_be;
        int tv_dbnum;
index 012c5daf2d6d8edae319179a8730990466af0215..2028db4fa11135623a5dcfd0d3fc8d0687d2f00c 100644 (file)
 #include <lutil_sha1.h>
 
 #include "ldap_defaults.h"
+
 #include "slap.h"
+#include "slap-config.h"
+#include "slapcommon.h"
 
-static int     verbose = 0;
 static char    *modulepath = NULL;
 static char    *moduleload = NULL;
 
@@ -204,6 +206,7 @@ slappasswd( int argc, char *argv[] )
                        usage ( progname );
                }
        }
+       slapTool = SLAPPASSWD;
 
        if( argc - optind != 0 ) {
                usage( progname );
index 93107968b037972db29c0a5a73b8a4f931a69605..044c665204f3ab2f854ac8fda6045b0ca4da25c3 100644 (file)
@@ -53,7 +53,7 @@ slapschema( int argc, char **argv )
        int requestBSF = 0;
        int doBSF = 0;
 
-       slap_tool_init( progname, SLAPCAT, argc, argv );
+       slap_tool_init( progname, SLAPSCHEMA, argc, argv );
 
        requestBSF = ( sub_ndn.bv_len || filter );