Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / bind / dist / contrib / dbus / bind-9.3.2b1-dbus.patch
blobcdf50d68bd8ded599a083601dcfce9688d40222d
1 --- bind-9.3.2b1/lib/dns/rbt.c.dbus 2005-06-17 21:03:24.000000000 -0400
2 +++ bind-9.3.2b1/lib/dns/rbt.c 2005-10-07 12:43:26.000000000 -0400
3 @@ -2172,6 +2172,47 @@
4 dns_rbt_printtree(rbt->root, NULL, 0);
7 +static void
8 +dns_rbt_traverse_tree(dns_rbtnode_t *root, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 ) {
9 +/*
10 + * This is used ONLY to traverse the forward table by dbus_mgr at the moment.
11 + * Since the forward table is not likely to be large, this can be recursive.
12 + */
13 + dns_name_t name;
14 + dns_offsets_t offsets;
15 + char buf[DNS_NAME_MAXWIRE];
16 + isc_buffer_t buffer;
18 + if (root != NULL) {
20 + if (DOWN(root))
21 + dns_rbt_traverse_tree(DOWN(root), cb, cb_arg1, cb_arg2);
23 + if( LEFT(root) != NULL )
24 + dns_rbt_traverse_tree(LEFT(root), cb, cb_arg1, cb_arg2);
26 + if( RIGHT(root) != NULL )
27 + dns_rbt_traverse_tree(RIGHT(root), cb, cb_arg1, cb_arg2);
29 + if( DATA(root) == 0L )
30 + return;
32 + dns_name_init(&name, offsets);
33 + isc_buffer_init(&buffer, buf, DNS_NAME_MAXWIRE);
34 + dns_name_setbuffer( &name, &buffer);
35 + dns_rbt_fullnamefromnode(root, &name);
37 + (*cb)(&name, DATA(root), cb_arg1, cb_arg2);
38 + }
41 +void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 )
43 + REQUIRE(VALID_RBT(rbt));
45 + dns_rbt_traverse_tree( rbt->root, cb, cb_arg1, cb_arg2 );
49 * Chain Functions
51 --- bind-9.3.2b1/lib/dns/forward.c.dbus 2005-03-16 22:58:30.000000000 -0500
52 +++ bind-9.3.2b1/lib/dns/forward.c 2005-10-07 12:43:26.000000000 -0400
53 @@ -200,3 +200,89 @@
55 isc_mem_put(fwdtable->mctx, forwarders, sizeof(dns_forwarders_t));
58 +/***
59 + *** new D-BUS Dynamic Forwarding Zones functions:
60 + ***/
61 +isc_result_t
62 +dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name )
64 + isc_result_t result;
66 + REQUIRE(VALID_FWDTABLE(fwdtable));
68 + RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
70 + result = dns_rbt_deletename(fwdtable->table, name, ISC_FALSE);
72 + RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
74 + return (result);
77 +isc_result_t
78 +dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable,
79 + dns_name_t *name,
80 + dns_name_t *foundname,
81 + dns_forwarders_t **forwardersp)
83 + isc_result_t result;
85 + REQUIRE(VALID_FWDTABLE(fwdtable));
87 + RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
89 + result = dns_rbt_findname(fwdtable->table, name, 0, foundname,
90 + (void **)forwardersp);
92 + if(result == DNS_R_PARTIALMATCH)
93 + result = ISC_R_SUCCESS;
95 + RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
97 + return (result);
100 +isc_result_t
101 +dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
102 + dns_forwarders_t **forwardersp)
104 + isc_result_t result;
106 + REQUIRE(VALID_FWDTABLE(fwdtable));
108 + REQUIRE(forwardersp != 0L);
110 + RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
112 + result = dns_rbt_findname(fwdtable->table, name, 0, NULL,
113 + (void **)forwardersp);
115 + if( result != ISC_R_SUCCESS )
116 + *forwardersp = 0L;
118 + RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
120 + return (result);
123 +static
124 +void dns_fwdtable_traverse
126 + dns_name_t *name,
127 + void *node_data,
128 + void *cbp,
129 + void *cb_arg
132 + dns_fwdtable_callback_t cb = (dns_fwdtable_callback_t) cbp;
134 + (*cb)( name, node_data, cb_arg);
137 +void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void *cb_arg )
139 + REQUIRE(VALID_FWDTABLE(fwdtable));
141 + dns_rbt_traverse( fwdtable->table, dns_fwdtable_traverse, cb, cb_arg );
143 --- bind-9.3.2b1/lib/dns/include/dns/forward.h.dbus 2005-03-16 22:58:31.000000000 -0500
144 +++ bind-9.3.2b1/lib/dns/include/dns/forward.h 2005-10-07 12:43:26.000000000 -0400
145 @@ -98,6 +98,37 @@
146 * all memory associated with the forwarding table is freed.
150 +/* These are ONLY used by dbus_mgr :
151 + */
153 +isc_result_t
154 +dns_fwdtable_delete( dns_fwdtable_t *fwdtable, dns_name_t *name );
155 +/*
156 + * Removes an entry from the forwarding table.
157 + */
159 +isc_result_t
160 +dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
161 + dns_forwarders_t **forwardersp);
163 + * Finds an exact match for "name" in the forwarding table.
164 + */
166 +isc_result_t
167 +dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable, dns_name_t *name, dns_name_t *foundname,
168 + dns_forwarders_t **forwardersp);
170 + * Finds the closest match for "*name" in the forwarding table, returning
171 + * the actual name matching in *name if different to *name passed in.
172 + */
174 +typedef void (*dns_fwdtable_callback_t)( dns_name_t *, dns_forwarders_t *, void *);
175 +void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void * );
176 +/* Invoke cb for each member of fwdtable
177 + */
180 ISC_LANG_ENDDECLS
182 #endif /* DNS_FORWARD_H */
183 --- bind-9.3.2b1/lib/dns/include/dns/rbt.h.dbus 2004-10-11 01:55:51.000000000 -0400
184 +++ bind-9.3.2b1/lib/dns/include/dns/rbt.h 2005-10-07 12:43:26.000000000 -0400
185 @@ -833,6 +833,17 @@
186 * <something_else> Any error result from dns_name_concatenate.
190 +typedef void (*dns_rbt_traverse_callback_t)( dns_name_t *name,
191 + void *node_data,
192 + void *cb_arg1,
193 + void *cb_arg2);
195 +void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 );
196 +/* tree traversal function (only used by D-BUS dynamic forwarding dbus_mgr at
197 + * the moment)
198 + */
200 ISC_LANG_ENDDECLS
202 #endif /* DNS_RBT_H */
203 --- bind-9.3.2b1/lib/isc/unix/socket.c.dbus 2005-08-25 00:32:55.000000000 -0400
204 +++ bind-9.3.2b1/lib/isc/unix/socket.c 2005-10-07 13:40:03.000000000 -0400
205 @@ -148,6 +148,11 @@
206 ISC_LIST(isc_socketevent_t) recv_list;
207 ISC_LIST(isc_socket_newconnev_t) accept_list;
208 isc_socket_connev_t *connect_ev;
210 + /* these are used only by isc_sockettype_fd sockets:*/
211 + isc_socketevent_t *read_ready_event;
212 + isc_socketevent_t *write_ready_event;
213 + isc_socketevent_t *selected_event;
216 * Internal events. Posted when a descriptor is readable or
217 @@ -304,7 +309,7 @@
219 static void
220 wakeup_socket(isc_socketmgr_t *manager, int fd, int msg) {
221 - isc_socket_t *sock;
222 + isc_socket_t *sock=0L;
225 * This is a wakeup on a socket. If the socket is not in the
226 @@ -1266,6 +1271,9 @@
227 sock->connected = 0;
228 sock->connecting = 0;
229 sock->bound = 0;
230 + sock->read_ready_event = 0L;
231 + sock->write_ready_event = 0L;
232 + sock->selected_event = 0L;
235 * initialize the lock
236 @@ -1378,13 +1386,16 @@
237 case isc_sockettype_tcp:
238 sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP);
239 break;
241 + case isc_sockettype_fd:
242 + sock->fd = pf;
245 #ifdef F_DUPFD
247 * Leave a space for stdio to work in.
249 - if (sock->fd >= 0 && sock->fd < 20) {
250 + if ( (type != isc_sockettype_fd) && (sock->fd >= 0) && (sock->fd < 20) ) {
251 int new, tmp;
252 new = fcntl(sock->fd, F_DUPFD, 20);
253 tmp = errno;
254 @@ -1438,7 +1449,7 @@
258 - if (make_nonblock(sock->fd) != ISC_R_SUCCESS) {
259 + if ((type != isc_sockettype_fd) && (make_nonblock(sock->fd) != ISC_R_SUCCESS)) {
260 (void)close(sock->fd);
261 free_socket(&sock);
262 return (ISC_R_UNEXPECTED);
263 @@ -1706,6 +1717,38 @@
264 isc_task_send(ev->ev_sender, (isc_event_t **)&iev);
267 +static
268 +isc_event_t *dispatch_read_ready(isc_socketmgr_t *manager, isc_socket_t *sock)
270 + isc_event_t *dev = (isc_event_t*)sock->read_ready_event, *ev;
272 + ev = isc_mem_get(manager->mctx, dev->ev_size);
273 + memcpy(ev,dev,dev->ev_size);
274 + ISC_LINK_INIT(ev,ev_link);
275 + isc_task_send(dev->ev_sender, &ev );
276 + return (isc_event_t *)sock->selected_event;
279 +static
280 +isc_event_t *dispatch_write_ready(isc_socketmgr_t *manager,isc_socket_t *sock)
282 + isc_event_t *dev = (isc_event_t*)sock->write_ready_event, *ev;
283 + ev = isc_mem_get(manager->mctx, dev->ev_size);
284 + memcpy(ev,dev,dev->ev_size);
285 + ISC_LINK_INIT(ev,ev_link);
286 + isc_task_send(dev->ev_sender, &ev );
287 + return (isc_event_t *)sock->selected_event;
290 +static
291 +void dispatch_selected(isc_socketmgr_t *manager, isc_event_t *dev)
292 +{ isc_event_t *ev;
293 + ev = isc_mem_get(manager->mctx, dev->ev_size);
294 + memcpy(ev,dev,dev->ev_size);
295 + ISC_LINK_INIT(ev,ev_link);
296 + isc_task_send(dev->ev_sender, &ev );
300 * Dequeue an item off the given socket's read queue, set the result code
301 * in the done event to the one provided, and send it to the task it was
302 @@ -2113,6 +2156,7 @@
303 int i;
304 isc_socket_t *sock;
305 isc_boolean_t unlock_sock;
306 + isc_event_t *sock_selected = 0L;
308 REQUIRE(maxfd <= (int)FD_SETSIZE);
310 @@ -2146,11 +2190,15 @@
311 unlock_sock = ISC_TRUE;
312 LOCK(&sock->lock);
313 if (!SOCK_DEAD(sock)) {
314 + if( sock->type != isc_sockettype_fd )
316 if (sock->listener)
317 dispatch_accept(sock);
318 else
319 dispatch_recv(sock);
321 + }else
322 + sock_selected = dispatch_read_ready(manager,sock);
323 + }
324 FD_CLR(i, &manager->read_fds);
326 check_write:
327 @@ -2164,16 +2212,24 @@
328 LOCK(&sock->lock);
330 if (!SOCK_DEAD(sock)) {
331 + if( sock->type != isc_sockettype_fd )
333 if (sock->connecting)
334 dispatch_connect(sock);
335 else
336 dispatch_send(sock);
337 + }else
338 + sock_selected = dispatch_write_ready(manager,sock);
340 FD_CLR(i, &manager->write_fds);
342 if (unlock_sock)
343 UNLOCK(&sock->lock);
345 + if( sock_selected != 0L )
347 + dispatch_selected(manager, sock_selected);
351 #ifdef ISC_PLATFORM_USETHREADS
352 @@ -2192,7 +2248,7 @@
353 int cc;
354 fd_set readfds;
355 fd_set writefds;
356 - int msg, fd;
357 + int msg, fd = -1;
358 int maxfd;
359 char strbuf[ISC_STRERRORSIZE];
361 @@ -3523,3 +3579,55 @@
362 return (ISC_R_SUCCESS);
364 #endif /* ISC_PLATFORM_USETHREADS */
366 +isc_socketevent_t*
367 +isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev )
369 + REQUIRE(VALID_SOCKET(sock));
370 + if(dev != 0L)
372 + sock->references=1;
373 + sock->read_ready_event = dev;
374 + select_poke(sock->manager, sock->fd, SELECT_POKE_READ);
375 + }else
377 + dev = sock->read_ready_event ;
378 + sock->read_ready_event = 0L ;
380 + return dev;
383 +isc_socketevent_t*
384 +isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev )
386 + REQUIRE(VALID_SOCKET(sock));
387 + if(dev != 0L)
389 + sock->references=1;
390 + sock->write_ready_event = dev;
391 + select_poke(sock->manager, sock->fd, SELECT_POKE_WRITE);
392 + }else
394 + dev = sock->write_ready_event;
395 + sock->write_ready_event = 0L;
397 + return dev;
400 +isc_socketevent_t*
401 +isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev )
403 + REQUIRE(VALID_SOCKET(sock));
404 + if(dev != 0L)
406 + sock->references=1;
407 + sock->selected_event = dev;
408 + }else
410 + dev = sock->selected_event;
411 + sock->selected_event = 0L;
412 + sock->references=0;
413 + destroy(&sock);
415 + return dev;
417 --- bind-9.3.2b1/lib/isc/include/isc/socket.h.dbus 2004-03-08 04:04:53.000000000 -0500
418 +++ bind-9.3.2b1/lib/isc/include/isc/socket.h 2005-10-07 12:43:26.000000000 -0400
419 @@ -136,6 +136,10 @@
420 #define ISC_SOCKEVENT_NEWCONN (ISC_EVENTCLASS_SOCKET + 3)
421 #define ISC_SOCKEVENT_CONNECT (ISC_EVENTCLASS_SOCKET + 4)
423 +#define ISC_SOCKEVENT_READ_READY (ISC_EVENTCLASS_SOCKET + 5)
424 +#define ISC_SOCKEVENT_WRITE_READY (ISC_EVENTCLASS_SOCKET + 6)
425 +#define ISC_SOCKEVENT_SELECTED (ISC_EVENTCLASS_SOCKET + 7)
428 * Internal events.
430 @@ -144,7 +148,8 @@
432 typedef enum {
433 isc_sockettype_udp = 1,
434 - isc_sockettype_tcp = 2
435 + isc_sockettype_tcp = 2,
436 + isc_sockettype_fd = 8
437 } isc_sockettype_t;
440 @@ -699,6 +704,30 @@
441 * 'sock' is a valid socket.
444 +isc_socketevent_t*
445 +isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev );
446 +/* register the "dev" event to be sent when the isc_sockettype_fd sock
447 + * was select()-ed for read. If there is already an event registered, it
448 + * is returned, otherwise 0 is returned. If dev is 0, removes any existing
449 + * registered event.
450 + */
452 +isc_socketevent_t*
453 +isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev );
454 +/* register the "dev" event to be sent when the isc_sockettype_fd sock
455 + * was select()-ed for write. If there is already an event registered, it
456 + * is returned, otherwise 0 is returned. If dev is 0, removes any existing
457 + * registered event.
458 + */
460 +isc_socketevent_t*
461 +isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev );
462 +/* register the "dev" event to be sent when ALL isc_sockettype_fd sockets
463 + * have been select()-ed . If there is already an event registered, it
464 + * is returned, otherwise 0 is returned. If dev is 0, removes any existing
465 + * registered event.
466 + */
468 ISC_LANG_ENDDECLS
470 #endif /* ISC_SOCKET_H */
471 --- bind-9.3.2b1/bin/named/log.c.dbus 2005-05-24 19:58:17.000000000 -0400
472 +++ bind-9.3.2b1/bin/named/log.c 2005-10-07 12:43:26.000000000 -0400
473 @@ -41,6 +41,7 @@
474 { "queries", 0 },
475 { "unmatched", 0 },
476 { "update-security", 0 },
477 + { "dbus", 0 },
478 { NULL, 0 }
481 @@ -60,6 +61,7 @@
482 { "notify", 0 },
483 { "control", 0 },
484 { "lwresd", 0 },
485 + { "dbus", 0 },
486 { NULL, 0 }
489 --- bind-9.3.2b1/bin/named/Makefile.in.dbus 2004-09-06 17:47:25.000000000 -0400
490 +++ bind-9.3.2b1/bin/named/Makefile.in 2005-10-07 13:44:22.000000000 -0400
491 @@ -35,7 +35,9 @@
492 ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
493 ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
494 ${DBDRIVER_INCLUDES}
496 +DBUS_ARCHDEP_LIBDIR ?= lib
497 +DBUS_INCLUDES = \
498 + -I/usr/${DBUS_ARCHDEP_LIBDIR}/dbus-1.0/include -I/usr/include/dbus-1.0
499 CDEFINES =
500 CWARNINGS =
502 @@ -52,6 +54,7 @@
503 ISCDEPLIBS = ../../lib/isc/libisc.@A@
504 LWRESDEPLIBS = ../../lib/lwres/liblwres.@A@
505 BIND9DEPLIBS = ../../lib/bind9/libbind9.@A@
506 +DBUSLIBS= -ldbus-1
508 DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
509 ${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS}
510 @@ -71,6 +74,7 @@
511 zoneconf.@O@ \
512 lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
513 lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
514 + dbus_service.@O@ dbus_mgr.@O@ \
515 $(DBDRIVER_OBJS)
517 UOBJS = unix/os.@O@
518 @@ -83,6 +87,7 @@
519 zoneconf.c \
520 lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
521 lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
522 + dbus_service.c dbus_mgr.c \
523 $(DBDRIVER_SRCS)
525 MANPAGES = named.8 lwresd.8 named.conf.5
526 @@ -105,9 +110,14 @@
527 -DNS_LOCALSTATEDIR=\"${localstatedir}\" \
528 -c ${srcdir}/config.c
530 +dbus_service.@O@: dbus_service.c
531 + ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
532 + ${DBUS_INCLUDES} \
533 + -c ${srcdir}/dbus_service.c
535 named@EXEEXT@: ${OBJS} ${UOBJS} ${DEPLIBS}
536 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
537 - ${OBJS} ${UOBJS} ${LIBS}
538 + ${OBJS} ${UOBJS} ${LIBS} ${DBUSLIBS}
540 lwresd@EXEEXT@: named@EXEEXT@
541 rm -f lwresd@EXEEXT@
542 --- bind-9.3.2b1/bin/named/named.8.dbus 2005-05-12 22:43:20.000000000 -0400
543 +++ bind-9.3.2b1/bin/named/named.8 2005-10-07 13:50:12.000000000 -0400
544 @@ -41,7 +41,7 @@
545 named \- Internet domain name server
546 .SH "SYNOPSIS"
547 .HP 6
548 -\fBnamed\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-c\ \fIconfig\-file\fR\fR] [\fB\-d\ \fIdebug\-level\fR\fR] [\fB\-f\fR] [\fB\-g\fR] [\fB\-n\ \fI#cpus\fR\fR] [\fB\-p\ \fIport\fR\fR] [\fB\-s\fR] [\fB\-t\ \fIdirectory\fR\fR] [\fB\-u\ \fIuser\fR\fR] [\fB\-v\fR] [\fB\-x\ \fIcache\-file\fR\fR]
549 +\fBnamed\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-c\ \fIconfig\-file\fR\fR] [\fB\-d\ \fIdebug\-level\fR\fR] [\fB\-f\fR] [\fB\-g\fR] [\fB\-n\ \fI#cpus\fR\fR] [\fB\-p\ \fIport\fR\fR] [\fB\-s\fR] [\fB\-t\ \fIdirectory\fR\fR] [\fB\-u\ \fIuser\fR\fR] [\fB\-v\fR] [\fB\-x\ \fIcache\-file\fR\fR] [\fB\-D\fR]
550 .SH "DESCRIPTION"
552 \fBnamed\fR is a Domain Name System (DNS) server, part of the BIND 9 distribution from ISC\&. For more information on the DNS, see RFCs 1033, 1034, and 1035\&.
553 @@ -103,6 +103,13 @@
554 .B "Warning:"
555 This option must not be used\&. It is only of interest to BIND 9 developers and may be removed or changed in a future release\&.
557 +.sp
558 +.TP
559 +\fB\-D\fR
560 +Enable dynamic management of the forwarding table with D-BUS
561 +messages. This option is required for Red Hat NetworkManager
562 +support. See doc/README.DBUS .
563 +.sp
564 .SH "SIGNALS"
566 In routine operation, signals should not be used to control the nameserver; \fBrndc\fR should be used instead\&.
567 @@ -117,6 +124,7 @@
568 .SH "CONFIGURATION"
570 The \fBnamed\fR configuration file is too complex to describe in detail here\&. A complete description is provided in the BIND 9 Administrator Reference Manual\&.
571 +.PP
572 .SH "FILES"
574 \fI/etc/named\&.conf\fR
575 --- bind-9.3.2b1/bin/named/main.c.dbus 2005-04-28 21:04:47.000000000 -0400
576 +++ bind-9.3.2b1/bin/named/main.c 2005-10-07 12:43:26.000000000 -0400
577 @@ -239,7 +239,8 @@
578 "usage: named [-4|-6] [-c conffile] [-d debuglevel] "
579 "[-f|-g] [-n number_of_cpus]\n"
580 " [-p port] [-s] [-t chrootdir] [-u username]\n"
581 - " [-m {usage|trace|record}]\n");
582 + " [-m {usage|trace|record}]\n"
583 + " [-D ]\n");
586 static void
587 @@ -345,7 +346,7 @@
589 isc_commandline_errprint = ISC_FALSE;
590 while ((ch = isc_commandline_parse(argc, argv,
591 - "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:")) != -1) {
592 + "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:D")) != -1) {
593 switch (ch) {
594 case '4':
595 if (disable4)
596 @@ -434,6 +435,9 @@
597 case 'v':
598 printf("BIND %s\n", ns_g_version);
599 exit(0);
600 + case 'D':
601 + ns_g_dbus = 1;
602 + break;
603 case '?':
604 usage();
605 ns_main_earlyfatal("unknown option '-%c'",
606 --- bind-9.3.2b1/bin/named/server.c.dbus 2005-07-26 22:53:15.000000000 -0400
607 +++ bind-9.3.2b1/bin/named/server.c 2005-10-07 12:43:26.000000000 -0400
608 @@ -86,6 +86,8 @@
609 #include <stdlib.h>
610 #endif
612 +#include <named/dbus_mgr.h>
615 * Check an operation for failure. Assumes that the function
616 * using it has a 'result' variable and a 'cleanup' label.
617 @@ -1496,12 +1498,12 @@
618 if (result != ISC_R_SUCCESS) {
619 char namebuf[DNS_NAME_FORMATSIZE];
620 dns_name_format(origin, namebuf, sizeof(namebuf));
621 - cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_WARNING,
622 - "could not set up forwarding for domain '%s': %s",
623 + cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_NOTICE,
624 + "setting up forwarding failed for domain '%s': %s",
625 namebuf, isc_result_totext(result));
626 goto cleanup;
630 result = ISC_R_SUCCESS;
632 cleanup:
633 @@ -2873,6 +2875,20 @@
635 CHECKFATAL(load_zones(server, ISC_FALSE), "loading zones");
637 + server->dbus_mgr = 0L;
638 + if( ns_g_dbus )
639 + if( dbus_mgr_create
640 + ( ns_g_mctx, ns_g_taskmgr, ns_g_socketmgr, ns_g_timermgr,
641 + &server->dbus_mgr
642 + ) != ISC_R_SUCCESS
645 + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
646 + NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
647 + "dbus_mgr initialization failed. D-BUS service is disabled."
648 + );
651 ns_os_started();
652 isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
653 ISC_LOG_NOTICE, "running");
654 @@ -2935,6 +2951,9 @@
656 dns_db_detach(&server->in_roothints);
658 + if( server->dbus_mgr != 0L )
659 + dbus_mgr_shutdown(server->dbus_mgr);
661 isc_task_endexclusive(server->task);
663 isc_task_detach(&server->task);
664 --- bind-9.3.2b1/bin/named/include/named/globals.h.dbus 2004-03-07 23:04:20.000000000 -0500
665 +++ bind-9.3.2b1/bin/named/include/named/globals.h 2005-10-07 13:47:36.000000000 -0400
666 @@ -112,6 +112,8 @@
668 EXTERN int ns_g_listen INIT(3);
670 +EXTERN int ns_g_dbus INIT(0);
672 #undef EXTERN
673 #undef INIT
675 --- bind-9.3.2b1/bin/named/include/named/server.h.dbus 2004-03-07 23:04:21.000000000 -0500
676 +++ bind-9.3.2b1/bin/named/include/named/server.h 2005-10-07 12:43:26.000000000 -0400
677 @@ -91,7 +91,8 @@
678 ns_controls_t * controls; /* Control channels */
679 unsigned int dispatchgen;
680 ns_dispatchlist_t dispatches;
683 + ns_dbus_mgr_t * dbus_mgr;
686 #define NS_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
687 --- bind-9.3.2b1/bin/named/include/named/log.h.dbus 2004-03-07 23:04:21.000000000 -0500
688 +++ bind-9.3.2b1/bin/named/include/named/log.h 2005-10-07 12:43:26.000000000 -0400
689 @@ -34,6 +34,7 @@
690 #define NS_LOGCATEGORY_QUERIES (&ns_g_categories[4])
691 #define NS_LOGCATEGORY_UNMATCHED (&ns_g_categories[5])
692 #define NS_LOGCATEGORY_UPDATE_SECURITY (&ns_g_categories[6])
693 +#define NS_LOGCATEGORY_DBUS (&ns_g_categories[7])
696 * Backwards compatibility.
697 @@ -51,6 +52,7 @@
698 #define NS_LOGMODULE_NOTIFY (&ns_g_modules[8])
699 #define NS_LOGMODULE_CONTROL (&ns_g_modules[9])
700 #define NS_LOGMODULE_LWRESD (&ns_g_modules[10])
701 +#define NS_LOGMODULE_DBUS (&ns_g_modules[11])
703 isc_result_t
704 ns_log_init(isc_boolean_t safe);
705 --- bind-9.3.2b1/bin/named/include/named/types.h.dbus 2004-03-06 05:21:26.000000000 -0500
706 +++ bind-9.3.2b1/bin/named/include/named/types.h 2005-10-07 12:43:26.000000000 -0400
707 @@ -38,4 +38,6 @@
708 typedef struct ns_dispatch ns_dispatch_t;
709 typedef ISC_LIST(ns_dispatch_t) ns_dispatchlist_t;
711 +typedef struct ns_dbus_mgr ns_dbus_mgr_t ;
713 #endif /* NAMED_TYPES_H */