diff options
author | Werner Koch <wk@gnupg.org> | 2020-07-02 16:05:40 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2020-07-02 16:19:24 +0200 |
commit | f55a05a69ba07eb2ed354a9275e71e94c5e362aa (patch) | |
tree | 1f492989d642e1043e581e7c27fd6fb063ad1984 /dirmngr | |
parent | Support a history file in gpg-card and gpg-connect-agent. (diff) | |
download | gnupg2-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.c | 13 |
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; } |