* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) The Exim Maintainers 2020 - 2022 */
+/* Copyright (c) The Exim Maintainers 2020 - 2023 */
/* Copyright (c) University of Cambridge 1995 - 2018 */
/* See the file NOTICE for conditions of use and distribution. */
-/* SPDX-License-Identifier: GPL-2.0-only */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Many thanks to Stuart Lynne for contributing the original code for this
driver. Further contributions from Michael Haardt, Brian Candler, Barry
g = string_catn(NULL, ldap_url, init_ptr - ldap_url);
g = string_fmt_append(g, "//%s:%d/", shost, port);
}
- string_from_gstring(g);
/* Call ldap_initialize() and check the result */
+ {
+ const uschar * s = string_from_gstring(g);
- DEBUG(D_lookup) debug_printf_indent("ldap_initialize with URL %s\n", g->s);
- if ((rc = ldap_initialize(&ld, CS g->s)) != LDAP_SUCCESS)
- {
- *errmsg = string_sprintf("ldap_initialize: (error %d) URL \"%s\"\n",
- rc, g->s);
- goto RETURN_ERROR;
- }
+ DEBUG(D_lookup) debug_printf_indent("ldap_initialize with URL %s\n", s);
+ if ((rc = ldap_initialize(&ld, CS s)) != LDAP_SUCCESS)
+ {
+ *errmsg = string_sprintf("ldap_initialize: (error %d) URL \"%s\"\n",
+ rc, s);
+ goto RETURN_ERROR;
+ }
+ }
store_reset(reset_point); /* Might as well save memory when we can */
{
if (Ustrchr(LDAP_DN_QUOTE, c) != NULL)
{
- Ustrncpy(t, US"%5C", 3); /* insert \ where needed */
- t += 3; /* fall through to check URL */
+ memcpy(t, US"%5C", 3); /* insert \ where needed */
+ t += 3; /* fall through to check URL */
}
if (Ustrchr(URL_NONQUOTE, c) == NULL) /* e.g. ] => %5D */
{
/* Handle the trailing spaces */
- while (*ss++ != 0)
+ while (*ss++)
{
- Ustrncpy(t, US"%5C%20", 6);
+ memcpy(t, US"%5C%20", 6);
t += 6;
}
}