* gpgv.c: Stub keyserver_import_ldap.
authorDavid Shaw <dshaw@jabberwocky.com>
Tue, 21 Feb 2006 16:09:09 +0000 (16:09 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Tue, 21 Feb 2006 16:09:09 +0000 (16:09 +0000)
* keyserver-internal.h, keyserver.c (keyserver_import_ldap): Import using
the PGP Universal trick of asking ldap://keys.(maildomain) for the key.

g10/ChangeLog
g10/gpgv.c
g10/keyserver-internal.h
g10/keyserver.c

index 5b6abd3..7162a15 100644 (file)
@@ -1,3 +1,11 @@
+2006-02-21  David Shaw  <dshaw@jabberwocky.com>
+
+       * gpgv.c: Stub keyserver_import_ldap.
+
+       * keyserver-internal.h, keyserver.c (keyserver_import_ldap):
+       Import using the PGP Universal trick of asking
+       ldap://keys.(maildomain) for the key.
+
 2006-02-20  David Shaw  <dshaw@jabberwocky.com>
 
        * keyserver.c (parse_keyserver_uri): Include the scheme in the uri
index dbff483..95bf097 100644 (file)
@@ -289,6 +289,9 @@ keyserver_import_pka(const char *name) { return -1; }
 int
 keyserver_import_name(const char *name) { return -1; }
 
+int
+keyserver_import_ldap(const char *name) { return -1; }
+
 /* Stub:
  * No encryption here but mainproc links to these functions.
  */
index 1f98317..48cb1ea 100644 (file)
@@ -44,5 +44,6 @@ int keyserver_fetch(STRLIST urilist);
 int keyserver_import_cert(const char *name);
 int keyserver_import_pka(const char *name);
 int keyserver_import_name(const char *name);
+int keyserver_import_ldap(const char *name);
 
 #endif /* !_KEYSERVER_INTERNAL_H_ */
index af65ad3..240ea99 100644 (file)
@@ -2016,3 +2016,38 @@ keyserver_import_name(const char *name)
 
   return rc;
 }
+
+/* Use the PGP Universal trick of asking ldap://keys.(maildomain) for
+   the key. */
+int
+keyserver_import_ldap(const char *name)
+{
+  char *domain;
+  struct keyserver_spec *keyserver;
+  STRLIST list=NULL;
+  int rc;
+
+  append_to_strlist(&list,name);
+
+  /* Parse out the domain */
+  domain=strrchr(name,'@');
+  if(!domain)
+    return G10ERR_GENERAL;
+
+  domain++;
+
+  keyserver=xmalloc_clear(sizeof(struct keyserver_spec));
+
+  keyserver->scheme=xstrdup("ldap");
+  keyserver->host=xmalloc(5+strlen(domain)+1);
+  strcpy(keyserver->host,"keys.");
+  strcat(keyserver->host,domain);
+    
+  rc=keyserver_work(KS_GETNAME,list,NULL,0,keyserver);
+
+  free_strlist(list);
+
+  free_keyserver_spec(keyserver);
+
+  return rc;
+}