1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

dirmngr: Minor cleanups.

* dirmngr/ks-engine-ldap.c [__riscos__]: Remove doubled util.h.
(ldap_to_gpg_err): s/GPG_ERR_GENERAL/GPG_ERR_INTERNAL/.
(tm2ldaptime): Use snprintf.
(ldap_connect): Get error code prior to log_error and and use modern
function.   Use xfree, xtrustrdup etc.
(modlist_lookup): Use GNUPG_GCC_A_USED.
(modlist_free): Use xfree.
--

sprintf has been replaced by snprintf to avoid warnings on some
platforms.

xfree et al. is required so that replacement functions are
used if defined.  For example the Libgcrypt functions which may not be
fully compatible with standard free.

Impossible conditions should use GPG_ERR_INTERNAL.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-03-25 19:33:59 +01:00
parent 99ef9cd7f5
commit 6c701af121
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
2 changed files with 29 additions and 25 deletions

View file

@ -127,7 +127,7 @@ ldap_parse_uri (parsed_uri_t *purip, const char *uri)
len = 0;
#define add(s) { if (s) len += strlen (s) + 1; }
#define add(s) do { if (s) len += strlen (s) + 1; } while (0)
add (scheme);
add (host);
@ -166,6 +166,11 @@ ldap_parse_uri (parsed_uri_t *purip, const char *uri)
if (password)
{
puri->query = calloc (sizeof (*puri->query), 1);
if (!puri->query)
{
err = gpg_err_code_from_syserror ();
goto out;
}
puri->query->name = "password";
copy (puri->query->value, password);
puri->query->valuelen = strlen (password) + 1;
@ -221,7 +226,8 @@ ldap_escape_filter (const char *filter)
case ')':
case '\\':
case '/':
sprintf (&escaped[escaped_i], "%%%02x", filter[filter_i]);
snprintf (&escaped[escaped_i], 4, "%%%02x",
((const unsigned char *)filter)[filter_i]);
escaped_i += 3;
break;