Make sure DynaGetFunction() returns a function pointer, not a data pointer.
The standards don't actually allow typecasts between data and functions so some picky compilers warn about this.
This commit is contained in:
parent
58a5f485db
commit
83e878420a
24
lib/ldap.c
24
lib/ldap.c
@ -54,12 +54,13 @@
|
|||||||
#define _MPRINTF_REPLACE /* use our functions only */
|
#define _MPRINTF_REPLACE /* use our functions only */
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
|
typedef void * (*dynafunc)(void *input);
|
||||||
|
|
||||||
#define DYNA_GET_FUNCTION(type, fnc) \
|
#define DYNA_GET_FUNCTION(type, fnc) \
|
||||||
(fnc) = (type)DynaGetFunction(#fnc); \
|
(fnc) = (type)DynaGetFunction(#fnc); \
|
||||||
if ((fnc) == NULL) { \
|
if ((fnc) == NULL) { \
|
||||||
return CURLE_FUNCTION_NOT_FOUND; \
|
return CURLE_FUNCTION_NOT_FOUND; \
|
||||||
} \
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*/
|
*/
|
||||||
@ -106,13 +107,13 @@ static void DynaClose(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void * DynaGetFunction(const char *name)
|
static dynafunc DynaGetFunction(const char *name)
|
||||||
{
|
{
|
||||||
void *func = NULL;
|
dynafunc func = (dynafunc)NULL;
|
||||||
|
|
||||||
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
|
#if defined(HAVE_DLOPEN) || defined(HAVE_LIBDL)
|
||||||
if (libldap) {
|
if (libldap) {
|
||||||
func = dlsym(libldap, name);
|
func = (dynafunc) dlsym(libldap, name);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -203,20 +204,24 @@ CURLcode Curl_ldap(struct connectdata *conn)
|
|||||||
failf(data, "LDAP: Cannot connect to %s:%d",
|
failf(data, "LDAP: Cannot connect to %s:%d",
|
||||||
conn->hostname, conn->port);
|
conn->hostname, conn->port);
|
||||||
status = CURLE_COULDNT_CONNECT;
|
status = CURLE_COULDNT_CONNECT;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
rc = ldap_simple_bind_s(server,
|
rc = ldap_simple_bind_s(server,
|
||||||
conn->bits.user_passwd?conn->user:NULL,
|
conn->bits.user_passwd?conn->user:NULL,
|
||||||
conn->bits.user_passwd?conn->passwd:NULL);
|
conn->bits.user_passwd?conn->passwd:NULL);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
failf(data, "LDAP: %s", ldap_err2string(rc));
|
failf(data, "LDAP: %s", ldap_err2string(rc));
|
||||||
status = CURLE_LDAP_CANNOT_BIND;
|
status = CURLE_LDAP_CANNOT_BIND;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
rc = ldap_url_parse(data->change.url, &ludp);
|
rc = ldap_url_parse(data->change.url, &ludp);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
failf(data, "LDAP: %s", ldap_err2string(rc));
|
failf(data, "LDAP: %s", ldap_err2string(rc));
|
||||||
status = CURLE_LDAP_INVALID_URL;
|
status = CURLE_LDAP_INVALID_URL;
|
||||||
} else {
|
}
|
||||||
rc = ldap_search_s(server, ludp->lud_dn, ludp->lud_scope, ludp->lud_filter, ludp->lud_attrs, 0, &result);
|
else {
|
||||||
|
rc = ldap_search_s(server, ludp->lud_dn, ludp->lud_scope,
|
||||||
|
ludp->lud_filter, ludp->lud_attrs, 0, &result);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
failf(data, "LDAP: %s", ldap_err2string(rc));
|
failf(data, "LDAP: %s", ldap_err2string(rc));
|
||||||
status = CURLE_LDAP_SEARCH_FAILED;
|
status = CURLE_LDAP_SEARCH_FAILED;
|
||||||
@ -224,8 +229,7 @@ CURLcode Curl_ldap(struct connectdata *conn)
|
|||||||
else {
|
else {
|
||||||
for (entryIterator = ldap_first_entry(server, result);
|
for (entryIterator = ldap_first_entry(server, result);
|
||||||
entryIterator;
|
entryIterator;
|
||||||
entryIterator = ldap_next_entry(server, entryIterator))
|
entryIterator = ldap_next_entry(server, entryIterator)) {
|
||||||
{
|
|
||||||
char *dn = ldap_get_dn(server, entryIterator);
|
char *dn = ldap_get_dn(server, entryIterator);
|
||||||
char **vals;
|
char **vals;
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user