[Date Prev][Date Next] [Chronological] [Thread] [Top]

ldap_search_ext_s and non-const attrs parameter

I am using ldap_search_ext_s with an attrs parameter that looks
something like this:
const char* attrs[] = { "cn", "statusCode", NULL };

Previously, I did not have the const qualifier on there, but I increased
the warning level of my compiler, and it was (correctly) complaining
that I was treating string constants as non-constant.

Unfortunately, the ldap_search_ext_s function is declared *without* the
const qualifier:

LDAP_F( int )
ldap_search_ext_s LDAP_P((
	LDAP			*ld,
	LDAP_CONST char	*base,
	int				scope,
	LDAP_CONST char	*filter,
	char			**attrs,         <------ here
	int				attrsonly,
	LDAPControl		**serverctrls,
	LDAPControl		**clientctrls,
	struct timeval	*timeout,
	int				sizelimit,
	LDAPMessage		**res ));

Does this mean that I really do need to pass in mutable buffers, or is
the API incorrect?  If it needs to be mutable, under what conditions
will those be changed, and do I need to re-initialize the values after
every call?
I notice that other ldap libraries (e.g. IBM's Tivoli Directory Server)
*do* use const for that parameter.