- minor correction in ldap-api patch for backward compatibility
This commit is contained in:
parent
96fffb4804
commit
af78c8d4b9
@ -1,5 +1,5 @@
|
|||||||
--- bind-9.4.1/contrib/sdb/ldap/ldapdb.c.new-api 2004-08-27 02:10:25.000000000 +0200
|
--- bind-9.4.1/contrib/sdb/ldap/ldapdb.c.new-api 2004-08-27 02:10:25.000000000 +0200
|
||||||
+++ bind-9.4.1/contrib/sdb/ldap/ldapdb.c 2007-05-21 15:22:10.000000000 +0200
|
+++ bind-9.4.1/contrib/sdb/ldap/ldapdb.c 2007-05-22 16:50:16.000000000 +0200
|
||||||
@@ -58,9 +58,13 @@
|
@@ -58,9 +58,13 @@
|
||||||
static dns_sdbimplementation_t *ldapdb = NULL;
|
static dns_sdbimplementation_t *ldapdb = NULL;
|
||||||
|
|
||||||
@ -26,25 +26,32 @@
|
|||||||
threaddata->data = conndata->next;
|
threaddata->data = conndata->next;
|
||||||
free(conndata);
|
free(conndata);
|
||||||
}
|
}
|
||||||
@@ -172,14 +180,14 @@ ldapdb_getconn(struct ldapdb_data *data)
|
@@ -172,14 +180,23 @@ ldapdb_getconn(struct ldapdb_data *data)
|
||||||
/* threaddata points at the connection list for current thread */
|
/* threaddata points at the connection list for current thread */
|
||||||
/* look for existing connection to our server */
|
/* look for existing connection to our server */
|
||||||
conndata = ldapdb_find((struct ldapdb_entry *)threaddata->data,
|
conndata = ldapdb_find((struct ldapdb_entry *)threaddata->data,
|
||||||
- data->hostport, strlen(data->hostport));
|
- data->hostport, strlen(data->hostport));
|
||||||
|
+#if LDAP_API_VERSION < 3001
|
||||||
|
+ data->hostport, strlen(data->hostport));
|
||||||
|
+#else
|
||||||
+ data->lud->lud_host, strlen(data->lud->lud_host));
|
+ data->lud->lud_host, strlen(data->lud->lud_host));
|
||||||
|
+#endif
|
||||||
if (conndata == NULL) {
|
if (conndata == NULL) {
|
||||||
/* no connection data structure for this server, create one */
|
/* no connection data structure for this server, create one */
|
||||||
conndata = malloc(sizeof(*conndata));
|
conndata = malloc(sizeof(*conndata));
|
||||||
if (conndata == NULL)
|
if (conndata == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
- conndata->index = data->hostport;
|
+#if LDAP_API_VERSION < 3001
|
||||||
- conndata->size = strlen(data->hostport);
|
conndata->index = data->hostport;
|
||||||
|
conndata->size = strlen(data->hostport);
|
||||||
|
+#else
|
||||||
+ conndata->index = data->lud->lud_host;
|
+ conndata->index = data->lud->lud_host;
|
||||||
+ conndata->size = strlen(data->lud->lud_host);
|
+ conndata->size = strlen(data->lud->lud_host);
|
||||||
|
+#endif
|
||||||
conndata->data = NULL;
|
conndata->data = NULL;
|
||||||
ldapdb_insert((struct ldapdb_entry **)&threaddata->data,
|
ldapdb_insert((struct ldapdb_entry **)&threaddata->data,
|
||||||
conndata);
|
conndata);
|
||||||
@@ -196,9 +204,15 @@ ldapdb_bind(struct ldapdb_data *data, LD
|
@@ -196,9 +213,15 @@ ldapdb_bind(struct ldapdb_data *data, LD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (*ldp != NULL)
|
if (*ldp != NULL)
|
||||||
@ -60,7 +67,7 @@
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifndef LDAPDB_RFC1823API
|
#ifndef LDAPDB_RFC1823API
|
||||||
@@ -211,8 +225,17 @@ ldapdb_bind(struct ldapdb_data *data, LD
|
@@ -211,8 +234,17 @@ ldapdb_bind(struct ldapdb_data *data, LD
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -78,7 +85,7 @@
|
|||||||
*ldp = NULL;
|
*ldp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,14 +247,19 @@ ldapdb_search(const char *zone, const ch
|
@@ -224,14 +256,19 @@ ldapdb_search(const char *zone, const ch
|
||||||
isc_result_t result = ISC_R_NOTFOUND;
|
isc_result_t result = ISC_R_NOTFOUND;
|
||||||
LDAP **ldp;
|
LDAP **ldp;
|
||||||
LDAPMessage *res, *e;
|
LDAPMessage *res, *e;
|
||||||
@ -100,7 +107,7 @@
|
|||||||
|
|
||||||
ldp = ldapdb_getconn(data);
|
ldp = ldapdb_getconn(data);
|
||||||
if (ldp == NULL)
|
if (ldp == NULL)
|
||||||
@@ -256,12 +284,21 @@ ldapdb_search(const char *zone, const ch
|
@@ -256,12 +293,21 @@ ldapdb_search(const char *zone, const ch
|
||||||
sprintf(data->filtername, "%s))", name);
|
sprintf(data->filtername, "%s))", name);
|
||||||
fltr = data->filterone;
|
fltr = data->filterone;
|
||||||
}
|
}
|
||||||
@ -123,7 +130,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*ldp == NULL || msgid == -1) {
|
if (*ldp == NULL || msgid == -1) {
|
||||||
@@ -293,15 +330,27 @@ ldapdb_search(const char *zone, const ch
|
@@ -293,15 +339,27 @@ ldapdb_search(const char *zone, const ch
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
@ -152,7 +159,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (a = ldap_first_attribute(ld, e, &ptr); a != NULL; a = ldap_next_attribute(ld, e, ptr)) {
|
for (a = ldap_first_attribute(ld, e, &ptr); a != NULL; a = ldap_next_attribute(ld, e, ptr)) {
|
||||||
@@ -319,34 +368,60 @@ ldapdb_search(const char *zone, const ch
|
@@ -319,34 +377,60 @@ ldapdb_search(const char *zone, const ch
|
||||||
|
|
||||||
strncpy(type, a, s - a);
|
strncpy(type, a, s - a);
|
||||||
type[s - a] = '\0';
|
type[s - a] = '\0';
|
||||||
@ -214,7 +221,7 @@
|
|||||||
}
|
}
|
||||||
#ifndef LDAPDB_RFC1823API
|
#ifndef LDAPDB_RFC1823API
|
||||||
ldap_memfree(a);
|
ldap_memfree(a);
|
||||||
@@ -357,7 +432,11 @@ ldapdb_search(const char *zone, const ch
|
@@ -357,7 +441,11 @@ ldapdb_search(const char *zone, const ch
|
||||||
ber_free(ptr, 0);
|
ber_free(ptr, 0);
|
||||||
#endif
|
#endif
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
@ -226,7 +233,7 @@
|
|||||||
|
|
||||||
/* free this result */
|
/* free this result */
|
||||||
ldap_msgfree(res);
|
ldap_msgfree(res);
|
||||||
@@ -460,10 +539,15 @@ parseextensions(char *extensions, struct
|
@@ -460,10 +548,15 @@ parseextensions(char *extensions, struct
|
||||||
static void
|
static void
|
||||||
free_data(struct ldapdb_data *data)
|
free_data(struct ldapdb_data *data)
|
||||||
{
|
{
|
||||||
@ -242,7 +249,7 @@
|
|||||||
if (data->filterall != NULL)
|
if (data->filterall != NULL)
|
||||||
isc_mem_put(ns_g_mctx, data->filterall, data->filteralllen);
|
isc_mem_put(ns_g_mctx, data->filterall, data->filteralllen);
|
||||||
if (data->filterone != NULL)
|
if (data->filterone != NULL)
|
||||||
@@ -478,7 +562,7 @@ ldapdb_create(const char *zone, int argc
|
@@ -478,7 +571,7 @@ ldapdb_create(const char *zone, int argc
|
||||||
{
|
{
|
||||||
struct ldapdb_data *data;
|
struct ldapdb_data *data;
|
||||||
char *s, *filter = NULL, *extensions = NULL;
|
char *s, *filter = NULL, *extensions = NULL;
|
||||||
@ -251,7 +258,7 @@
|
|||||||
|
|
||||||
UNUSED(driverdata);
|
UNUSED(driverdata);
|
||||||
|
|
||||||
@@ -486,7 +570,10 @@ ldapdb_create(const char *zone, int argc
|
@@ -486,7 +579,10 @@ ldapdb_create(const char *zone, int argc
|
||||||
/* want to do this only once for all instances */
|
/* want to do this only once for all instances */
|
||||||
|
|
||||||
if ((argc < 2)
|
if ((argc < 2)
|
||||||
@ -262,7 +269,7 @@
|
|||||||
|| ((defaultttl = atoi(argv[1])) < 1))
|
|| ((defaultttl = atoi(argv[1])) < 1))
|
||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
data = isc_mem_get(ns_g_mctx, sizeof(struct ldapdb_data));
|
data = isc_mem_get(ns_g_mctx, sizeof(struct ldapdb_data));
|
||||||
@@ -494,14 +581,15 @@ ldapdb_create(const char *zone, int argc
|
@@ -494,14 +590,15 @@ ldapdb_create(const char *zone, int argc
|
||||||
return (ISC_R_NOMEMORY);
|
return (ISC_R_NOMEMORY);
|
||||||
|
|
||||||
memset(data, 0, sizeof(struct ldapdb_data));
|
memset(data, 0, sizeof(struct ldapdb_data));
|
||||||
@ -280,7 +287,7 @@
|
|||||||
s = strchr(data->hostport, '/');
|
s = strchr(data->hostport, '/');
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
*s++ = '\0';
|
*s++ = '\0';
|
||||||
@@ -544,11 +632,26 @@ ldapdb_create(const char *zone, int argc
|
@@ -544,11 +641,26 @@ ldapdb_create(const char *zone, int argc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,7 +314,7 @@
|
|||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
/* err should be -1 or -2 */
|
/* err should be -1 or -2 */
|
||||||
free_data(data);
|
free_data(data);
|
||||||
@@ -562,6 +665,14 @@ ldapdb_create(const char *zone, int argc
|
@@ -562,6 +674,14 @@ ldapdb_create(const char *zone, int argc
|
||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,7 +329,7 @@
|
|||||||
|
|
||||||
if ((data->base != NULL && unhex(data->base) == NULL) ||
|
if ((data->base != NULL && unhex(data->base) == NULL) ||
|
||||||
(filter != NULL && unhex(filter) == NULL) ||
|
(filter != NULL && unhex(filter) == NULL) ||
|
||||||
@@ -572,6 +683,7 @@ ldapdb_create(const char *zone, int argc
|
@@ -572,6 +692,7 @@ ldapdb_create(const char *zone, int argc
|
||||||
"LDAP sdb zone '%s': URL: bad hex values", zone);
|
"LDAP sdb zone '%s': URL: bad hex values", zone);
|
||||||
return (ISC_R_FAILURE);
|
return (ISC_R_FAILURE);
|
||||||
}
|
}
|
||||||
@ -330,7 +337,7 @@
|
|||||||
|
|
||||||
/* compute filterall and filterone once and for all */
|
/* compute filterall and filterone once and for all */
|
||||||
if (filter == NULL) {
|
if (filter == NULL) {
|
||||||
@@ -602,6 +714,7 @@ ldapdb_create(const char *zone, int argc
|
@@ -602,6 +723,7 @@ ldapdb_create(const char *zone, int argc
|
||||||
}
|
}
|
||||||
data->filtername = data->filterone + strlen(data->filterone);
|
data->filtername = data->filterone + strlen(data->filterone);
|
||||||
|
|
||||||
@ -338,7 +345,7 @@
|
|||||||
/* support URLs with literal IPv6 addresses */
|
/* support URLs with literal IPv6 addresses */
|
||||||
data->hostname = isc_mem_strdup(ns_g_mctx, data->hostport + (*data->hostport == '[' ? 1 : 0));
|
data->hostname = isc_mem_strdup(ns_g_mctx, data->hostport + (*data->hostport == '[' ? 1 : 0));
|
||||||
if (data->hostname == NULL) {
|
if (data->hostname == NULL) {
|
||||||
@@ -620,8 +733,10 @@ ldapdb_create(const char *zone, int argc
|
@@ -620,8 +742,10 @@ ldapdb_create(const char *zone, int argc
|
||||||
data->portno = atoi(s);
|
data->portno = atoi(s);
|
||||||
} else
|
} else
|
||||||
data->portno = LDAP_PORT;
|
data->portno = LDAP_PORT;
|
||||||
|
Loading…
Reference in New Issue
Block a user