rpms/bind/FC-4 bind-9.3.1-fix_dbus.patch, NONE, 1.1 named-dbus.conf, NONE, 1.1 named.service, NONE, 1.1 bind.spec, 1.65, 1.66
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Mon Oct 17 23:02:18 UTC 2005
Author: jvdias
Update of /cvs/dist/rpms/bind/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv21360
Modified Files:
bind.spec
Added Files:
bind-9.3.1-fix_dbus.patch named-dbus.conf named.service
Log Message:
- fix bug 167682: bind-chroot directory permissions
- fix bug 168302: use %{__cc} for compiling dns-keygen
- fix bug 169969 and all known D-BUS support issues
- BIND D-BUS patch now enabled:
- give '-D' option to named to enable D-BUS support for NetworkManager
bind-9.3.1-fix_dbus.patch:
dbus_mgr.c | 136 +++++-
dbus_service.c | 919 +++++--------------------------------------
include/named/dbus_service.h | 86 ----
3 files changed, 248 insertions(+), 893 deletions(-)
--- NEW FILE bind-9.3.1-fix_dbus.patch ---
--- bind-9.3.1/bin/named/dbus_service.c.fix_dbus 2005-10-17 17:23:30.000000000 -0400
+++ bind-9.3.1/bin/named/dbus_service.c 2005-10-17 17:38:36.000000000 -0400
@@ -2,8 +2,8 @@
*
* D-BUS Service Utilities
*
- * Provides utilities for construction of D-BUS "Services"
- *
+ * Provides MINIMAL utilities for construction of D-BUS "Services".
+ *
* Jason Vas Dias <jvdias at redhat.com>, Red Hat Inc., 2005
*/
@@ -119,647 +119,6 @@
);
}
-static int root_comparator( const void *p1, const void *p2)
-{
- return strcmp((const char*)(((const Root*)p1)->path),
- (const char*)(((const Root*)p2)->path)
- );
-}
-
-static int mh_comparator( const void *p1, const void *p2 )
-{
- return strcmp((const char*)(((const MessageHandlerNode*)p1)->path),
- (const char*)(((const MessageHandlerNode*)p2)->path)
- );
-}
-
-static int mf_comparator( const void *p1, const void *p2 )
-{
- return ptr_key_comparator( (const void*)(((const MessageFilterNode*)p1)->mf),
- (const void*)(((const MessageFilterNode*)p2)->mf)
- );
-}
-
-static void
-unregister_function (DBusConnection *connection, void *user_data)
-{
- connection = user_data = 0L;
-}
-
-static DBusHandlerResult
-message_handler
-( DBusConnection *connection,
- DBusMessage *message,
- void *user_data
-)
-{
- Root *root = user_data;
- DBusConnectionState* cs = root->cs;
- uint32_t type =dbus_message_get_type( message ),
- serial =dbus_message_get_serial( message );
- uint8_t reply =(dbus_message_get_no_reply( message )==0);
- const char
- *path = dbus_message_get_path( message ),
- *dest = dbus_message_get_destination( message ),
- *member = dbus_message_get_member( message ),
- *interface=dbus_message_get_interface( message ),
- *sender =dbus_message_get_sender( message ),
- *signature=dbus_message_get_signature( message ),
- *if_suffix=0L,
- *obj_suffix=0L;
- char
- sub_path[1024];
- MessageHandlerNode mhn, *mhp, **mhpp;
- dbus_svc_HandlerResult r;
- int len;
- connection = connection;
- if( cs->dh != 0L ) (*(cs->dh))("message_handler : dest:%s path:%s member:%s interface:%s",
- dest, path, member, interface
- );
- if( path == 0L )
- {
- if( cs->eh != 0L ) (*(cs->eh))("message_handler: message with NULL path");
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- if(( root->if_prefix != 0L ) && (interface != 0L))
- {
- len = strlen(root->if_prefix);
- if( (strncmp(interface, root->if_prefix, len) == 0) && (interface[len] == '.'))
- if_suffix = interface + len + 1;
- }
-
- r = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- if ( strcmp(path, root->path) == 0 )
- {
- r = ( (*(root->mh))
- ( cs, type, reply, serial, dest, path, member, interface, if_suffix,
- sender, signature, message,
- 0L, 0L, 0L, root->object
- )
- );
- if( r != HANDLED_NOW )
- return r;
- }
-
- if ( root->tree == 0L )
- {
- if( cs->eh != 0L ) (*(cs->eh))("message_handler: not a prefix");
- return r;
- }
-
- len = strlen(root->path);
- if( ((int)strlen(path) < len) || (strncmp(root->path, path, len) != 0) )
- {
- if( cs->eh != 0L ) (*(cs->eh))("message_handler: can't happen?!?: path %s not prefixed by %s",
- path, root->path
- );
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- obj_suffix = (path + len + 1);
-
- if( root->tree == root )
- { /* no sub-path handlers defined yet */
- r = ( (*(root->mh))
- ( cs, type, reply, serial, dest, path, member, interface, if_suffix,
- sender, signature, message,
- root->path, obj_suffix, 0L, root->object
- )
- );
- if( r != HANDLED_NOW )
- return r;
- }
-
- if( root->tree != root )
- {
- if( ( if_suffix != 0L ) && (member != 0L) )
- {
- snprintf(sub_path, 1024, "%s.%s.%s",
- obj_suffix, if_suffix, member
- );
- }else
- if( (if_suffix == 0L) && (member != 0L))
- {
- snprintf(sub_path, 1024, "%s.%s",
- obj_suffix, member
- );
- }else
- if( member != 0L)
- {
- snprintf(sub_path, 1024, "%s.%s",
- obj_suffix, member
- );
- }else
- {
- if( cs->eh != 0L ) (*(cs->eh))("message_handler: null member for %s", path);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
- if( cs->dh != 0L ) (*(cs->dh))("message_handler: looking up sub-path %s", sub_path);
-
- mhn.path=(char*)sub_path;
- mhpp = tfind(&mhn, &(root->tree), mh_comparator);
-
- if ( (mhpp == 0L) || ((mhp=*mhpp)==0L) )
- {
- r = ( (*(root->mh))
- ( cs, type, reply, serial, dest, path, member, interface, if_suffix,
- sender, signature, message,
- root->path, obj_suffix, 0L, root->object
- )
- );
- if( r != HANDLED_NOW )
- return r;
- mhpp = tfind(&mhn, &(root->tree), mh_comparator);
- if ( (mhpp == 0L) || ((mhp=*mhpp)==0L) )
- {
- if( cs->eh != 0L ) (*(cs->eh))("message_handler: message handler not found under %s for sub-path %s", path, sub_path);
-
-
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- }
- r =( (*(mhp->mh))
- ( cs, type, reply, serial, dest, path, member, interface, if_suffix,
- sender, signature, message,
- root->path, obj_suffix, root->object, mhp->object
- )
- );
- if( r == HANDLED_NOW )
- {
- mhn.path=(char*)sub_path;
- mhpp = tfind(&mhn, &(root->tree), mh_comparator);
- if ( (mhpp == 0L) || ((mhp=*mhpp)==0L) )
- {
- if( cs->eh != 0L ) (*(cs->eh))("message_handler: message handler returned HANDLED_NOW for unhandled path %s", sub_path);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- r =
- ( (*(mhp->mh))
- ( cs, type, reply, serial, dest, path, member, interface, if_suffix,
- sender, signature, message,
- root->path, obj_suffix, root->object, mhp->object
- )
- );
- }else
- return r;
- }
-
- /* obj.if.member lookup failed */
-
- if( cs->dh != 0L ) (*(cs->dh))("message_handler: message handler not found for sub-path %s", obj_suffix);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-static DBusHandlerResult
-default_message_handler
-( DBusConnection *connection,
- DBusMessage *message,
- void *user_data
-)
-{
- DBusConnectionState* cs = user_data;
- uint32_t type =dbus_message_get_type( message ),
- serial =dbus_message_get_serial( message );
- uint8_t reply =(dbus_message_get_no_reply( message )==0);
- const char
- *path = dbus_message_get_path( message ),
- *dest = dbus_message_get_destination( message ),
- *member = dbus_message_get_member( message ),
- *interface=dbus_message_get_interface( message ),
- *sender =dbus_message_get_sender( message ),
- *signature=dbus_message_get_signature( message );
- connection = connection;
- return
- (*(cs->mh))
- ( cs, type, reply, serial, dest, path, member, interface, 0L,
- sender, signature, message,
- 0L, 0L, 0L, cs->def_mh_obj
- );
-}
-
-uint8_t
-dbus_svc_add_default_handler
-( DBusConnectionState *cs, char *object_path, dbus_svc_MessageHandler mh, void *object
-)
-{
- DBusObjectPathVTable vtable = { unregister_function, default_message_handler, NULL, 0, 0, 0 };
- cs->mh = mh;
- cs->def_mh_obj = object;
- return dbus_connection_register_fallback
- ( cs->connection,
- object_path,
- &vtable,
- cs
- );
-}
-
-uint8_t
-dbus_svc_add_path_handler
-( DBusConnectionState* cs,
- char *rootPath,
- char *ifPrefix,
- dbus_svc_MessageHandler mh,
- void *object,
- uint8_t isPrefix
-)
-{
- DBusObjectPathVTable vtable = { unregister_function, message_handler, NULL, 0, 0, 0 };
- Root *root;
- char *path, *ifp=0L;
-
- if( (rootPath == 0L) || (*rootPath == '\0') || (*rootPath != '/') )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_message_handler: invalid path %s", rootPath);
- return ( 0 );
- }
-
- root = ( Root* ) malloc( sizeof(Root) );
- path = ( char* ) malloc( strlen(rootPath) + 1 );
-
- if ( ( path == 0L ) || ( root == 0L ) )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_path_handler: out of memory");
- return(0);
- }
- if( ifPrefix != 0L )
- {
- if((ifp = (char*)malloc(strlen(ifPrefix)+1))==0L)
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_path_handler: out of memory");
- return(0);
- }
- strcpy(ifp, ifPrefix);
- }
- strcpy(path, rootPath);
- root->cs = cs;
- root->path = path;
- root->if_prefix = ifp;
- root->mh = mh;
- root->tree = isPrefix ? root : 0L;
- root->object = object;
-
- if ( ( (!isPrefix) &&
- !dbus_connection_register_object_path
- ( cs->connection,
- rootPath,
- &vtable,
- root
- )
- )
- ||( isPrefix &&
- !dbus_connection_register_fallback
- ( cs->connection,
- rootPath,
- &vtable,
- root
- )
- )
- )
- {
- if( cs->eh != 0L ) (*(cs->eh))
- ( "dbus_svc_add_message_handler failed for: %s: %s", rootPath,
- isPrefix ? "dbus_connection_register_fallback failed"
- : "dbus_connection_register_object_path failed"
- );
- return ( 0 );
- }
-
- return ( tsearch( root, &(cs->roots), root_comparator ) != 0L );
-}
-
-void free_mh( void *);
-void free_mh( void *mp )
-{
- MessageHandlerNode *mh = mp;
- free(mh->path);
- free(mh);
-}
-
-uint8_t
-dbus_svc_remove_path_handler
-(
- DBusConnectionState *cs,
- char *rootPath ,
- void **objectP
-)
-{
- Root r;
- Root *root, *const*rpp;
-
- if ( ( rootPath == 0L ) || ( *rootPath ='\0') || (*rootPath != '/'))
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_remove_path: bad root path %s", rootPath);
- return 0;
- }
-
- r.path = rootPath;
-
- rpp = tfind( &r, &(cs->roots), root_comparator );
-
- if ( (rpp = 0L) || ( (root=*rpp) == 0L ) )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_remove_path_handler: cannot remove nonexistent root node %s", rootPath);
- return 0;
- }
-
- tdelete(root, &(cs->roots), root_comparator);
-
- if ( !dbus_connection_unregister_object_path( cs->connection, rootPath ) )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_remove_path_handler:"
- "dbus_connection_unregister_object_path failed"
- );
- return ( 0 );
- }
-
- if ( ( root->tree != root ) && (root->tree != 0L) )
- tdestroy(root->tree, free_mh);
-
- if ( ( objectP != 0L ) && ( root->object != 0L ))
- *objectP = root->object;
-
- free(root->path);
- free((Root*)root);
-
- return 1;
-}
-
-static uint8_t
-add_handler
-( DBusConnectionState* cs,
- Root *root,
- char *path,
- dbus_svc_MessageHandler mh,
- void *object
-)
-{
- MessageHandlerNode *mhn = (MessageHandlerNode*) malloc ( sizeof(MessageHandlerNode) );
-
- if ( mhn == 0L )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_message_handler: out of memory");
- return ( 0 );
- }
-
- mhn->mh = mh;
-
- mhn->path = (char*) malloc (strlen(path)+1);
-
- strcpy(mhn->path,path);
-
- mhn->object = object;
-
- if( root->tree == root )
- root->tree = 0L;
- return ( tsearch( (void*)mhn , &(root->tree), mh_comparator ) != 0);
-}
-
-static Root*
-find_root
-( DBusConnectionState *cs,
- char *rootPath
-)
-{
- Root r;
- Root *root, *const*rpp;
-
- if( (rootPath == 0L) || (*rootPath=='\0') )
- return 0L;
-
- r.path=rootPath;
-
- rpp = tfind(&r, &(cs->roots), root_comparator);
-
- if ( (rpp==0L) || ((root=*rpp) == 0L ) )
- return 0L;
- return (Root*)root;
-}
-
-uint8_t
-dbus_svc_add_handler
-( DBusConnectionState *cs,
- char *rootPath,
- char *objectPath,
- dbus_svc_MessageHandler mh,
- void *object
-)
-{
- Root *root = find_root(cs, rootPath);
- int len;
-
- if( (root == 0L) || (objectPath==0L) || (*objectPath=='\0') )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_handler: bad path %s/%s", rootPath, objectPath);
- return 0;
- }
-
- len = strlen(root->path);
-
- if ( strncmp(root->path, objectPath, len) == 0 )
- {
- if ( *(objectPath + len)=='\0' )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_handler: cannot add object path %s - identical to prefix path", objectPath);
- return( 0 );
- }else
- if ( (*(objectPath + len)=='/' )
- &&(*(objectPath + len + 1) != '\0')
- &&(*(objectPath + len + 1) != '/')
- )
- {
- (*cs->eh)("dbus_svc_add_handler: invalid object path %s", (objectPath + len));
- return 0;
- }else
- if ( *(objectPath + len)!='/' )
- {
- (*cs->eh)("dbus_svc_add_handler: invalid object path %s", (objectPath + len));
- return 0;
- }
- objectPath += len + 1;
- }else
- if ( *objectPath == '/' )
- {
- if ( (*(objectPath+1) == '\0')
- ||(*(objectPath+1) == '/')
- )
- {
- (*cs->eh)("dbus_svc_add_handler: invalid object path %s", objectPath );
- return 0;
- }
- objectPath += 1;
- }else
- if ( *objectPath == '\0' )
- {
- (*cs->eh)("dbus_svc_add_handler: empty object path");
- return 0;
- }
-
- return( add_handler(cs, root, objectPath, mh, object) != 0L);
-}
-
-uint8_t
-dbus_svc_remove_handler
-( DBusConnectionState* cs ,
- char *rootPath,
- char *objectPath,
- void **objectP
-)
-{
- MessageHandlerNode mh, *mhp, **mhpp;
- Root *root = find_root(cs, rootPath);
-
- if( ( root == 0L ) || (objectPath == 0L) || (*objectPath=='\0') )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_remove_handler: unhandled path %s/%s", rootPath, objectPath);
- return( 0 );
- }
-
- mh.path = objectPath;
-
- if ( root->tree == root )
- return 0;
-
- mhpp = tfind(&mh, &(root->tree), mh_comparator);
-
- if( (mhpp != 0L) && ((mhp = *mhpp) != 0L) )
- {
- mhpp = tdelete(&mh, &(root->tree), mh_comparator);
- free(mhp->path);
- if( objectP != 0L )
- *objectP = mhp->object;
- free(mhp);
- }
-
- return (mhpp != 0L);
-}
-
-static void
-filter_current_message( const void *p, const VISIT which, const int level)
-{
- MessageFilterNode *mfp;
- MessageFilterNode *const*mfpp = p;
- int l = level ? 1 : 0;
- l=l;
-
- if( (mfpp == 0L) || ((mfp=*mfpp)==0L)
- || ((which != postorder) && (which != leaf))
- )
- return;
- if( mfp->cs->rejectMessage )
- return;
-
- DBusMessage *message = mfp->cs->currentMessage;
- uint32_t type =dbus_message_get_type( message ),
- serial =dbus_message_get_serial( message );
- uint8_t reply =dbus_message_get_no_reply( message )==0;
- const char
- *path = dbus_message_get_path( message ),
- *dest = dbus_message_get_destination( message ),
- *member = dbus_message_get_member( message ),
- *interface=dbus_message_get_interface( message ),
- *sender =dbus_message_get_sender( message ),
- *signature=dbus_message_get_signature( message );
- char
- *if_suffix=0L;
- mfp->cs->rejectMessage =
- ( (*(mfp->mf))
- ( mfp->cs, type, reply, serial, dest, path, member, interface, if_suffix,
- sender, signature, message, 0L, 0L, 0L, mfp->obj
- ) == HANDLED
- );
-}
-
-static DBusHandlerResult
-message_filter (DBusConnection *connection,
- DBusMessage *message,
- void *p
- )
-{
- DBusConnectionState *cs = p;
- connection=connection;
-
- cs->currentMessage = message;
- cs->rejectMessage = 0;
-
- twalk( cs->filters, filter_current_message);
-
- cs->currentMessage=0L;
- if( cs->rejectMessage )
- {
- cs->rejectMessage = 0;
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-uint8_t
-dbus_svc_add_message_filter
-( DBusConnectionState *cs, dbus_svc_MessageHandler mf, void *obj, int n_matches, ... )
-{
- MessageFilterNode *mfn;
- char **mp,*m;
- DBusError error;
- va_list va;
-
- va_start(va, n_matches );
-
- if ( ! dbus_connection_add_filter (cs->connection, message_filter, cs, NULL))
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_message_filter: dbus_connection_add_filter failed");
- va_end(va);
- return( 0 );
- }
- mfn = (MessageFilterNode *) malloc( sizeof( MessageFilterNode ) );
- if( mfn == 0L )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_message_filter: out of memory");
- va_end(va);
- return( 0 );
- }
- mfn->mf = mf;
- mfn->cs = cs;
- mfn->obj = obj;
- mfn->n_matches = n_matches;
- mfn->matches = 0L;
- if( n_matches )
- {
- memset(&error,'\0',sizeof(DBusError));
- dbus_error_init(&error);
- if((mp = mfn->matches = (char**)calloc(n_matches + 1, sizeof(char*)))==0L)
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_message_filter: out of memory");
- va_end(va);
- return( 0 );
- }
- while( n_matches-- )
- {
- m = va_arg(va, char* ) ;
- if( (*mp = (char*)malloc(strlen(m)+1)) == 0L )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_message_filter: out of memory");
- va_end(va);
- return(0);
- }
- strcpy(*mp, m);
- dbus_bus_add_match(cs->connection, *mp, &error);
- if( dbus_error_is_set(&error))
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_add_message_filter: dbus_bus_add_match failed for %s: %s %s",
- *mp, error.name, error.message
- );
- va_end(va);
- return(0);
- }
- mp++;
- }
- }
- va_end(va);
- return (tsearch(mfn, &(cs->filters), mf_comparator) != 0L);
-}
-
-
static DBusHandlerResult
default_message_filter
( DBusConnection *connection,
@@ -830,78 +189,6 @@
return( 1 );
}
-uint8_t
-dbus_svc_remove_message_filter( DBusConnectionState *cs, dbus_svc_MessageHandler mf )
-{
- MessageFilterNode **mfpp = tfind( mf, &(cs->filters), ptr_key_comparator), *mfp;
- DBusError error;
- int i;
-
- if( (mfpp != 0L) && ((mfp=*mfpp) !=0L) )
- {
- mfpp = tdelete(mfp->mf,&(cs->filters),mf_comparator);
- if(mfp->n_matches)
- {
- memset(&error,'\0',sizeof(DBusError));
- dbus_error_init(&error);
- for( i=0; i < mfp->n_matches; i++)
- {
- dbus_bus_remove_match(cs->connection, mfp->matches[i], &error);
- if( dbus_error_is_set(&error) )
- {
- if( cs->eh != 0L ) (*(cs->eh))("dbus_svc_remove_message_filter: remove match failed: %s %s",
- error.name, error.message
- );
- } /*XXX fixme: what if other handlers still want to match this match exp.?*/
- }
- free(mfp->matches);
- }
- free(mfp);
- }
- if( (mfpp != 0L) && (cs->filters == 0L) )
- dbus_connection_remove_filter (cs->connection, message_filter, cs);
- return (mfpp != 0);
-}
-
-
-static DBusHandlerResult
-shutdown_filter
-( DBusConnection *connection,
- DBusMessage *message,
- void *p
-)
-{
- DBusConnectionState *cs = p;
- uint32_t type =dbus_message_get_type( message );
- const char
- *path = dbus_message_get_path( message ),
- *member = dbus_message_get_member( message );
- connection=connection;
-
- if ( ( type == SIGNAL )
- &&( strcmp(path,"/org/freedesktop/DBus/Local") == 0 )
- &&( strcmp(member,"Disconnected") == 0 )
- )
- {
- if(cs->eh) (*(cs->eh))("D-BUS Shutdown");
- if( cs->sh )
- (*(cs->sh))(cs, cs->sh_obj);
- return DBUS_HANDLER_RESULT_HANDLED;
- }
- if(cs->eh) (*(cs->eh))("D-BUS message not filtered %s %s", path, member);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
-}
-
-uint8_t
-dbus_svc_add_shutdown_filter
-(
- DBusConnectionState *cs, dbus_svc_ShutdownHandler sh, void *obj
-)
-{
- cs->sh = sh;
- cs->sh_obj = obj;
- return dbus_connection_add_filter( cs->connection, shutdown_filter, cs, NULL );
-}
uint8_t
dbus_svc_get_args_va(DBusConnectionState *cs, DBusMessage* msg, dbus_svc_DataType firstType, va_list va)
@@ -1479,6 +766,8 @@
FD_CLR(fd , &(cs->r_fds));
FD_CLR(fd , &(cs->w_fds));
FD_CLR(fd , &(cs->e_fds));
+ if( cs->wh != 0L )
+ (*(cs->wh))(dbus_watch_get_fd(watch), WATCH_READ | WATCH_WRITE | WATCH_ERROR, cs->wh_arg );
}
static void
@@ -1556,6 +845,63 @@
cs->dispatchStatus = new_status;
}
+void
+dbus_svc_main_loop( DBusConnectionState *cs, void (*idle_handler)(DBusConnectionState *) )
+{
+ struct timeval timeout={0,200000};
+ int n_fds;
+
+ while( cs->status != SHUTDOWN )
+ {
+ cs->s_r_fds = cs->r_fds;
+ cs->s_w_fds = cs->w_fds;
+ cs->s_e_fds = cs->e_fds;
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec= 200000;
+
+ if ( (n_fds = select(cs->n, &(cs->s_r_fds), &(cs->s_w_fds), &(cs->s_e_fds), &timeout)) < 0 )
+ {
+ if (errno != EINTR)
+ {
+ if( cs->eh != 0L ) (*(cs->eh))( "select failed: %d : %s", errno, strerror(errno));
+ return;
+ }
+ }
+
+ if( n_fds > 0 )
+ process_watches(cs);
+
+ process_timeouts(cs);
+
+ if ( cs->dispatchStatus != DBUS_DISPATCH_COMPLETE )
+ dbus_connection_dispatch( cs->connection );
+
+ if( idle_handler != 0L )
+ (*idle_handler)(cs);
+ }
+}
+
+void dbus_svc_dispatch(DBusConnectionState *cs)
+{
+ process_watches(cs);
+
+ FD_ZERO(&(cs->s_r_fds));
+ FD_ZERO(&(cs->s_w_fds));
+ FD_ZERO(&(cs->s_e_fds));
+
+ process_timeouts(cs);
+
+ while ( cs->dispatchStatus != DBUS_DISPATCH_COMPLETE )
+ dbus_connection_dispatch( cs->connection );
+}
+
+void
+dbus_svc_quit( DBusConnectionState *cs )
+{
+ cs->status = SHUTDOWN;
+}
+
static DBusConnectionState *
connection_setup
( DBusConnection *connection,
@@ -1628,63 +974,6 @@
return 0L;
}
-void
-dbus_svc_main_loop( DBusConnectionState *cs, void (*idle_handler)(DBusConnectionState *) )
-{
- struct timeval timeout={0,200000};
- int n_fds;
-
- while( cs->status != SHUTDOWN )
- {
- cs->s_r_fds = cs->r_fds;
- cs->s_w_fds = cs->w_fds;
- cs->s_e_fds = cs->e_fds;
-
- timeout.tv_sec = 0;
- timeout.tv_usec= 200000;
-
- if ( (n_fds = select(cs->n, &(cs->s_r_fds), &(cs->s_w_fds), &(cs->s_e_fds), &timeout)) < 0 )
- {
- if (errno != EINTR)
- {
- if( cs->eh != 0L ) (*(cs->eh))( "select failed: %d : %s", errno, strerror(errno));
- return;
- }
- }
-
- if( n_fds > 0 )
- process_watches(cs);
-
- process_timeouts(cs);
-
- if ( cs->dispatchStatus != DBUS_DISPATCH_COMPLETE )
- dbus_connection_dispatch( cs->connection );
-
- if( idle_handler != 0L )
- (*idle_handler)(cs);
- }
-}
-
-void dbus_svc_dispatch(DBusConnectionState *cs)
-{
- process_watches(cs);
-
- FD_ZERO(&(cs->s_r_fds));
- FD_ZERO(&(cs->s_w_fds));
- FD_ZERO(&(cs->s_e_fds));
-
- process_timeouts(cs);
-
- while ( cs->dispatchStatus != DBUS_DISPATCH_COMPLETE )
- dbus_connection_dispatch( cs->connection );
-}
-
-void
-dbus_svc_quit( DBusConnectionState *cs )
-{
- cs->status = SHUTDOWN;
-}
-
DBusConnectionState *
dbus_svc_init
(
@@ -1699,17 +988,72 @@
DBusConnection *connection;
DBusError error;
DBusConnectionState *cs;
-
+ char *session_bus_address=0L;
+
memset(&error,'\0',sizeof(DBusError));
dbus_error_init(&error);
- if ( (connection = dbus_bus_get (bus, &error)) == 0L )
+ switch( bus )
{
- if(eh)(*eh)("dbus_svc_init failed: %s %s",error.name, error.message);
+ /* DBUS_PRIVATE_* bus types are the only type which allow reconnection if the dbus-daemon is restarted
+ */
+ case DBUS_PRIVATE_SYSTEM:
+
+ if ( (connection = dbus_connection_open_private("unix:path=/var/run/dbus/system_bus_socket", &error)) == 0L )
+ {
+ if(eh)(*eh)("dbus_svc_init failed: %s %s",error.name, error.message);
+ return ( 0L );
+ }
+
+ if ( ! dbus_bus_register(connection,&error) )
+ {
+ if(eh)(*eh)("dbus_bus_register failed: %s %s", error.name, error.message);
+ dbus_connection_disconnect(connection);
+ free(connection);
+ return ( 0L );
+ }
+ break;
+
+ case DBUS_PRIVATE_SESSION:
+
+ session_bus_address = getenv("DBUS_SESSION_BUS_ADDRESS");
+ if ( session_bus_address == 0L )
+ {
+ if(eh)(*eh)("dbus_svc_init failed: DBUS_SESSION_BUS_ADDRESS environment variable not set");
+ return ( 0L );
+ }
+
+ if ( (connection = dbus_connection_open_private(session_bus_address, &error)) == 0L )
+ {
+ if(eh)(*eh)("dbus_svc_init failed: %s %s",error.name, error.message);
+ return ( 0L );
+ }
+
+ if ( ! dbus_bus_register(connection,&error) )
+ {
+ if(eh)(*eh)("dbus_bus_register failed: %s %s", error.name, error.message);
+ dbus_connection_disconnect(connection);
+ free(connection);
+ return ( 0L );
+ }
+ break;
+
+ case DBUS_SYSTEM:
+ case DBUS_SESSION:
+
+ if ( (connection = dbus_bus_get (bus, &error)) == 0L )
+ {
+ if(eh)(*eh)("dbus_svc_init failed: %s %s",error.name, error.message);
+ return ( 0L );
+ }
+ break;
+
+ default:
+ if(eh)(*eh)("dbus_svc_init failed: unknown bus type %d", bus);
return ( 0L );
}
-
+
dbus_connection_set_exit_on_disconnect(connection, FALSE);
if ( (cs = connection_setup(connection, wh, eh, dh, wh_arg)) == 0L )
@@ -1720,7 +1064,7 @@
if( name == 0L )
return( cs );
-
+
cs->unique_name = dbus_bus_get_unique_name(connection);
switch
@@ -1740,12 +1084,18 @@
if(eh)(*eh)("dbus_svc_init: dbus_bus_request_name failed: %s %s", error.name, error.message);
goto give_up;
}
-
return ( cs );
give_up:
dbus_connection_disconnect( connection );
dbus_connection_unref( connection );
+ if( cs )
+ {
+ dbus_connection_set_dispatch_status_function (connection, NULL, NULL, NULL);
+ dbus_connection_set_watch_functions (connection, NULL, NULL, NULL, NULL, NULL);
+ dbus_connection_set_timeout_functions (connection, NULL, NULL, NULL, NULL, NULL);
+ free(cs);
+ }
return ( 0L );
}
@@ -1754,16 +1104,6 @@
return cs->unique_name;
}
-static
-void free_root( void *rp )
-{
- Root *root = rp;
- if( root->tree != root )
- tdestroy(root->tree, free_mh);
- free(root->path);
- free(root);
-}
-
void
dbus_svc_shutdown ( DBusConnectionState *cs )
{
@@ -1789,11 +1129,8 @@
cs->timeouts=0L;
tdestroy( cs->watches, no_free);
cs->watches=0L;
- tdestroy( cs->roots, free_root);
- cs->roots=0L;
dbus_connection_disconnect( cs->connection );
-
dbus_connection_unref( cs->connection );
free( cs );
--- bind-9.3.1/bin/named/dbus_mgr.c.fix_dbus 2005-10-17 17:23:30.000000000 -0400
+++ bind-9.3.1/bin/named/dbus_mgr.c 2005-10-17 17:23:31.000000000 -0400
@@ -194,6 +194,21 @@
return 0;
}
+static
+int dbus_mgr_log_info( const char *fmt, ...)
+{
+ va_list va;
+ va_start(va, fmt);
+ isc_log_vwrite(ns_g_lctx,
+ NS_LOGCATEGORY_DBUS,
+ NS_LOGMODULE_DBUS,
+ ISC_LOG_DEBUG(1),
+ fmt, va
+ );
+ va_end(va);
+ return 0;
+}
+
isc_result_t
dbus_mgr_create
( isc_mem_t *mctx,
@@ -258,6 +273,7 @@
if( mgr->sockets != 0L )
{
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
twalk(mgr->sockets, dbus_mgr_close_socket);
tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
mgr->sockets = 0L;
@@ -271,7 +287,7 @@
mgr->dbus =
dbus_svc_init
- ( DBUS_SYSTEM,
+ ( DBUS_PRIVATE_SYSTEM,
destination,
dbus_mgr_watch_handler,
0L, 0L,
@@ -282,7 +298,13 @@
{
if( mgr->timer == 0L)
{
- dbus_mgr_log_err("D-BUS service disabled.");
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
+ if( mgr->sockets != 0L )
+ {
+ twalk(mgr->sockets, dbus_mgr_close_socket);
+ tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
+ mgr->sockets = 0L;
+ }
dbus_mgr_dbus_shutdown_handler ( mgr );
return ISC_R_SUCCESS;
}
@@ -310,8 +332,6 @@
);
}
- dbus_svc_dispatch(mgr->dbus);
-
if( !dbus_mgr_subscribe_to_dhcdbd( mgr ) )
dbus_mgr_log_err("D-BUS dhcdbd subscription disabled.");
@@ -319,7 +339,7 @@
return ISC_R_SUCCESS;
cleanup:
-
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
twalk(mgr->sockets, dbus_mgr_close_socket);
tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
mgr->sockets = 0L;
@@ -404,8 +424,13 @@
isc_timer_detach(&(mgr->timer));
if( mgr->dbus != 0L )
{
- twalk(mgr->sockets, dbus_mgr_close_socket);
- tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
+ if( mgr->sockets != 0L )
+ {
+ twalk(mgr->sockets, dbus_mgr_close_socket);
+ tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
+ mgr->sockets = 0L;
+ }
dbus_svc_shutdown(mgr->dbus);
}
if( mgr->dhc_if != 0L )
@@ -423,6 +448,7 @@
ns_dbus_mgr_t *mgr = (ns_dbus_mgr_t*)(ev->ev_arg) ;
t=t;
isc_event_free(&ev);
+ dbus_mgr_log_dbg("attempting to connect to D-BUS");
dbus_mgr_init_dbus( mgr );
}
@@ -441,9 +467,13 @@
if ( dbus != 0L )
{
- twalk(mgr->sockets, dbus_mgr_close_socket);
- tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
- mgr->sockets = 0L;
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
+ if( mgr->sockets != 0L )
+ {
+ twalk(mgr->sockets, dbus_mgr_close_socket);
+ tdestroy(mgr->sockets, dbus_mgr_destroy_socket);
+ mgr->sockets = 0L;
+ }
dbus_svc_shutdown(dbus);
}
@@ -484,8 +514,10 @@
sizeof(isc_event_t)
);
if( dbus_shutdown_event != 0L )
+ {
+ isc_task_purgerange(mgr->task, 0L, ISC_SOCKEVENT_READ_READY, ISC_SOCKEVENT_SELECTED, 0L);
isc_task_send( mgr->task, &dbus_shutdown_event );
- else
+ }else
dbus_mgr_log_err("unable to allocate dbus shutdown event");
}
@@ -541,6 +573,15 @@
return 0L;
}
+static
+dns_fwdtable_t *dbus_mgr_get_view_and_fwdtable( dns_view_t **viewp )
+{
+ *viewp = dbus_mgr_get_localhost_view();
+ if( *viewp != 0L )
+ return (*viewp)->fwdtable;
+ return 0L;
+}
+
static int dbus_mgr_ifwdr_comparator( const void *p1, const void *p2 )
{
char n1buf[ DNS_NAME_FORMATSIZE ]="", *n1p=&(n1buf[0]),
@@ -629,6 +670,23 @@
mgr->ifwdt = 0L;
}
+static void
+dbus_mgr_log_forwarders( const char *pfx, dns_name_t *name, SockAddrList *saList)
+{
+ isc_sockaddr_t *sa;
+ char nameP[DNS_NAME_FORMATSIZE], addrP[128];
+ int s=0;
+ dns_name_format(name, nameP, DNS_NAME_FORMATSIZE );
+ for( sa = ISC_LIST_HEAD(*saList);
+ sa != 0L;
+ sa = ISC_LIST_NEXT(sa,link)
+ )
+ {
+ isc_sockaddr_format(sa, addrP, 128);
+ dbus_mgr_log_info("%s zone %s server %d: %s", pfx, nameP, s++, addrP);
+ }
+}
+
static
isc_result_t dbus_mgr_set_forwarders
(
@@ -640,12 +698,12 @@
{
isc_result_t result = ISC_R_SUCCESS;
dns_fwdtable_t *fwdtable;
- dns_view_t *view;
+ dns_view_t *view=0L;
dns_name_t *dnsName;
isc_sockaddr_t *sa, *nsa;
dns_forwarders_t *fwdr=0L;
-
- fwdtable = dbus_mgr_get_fwdtable();
+
+ fwdtable = dbus_mgr_get_view_and_fwdtable(&view);
if( fwdtable == 0L )
{
@@ -667,8 +725,12 @@
if( result != ISC_R_SUCCESS )
return result;
+
if( view->fwdtable == 0L )
return ISC_R_NOMEMORY;
+
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_info("Created forwarder table.");
}
}
@@ -695,11 +757,16 @@
fwdpolicy
) ;
+ if( view != 0L )
+ dns_view_flushcache( view );
+
isc_task_endexclusive(mgr->task);
if( result != ISC_R_SUCCESS )
return result;
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_forwarders("Created forwarder",dnsName, saList);
}
continue;
}
@@ -707,15 +774,21 @@
if( ISC_LIST_HEAD( *saList ) == 0L )
{ /* empty forwarders list - delete forwarder entry */
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_forwarders("Deleting forwarder", dnsName, (SockAddrList*)&(fwdr->addrs));
+
result = isc_task_beginexclusive(mgr->task);
if( result == ISC_R_SUCCESS )
{
result = dns_fwdtable_delete( fwdtable, dnsName );
+ if( view != 0L )
+ dns_view_flushcache( view );
+
isc_task_endexclusive(mgr->task);
if( result != ISC_R_SUCCESS )
- return result;
+ return result;
}
continue;
}
@@ -725,6 +798,9 @@
if( result == ISC_R_SUCCESS )
{
fwdr->fwdpolicy = fwdpolicy;
+
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_forwarders("Removing forwarder", dnsName, (SockAddrList*)&(fwdr->addrs));
for( sa = ISC_LIST_HEAD(fwdr->addrs);
sa != 0L ;
@@ -753,9 +829,15 @@
ISC_LINK_INIT( nsa, link );
ISC_LIST_APPEND( fwdr->addrs, nsa, link );
}
-
+
+ if( view != 0L )
+ dns_view_flushcache( view );
+
isc_task_endexclusive(mgr->task);
+ if( isc_log_getdebuglevel(ns_g_lctx) >= 1 )
+ dbus_mgr_log_forwarders("Added forwarder", dnsName, (SockAddrList*)&(fwdr->addrs));
+
}else
return result;
@@ -1061,7 +1143,7 @@
isc_sockaddr_t *nsSA;
isc_result_t result;
uint8_t fwdpolicy = dns_fwdpolicy_only;
-
+
iter = dbus_svc_message_iterator_new( dbus, msg );
if( iter == 0L )
@@ -1477,7 +1559,8 @@
sprintf(error_message,"out of memory");
dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
- );
+ );
+ return;
}
fwdtable = dbus_mgr_get_fwdtable();
@@ -1508,6 +1591,7 @@
dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
);
+ return;
}
}else
@@ -1521,11 +1605,12 @@
) ;
}else
{
+ sprintf(error_name,"com.redhat.dbus.NotFound");
sprintf(error_message,"Not Found");
- dbus_svc_message_append_args( dbus, msg,
- TYPE_STRING, error_message,
- TYPE_INVALID
- ) ;
+ dbus_svc_send( dbus, ERROR, serial, &new_serial, sender, path, interface, member,
+ TYPE_STRING, error_name, TYPE_STRING, error_message, TYPE_INVALID
+ );
+ return;
}
}
dbus_svc_send_message( dbus, msg, &new_serial );
@@ -2193,8 +2278,6 @@
return;
}
- sfd->ser->ev_attributes |= ISC_EVENTATTR_NOPURGE;
-
sev = isc_socket_fd_handle_reads(sfd->sock, sfd->ser );
}else
@@ -2222,7 +2305,6 @@
isc_mem_put(mgr->mctx, sfd, sizeof(DBusMgrSocket));
return;
}
- sfd->sew->ev_attributes |= ISC_EVENTATTR_NOPURGE;
sev = isc_socket_fd_handle_writes(sfd->sock, sfd->sew );
@@ -2251,7 +2333,6 @@
isc_mem_put(mgr->mctx, sfd, sizeof(DBusMgrSocket));
return;
}
- sfd->sel->ev_attributes |= ISC_EVENTATTR_NOPURGE;
sev = isc_socket_fd_handle_selected(sfd->sock, sfd->sel );
@@ -2262,6 +2343,7 @@
}
}else
{
+ dbus_mgr_log_dbg("watch %d disabled",fd);
if(flags & WATCH_READ)
{
sev = isc_socket_fd_handle_reads( sfd->sock, 0L );
@@ -2296,7 +2378,7 @@
tdelete(sfd, &(mgr->sockets), dbus_mgr_socket_comparator);
- isc_mem_put(mgr->mctx, sfd, sizeof(sfd));
+ isc_mem_put(mgr->mctx, sfd, sizeof(DBusMgrSocket));
}
}
}
--- bind-9.3.1/bin/named/include/named/dbus_service.h.fix_dbus 2005-10-17 17:23:30.000000000 -0400
+++ bind-9.3.1/bin/named/include/named/dbus_service.h 2005-10-17 17:23:31.000000000 -0400
@@ -25,7 +25,9 @@
{
DBUS_SESSION,
DBUS_SYSTEM,
- DBUS_STARTER
+ DBUS_STARTER,
+ DBUS_PRIVATE_SYSTEM,
+ DBUS_PRIVATE_SESSION
} dbus_svc_DBUS_TYPE;
typedef enum /* D-BUS Protocol Type Codes / Signature Chars */
@@ -131,6 +133,14 @@
* call dbus_svc_dispatch when all watches have been handled.
*/
+
+uint8_t
+dbus_svc_add_filter
+( DBUS_SVC, dbus_svc_MessageHandler mh, void *obj, int n_matches, ... );
+/*
+ * Registers SINGLE message handler to handle ALL messages, adding match rules
+ */
+
void dbus_svc_main_loop( DBUS_SVC, void (*idle_handler)(DBUS_SVC) );
void dbus_svc_handle_watch( DBUS_SVC, int watch_fd, dbus_svc_WatchFlags action);
@@ -159,59 +169,6 @@
*/
uint8_t
-dbus_svc_add_path_handler
-( DBUS_SVC, char *rootPath, char *ifPrefix, dbus_svc_MessageHandler mh, void *object, uint8_t isPrefix
-);
-/*
- * Registers message handler with D-BUS to handle all messages sent
- * to rootPath root Object Path.
- * If isPrefix > 1, this path may prefix other handled paths; ie.
- * a "Fallback" handler is registered, and when a message is sent
- * to a path prefixed by the rootPath, if no sub-path handler has been
- * registered with "dbus_svc_add_handler", the message-handler is called
- * with "prefix" non-null, and "path" set to the suffix (sub-path); otherwise
- * the sub-path handler is called.
- * Cannot be used in conjunction with dbus_svc_add_default_handler .
- */
-
-uint8_t
-dbus_svc_add_default_handler
-( DBUS_SVC, char *object_path, dbus_svc_MessageHandler mh, void *object
-);
-/* Registers the single default Fallback handler to handle all messages.
- * Cannot be used in conjunction with dbus_svc_add_path_handler / dbus_svc_add_handler.
- */
-
-uint8_t
-dbus_svc_add_handler( DBUS_SVC, char *rootPath, char *objectPath, dbus_svc_MessageHandler mh, void *object );
-/*
- * Registers with the 'dbus_svc' module a sub-path handler for objectPath prefixed by
- * an existing rootPath registered with dbus_svc_add_path_handler. The registered
- * handler will be called with "path" set to the complete path, "prefix" set to the
- * prefix portion, "suffix" set to the suffix, "object" set to the this registered
- * object pointer, and "prefixObject" set to the object registered for the prefix path.
- */
-
-uint8_t
-dbus_svc_remove_path_handler
-( DBUS_SVC,
- char *rootPath ,
- void **objectP
-);
-/* Removes the root Object Path handler and unregisters it with D-BUS.
- * All sub-path handlers for this path are also removed.
- * If objectP is non-null, the address of the object stored with dbus_svc_add_path_handler
- * will be stored in it.
- */
-
-uint8_t
-dbus_svc_remove_handler
-( DBUS_SVC, char *rootPath, char *objectPath, void **objectP );
-/* Removes sub-path handler for objectPath under rootPath
- * and returns stored object in *objectP if not null.
- */
-
-uint8_t
dbus_svc_get_args( DBUS_SVC, dbus_svc_MessageHandle, dbus_svc_DataType, ... );
/* get arguments from message */
@@ -219,27 +176,6 @@
dbus_svc_get_args_va( DBUS_SVC, dbus_svc_MessageHandle, dbus_svc_DataType, va_list );
/* get arguments from message */
-uint8_t
-dbus_svc_remove_message_handler
-( DBUS_SVC, char *objectPath );
-/* Unregisters the message handler */
-
-uint8_t
-dbus_svc_add_message_filter
-( DBUS_SVC, dbus_svc_MessageHandler mh, void *obj, int n_matches, ... );
-/*
- * Registers message handler to FILTER all messages sent to objectPath
- * before they are Handled.
- * If n_matches is > 0, then the variable argument list can contain n_matches
- * "const char*"s that are "match expressions" to pass to dbus_bus_add_match()
- */
-
-uint8_t
-dbus_svc_add_filter
-( DBUS_SVC, dbus_svc_MessageHandler mh, void *obj, int n_matches, ... );
-/*
- * Registers SINGLE message handler to handle ALL messages, adding match rules
- */
typedef void (*dbus_svc_ShutdownHandler) ( DBUS_SVC, void * );
uint8_t
--- NEW FILE named-dbus.conf ---
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<servicedir>/usr/share/dbus-1/services</servicedir>
<policy user="named">
<allow own="com.redhat.named"/>
<allow send_interface="com.redhat.named"/>
<allow send_destination="com.redhat.named"/>
</policy>
<policy user="root">
<allow send_interface="com.redhat.named"/>
<allow send_destination="com.redhat.named"/>
</policy>
<policy context="default">
<deny own="com.redhat.named"/>
<deny send_destination="com.redhat.named"/>
<deny send_interface="com.redhat.named"/>
</policy>
</busconfig>
--- NEW FILE named.service ---
[D-BUS Service]
Name=com.redhat.named
Exec=/usr/sbin/named
Index: bind.spec
===================================================================
RCS file: /cvs/dist/rpms/bind/FC-4/bind.spec,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- bind.spec 22 Aug 2005 20:25:52 -0000 1.65
+++ bind.spec 17 Oct 2005 23:01:59 -0000 1.66
@@ -1,15 +1,15 @@
%define posix_threads 0
%{?!SDB: %define SDB 1}
%{?!LIBBIND:%define LIBBIND 1}
+%{?!WITH_DBUS: %define WITH_DBUS 1} # + dynamic forwarder table management with D-BUS
%{?!efence: %define efence 0}
%{?!test: %define test 0}
-%{?!WITH_DBUS: %define WITH_DBUS 0} # + dynamic forwarder table management with D-BUS
# Usage: export RPM='/usr/bin/rpmbuild --define "test 1"'; make $arch;
Summary: The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server.
Name: bind
License: BSD-like
Version: 9.3.1
-Release: 10_FC4
+Release: 12_FC4
Epoch: 24
Url: http://www.isc.org/products/BIND/
Buildroot: %{_tmppath}/%{name}-root
@@ -26,6 +26,8 @@
Source7: bind-9.3.1rc1-sdb_tools-Makefile.in
Source8: dnszone.schema
Source9: libbind-man.tar.gz
+Source10: named-dbus.conf
+Source11: named.service
# http://www.venaas.no/ldap/bind-sdb/dnszone-schema.txt
Patch: bind-9.2.0rc3-varrun.patch
Patch1: bind-9.2.1-key.patch
@@ -52,6 +54,7 @@
Patch22: bind-9.3.1-sdb_dbus.patch
Patch23: bind-9.3.1-dbus_archdep_libdir.patch
Patch24: bind-9.3.1-t_no_default_lookups.patch
+Patch25: bind-9.3.1-fix_dbus.patch
Requires(pre,preun): shadow-utils
Requires(post,preun): chkconfig
Requires(post): textutils, fileutils, sed, grep
@@ -219,6 +222,7 @@
%patch23 -p1 -b .dbus_archdep_libdir
%endif
%patch24 -p1 -b .-t_no_default_lookups
+%patch25 -p1 -b .fix_dbus
%build
libtoolize --copy --force; aclocal; autoconf
@@ -254,7 +258,7 @@
--with-pic \
--with-openssl=/usr
%endif
-make
+make %{?_smp_mflags}
if [ $? -ne 0 ]; then
exit $?;
fi;
@@ -292,7 +296,7 @@
secret "@KEY@";
};
__EOF
-gcc $RPM_OPT_FLAGS -o $RPM_BUILD_ROOT/usr/sbin/dns-keygen %{SOURCE4}
+%{__cc} $RPM_OPT_FLAGS -o $RPM_BUILD_ROOT/usr/sbin/dns-keygen %{SOURCE4}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
cp %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/named
#mv $RPM_BUILD_ROOT/usr/share/man/man8/named.conf.* $RPM_BUILD_ROOT/usr/share/man/man5
@@ -303,6 +307,12 @@
%if %{LIBBIND}
gunzip < %{SOURCE9} | (cd $RPM_BUILD_ROOT/usr/share; tar -xpf -)
%endif
+%if %{WITH_DBUS}
+mkdir -p $RPM_BUILD_ROOT/etc/dbus-1/system.d
+mkdir -p $RPM_BUILD_ROOT/usr/share/dbus-1/services
+cp -fp %{SOURCE10} $RPM_BUILD_ROOT/etc/dbus-1/system.d/named.conf
+cp -fp %{SOURCE11} $RPM_BUILD_ROOT/usr/share/dbus-1/services/named.service
+%endif
%if %{test}
if [ "`whoami`" = 'root' ]; then
set -e
@@ -326,6 +336,12 @@
fi
:;
%endif
+# Files required to run test-suite outside of build tree:
+cp -fp config.h $RPM_BUILD_ROOT/%{_includedir}/bind9
+cp -fp lib/dns/include/dns/forward.h $RPM_BUILD_ROOT/%{_includedir}/dns
+cp -fp lib/isc/unix/include/isc/keyboard.h $RPM_BUILD_ROOT/%{_includedir}/isc
+cp -fp lib/isc/include/isc/hash.h $RPM_BUILD_ROOT/%{_includedir}/isc
+:;
%pre
/usr/sbin/groupadd -g 25 named >/dev/null 2>&1 || :;
@@ -385,11 +401,15 @@
/sbin/ldconfig
:;
-%triggerpostun -n bind -- bind <= 22:9.3.0-2
+%triggerpostun -n bind -- bind <= 24:9.3.1-11
if [ "$1" -gt 0 ]; then
# These versions of bind installed named service at order 55 in
# runlevel startup order, after programs like nis / ntp / nfs
# which may need its services if using no nameservers in resolv.conf.
+# bind <= 24:9.3.1-11:
+# These versions ran bind with order 11 in runlevel 2, after syslog
+# at order 12 . BIND should run after syslog and now has order '- 13 87'.
+#
rl=()
for l in 0 1 2 3 4 5 6;
do
@@ -429,6 +449,8 @@
%doc doc/arm doc/misc
%if %{WITH_DBUS}
%doc doc/README.DBUS
+%attr(644,root,root) %config /etc/dbus-1/system.d/named.conf
+%attr(644,root,root) %config /usr/share/dbus-1/services/named.service
%endif
%config(noreplace) /etc/logrotate.d/named
%attr(754,root,root) %config /etc/rc.d/init.d/named
@@ -512,10 +534,10 @@
%files chroot
%defattr(-,root,root)
-%attr(770,root,named) %dir %prefix
-%attr(770,root,named) %dir %prefix/dev
-%attr(770,root,named) %dir %prefix/etc
-%attr(770,root,named) %dir %prefix/var
+%attr(750,root,named) %dir %prefix
+%attr(750,root,named) %dir %prefix/dev
+%attr(750,root,named) %dir %prefix/etc
+%attr(750,root,named) %dir %prefix/var
%attr(770,root,named) %dir %prefix/var/run
%attr(770,named,named) %dir %prefix/var/tmp
%attr(770,named,named) %dir %prefix/var/run/named
@@ -692,6 +714,13 @@
:;
%changelog
+* Mon Oct 17 2005 Jason Vas Dias <jvdias at redhat.com> - 24:9.3.1-12
+- fix bug 167682: bind-chroot directory permissions
+- fix bug 168302: use %{__cc} for compiling dns-keygen
+- fix bug 169969 and all known D-BUS support issues
+- BIND D-BUS patch now enabled:
+ - give '-D' option to named to enable D-BUS support for NetworkManager
+
* Mon Aug 22 2005 Jason Vas Dias <jvdias at redhat.com> - 24:9.3.1-11
- fix bug 166227: host: don't do default AAAA and MX lookups with '-t a' option
More information about the fedora-cvs-commits
mailing list