replaced --with-gid/uid by --with-group/user
[strongswan.git] / src / charon / plugins / smp / smp.c
1 /*
2 * Copyright (C) 2007 Martin Willi
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * $Id$
16 */
17
18 #include <stdlib.h>
19
20 #include "smp.h"
21
22 #include <sys/types.h>
23 #include <sys/stat.h>
24 #include <sys/socket.h>
25 #include <sys/un.h>
26 #include <unistd.h>
27 #include <errno.h>
28 #include <pthread.h>
29 #include <signal.h>
30 #include <libxml/xmlreader.h>
31 #include <libxml/xmlwriter.h>
32
33 #include <library.h>
34 #include <daemon.h>
35 #include <processing/jobs/callback_job.h>
36
37
38 typedef struct private_smp_t private_smp_t;
39
40 /**
41 * Private data of an smp_t object.
42 */
43 struct private_smp_t {
44
45 /**
46 * Public part of smp_t object.
47 */
48 smp_t public;
49
50 /**
51 * XML unix socket fd
52 */
53 int socket;
54
55 /**
56 * job accepting stroke messages
57 */
58 callback_job_t *job;
59 };
60
61 ENUM(ike_sa_state_lower_names, IKE_CREATED, IKE_DELETING,
62 "created",
63 "connecting",
64 "established",
65 "rekeying",
66 "deleting",
67 );
68
69 /**
70 * write a bool into element
71 */
72 static void write_bool(xmlTextWriterPtr writer, char *element, bool val)
73 {
74 xmlTextWriterWriteElement(writer, element, val ? "true" : "false");
75 }
76
77 /**
78 * write a identification_t into element
79 */
80 static void write_id(xmlTextWriterPtr writer, char *element, identification_t *id)
81 {
82 xmlTextWriterStartElement(writer, element);
83 switch (id->get_type(id))
84 {
85 {
86 char *type = "";
87 while (TRUE)
88 {
89 case ID_ANY:
90 type = "any";
91 break;
92 case ID_IPV4_ADDR:
93 type = "ipv4";
94 break;
95 case ID_IPV6_ADDR:
96 type = "ipv6";
97 break;
98 case ID_FQDN:
99 type = "fqdn";
100 break;
101 case ID_RFC822_ADDR:
102 type = "email";
103 break;
104 case ID_DER_ASN1_DN:
105 type = "asn1dn";
106 break;
107 case ID_DER_ASN1_GN:
108 type = "asn1gn";
109 break;
110 }
111 xmlTextWriterWriteAttribute(writer, "type", type);
112 xmlTextWriterWriteFormatString(writer, "%D", id);
113 break;
114 }
115 default:
116 /* TODO: base64 keyid */
117 xmlTextWriterWriteAttribute(writer, "type", "keyid");
118 break;
119 }
120 xmlTextWriterEndElement(writer);
121 }
122
123 /**
124 * write a host_t address into an element
125 */
126 static void write_address(xmlTextWriterPtr writer, char *element, host_t *host)
127 {
128 xmlTextWriterStartElement(writer, element);
129 xmlTextWriterWriteAttribute(writer, "type",
130 host->get_family(host) == AF_INET ? "ipv4" : "ipv6");
131 if (host->is_anyaddr(host))
132 { /* do not use %any for XML */
133 xmlTextWriterWriteFormatString(writer, "%s",
134 host->get_family(host) == AF_INET ? "0.0.0.0" : "::");
135 }
136 else
137 {
138 xmlTextWriterWriteFormatString(writer, "%H", host);
139 }
140 xmlTextWriterEndElement(writer);
141 }
142
143 /**
144 * write networks element
145 */
146 static void write_networks(xmlTextWriterPtr writer, char *element,
147 linked_list_t *list)
148 {
149 enumerator_t *enumerator;
150 traffic_selector_t *ts;
151
152 xmlTextWriterStartElement(writer, element);
153 enumerator = list->create_enumerator(list);
154 while (enumerator->enumerate(enumerator, (void**)&ts))
155 {
156 xmlTextWriterStartElement(writer, "network");
157 xmlTextWriterWriteAttribute(writer, "type",
158 ts->get_type(ts) == TS_IPV4_ADDR_RANGE ? "ipv4" : "ipv6");
159 xmlTextWriterWriteFormatString(writer, "%R", ts);
160 xmlTextWriterEndElement(writer);
161 }
162 enumerator->destroy(enumerator);
163 xmlTextWriterEndElement(writer);
164 }
165
166 /**
167 * write a childEnd
168 */
169 static void write_childend(xmlTextWriterPtr writer, child_sa_t *child, bool local)
170 {
171 linked_list_t *list;
172
173 xmlTextWriterWriteFormatElement(writer, "spi", "%lx",
174 htonl(child->get_spi(child, local)));
175 list = child->get_traffic_selectors(child, local);
176 write_networks(writer, "networks", list);
177 }
178
179 /**
180 * write a child_sa_t
181 */
182 static void write_child(xmlTextWriterPtr writer, child_sa_t *child)
183 {
184 mode_t mode;
185 encryption_algorithm_t encr;
186 integrity_algorithm_t int_algo;
187 size_t encr_len, int_len;
188 u_int32_t rekey, use_in, use_out, use_fwd;
189 child_cfg_t *config;
190
191 config = child->get_config(child);
192 child->get_stats(child, &mode, &encr, &encr_len, &int_algo, &int_len,
193 &rekey, &use_in, &use_out, &use_fwd);
194
195 xmlTextWriterStartElement(writer, "childsa");
196 xmlTextWriterWriteFormatElement(writer, "reqid", "%d", child->get_reqid(child));
197 xmlTextWriterWriteFormatElement(writer, "childconfig", "%s",
198 config->get_name(config));
199 xmlTextWriterStartElement(writer, "local");
200 write_childend(writer, child, TRUE);
201 xmlTextWriterEndElement(writer);
202 xmlTextWriterStartElement(writer, "remote");
203 write_childend(writer, child, FALSE);
204 xmlTextWriterEndElement(writer);
205 xmlTextWriterEndElement(writer);
206 }
207
208 /**
209 * process a ikesalist query request message
210 */
211 static void request_query_ikesa(xmlTextReaderPtr reader, xmlTextWriterPtr writer)
212 {
213 enumerator_t *enumerator;
214 ike_sa_t *ike_sa;
215
216 /* <ikesalist> */
217 xmlTextWriterStartElement(writer, "ikesalist");
218
219 enumerator = charon->controller->create_ike_sa_enumerator(charon->controller);
220 while (enumerator->enumerate(enumerator, &ike_sa))
221 {
222 ike_sa_id_t *id;
223 host_t *local, *remote;
224 iterator_t *children;
225 child_sa_t *child_sa;
226
227 id = ike_sa->get_id(ike_sa);
228
229 xmlTextWriterStartElement(writer, "ikesa");
230 xmlTextWriterWriteFormatElement(writer, "id", "%d",
231 ike_sa->get_unique_id(ike_sa));
232 xmlTextWriterWriteFormatElement(writer, "status", "%N",
233 ike_sa_state_lower_names, ike_sa->get_state(ike_sa));
234 xmlTextWriterWriteElement(writer, "role",
235 id->is_initiator(id) ? "initiator" : "responder");
236 xmlTextWriterWriteElement(writer, "peerconfig", ike_sa->get_name(ike_sa));
237
238 /* <local> */
239 local = ike_sa->get_my_host(ike_sa);
240 xmlTextWriterStartElement(writer, "local");
241 xmlTextWriterWriteFormatElement(writer, "spi", "%.16llx",
242 id->is_initiator(id) ? id->get_initiator_spi(id)
243 : id->get_responder_spi(id));
244 write_id(writer, "identification", ike_sa->get_my_id(ike_sa));
245 write_address(writer, "address", local);
246 xmlTextWriterWriteFormatElement(writer, "port", "%d",
247 local->get_port(local));
248 if (ike_sa->supports_extension(ike_sa, EXT_NATT))
249 {
250 write_bool(writer, "nat", ike_sa->has_condition(ike_sa, COND_NAT_HERE));
251 }
252 xmlTextWriterEndElement(writer);
253 /* </local> */
254
255 /* <remote> */
256 remote = ike_sa->get_other_host(ike_sa);
257 xmlTextWriterStartElement(writer, "remote");
258 xmlTextWriterWriteFormatElement(writer, "spi", "%.16llx",
259 id->is_initiator(id) ? id->get_responder_spi(id)
260 : id->get_initiator_spi(id));
261 write_id(writer, "identification", ike_sa->get_other_id(ike_sa));
262 write_address(writer, "address", remote);
263 xmlTextWriterWriteFormatElement(writer, "port", "%d",
264 remote->get_port(remote));
265 if (ike_sa->supports_extension(ike_sa, EXT_NATT))
266 {
267 write_bool(writer, "nat", ike_sa->has_condition(ike_sa, COND_NAT_THERE));
268 }
269 xmlTextWriterEndElement(writer);
270 /* </remote> */
271
272 /* <childsalist> */
273 xmlTextWriterStartElement(writer, "childsalist");
274 children = ike_sa->create_child_sa_iterator(ike_sa);
275 while (children->iterate(children, (void**)&child_sa))
276 {
277 write_child(writer, child_sa);
278 }
279 children->destroy(children);
280 /* </childsalist> */
281 xmlTextWriterEndElement(writer);
282
283 /* </ikesa> */
284 xmlTextWriterEndElement(writer);
285 }
286 enumerator->destroy(enumerator);
287
288 /* </ikesalist> */
289 xmlTextWriterEndElement(writer);
290 }
291
292 /**
293 * process a configlist query request message
294 */
295 static void request_query_config(xmlTextReaderPtr reader, xmlTextWriterPtr writer)
296 {
297 enumerator_t *enumerator;
298 peer_cfg_t *peer_cfg;
299
300 /* <configlist> */
301 xmlTextWriterStartElement(writer, "configlist");
302
303 enumerator = charon->backends->create_peer_cfg_enumerator(charon->backends);
304 while (enumerator->enumerate(enumerator, (void**)&peer_cfg))
305 {
306 enumerator_t *children;
307 child_cfg_t *child_cfg;
308 ike_cfg_t *ike_cfg;
309 linked_list_t *list;
310
311 if (peer_cfg->get_ike_version(peer_cfg) != 2)
312 { /* only IKEv2 connections yet */
313 continue;
314 }
315
316 /* <peerconfig> */
317 xmlTextWriterStartElement(writer, "peerconfig");
318 xmlTextWriterWriteElement(writer, "name", peer_cfg->get_name(peer_cfg));
319 write_id(writer, "local", peer_cfg->get_my_id(peer_cfg));
320 write_id(writer, "remote", peer_cfg->get_other_id(peer_cfg));
321
322 /* <ikeconfig> */
323 ike_cfg = peer_cfg->get_ike_cfg(peer_cfg);
324 xmlTextWriterStartElement(writer, "ikeconfig");
325 write_address(writer, "local", ike_cfg->get_my_host(ike_cfg));
326 write_address(writer, "remote", ike_cfg->get_other_host(ike_cfg));
327 xmlTextWriterEndElement(writer);
328 /* </ikeconfig> */
329
330 /* <childconfiglist> */
331 xmlTextWriterStartElement(writer, "childconfiglist");
332 children = peer_cfg->create_child_cfg_enumerator(peer_cfg);
333 while (children->enumerate(children, &child_cfg))
334 {
335 /* <childconfig> */
336 xmlTextWriterStartElement(writer, "childconfig");
337 xmlTextWriterWriteElement(writer, "name",
338 child_cfg->get_name(child_cfg));
339 list = child_cfg->get_traffic_selectors(child_cfg, TRUE, NULL, NULL);
340 write_networks(writer, "local", list);
341 list->destroy_offset(list, offsetof(traffic_selector_t, destroy));
342 list = child_cfg->get_traffic_selectors(child_cfg, FALSE, NULL, NULL);
343 write_networks(writer, "remote", list);
344 list->destroy_offset(list, offsetof(traffic_selector_t, destroy));
345 xmlTextWriterEndElement(writer);
346 /* </childconfig> */
347 }
348 children->destroy(children);
349 /* </childconfiglist> */
350 xmlTextWriterEndElement(writer);
351 /* </peerconfig> */
352 xmlTextWriterEndElement(writer);
353 }
354 enumerator->destroy(enumerator);
355 /* </configlist> */
356 xmlTextWriterEndElement(writer);
357 }
358
359 /**
360 * callback which logs to a XML writer
361 */
362 static bool xml_callback(xmlTextWriterPtr writer, signal_t signal, level_t level,
363 ike_sa_t* ike_sa, char* format, va_list args)
364 {
365 if (level <= 1)
366 {
367 /* <item> */
368 xmlTextWriterStartElement(writer, "item");
369 xmlTextWriterWriteFormatAttribute(writer, "level", "%d", level);
370 xmlTextWriterWriteFormatAttribute(writer, "source", "%N", signal_names, signal);
371 xmlTextWriterWriteFormatAttribute(writer, "thread", "%u", pthread_self());
372 xmlTextWriterWriteVFormatString(writer, format, args);
373 xmlTextWriterEndElement(writer);
374 /* </item> */
375 }
376 return TRUE;
377 }
378
379 /**
380 * process a *terminate control request message
381 */
382 static void request_control_terminate(xmlTextReaderPtr reader,
383 xmlTextWriterPtr writer, bool ike)
384 {
385 if (xmlTextReaderRead(reader) &&
386 xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT)
387 {
388 const char *str;
389 u_int32_t id;
390 status_t status;
391
392 str = xmlTextReaderConstValue(reader);
393 if (str == NULL || !(id = atoi(str)))
394 {
395 DBG1(DBG_CFG, "error parsing XML id string");
396 return;
397 }
398 DBG1(DBG_CFG, "terminating %s_SA %d", ike ? "IKE" : "CHILD", id);
399
400 /* <log> */
401 xmlTextWriterStartElement(writer, "log");
402 if (ike)
403 {
404 status = charon->controller->terminate_ike(
405 charon->controller, id,
406 (controller_cb_t)xml_callback, writer);
407 }
408 else
409 {
410 status = charon->controller->terminate_child(
411 charon->controller, id,
412 (controller_cb_t)xml_callback, writer);
413 }
414 /* </log> */
415 xmlTextWriterEndElement(writer);
416 xmlTextWriterWriteFormatElement(writer, "status", "%d", status);
417 }
418 }
419
420 /**
421 * process a *initiate control request message
422 */
423 static void request_control_initiate(xmlTextReaderPtr reader,
424 xmlTextWriterPtr writer, bool ike)
425 {
426 if (xmlTextReaderRead(reader) &&
427 xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT)
428 {
429 const char *str;
430 status_t status = FAILED;
431 peer_cfg_t *peer;
432 child_cfg_t *child = NULL;
433 enumerator_t *enumerator;
434
435 str = xmlTextReaderConstValue(reader);
436 if (str == NULL)
437 {
438 DBG1(DBG_CFG, "error parsing XML config name string");
439 return;
440 }
441 DBG1(DBG_CFG, "initiating %s_SA %s", ike ? "IKE" : "CHILD", str);
442
443 /* <log> */
444 xmlTextWriterStartElement(writer, "log");
445 peer = charon->backends->get_peer_cfg_by_name(charon->backends, (char*)str);
446 if (peer)
447 {
448 enumerator = peer->create_child_cfg_enumerator(peer);
449 if (ike)
450 {
451 if (!enumerator->enumerate(enumerator, &child))
452 {
453 child = NULL;
454 }
455 child->get_ref(child);
456 }
457 else
458 {
459 while (enumerator->enumerate(enumerator, &child))
460 {
461 if (streq(child->get_name(child), str))
462 {
463 child->get_ref(child);
464 break;
465 }
466 child = NULL;
467 }
468 }
469 enumerator->destroy(enumerator);
470 if (child)
471 {
472 status = charon->controller->initiate(charon->controller,
473 peer, child, (controller_cb_t)xml_callback,
474 writer);
475 }
476 else
477 {
478 peer->destroy(peer);
479 }
480 }
481 /* </log> */
482 xmlTextWriterEndElement(writer);
483 xmlTextWriterWriteFormatElement(writer, "status", "%d", status);
484 }
485 }
486
487 /**
488 * process a query request
489 */
490 static void request_query(xmlTextReaderPtr reader, xmlTextWriterPtr writer)
491 {
492 /* <query> */
493 xmlTextWriterStartElement(writer, "query");
494 while (xmlTextReaderRead(reader))
495 {
496 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT)
497 {
498 if (streq(xmlTextReaderConstName(reader), "ikesalist"))
499 {
500 request_query_ikesa(reader, writer);
501 break;
502 }
503 if (streq(xmlTextReaderConstName(reader), "configlist"))
504 {
505 request_query_config(reader, writer);
506 break;
507 }
508 }
509 }
510 /* </query> */
511 xmlTextWriterEndElement(writer);
512 }
513
514 /**
515 * process a control request
516 */
517 static void request_control(xmlTextReaderPtr reader, xmlTextWriterPtr writer)
518 {
519 /* <control> */
520 xmlTextWriterStartElement(writer, "control");
521 while (xmlTextReaderRead(reader))
522 {
523 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT)
524 {
525 if (streq(xmlTextReaderConstName(reader), "ikesaterminate"))
526 {
527 request_control_terminate(reader, writer, TRUE);
528 break;
529 }
530 if (streq(xmlTextReaderConstName(reader), "childsaterminate"))
531 {
532 request_control_terminate(reader, writer, FALSE);
533 break;
534 }
535 if (streq(xmlTextReaderConstName(reader), "ikesainitiate"))
536 {
537 request_control_initiate(reader, writer, TRUE);
538 break;
539 }
540 if (streq(xmlTextReaderConstName(reader), "childsainitiate"))
541 {
542 request_control_initiate(reader, writer, FALSE);
543 break;
544 }
545 }
546 }
547 /* </control> */
548 xmlTextWriterEndElement(writer);
549 }
550
551 /**
552 * process a request message
553 */
554 static void request(xmlTextReaderPtr reader, char *id, int fd)
555 {
556 xmlTextWriterPtr writer;
557
558 writer = xmlNewTextWriter(xmlOutputBufferCreateFd(fd, NULL));
559 if (writer == NULL)
560 {
561 DBG1(DBG_CFG, "opening SMP XML writer failed");
562 return;
563 }
564
565 xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
566 /* <message xmlns="http://www.strongswan.org/smp/1.0"
567 id="id" type="response"> */
568 xmlTextWriterStartElement(writer, "message");
569 xmlTextWriterWriteAttribute(writer, "xmlns",
570 "http://www.strongswan.org/smp/1.0");
571 xmlTextWriterWriteAttribute(writer, "id", id);
572 xmlTextWriterWriteAttribute(writer, "type", "response");
573
574 while (xmlTextReaderRead(reader))
575 {
576 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT)
577 {
578 if (streq(xmlTextReaderConstName(reader), "query"))
579 {
580 request_query(reader, writer);
581 break;
582 }
583 if (streq(xmlTextReaderConstName(reader), "control"))
584 {
585 request_control(reader, writer);
586 break;
587 }
588 }
589 }
590 /* </message> and close document */
591 xmlTextWriterEndDocument(writer);
592 xmlFreeTextWriter(writer);
593 }
594
595 /**
596 * cleanup helper function for open file descriptors
597 */
598 static void closefdp(int *fd)
599 {
600 close(*fd);
601 }
602
603 /**
604 * read from a opened connection and process it
605 */
606 static job_requeue_t process(int *fdp)
607 {
608 int oldstate, fd = *fdp;
609 char buffer[4096];
610 size_t len;
611 xmlTextReaderPtr reader;
612 char *id = NULL, *type = NULL;
613
614 pthread_cleanup_push((void*)closefdp, (void*)&fd);
615 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);
616 len = read(fd, buffer, sizeof(buffer));
617 pthread_setcancelstate(oldstate, NULL);
618 pthread_cleanup_pop(0);
619 if (len <= 0)
620 {
621 close(fd);
622 DBG2(DBG_CFG, "SMP XML connection closed");
623 return JOB_REQUEUE_NONE;
624 }
625 DBG3(DBG_CFG, "got XML request: %b", buffer, len);
626
627 reader = xmlReaderForMemory(buffer, len, NULL, NULL, 0);
628 if (reader == NULL)
629 {
630 DBG1(DBG_CFG, "opening SMP XML reader failed");
631 return JOB_REQUEUE_FAIR;;
632 }
633
634 /* read message type and id */
635 while (xmlTextReaderRead(reader))
636 {
637 if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT &&
638 streq(xmlTextReaderConstName(reader), "message"))
639 {
640 id = xmlTextReaderGetAttribute(reader, "id");
641 type = xmlTextReaderGetAttribute(reader, "type");
642 break;
643 }
644 }
645
646 /* process message */
647 if (id && type)
648 {
649 if (streq(type, "request"))
650 {
651 request(reader, id, fd);
652 }
653 else
654 {
655 /* response(reader, id) */
656 }
657 }
658 xmlFreeTextReader(reader);
659 return JOB_REQUEUE_FAIR;;
660 }
661
662 /**
663 * accept from XML socket and create jobs to process connections
664 */
665 static job_requeue_t dispatch(private_smp_t *this)
666 {
667 struct sockaddr_un strokeaddr;
668 int oldstate, fd, *fdp, strokeaddrlen = sizeof(strokeaddr);
669 callback_job_t *job;
670
671 /* wait for connections, but allow thread to terminate */
672 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);
673 fd = accept(this->socket, (struct sockaddr *)&strokeaddr, &strokeaddrlen);
674 pthread_setcancelstate(oldstate, NULL);
675
676 if (fd < 0)
677 {
678 DBG1(DBG_CFG, "accepting SMP XML socket failed: %s", strerror(errno));
679 sleep(1);
680 return JOB_REQUEUE_FAIR;;
681 }
682
683 fdp = malloc_thing(int);
684 *fdp = fd;
685 job = callback_job_create((callback_job_cb_t)process, fdp, free, this->job);
686 charon->processor->queue_job(charon->processor, (job_t*)job);
687
688 return JOB_REQUEUE_DIRECT;
689 }
690
691 /**
692 * Implementation of itnerface_t.destroy.
693 */
694 static void destroy(private_smp_t *this)
695 {
696 this->job->cancel(this->job);
697 close(this->socket);
698 free(this);
699 }
700
701 /*
702 * Described in header file
703 */
704 plugin_t *plugin_create()
705 {
706 struct sockaddr_un unix_addr = { AF_UNIX, IPSEC_PIDDIR "/charon.xml"};
707 private_smp_t *this = malloc_thing(private_smp_t);
708 mode_t old;
709
710 this->public.plugin.destroy = (void (*)(plugin_t*))destroy;
711
712 /* set up unix socket */
713 this->socket = socket(AF_UNIX, SOCK_STREAM, 0);
714 if (this->socket == -1)
715 {
716 DBG1(DBG_CFG, "could not create XML socket");
717 free(this);
718 return NULL;
719 }
720
721 unlink(unix_addr.sun_path);
722 old = umask(~(S_IRWXU | S_IRWXG));
723 if (bind(this->socket, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0)
724 {
725 DBG1(DBG_CFG, "could not bind XML socket: %s", strerror(errno));
726 close(this->socket);
727 free(this);
728 return NULL;
729 }
730 umask(old);
731 if (chown(unix_addr.sun_path, charon->uid, charon->gid) != 0)
732 {
733 DBG1(DBG_CFG, "changing XML socket permissions failed: %s", strerror(errno));
734 }
735
736 if (listen(this->socket, 5) < 0)
737 {
738 DBG1(DBG_CFG, "could not listen on XML socket: %s", strerror(errno));
739 close(this->socket);
740 free(this);
741 return NULL;
742 }
743
744 this->job = callback_job_create((callback_job_cb_t)dispatch, this, NULL, NULL);
745 charon->processor->queue_job(charon->processor, (job_t*)this->job);
746
747 return &this->public.plugin;
748 }
749