summaryrefslogtreecommitdiffstats
path: root/dirmngr
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-07-02 16:05:40 +0200
committerWerner Koch <wk@gnupg.org>2020-07-02 16:19:24 +0200
commitf55a05a69ba07eb2ed354a9275e71e94c5e362aa (patch)
tree1f492989d642e1043e581e7c27fd6fb063ad1984 /dirmngr
parentSupport a history file in gpg-card and gpg-connect-agent. (diff)
downloadgnupg2-f55a05a69ba07eb2ed354a9275e71e94c5e362aa.tar.xz
gnupg2-f55a05a69ba07eb2ed354a9275e71e94c5e362aa.zip
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>
Diffstat (limited to 'dirmngr')
-rw-r--r--dirmngr/dirmngr.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 95f739a0c..034f7d5b4 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -406,7 +406,7 @@ static npth_key_t my_tlskey_current_fd;
/* Prototypes. */
static void cleanup (void);
#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*/
static fingerprint_list_t parse_ocsp_signer (const char *string);
static void netactivity_action (void);
@@ -1126,11 +1126,11 @@ main (int argc, char **argv)
ldapfile = make_filename (gnupg_homedir (),
"dirmngr_ldapservers.conf",
NULL);
- opt.ldapservers = parse_ldapserver_file (ldapfile);
+ opt.ldapservers = parse_ldapserver_file (ldapfile, 1);
xfree (ldapfile);
}
else
- opt.ldapservers = parse_ldapserver_file (ldapfile);
+ opt.ldapservers = parse_ldapserver_file (ldapfile, 0);
#endif /*USE_LDAP*/
#ifndef HAVE_W32_SYSTEM
@@ -1593,7 +1593,7 @@ dirmngr_deinit_default_ctrl (ctrl_t ctrl)
*/
#if USE_LDAP
static ldap_server_t
-parse_ldapserver_file (const char* filename)
+parse_ldapserver_file (const char* filename, int ignore_enoent)
{
char buffer[1024];
char *p;
@@ -1605,7 +1605,10 @@ parse_ldapserver_file (const char* filename)
fp = es_fopen (filename, "r");
if (!fp)
{
- log_info ("failed to open '%s': %s\n", filename, strerror (errno));
+ if (ignore_enoent && gpg_err_code_from_syserror () == GPG_ERR_ENOENT)
+ ;
+ else
+ log_info ("failed to open '%s': %s\n", filename, strerror (errno));
return NULL;
}