Back to index

openldap  2.4.31
slapcommon.h
Go to the documentation of this file.
00001 /* slapcommon.h - common definitions for the slap tools */
00002 /* $OpenLDAP$ */
00003 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00004  *
00005  * Copyright 1998-2012 The OpenLDAP Foundation.
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted only as authorized by the OpenLDAP
00010  * Public License.
00011  *
00012  * A copy of this license is available in the file LICENSE in the
00013  * top-level directory of the distribution or, alternatively, at
00014  * <http://www.OpenLDAP.org/license.html>.
00015  */
00016 
00017 #ifndef SLAPCOMMON_H_
00018 #define SLAPCOMMON_H_ 1
00019 
00020 #define SLAPD_TOOLS 1
00021 #include "slap.h"
00022 
00023 enum slaptool {
00024        SLAPADD=1,    /* LDIF -> database tool */
00025        SLAPCAT,      /* database -> LDIF tool */
00026        SLAPDN,              /* DN check w/ syntax tool */
00027        SLAPINDEX,    /* database index tool */
00028        SLAPPASSWD,   /* password generation tool */
00029        SLAPSCHEMA,   /* schema checking tool */
00030        SLAPTEST,     /* slapd.conf test tool */
00031        SLAPAUTH,     /* test authz-regexp and authc/authz stuff */
00032        SLAPACL,      /* test acl */
00033        SLAPLAST
00034 };
00035 
00036 typedef struct tool_vars {
00037        Backend *tv_be;
00038        int tv_dbnum;
00039        int tv_verbose;
00040        int tv_quiet;
00041        int tv_update_ctxcsn;
00042        int tv_continuemode;
00043        int tv_nosubordinates;
00044        int tv_dryrun;
00045        int tv_jumpline;
00046        struct berval tv_sub_ndn;
00047        int tv_scope;
00048        Filter *tv_filter;
00049        struct LDIFFP *tv_ldiffp;
00050        struct berval tv_baseDN;
00051        struct berval tv_authcDN;
00052        struct berval tv_authzDN;
00053        struct berval tv_authcID;
00054        struct berval tv_authzID;
00055        struct berval tv_mech;
00056        char   *tv_realm;
00057        struct berval tv_listener_url;
00058        struct berval tv_peer_domain;
00059        struct berval tv_peer_name;
00060        struct berval tv_sock_name;
00061        slap_ssf_t tv_ssf;
00062        slap_ssf_t tv_transport_ssf;
00063        slap_ssf_t tv_tls_ssf;
00064        slap_ssf_t tv_sasl_ssf;
00065        unsigned tv_dn_mode;
00066        unsigned int tv_csnsid;
00067        ber_len_t tv_ldif_wrap;
00068        char tv_maxcsnbuf[ LDAP_PVT_CSNSTR_BUFSIZE * ( SLAP_SYNC_SID_MAX + 1 ) ];
00069        struct berval tv_maxcsn[ SLAP_SYNC_SID_MAX + 1 ];
00070 } tool_vars;
00071 
00072 extern tool_vars tool_globals;
00073 
00074 #define       be tool_globals.tv_be
00075 #define       dbnum tool_globals.tv_dbnum
00076 #define verbose tool_globals.tv_verbose
00077 #define quiet tool_globals.tv_quiet
00078 #define jumpline tool_globals.tv_jumpline
00079 #define update_ctxcsn tool_globals.tv_update_ctxcsn
00080 #define continuemode tool_globals.tv_continuemode
00081 #define nosubordinates tool_globals.tv_nosubordinates
00082 #define dryrun tool_globals.tv_dryrun
00083 #define sub_ndn tool_globals.tv_sub_ndn
00084 #define scope tool_globals.tv_scope
00085 #define filter tool_globals.tv_filter
00086 #define ldiffp tool_globals.tv_ldiffp
00087 #define baseDN tool_globals.tv_baseDN
00088 #define authcDN tool_globals.tv_authcDN
00089 #define authzDN tool_globals.tv_authzDN
00090 #define authcID tool_globals.tv_authcID
00091 #define authzID tool_globals.tv_authzID
00092 #define mech tool_globals.tv_mech
00093 #define realm tool_globals.tv_realm
00094 #define listener_url tool_globals.tv_listener_url
00095 #define peer_domain tool_globals.tv_peer_domain
00096 #define peer_name tool_globals.tv_peer_name
00097 #define sock_name tool_globals.tv_sock_name
00098 #define ssf tool_globals.tv_ssf
00099 #define transport_ssf tool_globals.tv_transport_ssf
00100 #define tls_ssf tool_globals.tv_tls_ssf
00101 #define sasl_ssf tool_globals.tv_sasl_ssf
00102 #define dn_mode tool_globals.tv_dn_mode
00103 #define csnsid tool_globals.tv_csnsid
00104 #define ldif_wrap tool_globals.tv_ldif_wrap
00105 #define maxcsn tool_globals.tv_maxcsn
00106 #define maxcsnbuf tool_globals.tv_maxcsnbuf
00107 
00108 #define SLAP_TOOL_LDAPDN_PRETTY           SLAP_LDAPDN_PRETTY
00109 #define SLAP_TOOL_LDAPDN_NORMAL           (SLAP_LDAPDN_PRETTY << 1)
00110 
00111 void slap_tool_init LDAP_P((
00112        const char* name,
00113        int tool,
00114        int argc, char **argv ));
00115 
00116 int slap_tool_destroy LDAP_P((void));
00117 
00118 int slap_tool_update_ctxcsn LDAP_P((
00119        const char *progname,
00120        unsigned long sid,
00121        struct berval *bvtext ));
00122 
00123 unsigned long slap_tool_update_ctxcsn_check LDAP_P((
00124        const char *progname,
00125        Entry *e ));
00126 
00127 int slap_tool_update_ctxcsn_init LDAP_P((void));
00128 
00129 int slap_tool_entry_check LDAP_P((
00130        const char *progname,
00131        Operation *op,
00132        Entry *e,
00133        int lineno,
00134        const char **text,
00135        char *textbuf,
00136        size_t textlen ));
00137 
00138 #endif /* SLAPCOMMON_H_ */