summaryrefslogtreecommitdiffstats
path: root/dirmngr/ldap-parse-uri.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2020-12-17 16:09:31 +0100
committerWerner Koch <wk@gnupg.org>2020-12-17 18:25:11 +0100
commit1194e4f7e2dff620e0da87f212f3a35f8021b142 (patch)
tree4bd948d4c1cb09ed6a45b80bebefa2c79a22d033 /dirmngr/ldap-parse-uri.c
parentdirmngr: Allow LDAP searches via fingerprint. (diff)
downloadgnupg2-1194e4f7e2dff620e0da87f212f3a35f8021b142.tar.xz
gnupg2-1194e4f7e2dff620e0da87f212f3a35f8021b142.zip
dirmngr: Support "ldap:///" for the current AD user.
* dirmngr/http.h (struct parsed_uri_s): Add field ad_current. * dirmngr/ldap-parse-uri.c (ldap_parse_uri): Set it. * dirmngr/ks-engine-ldap.c (my_ldap_connect): Take care of ad_current. -- Ported from 2.2. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'dirmngr/ldap-parse-uri.c')
-rw-r--r--dirmngr/ldap-parse-uri.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/dirmngr/ldap-parse-uri.c b/dirmngr/ldap-parse-uri.c
index 240b98def..41633acf0 100644
--- a/dirmngr/ldap-parse-uri.c
+++ b/dirmngr/ldap-parse-uri.c
@@ -163,9 +163,21 @@ ldap_parse_uri (parsed_uri_t *purip, const char *uri)
puri->query->valuelen = strlen (password) + 1;
}
- puri->use_tls = strcmp (puri->scheme, "ldaps") == 0;
+ puri->use_tls = !strcmp (puri->scheme, "ldaps");
puri->port = lud->lud_port;
+ /* On Windows detect whether this is ldap:// or ldaps:// to indicate
+ * that authentication via AD and the current user is requested. */
+ puri->ad_current = 0;
+#ifdef HAVE_W32_SYSTEM
+ if ((!puri->host || !*puri->host)
+ && (!puri->path || !*puri->path)
+ && (!puri->auth || !*puri->auth)
+ && !password
+ )
+ puri->ad_current = 1;
+#endif
+
out:
if (lud)
ldap_free_urldesc (lud);