From 2a746777991e89c73a757266d620c318104c5657 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 20 Aug 1999 19:00:44 +0000 Subject: [PATCH] const'fication --- servers/slapd/aclparse.c | 4 +- servers/slapd/attr.c | 6 +- servers/slapd/back-ldbm/attr.c | 2 +- servers/slapd/back-ldbm/cache.c | 4 +- servers/slapd/back-ldbm/config.c | 2 +- servers/slapd/back-ldbm/dn2id.c | 10 +-- servers/slapd/back-ldbm/external.h | 6 +- servers/slapd/back-ldbm/group.c | 12 ++-- servers/slapd/back-ldbm/idl.c | 6 +- servers/slapd/back-ldbm/proto-back-ldbm.h | 17 ++--- servers/slapd/backend.c | 20 +++--- servers/slapd/bind.c | 3 +- servers/slapd/charray.c | 17 ++--- servers/slapd/config.c | 2 +- servers/slapd/dn.c | 17 ++--- servers/slapd/lock.c | 2 +- servers/slapd/proto-slap.h | 82 +++++++++++++---------- servers/slapd/result.c | 10 +-- servers/slapd/schema.c | 12 ++-- servers/slapd/schemaparse.c | 12 ++-- servers/slapd/slap.h | 8 +-- servers/slapd/tools/mimic.c | 10 +-- 22 files changed, 138 insertions(+), 126 deletions(-) diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index f31993f2d2..85748b9552 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -26,7 +26,7 @@ static void print_access(Access *b); #endif static int -regtest(char *fname, int lineno, char *pat) { +regtest(const char *fname, int lineno, char *pat) { int e; regex_t re; @@ -84,7 +84,7 @@ regtest(char *fname, int lineno, char *pat) { void parse_acl( Backend *be, - char *fname, + const char *fname, int lineno, int argc, char **argv diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 74e5c241c5..2aadf7056c 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -191,7 +191,7 @@ attr_merge( Attribute * attr_find( Attribute *a, - char *type + const char *type ) { for ( ; a != NULL; a = a->a_next ) { @@ -213,7 +213,7 @@ attr_find( int attr_delete( Attribute **attrs, - char *type + const char *type ) { Attribute **a; @@ -261,7 +261,7 @@ attr_syntax( char *type ) void attr_syntax_config( - char *fname, + const char *fname, int lineno, int argc, char **argv diff --git a/servers/slapd/back-ldbm/attr.c b/servers/slapd/back-ldbm/attr.c index ea7f85da1b..be71dcf2f7 100644 --- a/servers/slapd/back-ldbm/attr.c +++ b/servers/slapd/back-ldbm/attr.c @@ -88,7 +88,7 @@ attr_masks( void attr_index_config( struct ldbminfo *li, - char *fname, + const char *fname, int lineno, int argc, char **argv, diff --git a/servers/slapd/back-ldbm/cache.c b/servers/slapd/back-ldbm/cache.c index 66ecb5ba9b..d23747d995 100644 --- a/servers/slapd/back-ldbm/cache.c +++ b/servers/slapd/back-ldbm/cache.c @@ -435,14 +435,14 @@ ID cache_find_entry_dn2id( Backend *be, Cache *cache, - char *dn + const char *dn ) { Entry e, *ep; ID id; int count = 0; - e.e_dn = dn; + e.e_dn = (char *) dn; e.e_ndn = ch_strdup( dn ); (void) dn_normalize_case( e.e_ndn ); diff --git a/servers/slapd/back-ldbm/config.c b/servers/slapd/back-ldbm/config.c index 80cabd6a47..57cbd36c3d 100644 --- a/servers/slapd/back-ldbm/config.c +++ b/servers/slapd/back-ldbm/config.c @@ -18,7 +18,7 @@ int ldbm_back_db_config( Backend *be, - char *fname, + const char *fname, int lineno, int argc, char **argv diff --git a/servers/slapd/back-ldbm/dn2id.c b/servers/slapd/back-ldbm/dn2id.c index 2e1238ec9f..26f75476aa 100644 --- a/servers/slapd/back-ldbm/dn2id.c +++ b/servers/slapd/back-ldbm/dn2id.c @@ -18,7 +18,7 @@ int dn2id_add( Backend *be, - char *dn, + const char *dn, ID id ) { @@ -99,7 +99,7 @@ dn2id_add( ID dn2id( Backend *be, - char *dn + const char *dn ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; @@ -151,7 +151,7 @@ dn2id( ID_BLOCK * dn2idl( Backend *be, - char *dn, + const char *dn, int prefix ) { @@ -187,7 +187,7 @@ dn2idl( int dn2id_delete( Backend *be, - char *dn + const char *dn ) { DBCache *db; @@ -228,7 +228,7 @@ dn2id_delete( Entry * dn2entry_rw( Backend *be, - char *dn, + const char *dn, Entry **matched, int rw ) diff --git a/servers/slapd/back-ldbm/external.h b/servers/slapd/back-ldbm/external.h index c35e612d11..31fddcf0e5 100644 --- a/servers/slapd/back-ldbm/external.h +++ b/servers/slapd/back-ldbm/external.h @@ -19,7 +19,7 @@ extern int ldbm_back_db_close LDAP_P(( BackendDB *bd )); extern int ldbm_back_db_destroy LDAP_P(( BackendDB *bd )); extern int ldbm_back_db_config LDAP_P(( BackendDB *bd, - char *fname, int lineno, int argc, char **argv )); + const char *fname, int lineno, int argc, char **argv )); extern int ldbm_back_bind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, @@ -57,8 +57,8 @@ extern int ldbm_back_abandon LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, ber_int_t msgid )); extern int ldbm_back_group LDAP_P(( BackendDB *bd, - Entry *target, char* gr_ndn, char* op_ndn, - char* objectclassValue, char* groupattrName)); + Entry *target, const char* gr_ndn, const char* op_ndn, + const char* objectclassValue, const char* groupattrName)); /* hooks for slap tools */ diff --git a/servers/slapd/back-ldbm/group.c b/servers/slapd/back-ldbm/group.c index 252b584166..fbbc7f21b6 100644 --- a/servers/slapd/back-ldbm/group.c +++ b/servers/slapd/back-ldbm/group.c @@ -24,10 +24,10 @@ int ldbm_back_group( Backend *be, Entry *target, - char *gr_ndn, - char *op_ndn, - char *objectclassValue, - char *groupattrName + const char *gr_ndn, + const char *op_ndn, + const char *objectclassValue, + const char *groupattrName ) { struct ldbminfo *li = (struct ldbminfo *) be->be_private; @@ -104,7 +104,7 @@ ldbm_back_group( goto return_results; } - bv.bv_val = objectclassValue; + bv.bv_val = (char *) objectclassValue; bv.bv_len = strlen( bv.bv_val ); if (value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) { @@ -125,7 +125,7 @@ ldbm_back_group( "<= ldbm_back_group: found objectClass %s and %s\n", objectclassValue, groupattrName, 0 ); - bv.bv_val = op_ndn; + bv.bv_val = (char *) op_ndn; bv.bv_len = strlen( op_ndn ); if( value_find( attr->a_vals, &bv, attr->a_syntax, 1) != 0 ) diff --git a/servers/slapd/back-ldbm/idl.c b/servers/slapd/back-ldbm/idl.c index 47c8a305cc..31707adf0b 100644 --- a/servers/slapd/back-ldbm/idl.c +++ b/servers/slapd/back-ldbm/idl.c @@ -69,7 +69,7 @@ idl_fetch_one( ) { Datum data; - ID_BLOCK *idl; + ID_BLOCK idl; /* Debug( LDAP_DEBUG_TRACE, "=> idl_fetch_one\n", 0, 0, 0 ); */ @@ -79,10 +79,10 @@ idl_fetch_one( return NULL; } - idl = idl_dup( (ID_BLOCK *) data.dptr); + memcpy( &idl, data.dptr, data.dsize ); ldbm_datum_free( db->dbc_db, data ); - return( idl ); + return idl_dup( &idl ); } diff --git a/servers/slapd/back-ldbm/proto-back-ldbm.h b/servers/slapd/back-ldbm/proto-back-ldbm.h index 90ea6281d2..641c52d2b1 100644 --- a/servers/slapd/back-ldbm/proto-back-ldbm.h +++ b/servers/slapd/back-ldbm/proto-back-ldbm.h @@ -34,8 +34,9 @@ Entry *deref_internal_r LDAP_P(( void attr_masks LDAP_P(( struct ldbminfo *li, char *type, int *indexmask, int *syntaxmask )); -void attr_index_config LDAP_P(( struct ldbminfo *li, char *fname, int lineno, - int argc, char **argv, int init )); +void attr_index_config LDAP_P(( struct ldbminfo *li, + const char *fname, int lineno, + int argc, char **argv, int init )); void attr_index_destroy LDAP_P(( Avlnode *tree )); /* @@ -48,7 +49,7 @@ void cache_return_entry_rw LDAP_P(( Cache *cache, Entry *e, int rw )); #define cache_return_entry_r(c, e) cache_return_entry_rw((c), (e), 0) #define cache_return_entry_w(c, e) cache_return_entry_rw((c), (e), 1) -ID cache_find_entry_dn2id LDAP_P(( Backend *be, Cache *cache, char *dn )); +ID cache_find_entry_dn2id LDAP_P(( Backend *be, Cache *cache, const char *dn )); Entry * cache_find_entry_id LDAP_P(( Cache *cache, ID id, int rw )); int cache_delete_entry LDAP_P(( Cache *cache, Entry *e )); void cache_release_all LDAP_P(( Cache *cache )); @@ -70,12 +71,12 @@ int ldbm_cache_delete LDAP_P(( DBCache *db, Datum key )); * dn2id.c */ -int dn2id_add LDAP_P(( Backend *be, char *dn, ID id )); -ID dn2id LDAP_P(( Backend *be, char *dn )); -ID_BLOCK *dn2idl LDAP_P(( Backend *be, char *dn, int prefix )); -int dn2id_delete LDAP_P(( Backend *be, char *dn )); +int dn2id_add LDAP_P(( Backend *be, const char *dn, ID id )); +ID dn2id LDAP_P(( Backend *be, const char *dn )); +ID_BLOCK *dn2idl LDAP_P(( Backend *be, const char *dn, int prefix )); +int dn2id_delete LDAP_P(( Backend *be, const char *dn )); -Entry * dn2entry_rw LDAP_P(( Backend *be, char *dn, Entry **matched, int rw )); +Entry * dn2entry_rw LDAP_P(( Backend *be, const char *dn, Entry **matched, int rw )); #define dn2entry_r(be, dn, m) dn2entry_rw((be), (dn), (m), 0) #define dn2entry_w(be, dn, m) dn2entry_rw((be), (dn), (m), 1) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 7e8a1cf327..97552309a4 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -339,7 +339,7 @@ int backend_destroy(void) return 0; } -BackendInfo* backend_info(char *type) +BackendInfo* backend_info(const char *type) { int i; @@ -356,7 +356,7 @@ BackendInfo* backend_info(char *type) BackendDB * backend_db_init( - char *type + const char *type ) { Backend *be; @@ -410,7 +410,7 @@ be_db_close( void ) } Backend * -select_backend( char * dn ) +select_backend( const char * dn ) { int i, j, len, dnlen; @@ -452,7 +452,7 @@ select_backend( char * dn ) int be_issuffix( Backend *be, - char *suffix + const char *suffix ) { int i; @@ -467,7 +467,7 @@ be_issuffix( } int -be_isroot( Backend *be, char *ndn ) +be_isroot( Backend *be, const char *ndn ) { int rc; @@ -491,7 +491,7 @@ be_root_dn( Backend *be ) } int -be_isroot_pw( Backend *be, char *ndn, struct berval *cred ) +be_isroot_pw( Backend *be, const char *ndn, struct berval *cred ) { int result; @@ -578,10 +578,10 @@ int backend_group( Backend *be, Entry *target, - char *gr_ndn, - char *op_ndn, - char *objectclassValue, - char *groupattrName + const char *gr_ndn, + const char *op_ndn, + const char *objectclassValue, + const char *groupattrName ) { if (be->be_group) diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index 196fa67cf3..f6800973a2 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -35,7 +35,8 @@ do_bind( ber_int_t version; ber_tag_t method; char *mech; - char *dn, *ndn; + char *dn; + char *ndn; ber_tag_t tag; int rc = LDAP_SUCCESS; struct berval cred; diff --git a/servers/slapd/charray.c b/servers/slapd/charray.c index c7902bb844..8c27f1fbd0 100644 --- a/servers/slapd/charray.c +++ b/servers/slapd/charray.c @@ -16,7 +16,7 @@ void charray_add( char ***a, - char *s + const char *s ) { int n; @@ -40,7 +40,7 @@ charray_add( void charray_merge( char ***a, - char **s + const char **s ) { int i, n, nn; @@ -79,8 +79,8 @@ charray_free( char **array ) int charray_inlist( - char **a, - char *s + const char **a, + const char *s ) { int i; @@ -95,7 +95,7 @@ charray_inlist( } char ** -charray_dup( char **a ) +charray_dup( const char **a ) { int i; char **new; @@ -115,7 +115,7 @@ charray_dup( char **a ) char * -charray2str( char **a ) +charray2str( const char **a ) { char *s; int i; @@ -143,15 +143,16 @@ charray2str( char **a ) char ** -str2charray( char *str, char *brkstr ) +str2charray( const char *str_in, const char *brkstr ) { + char *str; char **res; char *s; char *lasts; int i; /* protect the input string from strtok */ - str = ch_strdup( str ); + str = ch_strdup( str_in ); i = 1; for ( s = str; *s; s++ ) { diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 294b8ed06f..f669e359d6 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -43,7 +43,7 @@ static int fp_parse_line(char *line, int *argcp, char **argv); static char *strtok_quote(char *line, char *sep); int -read_config( char *fname ) +read_config( const char *fname ) { FILE *fp; char *line, *savefname, *saveline; diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index c74ff919b1..be724852e0 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -197,10 +197,10 @@ dn_normalize_case( char *dn ) char * dn_parent( Backend *be, - char *dn + const char *dn ) { - char *s; + const char *s; int inquote; if( dn == NULL ) { @@ -345,21 +345,19 @@ char * dn_rdn( */ char **dn_subtree( Backend *be, - char *dn ) + const char *dn ) { char *child, *parent; char **subtree = NULL; - child = dn; + child = ch_strdup( dn ); do { charray_add( &subtree, child ); parent = dn_parent( be, child ); - if( child != dn ) { - free( child ); - } + free( child ); child = parent; } while ( child != NULL ); @@ -551,7 +549,10 @@ int rdn_validate( const char * rdn ) */ void -build_new_dn( char ** new_dn, char *e_dn, char * p_dn, char * newrdn ) +build_new_dn( char ** new_dn, + const char *e_dn, + const char * p_dn, + const char * newrdn ) { if ( p_dn == NULL ) { diff --git a/servers/slapd/lock.c b/servers/slapd/lock.c index ac109065a2..97ac5f8968 100644 --- a/servers/slapd/lock.c +++ b/servers/slapd/lock.c @@ -22,7 +22,7 @@ #include "slap.h" FILE * -lock_fopen( char *fname, char *type, FILE **lfp ) +lock_fopen( const char *fname, const char *type, FILE **lfp ) { FILE *fp; char buf[MAXPATHLEN]; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index a8dfa588e2..44a570982e 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -36,7 +36,10 @@ int acl_check_modlist LDAP_P(( Backend *be, * aclparse.c */ -void parse_acl LDAP_P(( Backend *be, char *fname, int lineno, int argc, char **argv )); +void parse_acl LDAP_P(( Backend *be, + const char *fname, + int lineno, + int argc, char **argv )); char * access2str LDAP_P(( int access )); int str2access LDAP_P(( char *str )); @@ -50,10 +53,10 @@ char * attr_normalize LDAP_P(( char *s )); int attr_merge_fast LDAP_P(( Entry *e, char *type, struct berval **vals, int nvals, int naddvals, int *maxvals, Attribute ***a )); int attr_merge LDAP_P(( Entry *e, char *type, struct berval **vals )); -Attribute * attr_find LDAP_P(( Attribute *a, char *type )); -int attr_delete LDAP_P(( Attribute **attrs, char *type )); +Attribute * attr_find LDAP_P(( Attribute *a, const char *type )); +int attr_delete LDAP_P(( Attribute **attrs, const char *type )); int attr_syntax LDAP_P(( char *type )); -void attr_syntax_config LDAP_P(( char *fname, int lineno, int argc, char **argv )); +void attr_syntax_config LDAP_P(( const char *fname, int lineno, int argc, char **argv )); AttributeType * at_find LDAP_P(( const char *name )); int at_find_in_list LDAP_P(( AttributeType *sat, AttributeType **list )); int at_append_to_list LDAP_P(( AttributeType *sat, AttributeType ***listp )); @@ -84,14 +87,14 @@ int backend_startup LDAP_P((Backend *be)); int backend_shutdown LDAP_P((Backend *be)); int backend_destroy LDAP_P((void)); -BackendInfo * backend_info LDAP_P(( char *type )); -BackendDB * backend_db_init LDAP_P(( char *type )); +BackendInfo * backend_info LDAP_P(( const char *type )); +BackendDB * backend_db_init LDAP_P(( const char *type )); -BackendDB * select_backend LDAP_P(( char * dn )); +BackendDB * select_backend LDAP_P(( const char * dn )); -int be_issuffix LDAP_P(( Backend *be, char *suffix )); -int be_isroot LDAP_P(( Backend *be, char *ndn )); -int be_isroot_pw LDAP_P(( Backend *be, char *ndn, struct berval *cred )); +int be_issuffix LDAP_P(( Backend *be, const char *suffix )); +int be_isroot LDAP_P(( Backend *be, const char *ndn )); +int be_isroot_pw LDAP_P(( Backend *be, const char *ndn, struct berval *cred )); char* be_root_dn LDAP_P(( Backend *be )); int be_entry_release_rw LDAP_P(( Backend *be, Entry *e, int rw )); #define be_entry_release_r( be, e ) be_entry_release_rw( be, e, 0 ) @@ -105,8 +108,10 @@ extern int backend_connection_destroy LDAP_P((Connection *conn)); extern int backend_group LDAP_P((Backend *be, Entry *target, - char *gr_ndn, char *op_ndn, - char *objectclassValue, char *groupattrName)); + const char *gr_ndn, + const char *op_ndn, + const char *objectclassValue, + const char *groupattrName)); #ifdef SLAPD_SCHEMA_DN /* temporary extern for temporary routine*/ @@ -142,13 +147,13 @@ void ch_free LDAP_P(( void * )); * charray.c */ -void charray_add LDAP_P(( char ***a, char *s )); -void charray_merge LDAP_P(( char ***a, char **s )); +void charray_add LDAP_P(( char ***a, const char *s )); +void charray_merge LDAP_P(( char ***a, const char **s )); void charray_free LDAP_P(( char **array )); -int charray_inlist LDAP_P(( char **a, char *s )); -char ** charray_dup LDAP_P(( char **a )); -char ** str2charray LDAP_P(( char *str, char *brkstr )); -char * charray2str LDAP_P(( char **a )); +int charray_inlist LDAP_P(( const char **a, const char *s )); +char ** charray_dup LDAP_P(( const char **a )); +char ** str2charray LDAP_P(( const char *str, const char *brkstr )); +char * charray2str LDAP_P(( const char **a )); /* * controls.c @@ -164,7 +169,7 @@ int get_manageDSAit LDAP_P(( Operation *op )); * config.c */ -int read_config LDAP_P(( char *fname )); +int read_config LDAP_P(( const char *fname )); /* * connection.c @@ -201,8 +206,8 @@ void connection_done LDAP_P((Connection *)); char * dn_normalize LDAP_P(( char *dn )); char * dn_normalize_case LDAP_P(( char *dn )); -char * dn_parent LDAP_P(( Backend *be, char *dn )); -char ** dn_subtree LDAP_P(( Backend *be, char *dn )); +char * dn_parent LDAP_P(( Backend *be, const char *dn )); +char ** dn_subtree LDAP_P(( Backend *be, const char *dn )); char * dn_rdn LDAP_P(( Backend *be, char *dn )); int dn_issuffix LDAP_P(( char *dn, char *suffix )); #ifdef DNS_DN @@ -213,8 +218,11 @@ char * str2lower LDAP_P(( char *str )); int rdn_validate LDAP_P(( const char* str )); char * rdn_attr_value LDAP_P(( char * rdn )); char * rdn_attr_type LDAP_P(( char * rdn )); -void build_new_dn LDAP_P(( char ** new_dn, char *e_dn, char * p_dn, - char * newrdn )); + +void build_new_dn LDAP_P(( char ** new_dn, + const char *e_dn, + const char * p_dn, + const char * newrdn )); /* * entry.c */ @@ -248,7 +256,7 @@ int test_filter LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e, * lock.c */ -FILE * lock_fopen LDAP_P(( char *fname, char *type, FILE **lfp )); +FILE * lock_fopen LDAP_P(( const char *fname, const char *type, FILE **lfp )); int lock_fclose LDAP_P(( FILE *fp, FILE *lfp )); /* @@ -310,17 +318,17 @@ struct berval **get_entry_referrals LDAP_P(( void send_ldap_result LDAP_P(( Connection *conn, Operation *op, - int err, char *matched, char *text, + int err, const char *matched, const char *text, struct berval **refs, LDAPControl **ctrls )); void send_ldap_disconnect LDAP_P(( Connection *conn, Operation *op, - int err, char *text )); + int err, const char *text )); void send_search_result LDAP_P(( Connection *conn, Operation *op, - int err, char *matched, char *text, + int err, const char *matched, const char *text, struct berval **refs, LDAPControl **ctrls, int nentries )); @@ -352,9 +360,9 @@ int sasl_destroy(void); */ int oc_schema_check LDAP_P(( Entry *e )); -int oc_check_operational_attr LDAP_P(( char *type )); -int oc_check_usermod_attr LDAP_P(( char *type )); -int oc_check_no_usermod_attr LDAP_P(( char *type )); +int oc_check_operational_attr LDAP_P(( const char *type )); +int oc_check_usermod_attr LDAP_P(( const char *type )); +int oc_check_no_usermod_attr LDAP_P(( const char *type )); ObjectClass *oc_find LDAP_P((const char *ocname)); int oc_add LDAP_P((LDAP_OBJECT_CLASS *oc, const char **err)); Syntax *syn_find LDAP_P((const char *synname)); @@ -365,7 +373,7 @@ int mr_add LDAP_P((LDAP_MATCHING_RULE *mr, slap_mr_normalize_func *normalize, sl void schema_info LDAP_P((Connection *conn, Operation *op, char **attrs, int attrsonly)); int schema_init LDAP_P((void)); -int is_entry_objectclass LDAP_P(( Entry *, char* objectclass )); +int is_entry_objectclass LDAP_P(( Entry *, const char* objectclass )); #define is_entry_alias(e) is_entry_objectclass((e), "ALIAS") #define is_entry_referral(e) is_entry_objectclass((e), "REFERRAL") @@ -374,12 +382,12 @@ int is_entry_objectclass LDAP_P(( Entry *, char* objectclass )); * schemaparse.c */ -void parse_oc_old LDAP_P(( Backend *be, char *fname, int lineno, int argc, char **argv )); -void parse_oc LDAP_P(( char *fname, int lineno, char *line, char **argv )); -void parse_at LDAP_P(( char *fname, int lineno, char *line, char **argv )); -void parse_oidm LDAP_P(( char *fname, int lineno, int argc, char **argv )); +void parse_oc_old LDAP_P(( Backend *be, const char *fname, int lineno, int argc, char **argv )); +void parse_oc LDAP_P(( const char *fname, int lineno, char *line, char **argv )); +void parse_at LDAP_P(( const char *fname, int lineno, char *line, char **argv )); +void parse_oidm LDAP_P(( const char *fname, int lineno, int argc, char **argv )); char *scherr2str LDAP_P((int code)); -int dscompare LDAP_P(( char *s1, char *s2del, char delim )); +int dscompare LDAP_P(( const char *s1, const char *s2del, char delim )); /* * str2filter.c */ @@ -408,7 +416,7 @@ int value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax, * user.c */ #if defined(HAVE_PWD_H) && defined(HAVE_GRP_H) -void slap_init_user LDAP_P(( char *username, char *groupname )); +void slap_init_user LDAP_P(( const char *username, const char *groupname )); #endif /* diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 6f3434276d..309350f646 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -299,7 +299,7 @@ send_ldap_disconnect( Connection *conn, Operation *op, ber_int_t err, - char *text + const char *text ) { ber_tag_t tag; @@ -353,8 +353,8 @@ send_ldap_result( Connection *conn, Operation *op, ber_int_t err, - char *matched, - char *text, + const char *matched, + const char *text, struct berval **ref, LDAPControl **ctrls ) @@ -420,8 +420,8 @@ send_search_result( Connection *conn, Operation *op, ber_int_t err, - char *matched, - char *text, + const char *matched, + const char *text, struct berval **refs, LDAPControl **ctrls, int nentries diff --git a/servers/slapd/schema.c b/servers/slapd/schema.c index b14680fda0..e347a5d693 100644 --- a/servers/slapd/schema.c +++ b/servers/slapd/schema.c @@ -180,7 +180,7 @@ static char *oc_no_usermod_attrs[] = { * check to see if attribute is 'operational' or not. */ int -oc_check_operational_attr( char *type ) +oc_check_operational_attr( const char *type ) { return charray_inlist( oc_operational_attrs, type ) || charray_inlist( oc_usermod_attrs, type ) @@ -191,7 +191,7 @@ oc_check_operational_attr( char *type ) * check to see if attribute can be user modified or not. */ int -oc_check_usermod_attr( char *type ) +oc_check_usermod_attr( const char *type ) { return charray_inlist( oc_usermod_attrs, type ); } @@ -200,7 +200,7 @@ oc_check_usermod_attr( char *type ) * check to see if attribute is 'no user modification' or not. */ int -oc_check_no_usermod_attr( char *type ) +oc_check_no_usermod_attr( const char *type ) { return charray_inlist( oc_no_usermod_attrs, type ); } @@ -565,7 +565,7 @@ syn_find_desc( const char *syndesc, int *len ) Syntax *synp; for (synp = syn_list; synp; synp = synp->ssyn_next) - if ((*len = dscompare( synp->ssyn_syn.syn_desc, (char *)syndesc, '{'))) + if ((*len = dscompare( synp->ssyn_syn.syn_desc, syndesc, '{'))) return synp; return( NULL ); } @@ -1225,7 +1225,7 @@ oc_print( ObjectClass *oc ) int is_entry_objectclass( Entry* e, - char* oc) + const char* oc) { Attribute *attr; struct berval bv; @@ -1243,7 +1243,7 @@ int is_entry_objectclass( return 0; } - bv.bv_val = oc; + bv.bv_val = (char *) oc; bv.bv_len = strlen( bv.bv_val ); if( value_find(attr->a_vals, &bv, attr->a_syntax, 1) != 0) { diff --git a/servers/slapd/schemaparse.c b/servers/slapd/schemaparse.c index a2e3514a41..938e8bbd39 100644 --- a/servers/slapd/schemaparse.c +++ b/servers/slapd/schemaparse.c @@ -51,7 +51,7 @@ scherr2str(int code) void parse_oc_old( Backend *be, - char *fname, + const char *fname, int lineno, int argc, char **argv @@ -151,9 +151,9 @@ parse_oc_old( * matched, otherwise return length matched. */ int -dscompare(char *s1, char *s2, char delim) +dscompare(const char *s1, const char *s2, char delim) { - char *orig = s1; + const char *orig = s1; while (*s1++ == *s2++) if (!s1[-1]) break; --s1; @@ -202,7 +202,7 @@ find_oidm(char *oid) void parse_oidm( - char *fname, + const char *fname, int lineno, int argc, char **argv @@ -233,7 +233,7 @@ usage: fprintf( stderr, "ObjectIdentifier \n"); void parse_oc( - char *fname, + const char *fname, int lineno, char *line, char **argv @@ -337,7 +337,7 @@ at_usage( void ) void parse_at( - char *fname, + const char *fname, int lineno, char *line, char **argv diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 4f544f4ca6..077566ebb2 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -497,7 +497,7 @@ struct slap_backend_info { */ int (*bi_init) LDAP_P((BackendInfo *bi)); int (*bi_config) LDAP_P((BackendInfo *bi, - char *fname, int lineno, int argc, char **argv )); + const char *fname, int lineno, int argc, char **argv )); int (*bi_open) LDAP_P((BackendInfo *bi)); int (*bi_close) LDAP_P((BackendInfo *bi)); int (*bi_destroy) LDAP_P((BackendInfo *bi)); @@ -525,7 +525,7 @@ struct slap_backend_info { */ int (*bi_db_init) LDAP_P((Backend *bd)); int (*bi_db_config) LDAP_P((Backend *bd, - char *fname, int lineno, int argc, char **argv )); + const char *fname, int lineno, int argc, char **argv )); int (*bi_db_open) LDAP_P((Backend *bd)); int (*bi_db_close) LDAP_P((Backend *bd)); int (*bi_db_destroy) LDAP_P((Backend *db)); @@ -567,8 +567,8 @@ struct slap_backend_info { int (*bi_entry_release_rw) LDAP_P((BackendDB *bd, Entry *e, int rw)); int (*bi_acl_group) LDAP_P((Backend *bd, - Entry *e, char *bdn, char *edn, - char *objectclassValue, char *groupattrName )); + Entry *e, const char *bdn, const char *edn, + const char *objectclassValue, const char *groupattrName )); int (*bi_connection_init) LDAP_P((BackendDB *bd, struct slap_conn *c)); diff --git a/servers/slapd/tools/mimic.c b/servers/slapd/tools/mimic.c index aa7d1dc41b..cc9c8b8c9a 100644 --- a/servers/slapd/tools/mimic.c +++ b/servers/slapd/tools/mimic.c @@ -32,7 +32,7 @@ send_ldap_disconnect( Connection *conn, Operation *op, ber_int_t err, - char *text + const char *text ) { assert(0); @@ -43,8 +43,8 @@ send_ldap_result( Connection *conn, Operation *op, int err, - char *matched, - char *text, + const char *matched, + const char *text, struct berval **refs, LDAPControl **ctrls ) @@ -57,8 +57,8 @@ send_search_result( Connection *conn, Operation *op, int err, - char *matched, - char *text, + const char *matched, + const char *text, struct berval **refs, LDAPControl **ctrls, int nentries -- 2.39.5