1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

dirmngr: Silence annoying warning for missing default ldap server file.

* dirmngr/dirmngr.c (parse_ldapserver_file): Add arg ignore_enoent.
(main): Use that arg for the default file.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2020-07-02 16:05:40 +02:00
parent d70b8769c8
commit f55a05a69b
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B

View File

@ -406,7 +406,7 @@ static npth_key_t my_tlskey_current_fd;
/* Prototypes. */ /* Prototypes. */
static void cleanup (void); static void cleanup (void);
#if USE_LDAP #if USE_LDAP
static ldap_server_t parse_ldapserver_file (const char* filename); static ldap_server_t parse_ldapserver_file (const char* filename, int ienoent);
#endif /*USE_LDAP*/ #endif /*USE_LDAP*/
static fingerprint_list_t parse_ocsp_signer (const char *string); static fingerprint_list_t parse_ocsp_signer (const char *string);
static void netactivity_action (void); static void netactivity_action (void);
@ -1126,11 +1126,11 @@ main (int argc, char **argv)
ldapfile = make_filename (gnupg_homedir (), ldapfile = make_filename (gnupg_homedir (),
"dirmngr_ldapservers.conf", "dirmngr_ldapservers.conf",
NULL); NULL);
opt.ldapservers = parse_ldapserver_file (ldapfile); opt.ldapservers = parse_ldapserver_file (ldapfile, 1);
xfree (ldapfile); xfree (ldapfile);
} }
else else
opt.ldapservers = parse_ldapserver_file (ldapfile); opt.ldapservers = parse_ldapserver_file (ldapfile, 0);
#endif /*USE_LDAP*/ #endif /*USE_LDAP*/
#ifndef HAVE_W32_SYSTEM #ifndef HAVE_W32_SYSTEM
@ -1593,7 +1593,7 @@ dirmngr_deinit_default_ctrl (ctrl_t ctrl)
*/ */
#if USE_LDAP #if USE_LDAP
static ldap_server_t static ldap_server_t
parse_ldapserver_file (const char* filename) parse_ldapserver_file (const char* filename, int ignore_enoent)
{ {
char buffer[1024]; char buffer[1024];
char *p; char *p;
@ -1605,6 +1605,9 @@ parse_ldapserver_file (const char* filename)
fp = es_fopen (filename, "r"); fp = es_fopen (filename, "r");
if (!fp) if (!fp)
{ {
if (ignore_enoent && gpg_err_code_from_syserror () == GPG_ERR_ENOENT)
;
else
log_info ("failed to open '%s': %s\n", filename, strerror (errno)); log_info ("failed to open '%s': %s\n", filename, strerror (errno));
return NULL; return NULL;
} }