Skip to content

Commit a22c38b

Browse files
committed
Some work on the dirmngr
1 parent b6490d3 commit a22c38b

16 files changed

+1162
-701
lines changed

NEWS

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Noteworthy changes in version 2.1.x (under development)
2626
* If the agent's --use-standard-socket option is active, all tools
2727
try to start and daemonize the agent on the fly. In the past this
2828
was only supported on W32; on non-W32 systems the new configure
29-
option --use-standard-socket may now be used to use this feature by
30-
default.
29+
option --enable-standard-socket may now be used to use this feature
30+
by default.
3131

3232
* Dirmngr is now a part of this package.
3333

common/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2010-07-19 Werner Koch <[email protected]>
2+
3+
* utf8conv.c (utf8_to_wchar): s/malloc/jnlib_malloc/.
4+
15
2010-07-16 Werner Koch <[email protected]>
26

37
* http.h (HTTP_FLAG_IGNORE_CL): Add flag .

common/utf8conv.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ utf8_to_wchar (const char *string)
802802
jnlib_set_errno (ENOMEM);
803803
return NULL;
804804
}
805-
result = malloc (nbytes);
805+
result = jnlib_malloc (nbytes);
806806
if (!result)
807807
return NULL;
808808

dirmngr/ChangeLog

+20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2010-07-19 Werner Koch <[email protected]>
2+
3+
* dirmngr.c: Include ldap-wrapper.h.
4+
(launch_reaper_thread): Move code to ...
5+
* ldap-wrapper.c (ldap_wrapper_launch_thread): .. here. Change
6+
callers.
7+
(ldap_wrapper_thread): Rename to ...
8+
(wrapper_thread): this and make local.
9+
10+
* ldap.c (destroy_wrapper, print_log_line)
11+
(read_log_data, ldap_wrapper_thread)
12+
(ldap_wrapper_wait_connections, ldap_wrapper_release_context)
13+
(ldap_wrapper_connection_cleanup, reader_callback, ldap_wrapper):
14+
Factor code out to ...
15+
* ldap-wrapper.c: new.
16+
(ldap_wrapper): Make public.
17+
(read_buffer): Copy from ldap.c.
18+
* ldap-wrapper.h: New.
19+
* Makefile.am (dirmngr_SOURCES): Add new files.
20+
121
2010-07-16 Werner Koch <[email protected]>
222

323
* http.c, http.h: Remove.

dirmngr/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ noinst_HEADERS = dirmngr.h crlcache.h crlfetch.h misc.h
3939
dirmngr_SOURCES = dirmngr.c dirmngr.h server.c crlcache.c crlfetch.c \
4040
ldapserver.h ldapserver.c certcache.c certcache.h \
4141
cdb.h cdblib.c ldap.c misc.c dirmngr-err.h \
42-
ocsp.c ocsp.h validate.c validate.h
42+
ocsp.c ocsp.h validate.c validate.h ldap-wrapper.c ldap-wrapper.h
4343

4444
dirmngr_LDADD = $(libcommonpth) ../gl/libgnu.a $(DNSLIBS) $(LIBASSUAN_LIBS) \
4545
$(LIBGCRYPT_LIBS) $(KSBA_LIBS) $(PTH_LIBS) $(LIBINTL) $(LIBICONV)

dirmngr/crlcache.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ update_dir (crl_cache_t cache)
891891

892892
xfree (line);
893893
}
894-
if (!es_ferror (fp) && !ferror (es_fpout) && !lineerr)
894+
if (!es_ferror (fp) && !es_ferror (fpout) && !lineerr)
895895
{
896896
/* Write out the remaining entries. */
897897
for (e= cache->entries; e; e = e->next)

dirmngr/crlfetch.h

-5
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ void crl_close_reader (ksba_reader_t reader);
6161

6262

6363
/*-- ldap.c --*/
64-
void *ldap_wrapper_thread (void*);
65-
void ldap_wrapper_wait_connections (void);
66-
void ldap_wrapper_release_context (ksba_reader_t reader);
67-
void ldap_wrapper_connection_cleanup (ctrl_t);
68-
6964
gpg_error_t url_fetch_ldap (ctrl_t ctrl,
7065
const char *url, const char *host, int port,
7166
ksba_reader_t *reader);

dirmngr/dirmngr.c

+6-31
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
#include "misc.h"
5555
#include "ldapserver.h"
5656
#include "asshelp.h"
57+
#include "ldap-wrapper.h"
5758

5859
/* The plain Windows version uses the windows service system. For
5960
example to start the service you may use "sc start dirmngr".
@@ -393,32 +394,6 @@ wrong_args (const char *text)
393394
}
394395

395396

396-
/* Helper to start the reaper thread for the ldap wrapper. */
397-
static void
398-
launch_reaper_thread (void)
399-
{
400-
static int done;
401-
pth_attr_t tattr;
402-
403-
if (done)
404-
return;
405-
done = 1;
406-
407-
tattr = pth_attr_new();
408-
pth_attr_set (tattr, PTH_ATTR_JOINABLE, 0);
409-
pth_attr_set (tattr, PTH_ATTR_STACK_SIZE, 256*1024);
410-
pth_attr_set (tattr, PTH_ATTR_NAME, "ldap-reaper");
411-
412-
if (!pth_spawn (tattr, ldap_wrapper_thread, NULL))
413-
{
414-
log_error (_("error spawning ldap wrapper reaper thread: %s\n"),
415-
strerror (errno) );
416-
dirmngr_exit (1);
417-
}
418-
pth_attr_destroy (tattr);
419-
}
420-
421-
422397
/* Helper to stop the reaper thread for the ldap wrapper. */
423398
static void
424399
shutdown_reaper (void)
@@ -938,7 +913,7 @@ main (int argc, char **argv)
938913
log_debug ("... okay\n");
939914
}
940915

941-
launch_reaper_thread ();
916+
ldap_wrapper_launch_thread ();
942917
cert_cache_init ();
943918
crl_cache_init ();
944919
start_command_handler (ASSUAN_INVALID_FD);
@@ -1101,7 +1076,7 @@ main (int argc, char **argv)
11011076
}
11021077
#endif
11031078

1104-
launch_reaper_thread ();
1079+
ldap_wrapper_launch_thread ();
11051080
cert_cache_init ();
11061081
crl_cache_init ();
11071082
#ifdef USE_W32_SERVICE
@@ -1127,7 +1102,7 @@ main (int argc, char **argv)
11271102
/* Just list the CRL cache and exit. */
11281103
if (argc)
11291104
wrong_args ("--list-crls");
1130-
launch_reaper_thread ();
1105+
ldap_wrapper_launch_thread ();
11311106
crl_cache_init ();
11321107
crl_cache_list (es_stdout);
11331108
}
@@ -1138,7 +1113,7 @@ main (int argc, char **argv)
11381113
memset (&ctrlbuf, 0, sizeof ctrlbuf);
11391114
dirmngr_init_default_ctrl (&ctrlbuf);
11401115

1141-
launch_reaper_thread ();
1116+
ldap_wrapper_launch_thread ();
11421117
cert_cache_init ();
11431118
crl_cache_init ();
11441119
if (!argc)
@@ -1160,7 +1135,7 @@ main (int argc, char **argv)
11601135
memset (&ctrlbuf, 0, sizeof ctrlbuf);
11611136
dirmngr_init_default_ctrl (&ctrlbuf);
11621137

1163-
launch_reaper_thread ();
1138+
ldap_wrapper_launch_thread ();
11641139
cert_cache_init ();
11651140
crl_cache_init ();
11661141
rc = crl_fetch (&ctrlbuf, argv[0], &reader);

0 commit comments

Comments
 (0)