2003-11-26 07:22:12 +08:00
|
|
|
/* common.h - common definitions for the ldap client tools */
|
2002-12-13 00:32:26 +08:00
|
|
|
/* $OpenLDAP$ */
|
2003-11-26 07:22:12 +08:00
|
|
|
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
|
|
|
|
*
|
2008-01-08 08:19:56 +08:00
|
|
|
* Copyright 1998-2008 The OpenLDAP Foundation.
|
2003-11-26 07:22:12 +08:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted only as authorized by the OpenLDAP
|
|
|
|
* Public License.
|
|
|
|
*
|
|
|
|
* A copy of this license is available in the file LICENSE in the
|
|
|
|
* top-level directory of the distribution or, alternatively, at
|
|
|
|
* <http://www.OpenLDAP.org/license.html>.
|
|
|
|
*/
|
2003-11-26 10:58:56 +08:00
|
|
|
/* ACKNOWLEDGEMENTS:
|
|
|
|
* This file was initially created by Hallvard B. Furuseth based (in
|
2003-11-26 07:22:12 +08:00
|
|
|
* part) upon argument parsing code for individual tools located in
|
|
|
|
* this directory.
|
2002-12-13 00:32:26 +08:00
|
|
|
*/
|
|
|
|
|
2003-11-26 07:22:12 +08:00
|
|
|
#ifndef _CLIENT_TOOLS_COMMON_H_
|
|
|
|
#define _CLIENT_TOOLS_COMMON_H_
|
2002-12-13 00:32:26 +08:00
|
|
|
|
2003-01-21 04:11:57 +08:00
|
|
|
LDAP_BEGIN_DECL
|
|
|
|
|
2006-01-09 03:51:28 +08:00
|
|
|
typedef enum tool_type_t {
|
|
|
|
TOOL_SEARCH = 0x01U,
|
|
|
|
TOOL_COMPARE = 0x02U,
|
|
|
|
TOOL_ADD = 0x04U,
|
|
|
|
TOOL_DELETE = 0x08U,
|
|
|
|
TOOL_MODIFY = 0x10U,
|
|
|
|
TOOL_MODRDN = 0x20U,
|
|
|
|
|
|
|
|
TOOL_EXOP = 0x40U,
|
|
|
|
|
|
|
|
TOOL_WHOAMI = TOOL_EXOP | 0x100U,
|
|
|
|
TOOL_PASSWD = TOOL_EXOP | 0x200U,
|
|
|
|
|
|
|
|
TOOL_WRITE = (TOOL_ADD|TOOL_DELETE|TOOL_MODIFY|TOOL_MODRDN),
|
|
|
|
TOOL_READ = (TOOL_SEARCH|TOOL_COMPARE),
|
|
|
|
|
|
|
|
TOOL_ALL = 0xFFU
|
|
|
|
} tool_type_t;
|
|
|
|
|
|
|
|
|
|
|
|
/* input-related vars */
|
|
|
|
|
|
|
|
/* misc. parameters */
|
|
|
|
extern tool_type_t tool_type;
|
|
|
|
extern int contoper;
|
|
|
|
extern int debug;
|
|
|
|
extern char *infile;
|
|
|
|
extern int dont;
|
|
|
|
extern int referrals;
|
|
|
|
extern int verbose;
|
|
|
|
extern int ldif;
|
|
|
|
extern char *prog;
|
|
|
|
|
|
|
|
/* connection */
|
|
|
|
extern char *ldapuri;
|
|
|
|
extern char *ldaphost;
|
|
|
|
extern int ldapport;
|
|
|
|
extern int use_tls;
|
|
|
|
extern int protocol;
|
|
|
|
extern int version;
|
|
|
|
|
|
|
|
/* authc/authz */
|
|
|
|
extern int authmethod;
|
|
|
|
extern char *binddn;
|
|
|
|
extern int want_bindpw;
|
|
|
|
extern struct berval passwd;
|
|
|
|
extern char *pw_file;
|
2002-12-13 00:32:26 +08:00
|
|
|
#ifdef HAVE_CYRUS_SASL
|
2006-01-09 03:51:28 +08:00
|
|
|
extern unsigned sasl_flags;
|
|
|
|
extern char *sasl_realm;
|
|
|
|
extern char *sasl_authc_id;
|
|
|
|
extern char *sasl_authz_id;
|
|
|
|
extern char *sasl_mech;
|
|
|
|
extern char *sasl_secprops;
|
2002-12-13 00:32:26 +08:00
|
|
|
#endif
|
2006-01-09 03:51:28 +08:00
|
|
|
|
|
|
|
/* controls */
|
|
|
|
extern char *assertion;
|
|
|
|
extern char *authzid;
|
|
|
|
extern int manageDIT;
|
|
|
|
extern int manageDSAit;
|
|
|
|
extern int noop;
|
|
|
|
extern int ppolicy;
|
|
|
|
extern int preread, postread;
|
|
|
|
extern ber_int_t pr_morePagedResults;
|
|
|
|
extern struct berval pr_cookie;
|
2005-01-26 00:11:26 +08:00
|
|
|
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
|
2006-01-09 03:51:28 +08:00
|
|
|
extern int chaining;
|
2005-01-26 00:11:26 +08:00
|
|
|
#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
|
2002-12-13 00:32:26 +08:00
|
|
|
|
2006-12-18 11:17:43 +08:00
|
|
|
/* options */
|
|
|
|
extern struct timeval nettimeout;
|
|
|
|
|
2002-12-13 00:32:26 +08:00
|
|
|
/* Defined in common.c, set in main() */
|
2006-01-09 03:51:28 +08:00
|
|
|
extern const char __Version[];
|
2002-12-13 00:32:26 +08:00
|
|
|
|
|
|
|
/* Defined in main program */
|
2006-01-09 03:51:28 +08:00
|
|
|
extern const char options[];
|
|
|
|
|
2002-12-13 00:32:26 +08:00
|
|
|
void usage LDAP_P(( void )) LDAP_GCCATTR((noreturn));
|
|
|
|
int handle_private_option LDAP_P(( int i ));
|
|
|
|
|
|
|
|
/* Defined in common.c */
|
2006-01-09 03:51:28 +08:00
|
|
|
void tool_init LDAP_P(( tool_type_t type ));
|
2002-12-13 00:32:26 +08:00
|
|
|
void tool_common_usage LDAP_P(( void ));
|
|
|
|
void tool_args LDAP_P(( int, char ** ));
|
|
|
|
LDAP *tool_conn_setup LDAP_P(( int dont, void (*private_setup)( LDAP * ) ));
|
|
|
|
void tool_bind LDAP_P(( LDAP * ));
|
2005-04-02 07:29:02 +08:00
|
|
|
void tool_unbind LDAP_P(( LDAP * ));
|
|
|
|
void tool_destroy LDAP_P(( void ));
|
2002-12-13 00:32:26 +08:00
|
|
|
void tool_server_controls LDAP_P(( LDAP *, LDAPControl *, int ));
|
2005-04-20 05:21:51 +08:00
|
|
|
int tool_check_abandon LDAP_P(( LDAP *ld, int msgid ));
|
2005-11-05 08:53:19 +08:00
|
|
|
void tool_perror LDAP_P((
|
2005-11-17 05:50:51 +08:00
|
|
|
const char *func,
|
2005-11-05 08:53:19 +08:00
|
|
|
int err,
|
2005-11-17 05:50:51 +08:00
|
|
|
const char *extra,
|
|
|
|
const char *matched,
|
|
|
|
const char *info,
|
2005-11-05 08:53:19 +08:00
|
|
|
char **refs ));
|
2005-11-23 09:18:18 +08:00
|
|
|
void tool_print_ctrls LDAP_P(( LDAP *ld, LDAPControl **ctrls ));
|
2005-11-22 22:29:38 +08:00
|
|
|
int tool_write_ldif LDAP_P(( int type, char *name, char *value, ber_len_t vallen ));
|
2006-01-07 00:20:24 +08:00
|
|
|
int tool_is_oid LDAP_P(( const char *s ));
|
2005-11-22 22:29:38 +08:00
|
|
|
|
2002-12-13 00:32:26 +08:00
|
|
|
|
2003-01-21 04:11:57 +08:00
|
|
|
LDAP_END_DECL
|
|
|
|
|
2003-11-26 07:22:12 +08:00
|
|
|
#endif /* _CLIENT_TOOLS_COMMON_H_ */
|