X-Git-Url: https://git.exim.org/users/jgh/exim.git/blobdiff_plain/bb4fd71d9937a07155e89b885d40c96f03700b84..4c04137d73637107669e02b21f890387aaa2ef34:/src/src/lookups/ldap.c?ds=sidebyside diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c index fe67e7f0a..b52ef2221 100644 --- a/src/src/lookups/ldap.c +++ b/src/src/lookups/ldap.c @@ -2,11 +2,11 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2015 */ +/* Copyright (c) University of Cambridge 1995 - 2016 */ /* See the file NOTICE for conditions of use and distribution. */ /* Many thanks to Stuart Lynne for contributing the original code for this -driver. Further contibutions from Michael Haardt, Brian Candler, Barry +driver. Further contributions from Michael Haardt, Brian Candler, Barry Pederson, Peter Savitch and Christian Kellner. Particular thanks to Brian for researching how to handle the different kinds of error. */ @@ -580,7 +580,7 @@ if (!lcp->bound || { DEBUG(D_lookup) debug_printf("%sbinding with user=%s password=%s\n", (lcp->bound)? "re-" : "", user, password); - if (eldap_start_tls && !lcp->is_start_tls_called) + if (eldap_start_tls && !lcp->is_start_tls_called && !ldapi) { #if defined(LDAP_OPT_X_TLS) && !defined(LDAP_LIB_SOLARIS) /* The Oracle LDAP libraries (LDAP_LIB_TYPE=SOLARIS) don't support this. @@ -734,7 +734,7 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) == /* Results for multiple entries values are separated by newlines. */ - if (data != NULL) data = string_cat(data, &size, &ptr, US"\n", 1); + if (data != NULL) data = string_catn(data, &size, &ptr, US"\n", 1); /* Get the DN from the last result. */ @@ -762,7 +762,7 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) == { /* condition, because of the else */ if (new_dn != NULL) /* below, that's for the first only */ { - data = string_cat(data, &size, &ptr, new_dn, Ustrlen(new_dn)); + data = string_cat(data, &size, &ptr, new_dn); data[ptr] = 0; attribute_found = TRUE; } @@ -796,11 +796,11 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) == if (attrs_requested != 1) { if (insert_space) - data = string_cat(data, &size, &ptr, US" ", 1); + data = string_catn(data, &size, &ptr, US" ", 1); else insert_space = TRUE; - data = string_cat(data, &size, &ptr, attr, Ustrlen(attr)); - data = string_cat(data, &size, &ptr, US"=\"", 2); + data = string_cat(data, &size, &ptr, attr); + data = string_catn(data, &size, &ptr, US"=\"", 2); } while (*values != NULL) @@ -818,7 +818,7 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) == attribute and append only every non first value. */ if (data && valuecount > 1) - data = string_cat(data, &size, &ptr, US",", 1); + data = string_catn(data, &size, &ptr, US",", 1); /* For multiple attributes, the data is in quotes. We must escape internal quotes, backslashes, newlines, and must double commas. */ @@ -829,14 +829,14 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) == for (j = 0; j < len; j++) { if (value[j] == '\n') - data = string_cat(data, &size, &ptr, US"\\n", 2); + data = string_catn(data, &size, &ptr, US"\\n", 2); else if (value[j] == ',') - data = string_cat(data, &size, &ptr, US",,", 2); + data = string_catn(data, &size, &ptr, US",,", 2); else { if (value[j] == '\"' || value[j] == '\\') - data = string_cat(data, &size, &ptr, US"\\", 1); - data = string_cat(data, &size, &ptr, value+j, 1); + data = string_catn(data, &size, &ptr, US"\\", 1); + data = string_catn(data, &size, &ptr, value+j, 1); } } } @@ -847,12 +847,10 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) == { int j; for (j = 0; j < len; j++) - { if (value[j] == ',') - data = string_cat(data, &size, &ptr, US",,", 2); + data = string_catn(data, &size, &ptr, US",,", 2); else - data = string_cat(data, &size, &ptr, value+j, 1); - } + data = string_catn(data, &size, &ptr, value+j, 1); } @@ -865,7 +863,7 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) == /* Closing quote at the end of the data for a named attribute. */ if (attrs_requested != 1) - data = string_cat(data, &size, &ptr, US"\"", 1); + data = string_catn(data, &size, &ptr, US"\"", 1); /* Free the values */