No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / bind / dist / contrib / dbus / bind-9.3.3rc2-dbus.patch
blob9048db71e0420b414c9ae4a40676fde1ae6fdec5
1 --- bind-9.3.3rc2/lib/dns/forward.c.dbus 2005-03-17 04:58:30.000000000 +0100
2 +++ bind-9.3.3rc2/lib/dns/forward.c 2006-09-18 10:08:37.000000000 +0200
3 @@ -200,3 +200,89 @@
5 isc_mem_put(fwdtable->mctx, forwarders, sizeof(dns_forwarders_t));
8 +/***
9 + *** new D-BUS Dynamic Forwarding Zones functions:
10 + ***/
11 +isc_result_t
12 +dns_fwdtable_delete(dns_fwdtable_t *fwdtable, dns_name_t *name )
14 + isc_result_t result;
16 + REQUIRE(VALID_FWDTABLE(fwdtable));
18 + RWLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
20 + result = dns_rbt_deletename(fwdtable->table, name, ISC_FALSE);
22 + RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_write);
24 + return (result);
27 +isc_result_t
28 +dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable,
29 + dns_name_t *name,
30 + dns_name_t *foundname,
31 + dns_forwarders_t **forwardersp)
33 + isc_result_t result;
35 + REQUIRE(VALID_FWDTABLE(fwdtable));
37 + RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
39 + result = dns_rbt_findname(fwdtable->table, name, 0, foundname,
40 + (void **)forwardersp);
42 + if(result == DNS_R_PARTIALMATCH)
43 + result = ISC_R_SUCCESS;
45 + RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
47 + return (result);
50 +isc_result_t
51 +dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
52 + dns_forwarders_t **forwardersp)
54 + isc_result_t result;
56 + REQUIRE(VALID_FWDTABLE(fwdtable));
58 + REQUIRE(forwardersp != 0L);
60 + RWLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
62 + result = dns_rbt_findname(fwdtable->table, name, 0, NULL,
63 + (void **)forwardersp);
65 + if( result != ISC_R_SUCCESS )
66 + *forwardersp = 0L;
68 + RWUNLOCK(&fwdtable->rwlock, isc_rwlocktype_read);
70 + return (result);
73 +static
74 +void dns_fwdtable_traverse
75 +(
76 + dns_name_t *name,
77 + void *node_data,
78 + void *cbp,
79 + void *cb_arg
82 + dns_fwdtable_callback_t cb = (dns_fwdtable_callback_t) cbp;
84 + (*cb)( name, node_data, cb_arg);
87 +void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void *cb_arg )
89 + REQUIRE(VALID_FWDTABLE(fwdtable));
91 + dns_rbt_traverse( fwdtable->table, dns_fwdtable_traverse, cb, cb_arg );
93 --- bind-9.3.3rc2/lib/dns/include/dns/forward.h.dbus 2005-03-17 04:58:31.000000000 +0100
94 +++ bind-9.3.3rc2/lib/dns/include/dns/forward.h 2006-09-18 10:08:37.000000000 +0200
95 @@ -98,6 +98,37 @@
96 * all memory associated with the forwarding table is freed.
100 +/* These are ONLY used by dbus_mgr :
101 + */
103 +isc_result_t
104 +dns_fwdtable_delete( dns_fwdtable_t *fwdtable, dns_name_t *name );
105 +/*
106 + * Removes an entry from the forwarding table.
107 + */
109 +isc_result_t
110 +dns_fwdtable_find_exact(dns_fwdtable_t *fwdtable, dns_name_t *name,
111 + dns_forwarders_t **forwardersp);
113 + * Finds an exact match for "name" in the forwarding table.
114 + */
116 +isc_result_t
117 +dns_fwdtable_find_closest(dns_fwdtable_t *fwdtable, dns_name_t *name, dns_name_t *foundname,
118 + dns_forwarders_t **forwardersp);
120 + * Finds the closest match for "*name" in the forwarding table, returning
121 + * the actual name matching in *name if different to *name passed in.
122 + */
124 +typedef void (*dns_fwdtable_callback_t)( dns_name_t *, dns_forwarders_t *, void *);
125 +void dns_fwdtable_foreach(dns_fwdtable_t *fwdtable, dns_fwdtable_callback_t cb, void * );
126 +/* Invoke cb for each member of fwdtable
127 + */
130 ISC_LANG_ENDDECLS
132 #endif /* DNS_FORWARD_H */
133 --- bind-9.3.3rc2/lib/dns/include/dns/rbt.h.dbus 2004-10-11 07:55:51.000000000 +0200
134 +++ bind-9.3.3rc2/lib/dns/include/dns/rbt.h 2006-09-18 10:08:37.000000000 +0200
135 @@ -833,6 +833,17 @@
136 * <something_else> Any error result from dns_name_concatenate.
140 +typedef void (*dns_rbt_traverse_callback_t)( dns_name_t *name,
141 + void *node_data,
142 + void *cb_arg1,
143 + void *cb_arg2);
145 +void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 );
146 +/* tree traversal function (only used by D-BUS dynamic forwarding dbus_mgr at
147 + * the moment)
148 + */
150 ISC_LANG_ENDDECLS
152 #endif /* DNS_RBT_H */
153 --- bind-9.3.3rc2/lib/dns/rbt.c.dbus 2005-06-18 03:03:24.000000000 +0200
154 +++ bind-9.3.3rc2/lib/dns/rbt.c 2006-09-18 10:08:37.000000000 +0200
155 @@ -2172,6 +2172,47 @@
156 dns_rbt_printtree(rbt->root, NULL, 0);
159 +static void
160 +dns_rbt_traverse_tree(dns_rbtnode_t *root, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 ) {
162 + * This is used ONLY to traverse the forward table by dbus_mgr at the moment.
163 + * Since the forward table is not likely to be large, this can be recursive.
164 + */
165 + dns_name_t name;
166 + dns_offsets_t offsets;
167 + char buf[DNS_NAME_MAXWIRE];
168 + isc_buffer_t buffer;
170 + if (root != NULL) {
172 + if (DOWN(root))
173 + dns_rbt_traverse_tree(DOWN(root), cb, cb_arg1, cb_arg2);
175 + if( LEFT(root) != NULL )
176 + dns_rbt_traverse_tree(LEFT(root), cb, cb_arg1, cb_arg2);
178 + if( RIGHT(root) != NULL )
179 + dns_rbt_traverse_tree(RIGHT(root), cb, cb_arg1, cb_arg2);
181 + if( DATA(root) == 0L )
182 + return;
184 + dns_name_init(&name, offsets);
185 + isc_buffer_init(&buffer, buf, DNS_NAME_MAXWIRE);
186 + dns_name_setbuffer( &name, &buffer);
187 + dns_rbt_fullnamefromnode(root, &name);
189 + (*cb)(&name, DATA(root), cb_arg1, cb_arg2);
190 + }
193 +void dns_rbt_traverse( dns_rbt_t *rbt, dns_rbt_traverse_callback_t cb, void *cb_arg1, void *cb_arg2 )
195 + REQUIRE(VALID_RBT(rbt));
197 + dns_rbt_traverse_tree( rbt->root, cb, cb_arg1, cb_arg2 );
201 * Chain Functions
203 --- bind-9.3.3rc2/lib/isc/include/isc/socket.h.dbus 2004-03-08 10:04:53.000000000 +0100
204 +++ bind-9.3.3rc2/lib/isc/include/isc/socket.h 2006-09-18 10:08:37.000000000 +0200
205 @@ -136,6 +136,10 @@
206 #define ISC_SOCKEVENT_NEWCONN (ISC_EVENTCLASS_SOCKET + 3)
207 #define ISC_SOCKEVENT_CONNECT (ISC_EVENTCLASS_SOCKET + 4)
209 +#define ISC_SOCKEVENT_READ_READY (ISC_EVENTCLASS_SOCKET + 5)
210 +#define ISC_SOCKEVENT_WRITE_READY (ISC_EVENTCLASS_SOCKET + 6)
211 +#define ISC_SOCKEVENT_SELECTED (ISC_EVENTCLASS_SOCKET + 7)
214 * Internal events.
216 @@ -144,7 +148,8 @@
218 typedef enum {
219 isc_sockettype_udp = 1,
220 - isc_sockettype_tcp = 2
221 + isc_sockettype_tcp = 2,
222 + isc_sockettype_fd = 8
223 } isc_sockettype_t;
226 @@ -699,6 +704,30 @@
227 * 'sock' is a valid socket.
230 +isc_socketevent_t*
231 +isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev );
232 +/* register the "dev" event to be sent when the isc_sockettype_fd sock
233 + * was select()-ed for read. If there is already an event registered, it
234 + * is returned, otherwise 0 is returned. If dev is 0, removes any existing
235 + * registered event.
236 + */
238 +isc_socketevent_t*
239 +isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev );
240 +/* register the "dev" event to be sent when the isc_sockettype_fd sock
241 + * was select()-ed for write. If there is already an event registered, it
242 + * is returned, otherwise 0 is returned. If dev is 0, removes any existing
243 + * registered event.
244 + */
246 +isc_socketevent_t*
247 +isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev );
248 +/* register the "dev" event to be sent when ALL isc_sockettype_fd sockets
249 + * have been select()-ed . If there is already an event registered, it
250 + * is returned, otherwise 0 is returned. If dev is 0, removes any existing
251 + * registered event.
252 + */
254 ISC_LANG_ENDDECLS
256 #endif /* ISC_SOCKET_H */
257 --- bind-9.3.3rc2/lib/isc/unix/socket.c.dbus 2006-05-19 04:53:36.000000000 +0200
258 +++ bind-9.3.3rc2/lib/isc/unix/socket.c 2006-09-18 10:08:37.000000000 +0200
259 @@ -148,6 +148,11 @@
260 ISC_LIST(isc_socketevent_t) recv_list;
261 ISC_LIST(isc_socket_newconnev_t) accept_list;
262 isc_socket_connev_t *connect_ev;
264 + /* these are used only by isc_sockettype_fd sockets:*/
265 + isc_socketevent_t *read_ready_event;
266 + isc_socketevent_t *write_ready_event;
267 + isc_socketevent_t *selected_event;
270 * Internal events. Posted when a descriptor is readable or
271 @@ -304,7 +309,7 @@
273 static void
274 wakeup_socket(isc_socketmgr_t *manager, int fd, int msg) {
275 - isc_socket_t *sock;
276 + isc_socket_t *sock=0L;
279 * This is a wakeup on a socket. If the socket is not in the
280 @@ -1289,6 +1294,9 @@
281 sock->connected = 0;
282 sock->connecting = 0;
283 sock->bound = 0;
284 + sock->read_ready_event = 0L;
285 + sock->write_ready_event = 0L;
286 + sock->selected_event = 0L;
289 * initialize the lock
290 @@ -1401,13 +1409,16 @@
291 case isc_sockettype_tcp:
292 sock->fd = socket(pf, SOCK_STREAM, IPPROTO_TCP);
293 break;
295 + case isc_sockettype_fd:
296 + sock->fd = pf;
299 #ifdef F_DUPFD
301 * Leave a space for stdio to work in.
303 - if (sock->fd >= 0 && sock->fd < 20) {
304 + if ( (type != isc_sockettype_fd) && (sock->fd >= 0) && (sock->fd < 20) ) {
305 int new, tmp;
306 new = fcntl(sock->fd, F_DUPFD, 20);
307 tmp = errno;
308 @@ -1461,7 +1472,7 @@
312 - if (make_nonblock(sock->fd) != ISC_R_SUCCESS) {
313 + if ((type != isc_sockettype_fd) && (make_nonblock(sock->fd) != ISC_R_SUCCESS)) {
314 (void)close(sock->fd);
315 free_socket(&sock);
316 return (ISC_R_UNEXPECTED);
317 @@ -1729,6 +1740,38 @@
318 isc_task_send(ev->ev_sender, (isc_event_t **)&iev);
321 +static
322 +isc_event_t *dispatch_read_ready(isc_socketmgr_t *manager, isc_socket_t *sock)
324 + isc_event_t *dev = (isc_event_t*)sock->read_ready_event, *ev;
326 + ev = isc_mem_get(manager->mctx, dev->ev_size);
327 + memcpy(ev,dev,dev->ev_size);
328 + ISC_LINK_INIT(ev,ev_link);
329 + isc_task_send(dev->ev_sender, &ev );
330 + return (isc_event_t *)sock->selected_event;
333 +static
334 +isc_event_t *dispatch_write_ready(isc_socketmgr_t *manager,isc_socket_t *sock)
336 + isc_event_t *dev = (isc_event_t*)sock->write_ready_event, *ev;
337 + ev = isc_mem_get(manager->mctx, dev->ev_size);
338 + memcpy(ev,dev,dev->ev_size);
339 + ISC_LINK_INIT(ev,ev_link);
340 + isc_task_send(dev->ev_sender, &ev );
341 + return (isc_event_t *)sock->selected_event;
344 +static
345 +void dispatch_selected(isc_socketmgr_t *manager, isc_event_t *dev)
346 +{ isc_event_t *ev;
347 + ev = isc_mem_get(manager->mctx, dev->ev_size);
348 + memcpy(ev,dev,dev->ev_size);
349 + ISC_LINK_INIT(ev,ev_link);
350 + isc_task_send(dev->ev_sender, &ev );
354 * Dequeue an item off the given socket's read queue, set the result code
355 * in the done event to the one provided, and send it to the task it was
356 @@ -2136,6 +2179,7 @@
357 int i;
358 isc_socket_t *sock;
359 isc_boolean_t unlock_sock;
360 + isc_event_t *sock_selected = 0L;
362 REQUIRE(maxfd <= (int)FD_SETSIZE);
364 @@ -2169,11 +2213,15 @@
365 unlock_sock = ISC_TRUE;
366 LOCK(&sock->lock);
367 if (!SOCK_DEAD(sock)) {
368 + if( sock->type != isc_sockettype_fd )
370 if (sock->listener)
371 dispatch_accept(sock);
372 else
373 dispatch_recv(sock);
375 + }else
376 + sock_selected = dispatch_read_ready(manager,sock);
377 + }
378 FD_CLR(i, &manager->read_fds);
380 check_write:
381 @@ -2187,16 +2235,24 @@
382 LOCK(&sock->lock);
384 if (!SOCK_DEAD(sock)) {
385 + if( sock->type != isc_sockettype_fd )
387 if (sock->connecting)
388 dispatch_connect(sock);
389 else
390 dispatch_send(sock);
391 + }else
392 + sock_selected = dispatch_write_ready(manager,sock);
394 FD_CLR(i, &manager->write_fds);
396 if (unlock_sock)
397 UNLOCK(&sock->lock);
399 + if( sock_selected != 0L )
401 + dispatch_selected(manager, sock_selected);
405 #ifdef ISC_PLATFORM_USETHREADS
406 @@ -2215,7 +2271,7 @@
407 int cc;
408 fd_set readfds;
409 fd_set writefds;
410 - int msg, fd;
411 + int msg, fd = -1;
412 int maxfd;
413 char strbuf[ISC_STRERRORSIZE];
415 @@ -3546,3 +3602,55 @@
416 return (ISC_R_SUCCESS);
418 #endif /* ISC_PLATFORM_USETHREADS */
420 +isc_socketevent_t*
421 +isc_socket_fd_handle_reads( isc_socket_t *sock, isc_socketevent_t *dev )
423 + REQUIRE(VALID_SOCKET(sock));
424 + if(dev != 0L)
426 + sock->references=1;
427 + sock->read_ready_event = dev;
428 + select_poke(sock->manager, sock->fd, SELECT_POKE_READ);
429 + }else
431 + dev = sock->read_ready_event ;
432 + sock->read_ready_event = 0L ;
434 + return dev;
437 +isc_socketevent_t*
438 +isc_socket_fd_handle_writes( isc_socket_t *sock, isc_socketevent_t *dev )
440 + REQUIRE(VALID_SOCKET(sock));
441 + if(dev != 0L)
443 + sock->references=1;
444 + sock->write_ready_event = dev;
445 + select_poke(sock->manager, sock->fd, SELECT_POKE_WRITE);
446 + }else
448 + dev = sock->write_ready_event;
449 + sock->write_ready_event = 0L;
451 + return dev;
454 +isc_socketevent_t*
455 +isc_socket_fd_handle_selected( isc_socket_t *sock, isc_socketevent_t *dev )
457 + REQUIRE(VALID_SOCKET(sock));
458 + if(dev != 0L)
460 + sock->references=1;
461 + sock->selected_event = dev;
462 + }else
464 + dev = sock->selected_event;
465 + sock->selected_event = 0L;
466 + sock->references=0;
467 + destroy(&sock);
469 + return dev;
471 --- bind-9.3.3rc2/bin/named/named.8.dbus 2006-06-29 15:02:30.000000000 +0200
472 +++ bind-9.3.3rc2/bin/named/named.8 2006-09-18 10:08:37.000000000 +0200
473 @@ -33,7 +33,7 @@
474 named \- Internet domain name server
475 .SH "SYNOPSIS"
476 .HP 6
477 -\fBnamed\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-c\ \fR\fB\fIconfig\-file\fR\fR] [\fB\-d\ \fR\fB\fIdebug\-level\fR\fR] [\fB\-f\fR] [\fB\-g\fR] [\fB\-n\ \fR\fB\fI#cpus\fR\fR] [\fB\-p\ \fR\fB\fIport\fR\fR] [\fB\-s\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR] [\fB\-v\fR] [\fB\-x\ \fR\fB\fIcache\-file\fR\fR]
478 +\fBnamed\fR [\fB\-4\fR] [\fB\-6\fR] [\fB\-c\ \fR\fB\fIconfig\-file\fR\fR] [\fB\-d\ \fR\fB\fIdebug\-level\fR\fR] [\fB\-f\fR] [\fB\-g\fR] [\fB\-n\ \fR\fB\fI#cpus\fR\fR] [\fB\-p\ \fR\fB\fIport\fR\fR] [\fB\-s\fR] [\fB\-t\ \fR\fB\fIdirectory\fR\fR] [\fB\-u\ \fR\fB\fIuser\fR\fR] [\fB\-v\fR] [\fB\-x\ \fR\fB\fIcache\-file\fR\fR] [\fB\-D\fR]
479 .SH "DESCRIPTION"
481 \fBnamed\fR
482 @@ -146,6 +146,13 @@
483 .B "Warning:"
484 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.
486 +.sp
487 +.TP
488 +\fB\-D\fR
489 +Enable dynamic management of the forwarding table with D-BUS
490 +messages. This option is required for Red Hat NetworkManager
491 +support. See doc/README.DBUS .
492 +.sp
493 .SH "SIGNALS"
495 In routine operation, signals should not be used to control the nameserver;
496 @@ -165,6 +172,73 @@
497 \fBnamed\fR
498 configuration file is too complex to describe in detail here. A complete description is provided in the
499 BIND 9 Administrator Reference Manual.
500 +.PP
501 +.SH "NOTES"
502 +.PP
503 +.TP
504 +\fBRed Hat SELinux BIND Security Profile:\fR
505 +.PP
506 +By default, Red Hat ships BIND with the most secure SELinux policy
507 +that will not prevent normal BIND operation and will prevent exploitation
508 +of all known BIND security vulnerabilities . See the selinux(8) man page
509 +for information about SElinux.
510 +.PP
511 +It is not necessary to run named in a chroot environment if the Red Hat
512 +SELinux policy for named is enabled. When enabled, this policy is far
513 +more secure than a chroot environment.
514 +.PP
515 +With this extra security comes some restrictions:
516 +.br
517 +By default, the SELinux policy does not allow named to write any master
518 +zone database files. Only the root user may create files in the $ROOTDIR/var/named
519 +zone database file directory (the options { "directory" } option), where
520 +$ROOTDIR is set in /etc/sysconfig/named.
521 +.br
522 +The "named" group must be granted read privelege to
523 +these files in order for named to be enabled to read them.
524 +.br
525 +Any file created in the zone database file directory is automatically assigned
526 +the SELinux file context named_zone_t .
527 +.br
528 +By default, SELinux prevents any role from modifying named_zone_t files; this
529 +means that files in the zone database directory cannot be modified by dynamic
530 +DNS (DDNS) updates or zone transfers.
531 +.br
532 +The Red Hat BIND distribution and SELinux policy creates two directories where
533 +named is allowed to create and modify files: $ROOTDIR/var/named/slaves and
534 +$ROOTDIR/var/named/data. By placing files you want named to modify, such as
535 +slave or DDNS updateable zone files and database / statistics dump files in
536 +these directories, named will work normally and no further operator action is
537 +required. Files in these directories are automatically assigned the 'named_cache_t'
538 +file context, which SELinux allows named to write.
539 +.br
540 +You can enable the named_t domain to write and create named_zone_t files by use
541 +of the SELinux tunable boolean variable "named_write_master_zones", using the
542 +setsebool(8) command or the system-config-security GUI . If you do this, you
543 +must also set the ENABLE_ZONE_WRITE variable in /etc/sysconfig/named to
544 +1 / yes to set the ownership of files in the $ROOTDIR/var/named directory
545 +to named:named in order for named to be allowed to write them.
546 +.PP
547 +\fBRed Hat BIND named_sdb SDB support:\fR
548 +.PP
549 +Red Hat ships the bind-sdb RPM that provides the /usr/sbin/named_sdb program,
550 +which is named compiled with the Simplified Database Backend modules that ISC
551 +provides in the "contrib/sdb" directory.
552 +.br
553 +The SDB modules for LDAP, PostGreSQL and DirDB are compiled into named_sdb.
554 +.br
555 +To run named_sdb, set the ENABLE_SDB variable in /etc/sysconfig/named to 1 or "yes",
556 +and then the "service named start" named initscript will run named_sdb instead
557 +of named .
558 +.br
559 +See the documentation for the various SDB modules in /usr/share/doc/bind-sdb-*/ .
560 +.PP
561 +\fBRed Hat system-config-bind:\fR
562 +.PP
563 +Red Hat provides the system-config-bind GUI to configure named.conf and zone
564 +database files. Run the "system-config-bind" command and access the manual
565 +by selecting the Help menu.
566 +.PP
567 .SH "FILES"
568 .TP 3n
569 \fI/etc/named.conf\fR
570 --- bind-9.3.3rc2/bin/named/include/named/globals.h.dbus 2006-03-02 01:37:20.000000000 +0100
571 +++ bind-9.3.3rc2/bin/named/include/named/globals.h 2006-09-18 10:08:37.000000000 +0200
572 @@ -112,6 +112,8 @@
574 EXTERN int ns_g_listen INIT(3);
576 +EXTERN int ns_g_dbus INIT(0);
578 #undef EXTERN
579 #undef INIT
581 --- bind-9.3.3rc2/bin/named/include/named/log.h.dbus 2004-03-08 05:04:21.000000000 +0100
582 +++ bind-9.3.3rc2/bin/named/include/named/log.h 2006-09-18 10:08:37.000000000 +0200
583 @@ -34,6 +34,7 @@
584 #define NS_LOGCATEGORY_QUERIES (&ns_g_categories[4])
585 #define NS_LOGCATEGORY_UNMATCHED (&ns_g_categories[5])
586 #define NS_LOGCATEGORY_UPDATE_SECURITY (&ns_g_categories[6])
587 +#define NS_LOGCATEGORY_DBUS (&ns_g_categories[7])
590 * Backwards compatibility.
591 @@ -51,6 +52,7 @@
592 #define NS_LOGMODULE_NOTIFY (&ns_g_modules[8])
593 #define NS_LOGMODULE_CONTROL (&ns_g_modules[9])
594 #define NS_LOGMODULE_LWRESD (&ns_g_modules[10])
595 +#define NS_LOGMODULE_DBUS (&ns_g_modules[11])
597 isc_result_t
598 ns_log_init(isc_boolean_t safe);
599 --- bind-9.3.3rc2/bin/named/include/named/server.h.dbus 2006-03-02 01:37:20.000000000 +0100
600 +++ bind-9.3.3rc2/bin/named/include/named/server.h 2006-09-18 10:08:37.000000000 +0200
601 @@ -91,7 +91,8 @@
602 ns_controls_t * controls; /* Control channels */
603 unsigned int dispatchgen;
604 ns_dispatchlist_t dispatches;
607 + ns_dbus_mgr_t * dbus_mgr;
610 #define NS_SERVER_MAGIC ISC_MAGIC('S','V','E','R')
611 --- bind-9.3.3rc2/bin/named/include/named/types.h.dbus 2004-03-06 11:21:26.000000000 +0100
612 +++ bind-9.3.3rc2/bin/named/include/named/types.h 2006-09-18 10:08:37.000000000 +0200
613 @@ -38,4 +38,6 @@
614 typedef struct ns_dispatch ns_dispatch_t;
615 typedef ISC_LIST(ns_dispatch_t) ns_dispatchlist_t;
617 +typedef struct ns_dbus_mgr ns_dbus_mgr_t ;
619 #endif /* NAMED_TYPES_H */
620 --- bind-9.3.3rc2/bin/named/log.c.dbus 2005-05-25 01:58:17.000000000 +0200
621 +++ bind-9.3.3rc2/bin/named/log.c 2006-09-18 10:08:37.000000000 +0200
622 @@ -41,6 +41,7 @@
623 { "queries", 0 },
624 { "unmatched", 0 },
625 { "update-security", 0 },
626 + { "dbus", 0 },
627 { NULL, 0 }
630 @@ -60,6 +61,7 @@
631 { "notify", 0 },
632 { "control", 0 },
633 { "lwresd", 0 },
634 + { "dbus", 0 },
635 { NULL, 0 }
638 --- bind-9.3.3rc2/bin/named/main.c.dbus 2006-01-06 01:01:42.000000000 +0100
639 +++ bind-9.3.3rc2/bin/named/main.c 2006-09-18 10:08:37.000000000 +0200
640 @@ -239,7 +239,8 @@
641 "usage: named [-4|-6] [-c conffile] [-d debuglevel] "
642 "[-f|-g] [-n number_of_cpus]\n"
643 " [-p port] [-s] [-t chrootdir] [-u username]\n"
644 - " [-m {usage|trace|record}]\n");
645 + " [-m {usage|trace|record}]\n"
646 + " [-D ]\n");
649 static void
650 @@ -345,7 +346,7 @@
652 isc_commandline_errprint = ISC_FALSE;
653 while ((ch = isc_commandline_parse(argc, argv,
654 - "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:")) != -1) {
655 + "46c:C:d:fgi:lm:n:N:p:P:st:u:vx:D")) != -1) {
656 switch (ch) {
657 case '4':
658 if (disable4)
659 @@ -434,6 +435,9 @@
660 case 'v':
661 printf("BIND %s\n", ns_g_version);
662 exit(0);
663 + case 'D':
664 + ns_g_dbus = 1;
665 + break;
666 case '?':
667 usage();
668 ns_main_earlyfatal("unknown option '-%c'",
669 --- bind-9.3.3rc2/bin/named/server.c.dbus 2006-05-24 06:30:24.000000000 +0200
670 +++ bind-9.3.3rc2/bin/named/server.c 2006-09-18 10:08:37.000000000 +0200
671 @@ -86,6 +86,8 @@
672 #include <stdlib.h>
673 #endif
675 +#include <named/dbus_mgr.h>
678 * Check an operation for failure. Assumes that the function
679 * using it has a 'result' variable and a 'cleanup' label.
680 @@ -1495,12 +1497,12 @@
681 if (result != ISC_R_SUCCESS) {
682 char namebuf[DNS_NAME_FORMATSIZE];
683 dns_name_format(origin, namebuf, sizeof(namebuf));
684 - cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_WARNING,
685 - "could not set up forwarding for domain '%s': %s",
686 + cfg_obj_log(forwarders, ns_g_lctx, ISC_LOG_NOTICE,
687 + "setting up forwarding failed for domain '%s': %s",
688 namebuf, isc_result_totext(result));
689 goto cleanup;
693 result = ISC_R_SUCCESS;
695 cleanup:
696 @@ -2875,6 +2877,20 @@
698 CHECKFATAL(load_zones(server, ISC_FALSE), "loading zones");
700 + server->dbus_mgr = 0L;
701 + if( ns_g_dbus )
702 + if( dbus_mgr_create
703 + ( ns_g_mctx, ns_g_taskmgr, ns_g_socketmgr, ns_g_timermgr,
704 + &server->dbus_mgr
705 + ) != ISC_R_SUCCESS
708 + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
709 + NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
710 + "dbus_mgr initialization failed. D-BUS service is disabled."
711 + );
714 ns_os_started();
715 isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
716 ISC_LOG_NOTICE, "running");
717 @@ -2937,6 +2953,9 @@
719 dns_db_detach(&server->in_roothints);
721 + if( server->dbus_mgr != 0L )
722 + dbus_mgr_shutdown(server->dbus_mgr);
724 isc_task_endexclusive(server->task);
726 isc_task_detach(&server->task);
727 --- bind-9.3.3rc2/bin/named/Makefile.in.dbus 2004-09-06 23:47:25.000000000 +0200
728 +++ bind-9.3.3rc2/bin/named/Makefile.in 2006-09-18 10:10:58.000000000 +0200
729 @@ -35,7 +35,8 @@
730 ${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
731 ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
732 ${DBDRIVER_INCLUDES}
734 +DBUS_INCLUDES = \
735 + -I/usr/lib/dbus-1.0/include -I/usr/include/dbus-1.0
736 CDEFINES =
737 CWARNINGS =
739 @@ -52,6 +53,7 @@
740 ISCDEPLIBS = ../../lib/isc/libisc.@A@
741 LWRESDEPLIBS = ../../lib/lwres/liblwres.@A@
742 BIND9DEPLIBS = ../../lib/bind9/libbind9.@A@
743 +DBUSLIBS= -ldbus-1
745 DEPLIBS = ${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
746 ${ISCCFGDEPLIBS} ${ISCCCDEPLIBS} ${ISCDEPLIBS}
747 @@ -71,6 +73,7 @@
748 zoneconf.@O@ \
749 lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
750 lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
751 + dbus_service.@O@ dbus_mgr.@O@ \
752 $(DBDRIVER_OBJS)
754 UOBJS = unix/os.@O@
755 @@ -83,6 +86,7 @@
756 zoneconf.c \
757 lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
758 lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
759 + dbus_service.c dbus_mgr.c \
760 $(DBDRIVER_SRCS)
762 MANPAGES = named.8 lwresd.8 named.conf.5
763 @@ -105,9 +109,14 @@
764 -DNS_LOCALSTATEDIR=\"${localstatedir}\" \
765 -c ${srcdir}/config.c
767 +dbus_service.o: dbus_service.c
768 + ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \
769 + ${DBUS_INCLUDES} \
770 + -c ${srcdir}/dbus_service.c
772 named@EXEEXT@: ${OBJS} ${UOBJS} ${DEPLIBS}
773 ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
774 - ${OBJS} ${UOBJS} ${LIBS}
775 + ${OBJS} ${UOBJS} ${LIBS} ${DBUSLIBS}
777 lwresd@EXEEXT@: named@EXEEXT@
778 rm -f lwresd@EXEEXT@