windbus-svn Mailing List for winDBus (Page 3)
Brought to you by:
syntheticpp
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(16) |
Aug
(159) |
Sep
(139) |
Oct
(22) |
Nov
(128) |
Dec
(35) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(12) |
Feb
(22) |
Mar
(38) |
Apr
(1) |
May
(10) |
Jun
(53) |
Jul
(71) |
Aug
(19) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2008 |
Jan
|
Feb
(1) |
Mar
(10) |
Apr
(7) |
May
(9) |
Jun
|
Jul
(5) |
Aug
(5) |
Sep
|
Oct
(8) |
Nov
|
Dec
|
2009 |
Jan
(6) |
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(3) |
Dec
|
2010 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <che...@us...> - 2008-04-05 14:58:16
|
Revision: 777 http://windbus.svn.sourceforge.net/windbus/?rev=777&view=rev Author: chehrlic Date: 2008-04-05 07:58:11 -0700 (Sat, 05 Apr 2008) Log Message: ----------- tag for 1.1.2 Added Paths: ----------- tags/1.1.2/ Copied: tags/1.1.2 (from rev 776, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-04-05 14:57:29
|
Revision: 776 http://windbus.svn.sourceforge.net/windbus/?rev=776&view=rev Author: chehrlic Date: 2008-04-05 07:57:26 -0700 (Sat, 05 Apr 2008) Log Message: ----------- Add tags folder Added Paths: ----------- tags/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-04-05 14:55:49
|
Revision: 775 http://windbus.svn.sourceforge.net/windbus/?rev=775&view=rev Author: chehrlic Date: 2008-04-05 07:55:43 -0700 (Sat, 05 Apr 2008) Log Message: ----------- update to 1.2.1 Modified Paths: -------------- branches/import/ChangeLog branches/import/bus/connection.c branches/import/bus/dir-watch-inotify.c branches/import/bus/expirelist.c branches/import/bus/expirelist.h branches/import/cmake/CMakeLists.txt branches/import/config.h.in branches/import/configure.in branches/import/dbus/dbus-bus.c branches/import/dbus/dbus-connection.c branches/import/dbus/dbus-sysdeps-unix.c branches/import/dbus/dbus-transport.c branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service branches/import/test/data/valid-config-files-system/debug-allow-all-fail.conf branches/import/test/data/valid-config-files-system/debug-allow-all-pass.conf branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service branches/import/tools/dbus-launch-x11.c branches/import/tools/dbus-launch.c branches/import/tools/dbus-send.c Added Paths: ----------- branches/import/doc/dbus-faq.html branches/import/doc/dbus-specification.html branches/import/doc/dbus-test-plan.html branches/import/doc/dbus-tutorial.html branches/import/test/name-test/run-with-tmp-session-bus.conf Removed Paths: ------------- branches/import/doc/diagram.png branches/import/doc/diagram.svg branches/import/pkg-config/ branches/import/test/break-loader.c branches/import/test/unused-code-gc.py Modified: branches/import/ChangeLog =================================================================== --- branches/import/ChangeLog 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/ChangeLog 2008-04-05 14:55:43 UTC (rev 775) @@ -1,3 +1,125 @@ +2008-04-04 John (J5) Palmieri <jo...@re...> + + * Released 1.2.1 + +2008-04-03 John (J5) Palmieri <jo...@re...> + + Patch from Sumit <sum...@ya...>, comments added + + * dbus/dbus-transport.c(_dbus_transport_open): fix mem leak + +2008-04-03 John (J5) Palmieri <jo...@re...> + + * dbus/dbus-connection.c (dbus_connection_send): add documentation + to describe when to call dbus_connection_flush and + dbus_connection_unref after a call to dbus_connection_send is made + Initial wording by Stanislav Brabec <sbrabec at suse.cz> + (fd.o bug#13558) + +2008-04-03 John (J5) Palmieri <jo...@re...> + + Patch from Kimmo Hämäläinen <kimmo.hamalainen at nokia.com> + + * bus/expirelist.c + (do_expiration_with_current_time): calculate correct min wait time + and next interval + (bus_expire_list_add, bus_expire_list_add_link): if the timeout is + disabled when we add an item to the expire list, enable the timeout + (do_expiration_with_current_time): only set timeout if there are + items to expire + +2008-04-01 Timo Hoenig <th...@su...> + + Patch from Frederic Crozat <fc...@ma...> + + * bus/dir-watch-inotify.c (bus_watch_directory): Only monitor + IN_CLOSE_WRITE, IN_DELETE, IN_MOVE_TO and IN_MOVE_FROM events. This + way, only atomic changes to configuration file are monitored. + * bus/dir-watch-inotify.c (_handle_inotify_watch): Fix typo in + _dbus_verbose function call + * bus/dir-watch-inotify.c (bus_drop_all_directory_watches): Use + _dbus_strerror instead of perror + +2008-03-04 Havoc Pennington <hp...@re...> + + * bus/connection.c, bus/expirelist.c: Make the BusExpireList + struct opaque, adding accessors for manipulating the list. In this + commit there should be no change in functionality or behavior. The + purpose of this change is to improve encapsulation prior to fixing + some bugs Kimmo Hämäläinen found where the timeout is not properly + updated, since we need to e.g. take some action whenever adding + and removing stuff from the expire list. + +2008-03-31 Colin Walters <wa...@ve...> + + Patch from Owen Taylor <ot...@re...> + + * tools/dbus-launch-x11.c: Check for X11 events before + selecting (FDO bug #15293) + +2008-03-31 Colin Walters <wa...@ve...> + + Patch from Owen Taylor <ot...@re...> + + * tools/dbus-launch-x11.c: Make sure we call XFlush() + on all code paths (FDO bug #15293) + +2008-03-27 Havoc Pennington <hp...@re...> + + * tools/dbus-send.c (append_dict): Do not provide a signature to + dbus_message_iter_open_container() when opening a dict entry. + +2008-03-26 Colin Walters <wa...@ve...> + + Patch from Scott James Remnant <sc...@ne...> + + * dbus/dbus-bus.c: Set default exit_on_disconnect after registration with + the bus, not before. This ensures that programs which wish to set + exit_on_disconnect to FALSE will not be terminated if the bus exits + during registration. (FDO Bug #15112) + +2008-03-04 John (J5) Palmieri <jo...@re...> + + * fix broken poll on Mac OSX - build patch by Benjamin Reed + * configure.in: check for OSX's deadlocking poll + * dbus/dbus-sysdeps-unix.c (_dbus_poll): if we have a broken poll + don't use poll + +2008-03-04 John (J5) Palmieri <jo...@re...> + + * check if the linker supports a flag instead of just checking for GNU + ld + * configure.in: move AM_PROG_LIBTOOL to the top + (ld_supports_flag): new function for checking if the linker supports + a given flag + +2008-03-04 John (J5) Palmieri <jo...@re...> + + * add a changelog for Benjamin Reed's git patch RANT: Change Logs are + handled by git and having an external changelog just screws up + merging. We should write down rules for doing git commit messages + and leave it at that. + * configure.in: Platform build fixes for Mac OS X + the Darwin linker does not understand the -z option; wrap it in + a check for $with_gnu_ld. + environ is only available at runtime, so you need to make a + reference to _NSGetEnviron instead for symbols to resolve properly. + +2008-03-04 John (J5) Palmieri <jo...@re...> + + * configure.in: add $THREAD_LIBS to DBUS_LAUNCHER_LIBS so we link + correctly + +2008-03-04 John (J5) Palmieri <jo...@re...> + + * tools/dbus-launch.c: wrap X'ism in #ifdef so we can compile + without X + +2008-02-28 John (J5) Palmieri <jo...@re...> + + * dbus/dbus-sysdeps-unix.c: define _AI_ADDRCONFIG as 0 if not + defined so that we can compile with an older glibc + 2008-02-26 John (J5) Palmieri <jo...@re...> * Released 1.1.20 Modified: branches/import/bus/connection.c =================================================================== --- branches/import/bus/connection.c 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/bus/connection.c 2008-04-05 14:55:43 UTC (rev 775) @@ -1467,9 +1467,9 @@ bus_transaction_cancel_and_free (transaction); return FALSE; } - - _dbus_list_remove_link (&connections->pending_replies->items, - link); + + bus_expire_list_remove_link (connections->pending_replies, link); + bus_pending_reply_free (pending); bus_transaction_execute_and_free (transaction); @@ -1488,14 +1488,14 @@ _dbus_verbose ("Dropping pending replies that involve connection %p\n", connection); - link = _dbus_list_get_first_link (&connections->pending_replies->items); + link = bus_expire_list_get_first_link (connections->pending_replies); while (link != NULL) { DBusList *next; BusPendingReply *pending; - next = _dbus_list_get_next_link (&connections->pending_replies->items, - link); + next = bus_expire_list_get_next_link (connections->pending_replies, + link); pending = link->data; if (pending->will_get_reply == connection) @@ -1508,8 +1508,8 @@ pending->will_get_reply, pending->reply_serial); - _dbus_list_remove_link (&connections->pending_replies->items, - link); + bus_expire_list_remove_link (connections->pending_replies, + link); bus_pending_reply_free (pending); } else if (pending->will_send_reply == connection) @@ -1527,8 +1527,7 @@ pending->expire_item.added_tv_sec = 0; pending->expire_item.added_tv_usec = 0; - bus_expire_timeout_set_interval (connections->pending_replies->timeout, - 0); + bus_expire_list_recheck_immediately (connections->pending_replies); } link = next; @@ -1549,8 +1548,8 @@ _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d); - if (!_dbus_list_remove (&d->connections->pending_replies->items, - d->pending)) + if (!bus_expire_list_remove (d->connections->pending_replies, + &d->pending->expire_item)) _dbus_assert_not_reached ("pending reply did not exist to be cancelled"); bus_pending_reply_free (d->pending); /* since it's been cancelled */ @@ -1597,7 +1596,7 @@ reply_serial = dbus_message_get_serial (reply_to_this); - link = _dbus_list_get_first_link (&connections->pending_replies->items); + link = bus_expire_list_get_first_link (connections->pending_replies); count = 0; while (link != NULL) { @@ -1612,8 +1611,8 @@ return FALSE; } - link = _dbus_list_get_next_link (&connections->pending_replies->items, - link); + link = bus_expire_list_get_next_link (connections->pending_replies, + link); if (pending->will_get_reply == will_get_reply) ++count; } @@ -1651,8 +1650,8 @@ return FALSE; } - if (!_dbus_list_prepend (&connections->pending_replies->items, - pending)) + if (!bus_expire_list_add (connections->pending_replies, + &pending->expire_item)) { BUS_SET_OOM (error); dbus_free (cprd); @@ -1666,7 +1665,7 @@ cancel_pending_reply_data_free)) { BUS_SET_OOM (error); - _dbus_list_remove (&connections->pending_replies->items, pending); + bus_expire_list_remove (connections->pending_replies, &pending->expire_item); dbus_free (cprd); bus_pending_reply_free (pending); return FALSE; @@ -1699,9 +1698,9 @@ CheckPendingReplyData *d = data; _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d); - - _dbus_list_prepend_link (&d->connections->pending_replies->items, - d->link); + + bus_expire_list_add_link (d->connections->pending_replies, + d->link); d->link = NULL; } @@ -1716,8 +1715,8 @@ { BusPendingReply *pending = d->link->data; - _dbus_assert (_dbus_list_find_last (&d->connections->pending_replies->items, - pending) == NULL); + _dbus_assert (!bus_expire_list_contains_item (d->connections->pending_replies, + &pending->expire_item)); bus_pending_reply_free (pending); _dbus_list_free_link (d->link); @@ -1747,7 +1746,7 @@ reply_serial = dbus_message_get_reply_serial (reply); - link = _dbus_list_get_first_link (&connections->pending_replies->items); + link = bus_expire_list_get_first_link (connections->pending_replies); while (link != NULL) { BusPendingReply *pending = link->data; @@ -1760,8 +1759,8 @@ break; } - link = _dbus_list_get_next_link (&connections->pending_replies->items, - link); + link = bus_expire_list_get_next_link (connections->pending_replies, + link); } if (link == NULL) @@ -1791,11 +1790,10 @@ cprd->link = link; cprd->connections = connections; - _dbus_list_unlink (&connections->pending_replies->items, - link); + bus_expire_list_unlink (connections->pending_replies, + link); - _dbus_assert (_dbus_list_find_last (&connections->pending_replies->items, - link->data) == NULL); + _dbus_assert (!bus_expire_list_contains_item (connections->pending_replies, link->data)); return TRUE; } Modified: branches/import/bus/dir-watch-inotify.c =================================================================== --- branches/import/bus/dir-watch-inotify.c 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/bus/dir-watch-inotify.c 2008-04-05 14:55:43 UTC (rev 775) @@ -64,7 +64,7 @@ ret = read (inotify_fd, buffer, INOTIFY_BUF_LEN); if (ret < 0) - _dbus_verbose ("Error reading inotify event: '%s'\n, _dbus_strerror(errno)"); + _dbus_verbose ("Error reading inotify event: '%s'\n", _dbus_strerror(errno)); else if (!ret) _dbus_verbose ("Error reading inotify event: buffer too small\n"); @@ -134,7 +134,7 @@ goto out; } - wd = inotify_add_watch (inotify_fd, dir, IN_MODIFY | IN_CREATE | IN_DELETE); + wd = inotify_add_watch (inotify_fd, dir, IN_CLOSE_WRITE | IN_DELETE | IN_MOVED_TO | IN_MOVED_FROM); if (wd < 0) { _dbus_warn ("Cannot setup inotify for '%s'; error '%s'\n", dir, _dbus_strerror (errno)); @@ -156,7 +156,7 @@ _dbus_verbose ("Dropping all watches on config directories\n"); ret = close (inotify_fd); if (ret) - _dbus_verbose ("Error dropping watches: '%s'\n", perror(ret)); + _dbus_verbose ("Error dropping watches: '%s'\n", _dbus_strerror(errno)); num_wds = 0; inotify_fd = -1; Modified: branches/import/bus/expirelist.c =================================================================== --- branches/import/bus/expirelist.c 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/bus/expirelist.c 2008-04-05 14:55:43 UTC (rev 775) @@ -27,6 +27,16 @@ #include <dbus/dbus-mainloop.h> #include <dbus/dbus-timeout.h> +struct BusExpireList +{ + DBusList *items; /**< List of BusExpireItem */ + DBusTimeout *timeout; + DBusLoop *loop; + BusExpireFunc expire_func; + void *data; + int expire_after; /**< Expire after milliseconds (thousandths) */ +}; + static dbus_bool_t expire_timeout_handler (void *data); static void @@ -92,8 +102,8 @@ } void -bus_expire_timeout_set_interval (DBusTimeout *timeout, - int next_interval) +bus_expire_timeout_set_interval (DBusTimeout *timeout, + int next_interval) { if (next_interval >= 0) { @@ -101,28 +111,38 @@ next_interval); _dbus_timeout_set_enabled (timeout, TRUE); - _dbus_verbose ("Enabled expire timeout with interval %d\n", + _dbus_verbose ("Enabled an expire timeout with interval %d\n", next_interval); } else if (dbus_timeout_get_enabled (timeout)) { _dbus_timeout_set_enabled (timeout, FALSE); - _dbus_verbose ("Disabled expire timeout\n"); + _dbus_verbose ("Disabled an expire timeout\n"); } else - _dbus_verbose ("No need to disable expire timeout\n"); + _dbus_verbose ("No need to disable this expire timeout\n"); } +void +bus_expire_list_recheck_immediately (BusExpireList *list) +{ + _dbus_verbose ("setting interval on expire list to 0 for immediate recheck\n"); + + bus_expire_timeout_set_interval (list->timeout, 0); +} + static int do_expiration_with_current_time (BusExpireList *list, long tv_sec, long tv_usec) { DBusList *link; - int next_interval; + int next_interval, min_wait_time, items_to_expire; next_interval = -1; + min_wait_time = 3600 * 1000; /* this is reset anyway if used */ + items_to_expire = 0; link = _dbus_list_get_first_link (&list->items); while (link != NULL) @@ -155,17 +175,20 @@ } else { - /* We can end the loop, since the connections are in oldest-first order */ - next_interval = ((double)list->expire_after) - elapsed; - _dbus_verbose ("Item %p expires in %d milliseconds\n", - item, next_interval); + double to_wait; - break; + items_to_expire = 1; + to_wait = (double) list->expire_after - elapsed; + if (min_wait_time > to_wait) + min_wait_time = to_wait; } link = next; } + if (next_interval < 0 && items_to_expire) + next_interval = min_wait_time; + return next_interval; } @@ -201,6 +224,72 @@ return TRUE; } +void +bus_expire_list_remove_link (BusExpireList *list, + DBusList *link) +{ + _dbus_list_remove_link (&list->items, link); +} + +dbus_bool_t +bus_expire_list_remove (BusExpireList *list, + BusExpireItem *item) +{ + return _dbus_list_remove (&list->items, item); +} + +void +bus_expire_list_unlink (BusExpireList *list, + DBusList *link) +{ + _dbus_list_unlink (&list->items, link); +} + +dbus_bool_t +bus_expire_list_add (BusExpireList *list, + BusExpireItem *item) +{ + dbus_bool_t ret; + + ret = _dbus_list_prepend (&list->items, item); + if (ret && !dbus_timeout_get_enabled (list->timeout)) + bus_expire_timeout_set_interval (list->timeout, 0); + + return ret; +} + +void +bus_expire_list_add_link (BusExpireList *list, + DBusList *link) +{ + _dbus_assert (link->data != NULL); + + _dbus_list_prepend_link (&list->items, link); + + if (!dbus_timeout_get_enabled (list->timeout)) + bus_expire_timeout_set_interval (list->timeout, 0); +} + +DBusList* +bus_expire_list_get_first_link (BusExpireList *list) +{ + return _dbus_list_get_first_link (&list->items); +} + +DBusList* +bus_expire_list_get_next_link (BusExpireList *list, + DBusList *link) +{ + return _dbus_list_get_next_link (&list->items, link); +} + +dbus_bool_t +bus_expire_list_contains_item (BusExpireList *list, + BusExpireItem *item) +{ + return _dbus_list_find_last (&list->items, item) != NULL; +} + #ifdef DBUS_BUILD_TESTS typedef struct @@ -283,7 +372,7 @@ item->item.added_tv_sec = tv_sec; item->item.added_tv_usec = tv_usec; - if (!_dbus_list_append (&list->items, item)) + if (!bus_expire_list_add (list, &item->item)) _dbus_assert_not_reached ("out of memory"); next_interval = @@ -307,7 +396,7 @@ _dbus_verbose ("next_interval = %d\n", next_interval); _dbus_assert (next_interval == 1000 + EXPIRE_AFTER); - _dbus_list_clear (&list->items); + bus_expire_list_remove (list, &item->item); dbus_free (item); bus_expire_list_free (list); Modified: branches/import/bus/expirelist.h =================================================================== --- branches/import/bus/expirelist.h 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/bus/expirelist.h 2008-04-05 14:55:43 UTC (rev 775) @@ -35,15 +35,6 @@ DBusList *link, void *data); -struct BusExpireList -{ - DBusList *items; /**< List of BusExpireItem */ - DBusTimeout *timeout; - DBusLoop *loop; - BusExpireFunc expire_func; - void *data; - int expire_after; /**< Expire after milliseconds (thousandths) */ -}; /* embed this in a child expire item struct */ struct BusExpireItem @@ -52,18 +43,38 @@ long added_tv_usec; /**< Time we were added (microsec component) */ }; -BusExpireList* bus_expire_list_new (DBusLoop *loop, - int expire_after, - BusExpireFunc expire_func, - void *data); -void bus_expire_list_free (BusExpireList *list); +BusExpireList* bus_expire_list_new (DBusLoop *loop, + int expire_after, + BusExpireFunc expire_func, + void *data); +void bus_expire_list_free (BusExpireList *list); +void bus_expire_list_recheck_immediately (BusExpireList *list); +void bus_expire_list_remove_link (BusExpireList *list, + DBusList *link); +dbus_bool_t bus_expire_list_remove (BusExpireList *list, + BusExpireItem *item); +DBusList* bus_expire_list_get_first_link (BusExpireList *list); +DBusList* bus_expire_list_get_next_link (BusExpireList *list, + DBusList *link); +dbus_bool_t bus_expire_list_add (BusExpireList *list, + BusExpireItem *item); +void bus_expire_list_add_link (BusExpireList *list, + DBusList *link); +dbus_bool_t bus_expire_list_contains_item (BusExpireList *list, + BusExpireItem *item); +void bus_expire_list_unlink (BusExpireList *list, + DBusList *link); +/* this macro and function are semi-related utility functions, not really part of the + * BusExpireList API + */ + #define ELAPSED_MILLISECONDS_SINCE(orig_tv_sec, orig_tv_usec, \ now_tv_sec, now_tv_usec) \ (((double) (now_tv_sec) - (double) (orig_tv_sec)) * 1000.0 + \ ((double) (now_tv_usec) - (double) (orig_tv_usec)) / 1000.0) -void bus_expire_timeout_set_interval (DBusTimeout *timeout, - int next_interval); +void bus_expire_timeout_set_interval (DBusTimeout *timeout, + int next_interval); #endif /* BUS_EXPIRE_LIST_H */ Modified: branches/import/cmake/CMakeLists.txt =================================================================== --- branches/import/cmake/CMakeLists.txt 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/cmake/CMakeLists.txt 2008-04-05 14:55:43 UTC (rev 775) @@ -2,8 +2,8 @@ # the version major, minor and release number should be synchron to the dbus cvs - windows releases should only update the patch level set (VERSION_MAJOR "1") -set (VERSION_MINOR "1") -set (VERSION_RELEASE "2") +set (VERSION_MINOR "2") +set (VERSION_RELEASE "1") set (VERSION_PATCH "0") if (VERSION_PATCH) set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}-${VERSION_PATCH}" ) Modified: branches/import/config.h.in =================================================================== --- branches/import/config.h.in 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/config.h.in 2008-04-05 14:55:43 UTC (rev 775) @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.in by autoheader. */ +/* poll doesn't work on devices */ +#undef BROKEN_POLL + /* Directory for installing the binaries */ #undef DBUS_BINDIR @@ -113,6 +116,9 @@ /* Have console owner file */ #undef HAVE_CONSOLE_OWNER_FILE +/* Define to 1 if you have the <crt_externs.h> header file. */ +#undef HAVE_CRT_EXTERNS_H + /* Have the ddfd member of DIR */ #undef HAVE_DDFD @@ -170,6 +176,9 @@ /* Have non-POSIX function getpwnam_r */ #undef HAVE_NONPOSIX_GETPWNAM_R +/* Define if your system needs _NSGetEnviron to set up the environment */ +#undef HAVE_NSGETENVIRON + /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL @@ -329,6 +338,14 @@ /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING + +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include <sys/time.h> +# include <crt_externs.h> +# define environ (*_NSGetEnviron()) +#endif + + /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus Modified: branches/import/configure.in =================================================================== --- branches/import/configure.in 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/configure.in 2008-04-05 14:55:43 UTC (rev 775) @@ -2,8 +2,8 @@ AC_PREREQ(2.52) m4_define([dbus_major_version], [1]) -m4_define([dbus_minor_version], [1]) -m4_define([dbus_micro_version], [20]) +m4_define([dbus_minor_version], [2]) +m4_define([dbus_micro_version], [1]) m4_define([dbus_version], [dbus_major_version.dbus_minor_version.dbus_micro_version]) AC_INIT(dbus, [dbus_version]) @@ -60,6 +60,7 @@ AC_ISC_POSIX AC_HEADER_STDC AC_C_INLINE +AM_PROG_LIBTOOL AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE) AC_ARG_ENABLE(ansi, AS_HELP_STRING([--enable-ansi],[enable -ansi -pedantic gcc flags]),enable_ansi=$enableval,enable_ansi=no) @@ -144,6 +145,36 @@ return $rc } +ld_supports_flag() { + AC_MSG_CHECKING([whether $LD supports "$@"]) + AC_TRY_LINK([ + int one(void) { return 1; } + int two(void) { return 2; } + ], [ two(); ] , [_ac_ld_flag_supported=yes], [_ac_ld_flag_supported=no]) + + if test "$_ac_ld_flag_supported" = "yes"; then + rm -f conftest.c + touch conftest.c + if $CC -c conftest.c; then + ld_out=`$LD $@ -o conftest conftest.o 2>&1` + ld_ret=$? + if test $ld_ret -ne 0 ; then + _ac_ld_flag_supported=no + elif echo "$ld_out" | egrep 'option ignored|^usage:|unrecognized option|illegal option' >/dev/null ; then + _ac_ld_flag_supported=no + fi + fi + rm -f conftest.c conftest.o conftest + fi + + AC_MSG_RESULT($_ac_ld_flag_supported) + if test "$_ac_ld_flag_supported" = "yes" ; then + return 0 + else + return 1 + fi +} + if test "x$GCC" = "xyes"; then changequote(,)dnl case " $CFLAGS " in @@ -214,7 +245,9 @@ *[\ \ ]-fPIC[\ \ ]*) ;; *) if cc_supports_flag -fPIC; then PIC_CFLAGS="-fPIC" - PIC_LDFLAGS="-Wl,-z,relro" + if ld_supports_flag -z,relro; then + PIC_LDFLAGS="-Wl,-z,relro" + fi fi ;; esac @@ -223,7 +256,11 @@ *[\ \ ]-fPIE[\ \ ]*) ;; *) if cc_supports_flag -fPIE; then PIE_CFLAGS="-fPIE" - PIE_LDFLAGS="-pie -Wl,-z,relro" + if ld_supports_flag -z,relro; then + PIE_LDFLAGS="-pie -Wl,-z,relro" + else + PIE_LDFLAGS="-pie" + fi fi ;; esac @@ -274,28 +311,7 @@ AC_SUBST(PIE_CFLAGS) AC_SUBST(PIE_LDFLAGS) -# Check for -Wl,--gc-sections -AC_MSG_CHECKING([for ld that supports "-Wl,--gc-sections"]) -AC_TRY_LINK([ - int one(void) { return 1; } - int two(void) { return 2; } - ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no]) - -if test "$ac_gcsections" = "yes"; then - rm -f conftest.c - touch conftest.c - if $CC -c conftest.c; then - ld_out=`$LD --gc-sections -o conftest conftest.o 2>&1` - ld_ret=$? - if test $ld_ret -ne 0 ; then - ac_gcsections=no - elif echo "$ld_out" | egrep 'option ignored|^usage:|illegal option' >/dev/null ; then - ac_gcsections=no - fi - fi - rm -f conftest.c conftest.o conftest -fi -if test "$ac_gcsections" = "yes"; then +if ld_supports_flag --gc-sections; then SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" fi @@ -310,8 +326,6 @@ CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;; esac -AM_PROG_LIBTOOL - changequote(,)dnl # compress spaces in flags CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'` @@ -576,8 +590,36 @@ AC_CHECK_LIB(socket,socket) AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)]) -AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep poll setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit) +AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll) +#### Check for broken poll; taken from Glib's configure + +AC_MSG_CHECKING([for broken poll]) +AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include <stdlib.h> + #include <fcntl.h> + #include <poll.h> + #ifdef HAVE_SYS_POLL_H + #include <sys/poll.h> + #endif + int main(void) { + struct pollfd fds[1]; + int fd; + fd = open("/dev/null", 1); + fds[0].fd = fd; + fds[0].events = POLLIN; + fds[0].revents = 0; + if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) { + exit(1); /* Does not work for devices -- fail */ + } + exit(0); + }]])], + [broken_poll=no], + [broken_poll=yes + AC_DEFINE(BROKEN_POLL,1,[poll doesn't work on devices])], + [broken_poll="no (cross compiling)"]) +AC_MSG_RESULT($broken_poll) + AC_MSG_CHECKING(for dirfd) AC_TRY_LINK([ #include <sys/types.h> @@ -998,7 +1040,7 @@ AC_SUBST(DBUS_BUS_LIBS) DBUS_LAUNCHER_CFLAGS="$XML_CFLAGS" -DBUS_LAUNCHER_LIBS="$XML_LIBS" +DBUS_LAUNCHER_LIBS="$XML_LIBS $THREAD_LIBS" AC_SUBST(DBUS_LAUNCHER_CFLAGS) AC_SUBST(DBUS_LAUNCHER_LIBS) @@ -1273,6 +1315,18 @@ AC_DEFINE_UNQUOTED(DBUS_UNIX, "1", [Defined on UNIX and Linux systems and not on Windows]) +# darwin needs this to initialize the environment +AC_CHECK_HEADERS(crt_externs.h) +AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])]) +AH_VERBATIM(_DARWIN_ENVIRON, +[ +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include <sys/time.h> +# include <crt_externs.h> +# define environ (*_NSGetEnviron()) +#endif +]) + AC_OUTPUT([ Doxyfile dbus/dbus-arch-deps.h Modified: branches/import/dbus/dbus-bus.c =================================================================== --- branches/import/dbus/dbus-bus.c 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/dbus/dbus-bus.c 2008-04-05 14:55:43 UTC (rev 775) @@ -436,12 +436,6 @@ return NULL; } - /* By default we're bound to the lifecycle of - * the message bus. - */ - dbus_connection_set_exit_on_disconnect (connection, - TRUE); - if (!dbus_bus_register (connection, error)) { _DBUS_ASSERT_ERROR_IS_SET (error); @@ -461,6 +455,12 @@ bus_connections[type] = connection; } + /* By default we're bound to the lifecycle of + * the message bus. + */ + dbus_connection_set_exit_on_disconnect (connection, + TRUE); + _DBUS_LOCK (bus_datas); bd = ensure_bus_data (connection); _dbus_assert (bd != NULL); /* it should have been created on Modified: branches/import/dbus/dbus-connection.c =================================================================== --- branches/import/dbus/dbus-connection.c 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/dbus/dbus-connection.c 2008-04-05 14:55:43 UTC (rev 775) @@ -3055,18 +3055,24 @@ /** * Adds a message to the outgoing message queue. Does not block to * write the message to the network; that happens asynchronously. To - * force the message to be written, call dbus_connection_flush(). + * force the message to be written, call dbus_connection_flush() however + * it is not necessary to call dbus_connection_flush() by hand; the + * message will be sent the next time the main loop is run. + * dbus_connection_flush() should only be used, for example, if + * the application was expected to exit before running the main loop. + * * Because this only queues the message, the only reason it can * fail is lack of memory. Even if the connection is disconnected, - * no error will be returned. - * - * If the function fails due to lack of memory, it returns #FALSE. - * The function will never fail for other reasons; even if the - * connection is disconnected, you can queue an outgoing message, + * no error will be returned. If the function fails due to lack of memory, + * it returns #FALSE. The function will never fail for other reasons; even + * if the connection is disconnected, you can queue an outgoing message, * though obviously it won't be sent. * * The message serial is used by the remote application to send a * reply; see dbus_message_get_serial() or the D-Bus specification. + * + * dbus_message_unref() can be called as soon as this method returns + * as the message queue will hold its own ref until the message is sent. * * @param connection the connection. * @param message the message to write. Modified: branches/import/dbus/dbus-sysdeps-unix.c =================================================================== --- branches/import/dbus/dbus-sysdeps-unix.c 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/dbus/dbus-sysdeps-unix.c 2008-04-05 14:55:43 UTC (rev 775) @@ -75,6 +75,10 @@ #define O_BINARY 0 #endif +#ifndef _AI_ADDRCONFIG +#define _AI_ADDRCONFIG 0 +#endif + #ifndef HAVE_SOCKLEN_T #define socklen_t int #endif @@ -1839,7 +1843,7 @@ int n_fds, int timeout_milliseconds) { -#ifdef HAVE_POLL +#if defined(HAVE_POLL) && !defined(BROKEN_POLL) /* This big thing is a constant expression and should get optimized * out of existence. So it's more robust than a configure check at * no cost. Modified: branches/import/dbus/dbus-transport.c =================================================================== --- branches/import/dbus/dbus-transport.c 2008-04-04 17:14:20 UTC (rev 774) +++ branches/import/dbus/dbus-transport.c 2008-04-05 14:55:43 UTC (rev 775) @@ -412,7 +412,22 @@ else { _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error); - transport->expected_guid = expected_guid; + + /* In the case of autostart the initial guid is NULL + * and the autostart transport recursively calls + * _dbus_open_transport wich returns a transport + * with a guid. That guid is the definitive one. + * + * FIXME: if more transports are added they may have + * an effect on the expected_guid semantics (i.e. + * expected_guid and transport->expected_guid may + * both have values). This is very unlikely though + * we should either throw asserts here for those + * corner cases or refactor the code so it is + * clearer on what is expected and what is not + */ + if(expected_guid) + transport->expected_guid = expected_guid; } return transport; Added: branches/import/doc/dbus-faq.html =================================================================== --- branches/import/doc/dbus-faq.html (rev 0) +++ branches/import/doc/dbus-faq.html 2008-04-05 14:55:43 UTC (rev 775) @@ -0,0 +1,437 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>D-Bus FAQ</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="index"></a>D-Bus FAQ</h2></div><div><div class="authorgroup"><div class="author"><h3 class="author"><span class="firstname">Havoc</span> <span class="surname">Pennington</span></h3><div class="affiliation"><span class="orgname">Red Hat, Inc.<br></span><div class="address"><p><br> + \xA0\xA0\xA0\xA0<code class="email"><<a class="email" href="mailto:hp...@po...">hp...@po...</a>></code><br> + \xA0\xA0</p></div></div></div><div class="author"><h3 class="author"><span class="firstname">David</span> <span class="othername">A</span> <span class="surname">Wheeler</span></h3></div></div></div><div><p class="releaseinfo">Version 0.3</p></div></div><hr></div><div class="qandaset"><dl><dt>1. <a href="#id2746602"> + What is D-Bus? + </a></dt><dt>2. <a href="#id2746639"> + Is D-Bus stable/finished? + </a></dt><dt>3. <a href="#id2779511"> + How is the reference implementation licensed? Can I use it in + proprietary applications? + </a></dt><dt>4. <a href="#id2741879"> + What is the difference between a bus name, and object path, + and an interface? + </a></dt><dt>5. <a href="#service"> + What is a "service"? + </a></dt><dt>6. <a href="#components"> + Is D-Bus a "component system"? + </a></dt><dt>7. <a href="#speed"> + How fast is the D-Bus reference implementation? + </a></dt><dt>8. <a href="#size"> + How large is the D-Bus reference implementation? + </a></dt><dt>9. <a href="#other-ipc"> + How does D-Bus differ from other interprocess communication + or networking protocols? + </a></dt><dt>10. <a href="#corba"> + How does D-Bus differ from CORBA? + </a></dt><dt>11. <a href="#xmlrpcsoap"> + How does D-Bus differ from XML-RPC and SOAP? + </a></dt><dt>12. <a href="#dce"> + How does D-Bus differ from DCE? + </a></dt><dt>13. <a href="#dcom"> + How does D-Bus differ from DCOM and COM? + </a></dt><dt>14. <a href="#internet-communications-engine"> + How does D-Bus differ from ZeroC's Internet Communications Engine (Ice) + </a></dt><dt>15. <a href="#inter-client-exchange"> + How does D-Bus differ from Inter-Client Exchange (ICE)? + </a></dt><dt>16. <a href="#dcop"> + How does D-Bus differ from DCOP? + </a></dt><dt>17. <a href="#yet-more-ipc"> + How does D-Bus differ from [yet more IPC mechanisms]? + </a></dt><dt>18. <a href="#which-ipc"> + Which IPC mechanism should I use? + </a></dt><dt>19. <a href="#id2789124"> + How can I submit a bug or patch? + </a></dt></dl><table border="0" summary="Q and A Set"><col align="left" width="1%"><tbody><tr class="question"><td align="left" valign="top"><a name="id2746602"></a><a name="id2746604"></a><p><b>1.</b></p></td><td align="left" valign="top"><p> + What is D-Bus? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + This is probably best answered by reading the D-Bus <a class="ulink" href="dbus-tutorial.html" target="_top">tutorial</a> or + the introduction to the <a class="ulink" href="dbus-specification.html" target="_top">specification</a>. In + short, it is a system consisting of 1) a wire protocol for exposing a + typical object-oriented language/framework to other applications; and + 2) a bus daemon that allows applications to find and monitor one another. + Phrased differently, D-Bus is 1) an interprocess communication (IPC) system and 2) some higher-level + structure (lifecycle tracking, service activation, security policy) provided by two bus daemons, + one systemwide and one per-user-session. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="id2746639"></a><a name="id2746641"></a><p><b>2.</b></p></td><td align="left" valign="top"><p> + Is D-Bus stable/finished? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + The low-level library "libdbus" and the protocol specification are considered + ABI stable. The <a class="ulink" href="README" target="_top">README</a> + file has a discussion of the API/ABI stability guarantees. + Higher-level bindings (such as those for Qt, GLib, Python, Java, C#) each + have their own release schedules and degree of maturity, not linked to + the low-level library and bus daemon release. Check the project page for + the binding you're considering to understand that project's policies. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="id2779511"></a><a name="id2779513"></a><p><b>3.</b></p></td><td align="left" valign="top"><p> + How is the reference implementation licensed? Can I use it in + proprietary applications? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + The short answer is yes, you can use it in proprietary applications. + You should read the <a class="ulink" href="COPYING" target="_top">COPYING</a> file, which + offers you the choice of two licenses. These are the GPL and the + AFL. The GPL requires that your application be licensed under the GPL + as well. The AFL is an "X-style" or "BSD-style" license compatible + with proprietary licensing, but it does have some requirements; in + particular it prohibits you from filing a lawsuit alleging that the + D-Bus software infringes your patents <span class="emphasis"><em>while you continue to + use D-Bus</em></span>. If you're going to sue, you have to stop using + the software. Read the licenses to determine their meaning, this FAQ + entry is not intended to change the meaning or terms of the licenses. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="id2741879"></a><a name="id2741881"></a><p><b>4.</b></p></td><td align="left" valign="top"><p> + What is the difference between a bus name, and object path, + and an interface? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + If you imagine a C++ program that implements a network service, then + the bus name is the hostname of the computer running this C++ program, + the object path is a C++ object instance pointer, and an interface is + a C++ class (a pure virtual or abstract class, to be exact). + </p><p> + In Java terms, the object path is an object reference, + and an interface is a Java interface. + </p><p> + People get confused because if they write an application + with a single object instance and a single interface, + then the bus name, object path, and interface look + redundant. For example, you might have a text editor + that uses the bus name <code class="literal">org.freedesktop.TextEditor</code>, + has a global singleton object called + <code class="literal">/org/freedesktop/TextEditor</code>, and + that singleton object could implement the interface + <code class="literal">org.freedesktop.TextEditor</code>. + </p><p> + However, a text editor application could as easily own multiple bus + names (for example, <code class="literal">org.kde.KWrite</code> in addition to + generic <code class="literal">TextEditor</code>), have multiple objects (maybe + <code class="literal">/org/kde/documents/4352</code> where the number changes + according to the document), and each object could implement multiple + interfaces, such as <code class="literal">org.freedesktop.DBus.Introspectable</code>, + <code class="literal">org.freedesktop.BasicTextField</code>, + <code class="literal">org.kde.RichTextDocument</code>. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="service"></a><a name="id2741988"></a><p><b>5.</b></p></td><td align="left" valign="top"><p> + What is a "service"? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + A service is a program that can be launched by the bus daemon + to provide some functionality to other programs. Services + are normally launched according to the bus name they will + have. + </p><p> + People often misuse the word "service" for any + bus name, but this tends to be ambiguous and confusing so is discouraged. + In the D-Bus docs we try to use "service" only when talking about + programs the bus knows how to launch, i.e. a service always has a + .service file. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="components"></a><a name="id2742021"></a><p><b>6.</b></p></td><td align="left" valign="top"><p> + Is D-Bus a "component system"? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + It helps to keep these concepts separate in your mind: + </p><div class="orderedlist"><ol type="1"><li><p> + Object/component system + </p></li><li><p> + GUI control/widget embedding interfaces + </p></li><li><p> + Interprocess communication system or wire protocol + </p></li></ol></div><p> + </p><p> + D-Bus is not a component system. "Component system" was originally + defined by COM, and was essentially a workaround for the limitations + of the C++ object system (adding introspection, runtime location of + objects, ABI guarantees, and so forth). With the C# language and CLR, + Microsoft added these features to the primary object system, leaving + COM obsolete. Similarly, Java has much less need for something like + COM than C++ did. Even QObject (from Qt) and GObject (from GLib) offer + some of the same features found in COM. + </p><p> + Component systems are not about GUI control embedding. Embedding + a spreadsheet in a word processor document is a matter of defining + some specific <span class="emphasis"><em>interfaces</em></span> that objects + can implement. These interfaces provide methods related to + GUI controls. So an object implementing those interfaces + can be embedded. + </p><p> + The word "component" just means "object with some fancy features" and + in modern languages all objects are effectively "components." + </p><p> + So components are fancy objects, and some objects are GUI controls. + </p><p> + A third, unrelated feature is interprocess communication or IPC. + D-Bus is an IPC system. Given an object (or "component" if you must), + you can expose the functionality of that object over an IPC system. + Examples of IPC systems are DCOM, CORBA, SOAP, XML-RPC, and D-Bus. + You can use any of these IPC systems with any object/component system, + though some of them are "tuned" for specific object systems. + You can think of an IPC system primarily as a wire protocol. + </p><p> + If you combine an IPC system with a set of GUI control interfaces, + then you can have an out-of-process or dynamically-loaded GUI control. + </p><p> + Another related concept is the <em class="firstterm">plugin</em> or + <em class="firstterm">extension</em>. Generic plugin systems such as the + <a class="ulink" href="http://eclipse.org" target="_top">Eclipse</a> system are not so different + from component/object systems, though perhaps a "plugin" tends to be a + bundle of objects with a user-visible name and can be + downloaded/packaged as a unit. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="speed"></a><a name="id2745871"></a><p><b>7.</b></p></td><td align="left" valign="top"><p> + How fast is the D-Bus reference implementation? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + Of course it depends a bit on what you're doing. + <a class="ulink" href="http://lists.freedesktop.org/pipermail/dbus/2004-November/001779.html" target="_top"> + This mail</a> contains some benchmarking. At the time of that + benchmark, D-Bus one-to-one communication was about 2.5x slower than + simply pushing the data raw over a socket. After the recent rewrite of + the marshaling code, D-Bus is slower than that because a lot of + optimization work was lost. But it can probably be sped up again. + </p><p> + D-Bus communication with the intermediate bus daemon should be + (and as last profiled, was) about twice as slow as one-to-one + mode, because a round trip involves four socket reads/writes rather + than two socket reads/writes. + </p><p> + The overhead comes from a couple of places; part of it is simply + "abstraction penalty" (there are layers of code to support + multiple main loops, multiple transport types, security, etc.). + Probably the largest part comes from data validation + (because the reference implementation does not trust incoming data). + It would be simple to add a "no validation" mode, but probably + not a good idea all things considered. + </p><p> + Raw bandwidth isn't the only concern; D-Bus is designed to + enable asynchronous communication and avoid round trips. + This is frequently a more important performance issue + than throughput. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="size"></a><a name="id2745931"></a><p><b>8.</b></p></td><td align="left" valign="top"><p> + How large is the D-Bus reference implementation? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + A production build (with assertions, unit tests, and verbose logging + disabled) is on the order of a 150K shared library. + </p><p> + A much, much smaller implementation would be possible by omitting out + of memory handling, hardcoding a main loop (or always using blocking + I/O), skipping validation, and otherwise simplifying things. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="other-ipc"></a><a name="id2745962"></a><p><b>9.</b></p></td><td align="left" valign="top"><p> + How does D-Bus differ from other interprocess communication + or networking protocols? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + Keep in mind, it is not only an IPC system; it also includes + lifecycle tracking, service activation, security policy, and other + higher-level structure and assumptions. + </p><p> + The best place to start is to read the D-Bus <a class="ulink" href="dbus-tutorial.html" target="_top">tutorial</a>, so + you have a concrete idea what D-Bus actually is. If you + understand other protocols on a wire format level, you + may also want to read the D-Bus <a class="ulink" href="dbus-specification.html" target="_top">specification</a> to see what + D-Bus looks like on a low level. + </p><p> + As the <a class="ulink" href="dbus-tutorial.html" target="_top">tutorial</a> and <a class="ulink" href="dbus-specification.html" target="_top">specification</a> both explain, D-Bus is tuned + for some specific use cases. Thus, it probably isn't tuned + for what you want to do, unless you are doing the things + D-Bus was designed for. Don't make the mistake of thinking + that any system involving "IPC" is the same thing. + </p><p> + The D-Bus authors would not recommend using D-Bus + for applications where it doesn't make sense. + The following questions compare D-Bus to some other + protocols primarily to help you understand D-Bus + and decide whether it's appropriate; D-Bus is neither intended + nor claimed to be the right choice for every application. + </p><p> + It should be possible to bridge D-Bus to other IPC systems, + just as D-Bus can be bridged to object systems. + </p><p> + Note: the D-Bus mailing list subscribers are <span class="emphasis"><em>very much not + interested</em></span> in debating which IPC system is the One True + System. So if you want to discuss that, please use another forum. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="corba"></a><a name="id2746052"></a><p><b>10.</b></p></td><td align="left" valign="top"><p> + How does D-Bus differ from CORBA? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + Start by reading <a class="xref" href="#other-ipc" title="Question">Q:\xA09</a>. + </p><p> + <a class="ulink" href="http://www.omg.org" target="_top">CORBA</a> is designed to support + object-oriented IPC between objects, automatically marshalling + parameters as necessary. CORBA is strongly supported by the <a class="ulink" href="http://www.omg.org" target="_top">Open Management Group (OMG)</a>, which + produces various standards and supporting documents for CORBA and has + the backing of many large organizations. There are many CORBA ORBs + available, both proprietary ORBs and free / open source software ORBs + (the latter include <a class="ulink" href="http://orbit-resource.sourceforge.net/" target="_top">ORBit</a>, <a class="ulink" href="http://www.mico.org/" target="_top">MICO</a>, and <a class="ulink" href="http://www.theaceorb.com/" target="_top">The ACE Orb (TAO)</a>). Many + organizations continue to use CORBA ORBs for various kinds of IPC. + </p><p> + Both GNOME and KDE have used CORBA and then moved away from it. KDE + had more success with a system called DCOP, and GNOME layered a system + called Bonobo on top of CORBA. Without custom extensions, CORBA does + not support many of the things one wants to do in a desktop + environment with the GNOME/KDE architecture. + </p><p> + CORBA on the other hand has a number of features of interest for + enterprise and web application development, though XML systems such as + SOAP are the latest fad. + </p><p> + Like D-Bus, CORBA uses a fast binary protocol (IIOP). Both systems + work in terms of objects and methods, and have concepts such as + "oneway" calls. Only D-Bus has direct support for "signals" as in + GLib/Qt (or Java listeners, or C# delegates). + </p><p> + D-Bus hardcodes and specifies a lot of things that CORBA leaves open-ended, + because CORBA is more generic and D-Bus has two specific use-cases in mind. + This makes D-Bus a bit simpler. + </p><p> + However, unlike CORBA D-Bus does <span class="emphasis"><em>not</em></span> specify the + API for the language bindings. Instead, "native" bindings adapted + specifically to the conventions of a framework such as QObject, + GObject, C#, Java, Python, etc. are encouraged. The libdbus reference + implementation is designed to be a backend for bindings of this + nature, rather than to be used directly. The rationale is that an IPC + system API should not "leak" all over a program; it should come into + play only just before data goes over the wire. As an aside, OMG is + apparently working on a simpler C++ binding for CORBA. + </p><p> + Many CORBA implementations such as ORBit are faster than the libdbus + reference implementation. One reason is that D-Bus considers data + from the other end of the connection to be untrusted and extensively + validates it. But generally speaking other priorities were placed + ahead of raw speed in the libdbus implementation. A fast D-Bus + implementation along the lines of ORBit should be possible, of course. + </p><p> + On a more trivial note, D-Bus involves substantially fewer acronyms + than CORBA. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="xmlrpcsoap"></a><a name="id2741052"></a><p><b>11.</b></p></td><td align="left" valign="top"><p> + How does D-Bus differ from XML-RPC and SOAP? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + Start by reading <a class="xref" href="#other-ipc" title="Question">Q:\xA09</a>. + </p><p> + In <a class="ulink" href="http://www.w3.org/TR/SOAP/" target="_top">SOAP</a> and <a class="ulink" href="http://www.xmlrpc.com" target="_top">XML-RPC</a>, RPC calls are transformed + into an XML-based format, then sent over the wire (typically using the + HTTP protocol), where they are processed and returned. XML-RPC is the + simple protocol (its spec is only a page or two), and SOAP is the + full-featured protocol. + </p><p> + XML-RPC and SOAP impose XML parsing overhead that is normally + irrelevant in the context of the Internet, but significant for + constant fine-grained IPC among applications in a desktop session. + </p><p> + D-Bus offers persistent connections and with the bus daemon + supports lifecycle tracking of other applications connected + to the bus. With XML-RPC and SOAP, typically each method call + exists in isolation and has its own HTTP connection. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="dce"></a><a name="id2741112"></a><p><b>12.</b></p></td><td align="left" valign="top"><p> + How does D-Bus differ from DCE? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + Start by reading <a class="xref" href="#other-ipc" title="Question">Q:\xA09</a>. + </p><p> + <a class="ulink" href="http://www.opengroup.org/dce/" target="_top">Distributed Computing + Environment (DCE)</a> is an industry-standard vendor-neutral + standard that includes an IPC mechanism. <a class="ulink" href="http://www.opengroup.org/comm/press/05-01-12.htm" target="_top">The Open Group + has released an implementation as open source software</a>. DCE + is quite capable, and includes a vast amount of functionality such as + a distributed time service. As the name implies, DCE is intended for + use in a large, multi-computer distributed application. D-Bus would + not be well-suited for this. + </p></td></tr><tr class="question"><td align="left" valign="top"><a name="dcom"></a><a name="id2741525"></a><p><b>13.</b></p></td><td align="left" valign="top"><p> + How does D-Bus differ from DCOM and COM? + </p></td></tr><tr class="answer"><td align="left" valign="top"></td><td align="left" valign="top"><p> + Start by reading <a class="xref" href="#other-ipc" title="Question">Q:\xA09</a>. + </p><p> + Comparing D-Bus to COM is apples and oranges; + see <a class="xref" href="#components" title="Question">Q:\xA06</a>. + </p><p> + DCOM (distributed COM) is a Windows IPC system designed for use with + the COM objec... [truncated message content] |
From: <che...@us...> - 2008-04-04 17:14:23
|
Revision: 774 http://windbus.svn.sourceforge.net/windbus/?rev=774&view=rev Author: chehrlic Date: 2008-04-04 10:14:20 -0700 (Fri, 04 Apr 2008) Log Message: ----------- I don't know who on earth did this behavior change but it broke dbus on windows. thx Modified Paths: -------------- branches/import/dbus/dbus-watch.c Modified: branches/import/dbus/dbus-watch.c =================================================================== --- branches/import/dbus/dbus-watch.c 2008-03-19 06:07:58 UTC (rev 773) +++ branches/import/dbus/dbus-watch.c 2008-04-04 17:14:20 UTC (rev 774) @@ -516,7 +516,7 @@ #ifdef DBUS_UNIX return watch->fd; #else - return -1; + return dbus_watch_get_socket( watch ); #endif } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-03-19 06:08:04
|
Revision: 773 http://windbus.svn.sourceforge.net/windbus/?rev=773&view=rev Author: chehrlic Date: 2008-03-18 23:07:58 -0700 (Tue, 18 Mar 2008) Log Message: ----------- fix from Thorvald Natvig Modified Paths: -------------- trunk/dbus/dbus-spawn-win.c Modified: trunk/dbus/dbus-spawn-win.c =================================================================== --- trunk/dbus/dbus-spawn-win.c 2008-03-10 20:09:45 UTC (rev 772) +++ trunk/dbus/dbus-spawn-win.c 2008-03-19 06:07:58 UTC (rev 773) @@ -228,7 +228,7 @@ { PING(); CloseHandle (sitter->start_sync_event); - sitter->end_sync_event = NULL; + sitter->start_sync_event = NULL; } #ifdef DBUS_BUILD_TESTS This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-03-10 20:09:47
|
Revision: 772 http://windbus.svn.sourceforge.net/windbus/?rev=772&view=rev Author: chehrlic Date: 2008-03-10 13:09:45 -0700 (Mon, 10 Mar 2008) Log Message: ----------- update version number Modified Paths: -------------- branches/import/cmake/CMakeLists.txt Modified: branches/import/cmake/CMakeLists.txt =================================================================== --- branches/import/cmake/CMakeLists.txt 2008-03-10 18:23:49 UTC (rev 771) +++ branches/import/cmake/CMakeLists.txt 2008-03-10 20:09:45 UTC (rev 772) @@ -3,8 +3,8 @@ # the version major, minor and release number should be synchron to the dbus cvs - windows releases should only update the patch level set (VERSION_MAJOR "1") set (VERSION_MINOR "1") -set (VERSION_RELEASE "1") -set (VERSION_PATCH "4") +set (VERSION_RELEASE "2") +set (VERSION_PATCH "0") if (VERSION_PATCH) set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}-${VERSION_PATCH}" ) else (VERSION_PATCH) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-03-10 18:23:54
|
Revision: 771 http://windbus.svn.sourceforge.net/windbus/?rev=771&view=rev Author: chehrlic Date: 2008-03-10 11:23:49 -0700 (Mon, 10 Mar 2008) Log Message: ----------- update to 1.1.20/1.2.0 Modified Paths: -------------- branches/import/ChangeLog branches/import/NEWS branches/import/bus/policy.c branches/import/bus/selinux.c branches/import/configure.in branches/import/dbus/dbus-connection.c branches/import/dbus/dbus-sysdeps-unix.c branches/import/tools/dbus-launch.c Modified: branches/import/ChangeLog =================================================================== --- branches/import/ChangeLog 2008-03-10 18:06:40 UTC (rev 770) +++ branches/import/ChangeLog 2008-03-10 18:23:49 UTC (rev 771) @@ -1,3 +1,44 @@ +2008-02-26 John (J5) Palmieri <jo...@re...> + + * Released 1.1.20 + +2008-02-26 John (J5) Palmieri <jo...@re...> + + * CVE-2008-0595 - security policy of the type <allow send_interface= + "some.interface.WithMethods"/> work as an implicit allow for + messages sent without an interface bypassing the default deny rules + and potentially allowing restricted methods exported on the bus to be + executed by unauthorized users. This patch fixes the issue. + * bus/policy.c (bus_client_policy_check_can_send, + bus_client_policy_check_can_receive): skip messages without an + interface when evaluating an allow rule, and thus pass it to the + default deny rules + +2008-02-26 John (J5) Palmieri <jo...@re...> + + * correctly unref connections without guids during shutdown + * dbus/dbus-connection.c (close_connection_on_shutdown): new method + split out from shared_connections_shutdown + (shared_connections_shutdown): shutdown all shared connections + without guids + (_dbus_connection_ref_unlocked): handle OOM when prepending no guid + connections to the shared_connections_no_guid list + * Patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + +2008-02-21 John (J5) Palmieri <jo...@re...> + + * fix build against the latest gcc/glibc + * dbus/dbus-sysdeps-unix.c: define _GNU_SOURCE + * bus/selinux.c: include limits.h + * Patch by Matthias Clasen <mclasen at redhat.com> + +2008-02-21 John (J5) Palmieri <jo...@re...> + + * fixes dbus-launch so the bus goes away when X does + (Red Hat Bug #430412) + * tools/dbus-launch.c (main): set xdisplay = NULL + * Patch by Matthias Clasen <mclasen at redhat.com> + 2008-01-17 John (J5) Palmieri <jo...@re...> * Released 1.1.4 Modified: branches/import/NEWS =================================================================== --- branches/import/NEWS 2008-03-10 18:06:40 UTC (rev 770) +++ branches/import/NEWS 2008-03-10 18:23:49 UTC (rev 771) @@ -1,3 +1,33 @@ +D-Bus 1.1.20 - "Conisten Water" (27 Febuary) +== + +- This is the next generation supported STABLE release of D-Bus. For all + intents and purposes this is the 1.2.0 release WITHOUT the planned X11/MIT + license change due to a couple of license holders who have yet to respond. + For the most part this license change is being persued to simplify licensing + issues and fix a couple of licensing courner cases. When this happens D-Bus + will be released under the 1.2.0 version. + +- D-Bus 1.0.x effectively goes into security fix mode and will only be + updated for major issues. + +- Fixed CVE-2008-0595 - security policy of the type <allow send_interface= + "some.interface.WithMethods"/> work as an implicit allow for + messages sent without an interface bypassing the default deny rules and + potentially allowing restricted methods exported on the bus to be executed + by unauthorized users. + +- Fixes dbus-launch so the session bus goes away so does D-Bus + +- Builds against latest gcc/glibc changes + +- Correctly unref connections without guids during shutdown + +- About the name: Submitted by Greg K Nicholson, Conisten Water is a lake in + Cumbria, England where several water speed records have been broken. Between + 1956 and 1959 Sir Malcolm's son Donald Campbell set four successive records on the lake in Bluebird K7, a hydroplane. + (Wikipedia http://en.wikipedia.org/wiki/Coniston_Water#Waterspeed_record) + D-Bus 1.1.4 - 1.2.0RC2 (17 January 2007) == - Fixes inotify support Modified: branches/import/bus/policy.c =================================================================== --- branches/import/bus/policy.c 2008-03-10 18:06:40 UTC (rev 770) +++ branches/import/bus/policy.c 2008-03-10 18:23:49 UTC (rev 771) @@ -942,9 +942,19 @@ if (rule->d.send.interface != NULL) { - if (dbus_message_get_interface (message) != NULL && - strcmp (dbus_message_get_interface (message), - rule->d.send.interface) != 0) + /* The interface is optional in messages. For allow rules, if the message + * has no interface we want to skip the rule (and thus not allow); + * for deny rules, if the message has no interface we want to use the + * rule (and thus deny). + */ + dbus_bool_t no_interface; + + no_interface = dbus_message_get_interface (message) == NULL; + + if ((no_interface && rule->allow) || + (!no_interface && + strcmp (dbus_message_get_interface (message), + rule->d.send.interface) != 0)) { _dbus_verbose (" (policy) skipping rule for different interface\n"); continue; @@ -1128,9 +1138,19 @@ if (rule->d.receive.interface != NULL) { - if (dbus_message_get_interface (message) != NULL && - strcmp (dbus_message_get_interface (message), - rule->d.receive.interface) != 0) + /* The interface is optional in messages. For allow rules, if the message + * has no interface we want to skip the rule (and thus not allow); + * for deny rules, if the message has no interface we want to use the + * rule (and thus deny). + */ + dbus_bool_t no_interface; + + no_interface = dbus_message_get_interface (message) == NULL; + + if ((no_interface && rule->allow) || + (!no_interface && + strcmp (dbus_message_get_interface (message), + rule->d.receive.interface) != 0)) { _dbus_verbose (" (policy) skipping rule for different interface\n"); continue; Modified: branches/import/bus/selinux.c =================================================================== --- branches/import/bus/selinux.c 2008-03-10 18:06:40 UTC (rev 770) +++ branches/import/bus/selinux.c 2008-03-10 18:23:49 UTC (rev 771) @@ -34,6 +34,7 @@ #ifdef HAVE_ERRNO_H #include <errno.h> #endif +#include <limits.h> #include <pthread.h> #include <syslog.h> #include <selinux/selinux.h> Modified: branches/import/configure.in =================================================================== --- branches/import/configure.in 2008-03-10 18:06:40 UTC (rev 770) +++ branches/import/configure.in 2008-03-10 18:23:49 UTC (rev 771) @@ -3,7 +3,7 @@ m4_define([dbus_major_version], [1]) m4_define([dbus_minor_version], [1]) -m4_define([dbus_micro_version], [4]) +m4_define([dbus_micro_version], [20]) m4_define([dbus_version], [dbus_major_version.dbus_minor_version.dbus_micro_version]) AC_INIT(dbus, [dbus_version]) Modified: branches/import/dbus/dbus-connection.c =================================================================== --- branches/import/dbus/dbus-connection.c 2008-03-10 18:06:40 UTC (rev 770) +++ branches/import/dbus/dbus-connection.c 2008-03-10 18:23:49 UTC (rev 771) @@ -1438,8 +1438,25 @@ _DBUS_DEFINE_GLOBAL_LOCK (shared_connections); static DBusHashTable *shared_connections = NULL; +static DBusList *shared_connections_no_guid = NULL; static void +close_connection_on_shutdown (DBusConnection *connection) +{ + DBusMessage *message; + + dbus_connection_ref (connection); + _dbus_connection_close_possibly_shared (connection); + + /* Churn through to the Disconnected message */ + while ((message = dbus_connection_pop_message (connection))) + { + dbus_message_unref (message); + } + dbus_connection_unref (connection); +} + +static void shared_connections_shutdown (void *data) { int n_entries; @@ -1450,7 +1467,6 @@ while ((n_entries = _dbus_hash_table_get_n_entries (shared_connections)) > 0) { DBusConnection *connection; - DBusMessage *message; DBusHashIter iter; _dbus_hash_iter_init (shared_connections, &iter); @@ -1459,17 +1475,7 @@ connection = _dbus_hash_iter_get_value (&iter); _DBUS_UNLOCK (shared_connections); - - dbus_connection_ref (connection); - _dbus_connection_close_possibly_shared (connection); - - /* Churn through to the Disconnected message */ - while ((message = dbus_connection_pop_message (connection))) - { - dbus_message_unref (message); - } - dbus_connection_unref (connection); - + close_connection_on_shutdown (connection); _DBUS_LOCK (shared_connections); /* The connection should now be dead and not in our hash ... */ @@ -1480,6 +1486,21 @@ _dbus_hash_table_unref (shared_connections); shared_connections = NULL; + + if (shared_connections_no_guid != NULL) + { + DBusConnection *connection; + connection = _dbus_list_pop_first (&shared_connections_no_guid); + while (connection != NULL) + { + _DBUS_UNLOCK (shared_connections); + close_connection_on_shutdown (connection); + _DBUS_LOCK (shared_connections); + connection = _dbus_list_pop_first (&shared_connections_no_guid); + } + } + + shared_connections_no_guid = NULL; _DBUS_UNLOCK (shared_connections); } @@ -1589,7 +1610,18 @@ _dbus_connection_ref_unlocked (connection); if (guid == NULL) - return TRUE; /* don't store in the hash */ + { + _DBUS_LOCK (shared_connections); + + if (!_dbus_list_prepend (&shared_connections_no_guid, connection)) + { + _DBUS_UNLOCK (shared_connections); + return FALSE; + } + + _DBUS_UNLOCK (shared_connections); + return TRUE; /* don't store in the hash */ + } /* A separate copy of the key is required in the hash table, because * we don't have a lock on the connection when we are doing a hash Modified: branches/import/dbus/dbus-sysdeps-unix.c =================================================================== --- branches/import/dbus/dbus-sysdeps-unix.c 2008-03-10 18:06:40 UTC (rev 770) +++ branches/import/dbus/dbus-sysdeps-unix.c 2008-03-10 18:23:49 UTC (rev 771) @@ -22,6 +22,8 @@ * */ +#define _GNU_SOURCE + #include "dbus-internals.h" #include "dbus-sysdeps.h" #include "dbus-sysdeps-unix.h" Modified: branches/import/tools/dbus-launch.c =================================================================== --- branches/import/tools/dbus-launch.c 2008-03-10 18:06:40 UTC (rev 770) +++ branches/import/tools/dbus-launch.c 2008-03-10 18:23:49 UTC (rev 771) @@ -966,6 +966,8 @@ char write_pid_fd_as_string[MAX_FD_LEN]; char write_address_fd_as_string[MAX_FD_LEN]; + xdisplay = NULL; + if (close_stderr) do_close_stderr (); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-03-10 18:06:44
|
Revision: 770 http://windbus.svn.sourceforge.net/windbus/?rev=770&view=rev Author: chehrlic Date: 2008-03-10 11:06:40 -0700 (Mon, 10 Mar 2008) Log Message: ----------- update to 1.1.4 Modified Paths: -------------- branches/import/ChangeLog branches/import/NEWS branches/import/cmake/CMakeLists.txt branches/import/configure.in Modified: branches/import/ChangeLog =================================================================== --- branches/import/ChangeLog 2008-03-10 18:02:05 UTC (rev 769) +++ branches/import/ChangeLog 2008-03-10 18:06:40 UTC (rev 770) @@ -1,5 +1,23 @@ +2008-01-17 John (J5) Palmieri <jo...@re...> + + * Released 1.1.4 + +2008-01-17 Timo Hoenig <th...@su...> + * fix inotify support + * bus/dir-watch-inotify.c (_handle_inotify_watch): fix reading of the + inotify events. Also, use ssize_t not size_t for 'ret'. + * bus/dir-watch-inotify.c (bus_watch_directory): watch not only for + IN_MODIFY but also for IN_CREATE and IN_DELETE + * bus/dir-watch-inotify.c (bus_drop_all_directory_watches): drop the + inotify watches more elegantly by closing inotify:_fd, set inotify_fd to + -1 after dropping the watches + 2008-01-15 John (J5) Palmieri <jo...@re...> + * configure.in: post-release version bump + +2008-01-15 John (J5) Palmieri <jo...@re...> + * Released 1.1.3 (1.2.0RC1) 2008-01-15 John (J5) Palmieri <jo...@re...> Modified: branches/import/NEWS =================================================================== --- branches/import/NEWS 2008-03-10 18:02:05 UTC (rev 769) +++ branches/import/NEWS 2008-03-10 18:06:40 UTC (rev 770) @@ -1,3 +1,7 @@ +D-Bus 1.1.4 - 1.2.0RC2 (17 January 2007) +== +- Fixes inotify support + D-Bus 1.1.3 - 1.2.0RC1 (15 January 2007) == Modified: branches/import/cmake/CMakeLists.txt =================================================================== --- branches/import/cmake/CMakeLists.txt 2008-03-10 18:02:05 UTC (rev 769) +++ branches/import/cmake/CMakeLists.txt 2008-03-10 18:06:40 UTC (rev 770) @@ -4,7 +4,7 @@ set (VERSION_MAJOR "1") set (VERSION_MINOR "1") set (VERSION_RELEASE "1") -set (VERSION_PATCH "3") +set (VERSION_PATCH "4") if (VERSION_PATCH) set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}-${VERSION_PATCH}" ) else (VERSION_PATCH) Modified: branches/import/configure.in =================================================================== --- branches/import/configure.in 2008-03-10 18:02:05 UTC (rev 769) +++ branches/import/configure.in 2008-03-10 18:06:40 UTC (rev 770) @@ -3,7 +3,7 @@ m4_define([dbus_major_version], [1]) m4_define([dbus_minor_version], [1]) -m4_define([dbus_micro_version], [3]) +m4_define([dbus_micro_version], [4]) m4_define([dbus_version], [dbus_major_version.dbus_minor_version.dbus_micro_version]) AC_INIT(dbus, [dbus_version]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-03-10 18:02:19
|
Revision: 769 http://windbus.svn.sourceforge.net/windbus/?rev=769&view=rev Author: chehrlic Date: 2008-03-10 11:02:05 -0700 (Mon, 10 Mar 2008) Log Message: ----------- update to 1.1.3 Modified Paths: -------------- branches/import/AUTHORS branches/import/ChangeLog branches/import/HACKING branches/import/NEWS branches/import/bus/Makefile.am branches/import/bus/activation-helper.c branches/import/bus/bus.c branches/import/bus/config-parser.c branches/import/bus/connection.c branches/import/bus/dir-watch-dnotify.c branches/import/bus/main.c branches/import/bus/messagebus.in branches/import/bus/selinux.c branches/import/bus/selinux.h branches/import/bus/signals.c branches/import/bus/signals.h branches/import/cmake/CMakeLists.txt branches/import/cmake/dbus/dbus-1.def.cmake branches/import/config.h.in branches/import/configure.in branches/import/dbus/Makefile.am branches/import/dbus/dbus-address.c branches/import/dbus/dbus-arch-deps.h.in branches/import/dbus/dbus-auth-script.c branches/import/dbus/dbus-auth-util.c branches/import/dbus/dbus-auth.c branches/import/dbus/dbus-bus.c branches/import/dbus/dbus-connection.c branches/import/dbus/dbus-connection.h branches/import/dbus/dbus-errors.c branches/import/dbus/dbus-errors.h branches/import/dbus/dbus-internals.c branches/import/dbus/dbus-internals.h branches/import/dbus/dbus-keyring.c branches/import/dbus/dbus-macros.h branches/import/dbus/dbus-marshal-recursive.c branches/import/dbus/dbus-marshal-validate.c branches/import/dbus/dbus-message-util.c branches/import/dbus/dbus-message.c branches/import/dbus/dbus-misc.c branches/import/dbus/dbus-misc.h branches/import/dbus/dbus-object-tree.c branches/import/dbus/dbus-object-tree.h branches/import/dbus/dbus-protocol.h branches/import/dbus/dbus-server-socket.c branches/import/dbus/dbus-server.c branches/import/dbus/dbus-sha.c branches/import/dbus/dbus-shell.c branches/import/dbus/dbus-shell.h branches/import/dbus/dbus-spawn.c branches/import/dbus/dbus-string-util.c branches/import/dbus/dbus-string.c branches/import/dbus/dbus-string.h branches/import/dbus/dbus-sysdeps-unix.c branches/import/dbus/dbus-sysdeps-unix.h branches/import/dbus/dbus-sysdeps-util-unix.c branches/import/dbus/dbus-sysdeps.c branches/import/dbus/dbus-sysdeps.h branches/import/dbus/dbus-transport-socket.c branches/import/dbus/dbus-transport.c branches/import/dbus/dbus-userdb.c branches/import/dbus/dbus-uuidgen.c branches/import/doc/dbus-specification.xml branches/import/doc/introspect.xsl branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service branches/import/test/data/valid-config-files-system/debug-allow-all-fail.conf branches/import/test/data/valid-config-files-system/debug-allow-all-pass.conf branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service branches/import/test/name-test/run-test.sh branches/import/tools/dbus-launch-x11.c branches/import/tools/dbus-launch.c branches/import/tools/dbus-send.1 branches/import/tools/run-with-tmp-session-bus.sh Added Paths: ----------- branches/import/bus/dir-watch-inotify.c Modified: branches/import/AUTHORS =================================================================== --- branches/import/AUTHORS 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/AUTHORS 2008-03-10 18:02:05 UTC (rev 769) @@ -11,10 +11,12 @@ Christian Ehrlicher <ch....@gm...> Harald Fernengel <ha...@kd...> Owen Fraser-Green <ow...@di...> +Peter O'Gorman <po...@th...> Jens Granseuer <je...@gm...> Ralf Habacker <ral...@fr...> Mikael Hallendal <mi...@co...> Kimmo Hämäläinen <kim...@no...> +Magnus Henoch <hen...@dt...> Kristian Høgsberg <kr...@re...> Iain Holmes <ia...@op...> Richard Hughes <ri...@hu...> @@ -23,6 +25,8 @@ Alex Larsson <al...@re...> Bernard Leak <be...@br...> Tor Lillqvist <tm...@ik...> +Ryan Lortie <de...@de...> +Andrea Luzzardi <sc...@si...> Marcelo Ricardo Leitner <mar...@te...> Thiago Macieira <th...@kd...> Kjartan Maraas <km...@gn...> Modified: branches/import/ChangeLog =================================================================== --- branches/import/ChangeLog 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/ChangeLog 2008-03-10 18:02:05 UTC (rev 769) @@ -1,5 +1,437 @@ +2008-01-15 John (J5) Palmieri <jo...@re...> + + * Released 1.1.3 (1.2.0RC1) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * fix hacking to say git instead of cvs + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Sébastien Couret <10function at gmail dot com> + + * dbus/dbus-marshal-recursive.c (all_reader_classes[]): wrap in + #ifndef DBUS_DISABLE_ASSERT since it is only used in asserts which + are noop + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Magnus Henoch <henoch plus bfdo at dtek dot chalmers dot se> + + * dbus/dbus-auth.c (handle_server_data_external_mech): handle SASL + EXTERNAL's inital empty responce (FDO Bug #9945) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * bus/messagebus.in: add lsb headers (FDO Bug #11491) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Peter O'Gorman <pogma at thewrittenword dot com> + + * dbus/dbus-spawn.c (babysit_signal_handler): check write return value + so we don't hang (FDO Bug #11665) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Peter O'Gorman <pogma at thewrittenword dot com> + + * dbus/dbus-sysdeps.h: support for AIX poll implementation (FDO Bug + #11666) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * tests/name-test/run-test.sh: make more portable (FDO Bug #11667) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * dbus/dbus-connection.c (_dbus_connection_get_next_client_serial): + don't check for < 0 on an unsigned variable (FDO Bug #12924) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * bus/bus.c (setup_server): check failed allocation (FDO Bug #12920) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * dbus/dbus-spawn.c (_dbus_spawn_async_with_babysitter): the API + contract says sitter_p can be NULL, so let's check it (FDO Bug #12919) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * dbus/dbus-spawn.c (read_ints, read_pid): use correct ssize_t type + instead of size_t (FDO Bug #12862) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * dbus/dbus-errors.c (dbus_set_error): make sure to call va_end if we + hit an OOM error inside va_start (FDO Bug #12846) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * dbus/dbus-connection.c (dbus_connection_send_with_reply): + fix possible crash if pending_return is NULL (FDO Bug #12673) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * portions of patch submitted by Tim Mooney + <enchanter at users dot sourceforge dot net> + + * configure.in: never auto-select libxml (FDO Bug #12479) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patches by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * dbus/dbus-sysdeps-unix (_dbus_get_autolaunch_address): handle OOM + (FDO Bug #12945) + + * dbus/dbus-uuidgen.c (return_uuid): handle OOM (FDO Bug #12928) + + * dbus/dbus-misc.c (dbus_get_local_machine_id): handle OOM, fix return + value to return NULL not FALSE (FDO Bug #12946) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * bus/bus.c (bus_context_check_security_policy): rewrite selinux error + handling to not abort due to a NULL read and to set the error only if + it is not already set (Based off of FDO Bug #12430) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * dbus/dbus-internals.c (_dbus_read_uuid_file_without_creating, + _dbus_create_uuid_file_exclusively): add OOM handling (FDO Bug #12952) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * dbus/dbus-spawn.c (babysit, babysitter_iteration): add error + handling when polling (FDO Bug #12954) + +2008-01-15 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * bus/config-parser.c (locate_attributes): remove dead code which + always evaluated to TRUE + + * dbus/dbus-shell.c (_dbus_shell_quote): remove unused code + +2008-01-14 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * bus/connection.c (bus_connection_complete): plug a possible + BusClientPolicy leak (FDO Bug #13242) + +2008-01-14 John (J5) Palmieri <jo...@re...> + + * patch by Frederic Crozat <fcrozat at mandriva dot com> (FDO Bz# + 13268) + + * add inotify support + + * bus/Makefile.am: add inotify module to the build + + * bus/dir-watch-inotify.c: inotify module based off the dnotify and + kqueue modules + + * configure.in: add checks and switch for inotify + also add a printout at the end of configure if inotify and kqueue + support is being built in (dnotify already had this) + +2008-01-14 John (J5) Palmieri <jo...@re...> + + * patch by Frederic Crozat <fcrozat at mandriva dot com> + + * bus/dir-watch-dnotify.c (bus_watch_directory): watch for file + creates also + +2008-01-14 John (J5) Palmieri <jo...@re...> + + * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> + + * dbus/dbus-transport-socket.c(do_reading): return message + loader buffer in case of OOM (FDO Bug#12666) + +2008-01-14 John (J5) Palmieri <jo...@re...> + + * configure.in: add warning to output when libxml is selected since + we don't have a libxml maintainer and expat works perfectly fine + for what we need an xml parser for + +2008-01-14 John (J5) Palmieri <jo...@re...> + + * Patch by Andrea Luzzardi <scox at sig11 dot org>: creates a + _dbus_geteuid function to fix EXTERNAL authentication in setuid + applications + + * dbus/dbus-sysdeps-unix.c (_dbus_geteuid): used to get the effective + uid of the running program + (_dbus_credentials_add_from_current_process): use geteuid instead of + getuid + (_dbus_append_user_from_current_process): use geteuid instead of + getuid + + * dbus/dbus-sysdeps-util-unix.c (_dbus_change_to_daemon_user): use + geteuid instead of getuid + (_dbus_unix_user_is_at_console): use geteuid instead of getuid + + * dbus/dbus-sysdeps-win.c (_dbus_geteuid): add a windows equivilant + that returns DBUS_UID_UNSET + +2007-12-18 Havoc Pennington <hp...@re...> + + * dbus/dbus-connection.c (_dbus_connection_block_pending_call): + fix location of curly braces + +2007-11-23 Sjoerd Simons <sj...@lu...> + + * tools/dbus-launch.c: let both a normal dbus-launch and an + autolaunched bus save their parameters in X11 if possible. This makes + the autolaunch and non-autolaunch behaviour more similar. With the + exception that on a normal launch there will always be a new session + bus and not being able to save parameters is not fatal. This also + enables to launch programs directly with autolaunch (not very usefull + though). + +2007-10-31 Havoc Pennington <hp...@re...> + + * bus/selinux.c (log_audit_callback): rewrite to use + _dbus_string_copy_to_buffer_with_nul() + + * dbus/dbus-string.c (_dbus_string_copy_to_buffer): change to NOT + nul-terminate the buffer; fail an assertion if there is not enough + space in the target buffer. This fixes two bugs where + copy_to_buffer was used to copy the binary bytes in a UUID, where + nul termination did not make sense. Bug reported by David Castelow. + (_dbus_string_copy_to_buffer_with_nul): new function that always + nul-terminates the buffer, and fails an assertion if there is not + enough space in the buffer. + +2007-10-23 Havoc Pennington <hp...@re...> + + * bus/bus.c (bus_context_new): use the new name here + + * bus/selinux.c (bus_selinux_audit_init): rename from audit_init() + to avoid possible libc conflict, and declare it in .h file to + avoid a warning + +2007-10-19 Havoc Pennington <hp...@re...> + + * bus/bus.c (bus_context_new): put audit_init() in HAVE_SELINUX + +2007-10-19 Havoc Pennington <hp...@re...> + + * bus/bus.c (bus_context_new): put the audit_init() in here + instead, which I believe ends up being the same as where it was + before, though I'm not sure I understand why it goes here. + + * dbus/dbus-sysdeps-util-unix.c (_dbus_change_to_daemon_user): + remove audit_init() from here, this file can't depend on code in + bus/ directory + +2007-10-16 Simon McVittie <sim...@co...> + + * configure.in: *Actually* fix detection of i486 atomic ops - + my previous attempt at a fix would always enable them due to wrong + quoting. Patch from Colin Walters <wa...@ve...> + +2007-10-11 Simon McVittie <sim...@co...> + + * configure.in: enable Autoconf's AC_C_INLINE to avoid compilation + failure with gcc -ansi + * dbus/dbus-macros.h, dbus/dbus-arch-deps.h.in: Use new macro + _DBUS_GNUC_EXTENSION (the same as G_GNUC_EXTENSION) to avoid -ansi + warnings about use of "long long". + * dbus/dbus-server-socket.c: remove unused variable when assertions + are disabled + * dbus/dbus-marshal-validate.c: avoid empty statements by removing + stray semicolons + * tools/dbus-launch.c: convert C++-style comment to C-style, add {} + for clarity + * .gitignore: ignore vi swapfiles + * dbus/dbus-errors.h, dbus/dbus-errors.c: Add DBUS_ERROR_INIT macro, + equivalent to calling dbus_error_init() on an uninitialized DBusError + * dbus/dbus-address.c, dbus/dbus-auth-script.c, dbus/dbus-auth-util.c, + dbus/dbus-connection.c, dbus/dbus-internals.c, dbus/dbus-keyring.c, + dbus/dbus-message-util.c, dbus/dbus-server.c, dbus/dbus-sha.c, + dbus/dbus-spawn-win.c, dbus/dbus-spawn.c, + dbus/dbus-sysdeps-util-win.c, dbus/dbus-transport-socket.c, + dbus/dbus-transport.c, dbus/dbus-userdb.c: use that macro instead of + calling dbus_error_init() where it's clearly equivalent + * configure.in, dbus/dbus-sysdeps.h, dbus/dbus-sysdeps-unix.c: Fix + detection of i486 atomic ops. Previously, the attempts to determine + support at compile-time on Darwin were causing the i486 atomic ops to + be used on *all* i386 or x86-64 GCC builds (AH_VERBATIM can't be + conditionalized like we were trying to). + +2007-10-10 Simon McVittie <sim...@co...> + + * dbus/dbus-errors.c, dbus/dbus-protocol.h: Add new error + org.freedesktop.DBus.Error.ObjectPathInUse + * dbus/dbus-object-tree.h, dbus/dbus-object-tree.c, + dbus/dbus-connection.c, dbus/dbus-connection.h: add new functions + dbus_connection_try_register_object_path and + dbus_connection_try_register_fallback, which raise ObjectPathInUse + rather than asserting, to make object path registration less painful + for bindings + * .gitignore: add various things that weren't in .cvsignore because + CVS implicitly ignored them; generally bring up to date + +2007-10-09 John (J5) Palmieri <jo...@re...> + + * tools/run-with-tmp-session-bus.sh: Fix env exports for better + portability (#9280) + * tools/dbus-send.1: Document syntax for container types in dbus-send + man file (#9553) - patch from Jack Spaar <jspaar at + users.sourceforge.net> + + [Both OK for MIT/X11 relicensing -smcv] + +2007-10-09 Simon McVittie <sim...@co...> + + * doc/dbus-specification.xml: Specifically forbid empty structs (#7969) + * doc/dbus-specification.xml: Patches from Kristoffer Lundén to clarify + description of DBUS_COOKIE_SHA1 (#10184) and allowable contents of a + variant (#10185, amended as per Havoc's comments) + + [All of the above are OK for MIT/X11 licensing] + +2007-10-03 John (J5) Palmieri <jo...@re...> + + * dbus/dbus-internals.h: fd.o bug #11678 Don't error out if compiler + does not support vararg macros. _dbus_verbose is the only function + that does this so make it a noop if vararg macros are not supported + * bus/selinux.c, dbus/dbus-sysdeps-util-unix.c: fd.o bug #12429 + Reverse check to setpcap and only init audit if we were root + (patch by Dan Walsh <dw...@re...>, + https://bugs.freedesktop.org/show_bug.cgi?id=12429). Reverse + we_were_root check to setpcap if we were root. Also only init audit + if we were root. So error dbus message will not show up when policy + reload happens. dbus -session will no longer try to send audit + message, only system will. + * configure.in: fd.o bug #11872 improve linker test for --gc-sections. + Patch by Tim Mooney <enchanter at users.sourceforge.net> + * configure.in, dbus/dbus-sysdeps.c: fd.o bug #11872 fix clearenv for + systems that do not have it. Patch from Brian Cameron <brian.cameron + at sun.com> + * tools/dbus-launch.c: fd.o bug #12547 remove superfluous if. + Also convert tabs to spaces + * configure.in, bus/Makefile.am, dbus/Makefile.am: Correctly implement + -fPIC and -fPIE. For security reasons we want possition independent + code for libraries and possition independent executable for + executables. Before we were just enabling -fPIC. Now we correctly + enable -fPIC and -PIE for libdbus and the bus respectively. Proper + LD_FLAGS are set for each also. + +2007-09-20 Ryan Lortie <de...@de...> + + Add argument path matching support. Bug #11066. + + * dbus/signals.c (struct DBusMatchRule, bus_match_rule_new, + bus_match_rule_set_arg, bus_match_rule_parse_arg_match, + match_rule_matches): Add support for parsing and matching on + arg0path='/some/path' type rules. + + * dbus/signals.h (bus_match_rule_set_arg): change to take const + DBusString instead of const char * for the string to match against. + + * dbus/dbus-bus.c: add a quick note to dbus_bus_add_match + documentation about the path matching. + + * doc/dbus-specification.xml: add a more detailed description of the + changes here. + +2007-09-19 Ryan Lortie <de...@de...> + + Add support for compacting DBusStrings to release wasted memory. + + * dbus/dbus-string.[ch] (compact, _dbus_string_compact, + _dbus_string_lock): new compact function to free up allocated memory + that is no longer used. + + * dbus/dbus-message.c (load_message): call _dbus_string_compact on the + message loader buffer. + + * dbus/dbus-transport-socket.c (do_reading, do_writing): call + _dbus_string_compact on the incoming/outgoing "encoded" buffers. + + * dbus/dbus-string-util.c (_dbus_string_test): add a few tests for + string compacting. + +2007-09-13 Ryan Lortie <de...@de...> + + * HACKING: add more explicit git branch/tag instructions + +2007-09-13 Ryan Lortie <de...@de...> + + migrate from cvs to git (cvs2svn -> git-svnimport). + + * HACKING: update release/branch/tag instructions + * */.cvsignore: rename to .gitignore + + also, clean up tags and branch names to conform to HACKING + +2007-08-17 William Jon McCann <mc...@jh...> + + * update-dbus-docs.sh: upload DTD to server + +2007-08-17 Havoc Pennington <hp...@re...> + + * tools/dbus-launch-x11.c (set_address_in_x11): fix from Michael + Lorenz to use long not int with XChangeProperty format 32 + + * dbus/dbus-sysdeps-util-unix.c + (_dbus_write_pid_to_file_and_pipe): factor this out, and use the + same code in _dbus_become_daemon (where the parent writes the pid + file and to the pid pipe) and in bus_context_new (where the daemon + writes its own pid file and to its own pid pipe) + + * bus/bus.c (bus_context_new): close the pid pipe after we print + to it. Also, don't write the pid to the pipe twice when we fork, + someone reported this bug a long time ago. + +2007-08-03 Havoc Pennington <hp...@re...> + + * configure.in: add major/minor/micro version number AC_SUBST + + * dbus/dbus-arch-deps.h.in (DBUS_MAJOR_VERSION, + DBUS_MINOR_VERSION, DBUS_MICRO_VERSION, DBUS_VERSION_STRING, + DBUS_VERSION): collection of macros to get version of library we + are compiled against. + + * dbus/dbus-misc.c (dbus_get_version): new function, to get + version of library we are linked against at runtime. + +2007-07-30 Havoc Pennington <hp...@re...> + + * bus/activation-helper.c (check_bus_name): don't use + _dbus_check_valid_bus_name() which is only around with + --enable-checks, instead use _dbus_validate_bus_name(). + Bug #11766 from Diego <di...@pe...> + 2007-07-27 Havoc Pennington <hp...@re...> + * configure.in: post-release version bump + +2007-07-27 Havoc Pennington <hp...@re...> + * release 1.1.2 2007-07-26 Havoc Pennington <hp...@re...> @@ -570,7 +1002,7 @@ 2007-06-14 Havoc Pennington <hp...@re...> * bus/dispatch.c (check_get_connection_unix_process_id): mop up - getpid() (noticed by Peter KKümmel) and adapt the test to + getpid() (noticed by Peter Kümmel) and adapt the test to expect a "pid unknown" error when running on Windows. 2007-06-14 Havoc Pennington <hp...@re...> @@ -633,7 +1065,7 @@ 2007-06-14 Simon McVittie <sim...@co...> * doc/dbus-specification.xml: say the protocol version is 1 instead of - 0 (patch from Kristoffer Lund\xE9n, fd.o#10033) and remove the FIXME + 0 (patch from Kristoffer Lundén, fd.o#10033) and remove the FIXME about removing protocol version from messages (as per Havoc's comment on that bug) @@ -1358,7 +1790,7 @@ 2006-12-12 John (J5) Palmieri <jo...@re...> * bus/signal.c: Fix match_rule_equal errata - (CVE-2006-6107 - Patch from Kimmo Hämäläinen + (CVE-2006-6107 - Patch from Kimmo Hämäläinen <kim...@no...>) 2006-11-19 Thiago Macieira <th...@kd...> Modified: branches/import/HACKING =================================================================== --- branches/import/HACKING 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/HACKING 2008-03-10 18:02:05 UTC (rev 769) @@ -76,28 +76,31 @@ - add a ChangeLog entry containing the version number you're releasing ("Released 0.3" or something) so people can see which changes were before and after - a given release. + a given release - - The version number should have major.minor.micro even + - the version number should have major.minor.micro even if micro is 0, i.e. "1.0.0" and "1.2.0" not "1.0"/"1.2" - "make distcheck" (DO NOT just "make dist" - pass the check!) - if make distcheck fails, fix it. - - once distcheck succeeds, "cvs commit" + - once distcheck succeeds, "git-commit -a". This is the version + of the tree that corresponds exactly to the released tarball. - - if someone else made changes and the commit fails, - you have to "cvs up" and run "make distcheck" again + - tag the tree with "git-tag -s -m 'Released X.Y.Z' dbus-X.Y.Z" + where X.Y.Z is the version of the release. If you can't sign + then simply created an unannotated tag: "git-tag dbus-X.Y.Z". - - once the commit succeeds, "cvs tag DBUS_X_Y_Z" where - X_Y_Z map to version X.Y.Z - - bump the version number up in configure.in, and commit it. Make sure you do this *after* tagging the previous - release! The idea is that CVS has a newer version number + release! The idea is that git has a newer version number than anything released. + - push your changes to the central repository with "git-push" + + - push your new tag, too: "git-push origin dbus-X.Y.Z" + - scp your tarball to freedesktop.org server and copy it to /srv/dbus.freedesktop.org/www/releases/dbus. This should be possible if you're in group "dbus" @@ -118,7 +121,7 @@ After making a ".0" stable release === -After releasing, when you increment the version number in CVS, also +After releasing, when you increment the version number in git, also move the ChangeLog to ChangeLog.pre-X-Y where X-Y is what you just released, e.g. ChangeLog.pre-1-0. Then create and cvs add a new empty ChangeLog. The last entry in ChangeLog.pre-1-0 should be the one about @@ -131,16 +134,16 @@ a not-suitable-for-stable change they want to make and then branch to allow committing that change. -The branch name should be DBUS_X_Y_BRANCH which is a branch that has +The branch name should be dbus-X.Y-branch which is a branch that has releases versioned X.Y.Z -To branch, tag HEAD with DBUS_X_Y_BRANCHPOINT: - cvs tag DBUS_X_Y_BRANCHPOINT -then create the branch from that tag: - cvs rtag -b -r DBUS_X_Y_BRANCHPOINT DBUS_X_Y_BRANCH dbus +To branch: + git branch dbus-X.Y-branch +and upload the branch tag to the server: + git-push origin dbus-X.Y-branch -Note that DBUS_X_Y_BRANCHPOINT may not tag the same revision as the -DBUS_X_Y_0 release, since we may not branch immediately. +To develop in this branch: + git-checkout dbus-X.Y-branch Environment variables === Modified: branches/import/NEWS =================================================================== --- branches/import/NEWS 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/NEWS 2008-03-10 18:02:05 UTC (rev 769) @@ -1,3 +1,33 @@ +D-Bus 1.1.3 - 1.2.0RC1 (15 January 2007) +== + +- This release is intended to be Release Candidate 1 of major release + D-Bus 1.2.0. If nothing is found to be wrong with this release it + will become 1.2.0 within a week. If we need to make major changes + we will release an RC2 and start the process over again. + +- This is a development release, so API's may still change if problems + are found (though this is extreamly unlikely). + +- DTD for the introspection format is fixed and uploaded to the servers + +- Sources now reside in a git repository at + http://gitweb.freedesktop.org/?p=dbus/dbus.git;a=summary + +- Argument path matching of the type arg0path='/aa/bb/' is now supported + (see the specification for more information) + +- New error org.freedesktop.DBus.Error.ObjectPathInUse added + +- Autolaunched busses now save their parameters in X11 if possible making them + behave closer to busses launched through the normal mechanisms + +- inotify is now the default backend for watching configuration file changes + +- More support for the AIX platform has been added + +- Numerous bug fixes and performance enhancements + D-Bus 1.1.2 (27 July 2007) == Modified: branches/import/bus/Makefile.am =================================================================== --- branches/import/bus/Makefile.am 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/Makefile.am 2008-03-10 18:02:05 UTC (rev 769) @@ -1,7 +1,7 @@ configdir=$(sysconfdir)/dbus-1 -INCLUDES=-I$(top_srcdir) $(DBUS_BUS_CFLAGS) \ +INCLUDES=-I$(top_srcdir) $(DBUS_BUS_CFLAGS) @PIE_CFLAGS@ \ -DDBUS_SYSTEM_CONFIG_FILE=\""$(configdir)/system.conf"\" \ -DDAEMON_NAME=\"dbus-daemon\" -DDBUS_COMPILATION @@ -25,12 +25,16 @@ if DBUS_BUS_ENABLE_KQUEUE DIR_WATCH_SOURCE=dir-watch-kqueue.c else +if DBUS_BUS_ENABLE_INOTIFY +DIR_WATCH_SOURCE=dir-watch-inotify.c +else if DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX DIR_WATCH_SOURCE=dir-watch-dnotify.c else DIR_WATCH_SOURCE=dir-watch-default.c endif endif +endif BUS_SOURCES= \ activation.c \ @@ -77,7 +81,7 @@ $(DBUS_BUS_LIBS) \ $(top_builddir)/dbus/libdbus-convenience.la -dbus_daemon_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@ +dbus_daemon_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@ @PIE_LDFLAGS@ LAUNCH_HELPER_SOURCES= \ $(XML_SOURCES) \ Modified: branches/import/bus/activation-helper.c =================================================================== --- branches/import/bus/activation-helper.c 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/activation-helper.c 2008-03-10 18:02:05 UTC (rev 769) @@ -381,14 +381,20 @@ } static dbus_bool_t -check_bus_name (const char *bus_name, DBusError *error) +check_bus_name (const char *bus_name, + DBusError *error) { - if (!_dbus_check_is_valid_bus_name (bus_name)) + DBusString str; + + _dbus_string_init_const (&str, bus_name); + if (!_dbus_validate_bus_name (&str, 0, _dbus_string_get_length (&str))) { dbus_set_error (error, DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND, - "bus name '%s' not found\n", bus_name); + "bus name '%s' is not a valid bus name\n", + bus_name); return FALSE; } + return TRUE; } @@ -517,7 +523,8 @@ } dbus_bool_t -run_launch_helper (const char *bus_name, DBusError *error) +run_launch_helper (const char *bus_name, + DBusError *error) { BusConfigParser *parser; dbus_bool_t retval; Modified: branches/import/bus/bus.c =================================================================== --- branches/import/bus/bus.c 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/bus.c 2008-03-10 18:02:05 UTC (rev 769) @@ -208,9 +208,9 @@ BusServerData *bd; bd = dbus_new0 (BusServerData, 1); - if (!dbus_server_set_data (server, - server_data_slot, - bd, free_server_data)) + if (bd == NULL || !dbus_server_set_data (server, + server_data_slot, + bd, free_server_data)) { dbus_free (bd); BUS_SET_OOM (error); @@ -665,7 +665,7 @@ if (!_dbus_pipe_is_stdout_or_stderr (print_addr_pipe)) _dbus_pipe_close (print_addr_pipe, NULL); - + _dbus_string_free (&addr); } @@ -695,78 +695,48 @@ } } - /* Now become a daemon if appropriate */ - if ((force_fork != FORK_NEVER && context->fork) || force_fork == FORK_ALWAYS) - { - DBusString u; + /* Now become a daemon if appropriate and write out pid file in any case */ + { + DBusString u; - if (context->pidfile) - _dbus_string_init_const (&u, context->pidfile); - - if (!_dbus_become_daemon (context->pidfile ? &u : NULL, - print_pid_pipe, - error)) - { - _DBUS_ASSERT_ERROR_IS_SET (error); - goto failed; - } - } - else - { - /* Need to write PID file for ourselves, not for the child process */ - if (context->pidfile != NULL) - { - DBusString u; + if (context->pidfile) + _dbus_string_init_const (&u, context->pidfile); - _dbus_string_init_const (&u, context->pidfile); - - if (!_dbus_write_pid_file (&u, _dbus_getpid (), error)) - { - _DBUS_ASSERT_ERROR_IS_SET (error); - goto failed; - } - } - } + if ((force_fork != FORK_NEVER && context->fork) || force_fork == FORK_ALWAYS) + { + _dbus_verbose ("Forking and becoming daemon\n"); + + if (!_dbus_become_daemon (context->pidfile ? &u : NULL, + print_pid_pipe, + error)) + { + _DBUS_ASSERT_ERROR_IS_SET (error); + goto failed; + } + } + else + { + _dbus_verbose ("Fork not requested\n"); + + /* Need to write PID file and to PID pipe for ourselves, + * not for the child process. This is a no-op if the pidfile + * is NULL and print_pid_pipe is NULL. + */ + if (!_dbus_write_pid_to_file_and_pipe (context->pidfile ? &u : NULL, + print_pid_pipe, + _dbus_getpid (), + error)) + { + _DBUS_ASSERT_ERROR_IS_SET (error); + goto failed; + } + } + } - /* Write PID if requested */ - if (print_pid_pipe != NULL && _dbus_pipe_is_valid (print_pid_pipe)) - { - DBusString pid; - int bytes; - - if (!_dbus_string_init (&pid)) - { - BUS_SET_OOM (error); - goto failed; - } - - if (!_dbus_string_append_int (&pid, _dbus_getpid ()) || - !_dbus_string_append (&pid, "\n")) - { - _dbus_string_free (&pid); - BUS_SET_OOM (error); - goto failed; - } - - bytes = _dbus_string_get_length (&pid); - if (_dbus_pipe_write (print_pid_pipe, &pid, 0, bytes, error) != bytes) - { - /* pipe_write sets error on failure but not short write */ - if (error != NULL && !dbus_error_is_set (error)) - { - dbus_set_error (error, DBUS_ERROR_FAILED, - "Printing message bus PID: did not write enough bytes\n"); - } - _dbus_string_free (&pid); - goto failed; - } - - if (!_dbus_pipe_is_stdout_or_stderr (print_pid_pipe)) - _dbus_pipe_close (print_pid_pipe, NULL); - - _dbus_string_free (&pid); - } - + if (print_pid_pipe && _dbus_pipe_is_valid (print_pid_pipe) && + !_dbus_pipe_is_stdout_or_stderr (print_pid_pipe)) + _dbus_pipe_close (print_pid_pipe, NULL); + if (!process_config_postinit (context, parser, error)) { _DBUS_ASSERT_ERROR_IS_SET (error); @@ -789,6 +759,11 @@ _DBUS_ASSERT_ERROR_IS_SET (error); goto failed; } + +#ifdef HAVE_SELINUX + /* FIXME - why not just put this in full_init() below? */ + bus_selinux_audit_init (); +#endif } if (!bus_selinux_full_init ()) @@ -1205,27 +1180,23 @@ dbus_message_get_error_name (message), dest ? dest : DBUS_SERVICE_DBUS, error)) { + if (error != NULL && !dbus_error_is_set (error)) + { + dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, + "An SELinux policy prevents this sender " + "from sending this message to this recipient " + "(rejected message had interface \"%s\" " + "member \"%s\" error name \"%s\" destination \"%s\")", + dbus_message_get_interface (message) ? + dbus_message_get_interface (message) : "(unset)", + dbus_message_get_member (message) ? + dbus_message_get_member (message) : "(unset)", + dbus_message_get_error_name (message) ? + dbus_message_get_error_name (message) : "(unset)", + dest ? dest : DBUS_SERVICE_DBUS); + _dbus_verbose ("SELinux security check denying send to service\n"); + } - if (dbus_error_is_set (error) && - dbus_error_has_name (error, DBUS_ERROR_NO_MEMORY)) - { - return FALSE; - } - - - dbus_set_error (error, DBUS_ERROR_ACCESS_DENIED, - "An SELinux policy prevents this sender " - "from sending this message to this recipient " - "(rejected message had interface \"%s\" " - "member \"%s\" error name \"%s\" destination \"%s\")", - dbus_message_get_interface (message) ? - dbus_message_get_interface (message) : "(unset)", - dbus_message_get_member (message) ? - dbus_message_get_member (message) : "(unset)", - dbus_message_get_error_name (message) ? - dbus_message_get_error_name (message) : "(unset)", - dest ? dest : DBUS_SERVICE_DBUS); - _dbus_verbose ("SELinux security check denying send to service\n"); return FALSE; } Modified: branches/import/bus/config-parser.c =================================================================== --- branches/import/bus/config-parser.c 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/config-parser.c 2008-03-10 18:02:05 UTC (rev 769) @@ -582,9 +582,6 @@ va_end (args); - if (!retval) - return retval; - i = 0; while (attribute_names[i]) { Modified: branches/import/bus/connection.c =================================================================== --- branches/import/bus/connection.c 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/connection.c 2008-03-10 18:02:05 UTC (rev 769) @@ -1306,6 +1306,8 @@ BUS_SET_OOM (error); dbus_free (d->name); d->name = NULL; + bus_client_policy_unref (d->policy); + d->policy = NULL; return FALSE; } } Modified: branches/import/bus/dir-watch-dnotify.c =================================================================== --- branches/import/bus/dir-watch-dnotify.c 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/dir-watch-dnotify.c 2008-03-10 18:02:05 UTC (rev 769) @@ -60,7 +60,7 @@ goto out; } - if (fcntl (fd, F_NOTIFY, DN_DELETE|DN_RENAME|DN_MODIFY) == -1) + if (fcntl (fd, F_NOTIFY, DN_CREATE|DN_DELETE|DN_RENAME|DN_MODIFY) == -1) { _dbus_warn ("Cannot setup D_NOTIFY for '%s' error '%s'\n", dir, _dbus_strerror (errno)); close (fd); Added: branches/import/bus/dir-watch-inotify.c =================================================================== --- branches/import/bus/dir-watch-inotify.c (rev 0) +++ branches/import/bus/dir-watch-inotify.c 2008-03-10 18:02:05 UTC (rev 769) @@ -0,0 +1,163 @@ +/* -*- mode: C; c-file-style: "gnu" -*- */ +/* dir-watch-inotify.c OS specific directory change notification for message bus + * + * Copyright (C) 2003 Red Hat, Inc. + * (c) 2006 Mandriva + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include <config.h> + +#define _GNU_SOURCE +#include <stdlib.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/inotify.h> +#include <sys/types.h> +#include <signal.h> +#include <errno.h> + +#include <dbus/dbus-internals.h> +#include <dbus/dbus-watch.h> +#include "dir-watch.h" + +#define MAX_DIRS_TO_WATCH 128 +#define INOTIFY_EVENT_SIZE (sizeof(struct inotify_event)) +#define INOTIFY_BUF_LEN (1024 * (INOTIFY_EVENT_SIZE + 16)) + +/* use a static array to avoid handling OOM */ +static int wds[MAX_DIRS_TO_WATCH]; +static int num_wds = 0; +static int inotify_fd = -1; +static DBusWatch *watch = NULL; +static DBusLoop *loop = NULL; + +static dbus_bool_t +_inotify_watch_callback (DBusWatch *watch, unsigned int condition, void *data) +{ + return dbus_watch_handle (watch, condition); +} + +static dbus_bool_t +_handle_inotify_watch (DBusWatch *watch, unsigned int flags, void *data) +{ + char buffer[INOTIFY_BUF_LEN]; + ssize_t ret = 0; + int i = 0; + pid_t pid; + + ret = read (inotify_fd, buffer, INOTIFY_BUF_LEN); + if (ret < 0) + _dbus_verbose ("Error reading inotify event: '%s'\n, _dbus_strerror(errno)"); + else if (!ret) + _dbus_verbose ("Error reading inotify event: buffer too small\n"); + + while (i < ret) + { + struct inotify_event *ev; + pid = _dbus_getpid (); + + ev = (struct inotify_event *) &buffer[i]; + i += INOTIFY_EVENT_SIZE + ev->len; +#ifdef DBUS_ENABLE_VERBOSE_MODE + if (ev->len) + _dbus_verbose ("event name: '%s'\n", ev->name); + _dbus_verbose ("inotify event: wd=%d mask=%u cookie=%u len=%u\n", ev->wd, ev->mask, ev->cookie, ev->len); +#endif + _dbus_verbose ("Sending SIGHUP signal on reception of a inotify event\n"); + (void) kill (pid, SIGHUP); + } + + if (watch != NULL) + { + _dbus_loop_remove_watch (loop, watch, _inotify_watch_callback, NULL); + _dbus_watch_unref (watch); + watch = NULL; + } + + return TRUE; +} + +void +bus_watch_directory (const char *dir, BusContext *context) +{ + int wd; + + _dbus_assert (dir != NULL); + + if (inotify_fd == -1) { + inotify_fd = inotify_init (); + if (inotify_fd <= 0) { + _dbus_warn ("Cannot initialize inotify\n"); + goto out; + } + loop = bus_context_get_loop (context); + + watch = _dbus_watch_new (inotify_fd, DBUS_WATCH_READABLE, TRUE, + _handle_inotify_watch, NULL, NULL); + + if (watch == NULL) + { + _dbus_warn ("Unable to create inotify watch\n"); + goto out; + } + + if (!_dbus_loop_add_watch (loop, watch, _inotify_watch_callback, + NULL, NULL)) + { + _dbus_warn ("Unable to add reload watch to main loop"); + _dbus_watch_unref (watch); + watch = NULL; + goto out; + } + } + + if (num_wds >= MAX_DIRS_TO_WATCH ) + { + _dbus_warn ("Cannot watch config directory '%s'. Already watching %d directories\n", dir, MAX_DIRS_TO_WATCH); + goto out; + } + + wd = inotify_add_watch (inotify_fd, dir, IN_MODIFY | IN_CREATE | IN_DELETE); + if (wd < 0) + { + _dbus_warn ("Cannot setup inotify for '%s'; error '%s'\n", dir, _dbus_strerror (errno)); + goto out; + } + + wds[num_wds++] = wd; + _dbus_verbose ("Added watch on config directory '%s'\n", dir); + + out: + ; +} + +void +bus_drop_all_directory_watches (void) +{ + int ret; + + _dbus_verbose ("Dropping all watches on config directories\n"); + ret = close (inotify_fd); + if (ret) + _dbus_verbose ("Error dropping watches: '%s'\n", perror(ret)); + + num_wds = 0; + inotify_fd = -1; +} Modified: branches/import/bus/main.c =================================================================== --- branches/import/bus/main.c 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/main.c 2008-03-10 18:02:05 UTC (rev 769) @@ -452,6 +452,10 @@ exit (1); } + /* bus_context_new() closes the print_addr_pipe and + * print_pid_pipe + */ + setup_reload_pipe (bus_context_get_loop (context)); _dbus_set_signal_handler (SIGHUP, signal_handler); Modified: branches/import/bus/messagebus.in =================================================================== --- branches/import/bus/messagebus.in 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/messagebus.in 2008-03-10 18:02:05 UTC (rev 769) @@ -9,6 +9,16 @@ # processname: dbus-daemon # pidfile: @DBUS_SYSTEM_PID_FILE@ # +### BEGIN INIT INFO +# Provides: messagebus +# Required-Start: $syslog $local_fs +# Required-Stop: $syslog $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: The D-Bus systemwide message bus +# Description: This is a daemon which broadcasts notifications of system +# events and other messages. See http://www.freedesktop.org/software/dbus +### END INIT INFO # Sanity checks. [ -x @EXPANDED_BINDIR@/dbus-daemon ] || exit 0 Modified: branches/import/bus/selinux.c =================================================================== --- branches/import/bus/selinux.c 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/selinux.c 2008-03-10 18:02:05 UTC (rev 769) @@ -113,8 +113,8 @@ static int audit_fd = -1; #endif -static void -audit_init(void) +void +bus_selinux_audit_init(void) { #ifdef HAVE_LIBAUDIT audit_fd = audit_open (); @@ -178,7 +178,20 @@ log_audit_callback (void *data, security_class_t class, char *buf, size_t bufleft) { DBusString *audmsg = data; - _dbus_string_copy_to_buffer (audmsg, buf, bufleft); + + if (bufleft > (size_t) _dbus_string_get_length(audmsg)) + { + _dbus_string_copy_to_buffer_with_nul (audmsg, buf, bufleft); + } + else + { + DBusString s; + + _dbus_string_init_const(&s, "Buffer too small for audit message"); + + if (bufleft > (size_t) _dbus_string_get_length(&s)) + _dbus_string_copy_to_buffer_with_nul (&s, buf, bufleft); + } } /** @@ -350,12 +363,8 @@ freecon (bus_context); - audit_init (); - +#endif /* HAVE_SELINUX */ return TRUE; -#else - return TRUE; -#endif /* HAVE_SELINUX */ } /** Modified: branches/import/bus/selinux.h =================================================================== --- branches/import/bus/selinux.h 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/selinux.h 2008-03-10 18:02:05 UTC (rev 769) @@ -67,5 +67,6 @@ DBusError *error); +void bus_selinux_audit_init(void); #endif /* BUS_SELINUX_H */ Modified: branches/import/bus/signals.c =================================================================== --- branches/import/bus/signals.c 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/signals.c 2008-03-10 18:02:05 UTC (rev 769) @@ -40,10 +40,13 @@ char *destination; char *path; + unsigned int *arg_lens; char **args; int args_len; }; +#define BUS_MATCH_ARG_IS_PATH 0x8000000u + BusMatchRule* bus_match_rule_new (DBusConnection *matches_go_to) { @@ -86,6 +89,7 @@ dbus_free (rule->sender); dbus_free (rule->destination); dbus_free (rule->path); + dbus_free (rule->arg_lens); /* can't use dbus_free_string_array() since there * are embedded NULL @@ -205,15 +209,19 @@ { if (rule->args[i] != NULL) { + dbus_bool_t is_path; + if (_dbus_string_get_length (&str) > 0) { if (!_dbus_string_append (&str, ",")) goto nomem; } + + is_path = (rule->arg_lens[i] & BUS_MATCH_ARG_IS_PATH) != 0; if (!_dbus_string_append_printf (&str, - "arg%d='%s'", - i, + "arg%d%s='%s'", + i, is_path ? "path" : "", rule->args[i])) goto nomem; } @@ -346,23 +354,22 @@ } dbus_bool_t -bus_match_rule_set_arg (BusMatchRule *rule, - int arg, - const char *value) +bus_match_rule_set_arg (BusMatchRule *rule, + int arg, + const DBusString *value, + dbus_bool_t is_path) { + int length; char *new; _dbus_assert (value != NULL); - new = _dbus_strdup (value); - if (new == NULL) - return FALSE; - /* args_len is the number of args not including null termination * in the char** */ if (arg >= rule->args_len) { + unsigned int *new_arg_lens; char **new_args; int new_args_len; int i; @@ -371,12 +378,9 @@ /* add another + 1 here for null termination */ new_args = dbus_realloc (rule->args, - sizeof(rule->args[0]) * (new_args_len + 1)); + sizeof (char *) * (new_args_len + 1)); if (new_args == NULL) - { - dbus_free (new); - return FALSE; - } + return FALSE; /* NULL the new slots */ i = rule->args_len; @@ -387,16 +391,42 @@ } rule->args = new_args; + + /* and now add to the lengths */ + new_arg_lens = dbus_realloc (rule->arg_lens, + sizeof (int) * (new_args_len + 1)); + + if (new_arg_lens == NULL) + return FALSE; + + /* zero the new slots */ + i = rule->args_len; + while (i <= new_args_len) /* <= for null termination */ + { + new_arg_lens[i] = 0; + ++i; + } + + rule->arg_lens = new_arg_lens; rule->args_len = new_args_len; } + length = _dbus_string_get_length (value); + if (!_dbus_string_copy_data (value, &new)) + return FALSE; + rule->flags |= BUS_MATCH_ARGS; dbus_free (rule->args[arg]); + rule->arg_lens[arg] = length; rule->args[arg] = new; + if (is_path) + rule->arg_lens[arg] |= BUS_MATCH_ARG_IS_PATH; + /* NULL termination didn't get busted */ _dbus_assert (rule->args[rule->args_len] == NULL); + _dbus_assert (rule->arg_lens[rule->args_len] == 0); return TRUE; } @@ -688,8 +718,10 @@ const DBusString *value, DBusError *error) { + dbus_bool_t is_path; DBusString key_str; unsigned long arg; + int length; int end; /* For now, arg0='foo' always implies that 'foo' is a @@ -701,6 +733,7 @@ /* First we need to parse arg0 = 0, arg27 = 27 */ _dbus_string_init_const (&key_str, key); + length = _dbus_string_get_length (&key_str); if (_dbus_string_get_length (&key_str) < 4) { @@ -709,14 +742,24 @@ goto failed; } - if (!_dbus_string_parse_uint (&key_str, 3, &arg, &end) || - end != _dbus_string_get_length (&key_str)) + if (!_dbus_string_parse_uint (&key_str, 3, &arg, &end)) { dbus_set_error (error, DBUS_ERROR_MATCH_RULE_INVALID, "Key '%s' in match rule starts with 'arg' but could not parse arg number. Should be 'arg0' or 'arg7' for example.\n", key); goto failed; } + if (end != length && + ((end + 4) != length || + !_dbus_string_ends_with_c_str (&key_str, "path"))) + { + dbus_set_error (error, DBUS_ERROR_MATCH_RULE_INVALID, + "Key '%s' in match rule contains junk after argument number. Only 'path' is optionally valid ('arg0path' for example).\n", key); + goto failed; + } + + is_path = end != length; + /* If we didn't check this we could allocate a huge amount of RAM */ if (arg > DBUS_MAXIMUM_MATCH_RULE_ARG_NUMBER) { @@ -730,12 +773,11 @@ rule->args[arg] != NULL) { dbus_set_error (error, DBUS_ERROR_MATCH_RULE_INVALID, - "Key '%s' specified twice in match rule\n", key); + "Argument %d matched more than once in match rule\n", key); goto failed; } - if (!bus_match_rule_set_arg (rule, arg, - _dbus_string_get_const_data (value))) + if (!bus_match_rule_set_arg (rule, arg, value, is_path)) { BUS_SET_OOM (error); goto failed; @@ -1104,13 +1146,20 @@ i = 0; while (i < a->args_len) { + int length; + if ((a->args[i] != NULL) != (b->args[i] != NULL)) return FALSE; + if (a->arg_lens[i] != b->arg_lens[i]) + return FALSE; + + length = a->arg_lens[i] & ~BUS_MATCH_ARG_IS_PATH; + if (a->args[i] != NULL) { _dbus_assert (b->args[i] != NULL); - if (strcmp (a->args[i], b->args[i]) != 0) + if (memcmp (a->args[i], b->args[i], length) != 0) return FALSE; } @@ -1399,14 +1448,19 @@ { int current_type; const char *expected_arg; + int expected_length; + dbus_bool_t is_path; expected_arg = rule->args[i]; + expected_length = rule->arg_lens[i] & ~BUS_MATCH_ARG_IS_PATH; + is_path = (rule->arg_lens[i] & BUS_MATCH_ARG_IS_PATH) != 0; current_type = dbus_message_iter_get_arg_type (&iter); if (expected_arg != NULL) { const char *actual_arg; + int actual_length; if (current_type != DBUS_TYPE_STRING) return FALSE; @@ -1415,8 +1469,29 @@ dbus_message_iter_get_basic (&iter, &actual_arg); _dbus_assert (actual_arg != NULL); - if (strcmp (expected_arg, actual_arg) != 0) - return FALSE; + actual_length = strlen (actual_arg); + + if (is_path) + { + if (actual_length < expected_length && + actual_arg[actual_length - 1] != '/') + return FALSE; + + if (expected_length < actual_length && + expected_arg[expected_length - 1] != '/') + return FALSE; + + if (memcmp (actual_arg, expected_arg, + MIN (actual_length, expected_length)) != 0) + return FALSE; + } + else + { + if (expected_length != actual_length || + memcmp (expected_arg, actual_arg, expected_length) != 0) + return FALSE; + } + } if (current_type != DBUS_TYPE_INVALID) Modified: branches/import/bus/signals.h =================================================================== --- branches/import/bus/signals.h 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/bus/signals.h 2008-03-10 18:02:05 UTC (rev 769) @@ -44,21 +44,22 @@ BusMatchRule* bus_match_rule_ref (BusMatchRule *rule); void bus_match_rule_unref (BusMatchRule *rule); -dbus_bool_t bus_match_rule_set_message_type (BusMatchRule *rule, - int type); -dbus_bool_t bus_match_rule_set_interface (BusMatchRule *rule, - const char *interface); -dbus_bool_t bus_match_rule_set_member (BusMatchRule *rule, - const char *member); -dbus_bool_t bus_match_rule_set_sender (BusMatchRule *rule, - const char *sender); -dbus_bool_t bus_match_rule_set_destination (BusMatchRule *rule, - const char *destination); -dbus_bool_t bus_match_rule_set_path (BusMatchRule *rule, - const char *path); -dbus_bool_t bus_match_rule_set_arg (BusMatchRule *rule, - int arg, - const char *value); +dbus_bool_t bus_match_rule_set_message_type (BusMatchRule *rule, + int type); +dbus_bool_t bus_match_rule_set_interface (BusMatchRule *rule, + const char *interface); +dbus_bool_t bus_match_rule_set_member (BusMatchRule *rule, + const char *member); +dbus_bool_t bus_match_rule_set_sender (BusMatchRule *rule, + const char *sender); +dbus_bool_t bus_match_rule_set_destination (BusMatchRule *rule, + const char *destination); +dbus_bool_t bus_match_rule_set_path (BusMatchRule *rule, + const char *path); +dbus_bool_t bus_match_rule_set_arg (BusMatchRule *rule, + int arg, + const DBusString *value, + dbus_bool_t is_path); BusMatchRule* bus_match_rule_parse (DBusConnection *matches_go_to, const DBusString *rule_text, Modified: branches/import/cmake/CMakeLists.txt =================================================================== --- branches/import/cmake/CMakeLists.txt 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/cmake/CMakeLists.txt 2008-03-10 18:02:05 UTC (rev 769) @@ -4,7 +4,7 @@ set (VERSION_MAJOR "1") set (VERSION_MINOR "1") set (VERSION_RELEASE "1") -set (VERSION_PATCH "2") +set (VERSION_PATCH "3") if (VERSION_PATCH) set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}-${VERSION_PATCH}" ) else (VERSION_PATCH) Modified: branches/import/cmake/dbus/dbus-1.def.cmake =================================================================== --- branches/import/cmake/dbus/dbus-1.def.cmake 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/cmake/dbus/dbus-1.def.cmake 2008-03-10 18:02:05 UTC (rev 769) @@ -437,7 +437,6 @@ _dbus_sha_test _dbus_sha_update _dbus_shell_parse_argv -_dbus_shell_quote _dbus_shell_unquote _dbus_signature_test _dbus_sleep_milliseconds @@ -653,7 +652,7 @@ _dbus_win_utf8_to_utf16 _dbus_win_warn_win_error _dbus_windows_user_is_process_owner -_dbus_write_pid_file +_dbus_write_pid_to_file_and_pipe _dbus_write_socket _dbus_write_socket_two dbus_address_entries_free Modified: branches/import/config.h.in =================================================================== --- branches/import/config.h.in 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/config.h.in 2008-03-10 18:02:05 UTC (rev 769) @@ -15,6 +15,9 @@ /* Use dnotify on Linux */ #undef DBUS_BUS_ENABLE_DNOTIFY_ON_LINUX +/* Use inotify */ +#undef DBUS_BUS_ENABLE_INOTIFY + /* Use kqueue */ #undef DBUS_BUS_ENABLE_KQUEUE @@ -45,15 +48,10 @@ /* Defined if gcov is enabled to force a rebuild due to config.h changing */ #undef DBUS_GCOV_ENABLED -/* Some atomic integer implementation present */ -#undef DBUS_HAVE_ATOMIC_INT +/* Always defined; expands to 1 if we have an atomic integer implementation, + else 0 */ +#undef DBUS_HAVE_ATOMIC_INT_COND - - #if (defined(__i386__) || defined(__x86_64__)) - # define DBUS_HAVE_ATOMIC_INT 1 - #endif - - /* Defined if we have gcc 3.3 and thus the new gcov format */ #undef DBUS_HAVE_GCC33_GCOV @@ -81,15 +79,10 @@ /* User for running the system BUS daemon */ #undef DBUS_USER -/* Use atomic integer implementation for 486 */ -#undef DBUS_USE_ATOMIC_INT_486 +/* Always defined; expands to 1 if we should use atomic integer implementation + for 486, else 0 */ +#undef DBUS_USE_ATOMIC_INT_486_COND - - #if (defined(__i386__) || defined(__x86_64__)) - # define DBUS_USE_ATOMIC_INT_486 1 - #endif - - /* A 'va_copy' style function */ #undef DBUS_VA_COPY @@ -111,6 +104,9 @@ /* Define to 1 if you have the `backtrace' function. */ #undef HAVE_BACKTRACE +/* Define to 1 if you have the `clearenv' function. */ +#undef HAVE_CLEARENV + /* Have cmsgcred structure */ #undef HAVE_CMSGCRED @@ -207,6 +203,9 @@ /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H +/* Define to 1 if you have the <sys/inotify.h> header file. */ +#undef HAVE_SYS_INOTIFY_H + /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H @@ -329,3 +328,9 @@ /* Define to 1 if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif Modified: branches/import/configure.in =================================================================== --- branches/import/configure.in 2008-03-10 17:09:14 UTC (rev 768) +++ branches/import/configure.in 2008-03-10 18:02:05 UTC (rev 769) @@ -1,7 +1,12 @@ dnl -*- mode: m4... [truncated message content] |
From: <che...@us...> - 2008-03-10 17:09:36
|
Revision: 768 http://windbus.svn.sourceforge.net/windbus/?rev=768&view=rev Author: chehrlic Date: 2008-03-10 10:09:14 -0700 (Mon, 10 Mar 2008) Log Message: ----------- make it compile & link - thx to Olivier Hochreutiner Modified Paths: -------------- branches/import/cmake/CMakeLists.txt branches/import/cmake/bus/CMakeLists.txt branches/import/cmake/config.h.cmake branches/import/cmake/dbus/CMakeLists.txt branches/import/cmake/dbus/dbus-1.def.cmake branches/import/cmake/test/CMakeLists.txt branches/import/dbus/dbus-spawn-win.c branches/import/dbus/dbus-sysdeps-util-win.c branches/import/dbus/dbus-sysdeps-win.c branches/import/dbus/dbus-sysdeps.c Modified: branches/import/cmake/CMakeLists.txt =================================================================== --- branches/import/cmake/CMakeLists.txt 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/cmake/CMakeLists.txt 2008-03-10 17:09:14 UTC (rev 768) @@ -10,6 +10,12 @@ else (VERSION_PATCH) set (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}" ) endif (VERSION_PATCH) +set (DBUS_MAJOR_VERSION ${VERSION_MAJOR}) +set (DBUS_MINOR_VERSION ${VERSION_MAJOR}) +set (DBUS_MICRO_VERSION ${VERSION_MAJOR}) +set (DBUS_MAJOR_VERSION ${VERSION_MAJOR}) +set (DBUS_VERSION ${VERSION}) +set (DBUS_VERSION_STRING "${VERSION}") project(${PACKAGE}) Modified: branches/import/cmake/bus/CMakeLists.txt =================================================================== --- branches/import/cmake/bus/CMakeLists.txt 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/cmake/bus/CMakeLists.txt 2008-03-10 17:09:14 UTC (rev 768) @@ -46,8 +46,11 @@ ${BUS_DIR}/bus.c ${BUS_DIR}/bus.h ${BUS_DIR}/config-parser.c - ${BUS_DIR}/config-parser.h - ${BUS_DIR}/connection.c + ${BUS_DIR}/config-parser.h + ${BUS_DIR}/config-parser-common.c + ${BUS_DIR}/config-parser-common.h +# ${BUS_DIR}/config-parser-trivial.c + ${BUS_DIR}/connection.c ${BUS_DIR}/connection.h ${BUS_DIR}/desktop-file.c ${BUS_DIR}/desktop-file.h Modified: branches/import/cmake/config.h.cmake =================================================================== --- branches/import/cmake/config.h.cmake 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/cmake/config.h.cmake 2008-03-10 17:09:14 UTC (rev 768) @@ -19,6 +19,12 @@ #cmakedefine PACKAGE "@PACKAGE@" /* Version number of package */ #cmakedefine VERSION "@VERSION@" +#cmakedefine DBUS_MAJOR_VERSION ${VERSION_MAJOR} +#cmakedefine DBUS_MINOR_VERSION ${VERSION_MINOR} +#cmakedefine DBUS_MICRO_VERSION ${VERSION_RELEASE} +#cmakedefine DBUS_VERSION ((@VERSION_MAJOR@ << 16) | (@VERSION_MINOR@ << 8) | (@VERSION_RELEASE@)) +#cmakedefine DBUS_VERSION_STRING "@VERSION@" + // test binaries /* Full path to test file test/test-exit in builddir */ #define TEST_BUS_BINARY "@TEST_BUS_BINARY@" Modified: branches/import/cmake/dbus/CMakeLists.txt =================================================================== --- branches/import/cmake/dbus/CMakeLists.txt 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/cmake/dbus/CMakeLists.txt 2008-03-10 17:09:14 UTC (rev 768) @@ -24,6 +24,7 @@ ${DBUS_DIR}/dbus-server.h ${DBUS_DIR}/dbus-shared.h ${DBUS_DIR}/dbus-signature.h + ${DBUS_DIR}/dbus-spawn.h ${DBUS_DIR}/dbus-threads.h ${DBUS_DIR}/dbus-types.h dbus-arch-deps.h Modified: branches/import/cmake/dbus/dbus-1.def.cmake =================================================================== --- branches/import/cmake/dbus/dbus-1.def.cmake 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/cmake/dbus/dbus-1.def.cmake 2008-03-10 17:09:14 UTC (rev 768) @@ -33,6 +33,7 @@ _dbus_auth_test _dbus_auth_unref _dbus_babysitter_get_child_exited +_dbus_babysitter_get_child_exit_status _dbus_babysitter_kill_child _dbus_babysitter_ref _dbus_babysitter_set_child_exit_error @@ -170,6 +171,7 @@ _dbus_get_malloc_blocks_outstanding _dbus_get_oom_wait _dbus_get_standard_session_servicedirs +_dbus_get_standard_system_servicedirs _dbus_get_tmpdir _dbus_getenv _dbus_getgid Modified: branches/import/cmake/test/CMakeLists.txt =================================================================== --- branches/import/cmake/test/CMakeLists.txt 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/cmake/test/CMakeLists.txt 2008-03-10 17:09:14 UTC (rev 768) @@ -141,21 +141,26 @@ ### keep these in creation order, i.e. uppermost dirs first set (TESTDIRS test/data - test/data/valid-messages - test/data/invalid-messages - test/data/incomplete-messages - test/data/auth - test/data/sha-1 - test/data/valid-config-files + test/data/auth + test/data/equiv-config-files + test/data/equiv-config-files/basic + test/data/equiv-config-files/basic/basic.d + test/data/equiv-config-files/entities + test/data/equiv-config-files/entities/basic.d + test/data/incomplete-messages + test/data/invalid-config-files + test/data/invalid-config-files-system + test/data/invalid-messages + test/data/invalid-service-files-system + test/data/sha-1 + test/data/valid-config-files test/data/valid-config-files/basic.d - test/data/valid-config-files/system.d - test/data/valid-service-files - test/data/invalid-config-files - test/data/equiv-config-files - test/data/equiv-config-files/basic - test/data/equiv-config-files/basic/basic.d - test/data/equiv-config-files/entities - test/data/equiv-config-files/entities/basic.d + test/data/valid-config-files/system.d + test/data/valid-config-files-system + test/data/valid-introspection-files + test/data/valid-messages + test/data/valid-service-files + test/data/valid-service-files-system ) set (CONFIG_VERBOSE 0) Modified: branches/import/dbus/dbus-spawn-win.c =================================================================== --- branches/import/dbus/dbus-spawn-win.c 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/dbus/dbus-spawn-win.c 2008-03-10 17:09:14 UTC (rev 768) @@ -269,6 +269,33 @@ } /** + * Gets the exit status of the child. We do this so implementation specific + * detail is not cluttering up dbus, for example the system launcher code. + * This can only be called if the child has exited, i.e. call + * _dbus_babysitter_get_child_exited(). It returns FALSE if the child + * did not return a status code, e.g. because the child was signaled + * or we failed to ever launch the child in the first place. + * + * @param sitter the babysitter + * @param status the returned status code + * @returns #FALSE on failure + */ +dbus_bool_t +_dbus_babysitter_get_child_exit_status (DBusBabysitter *sitter, + int *status) +{ + if (!_dbus_babysitter_get_child_exited (sitter)) + _dbus_assert_not_reached ("Child has not exited"); + + if (!sitter->have_child_status || + sitter->child_status == STILL_ACTIVE) + return FALSE; + + *status = sitter->child_status; + return TRUE; +} + +/** * Sets the #DBusError with an explanation of why the spawned * child process exited (on a signal, or whatever). If * the child process has not exited, does nothing (error Modified: branches/import/dbus/dbus-sysdeps-util-win.c =================================================================== --- branches/import/dbus/dbus-sysdeps-util-win.c 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/dbus/dbus-sysdeps-util-win.c 2008-03-10 17:09:14 UTC (rev 768) @@ -37,6 +37,7 @@ #include <io.h> #include <sys/stat.h> #include <aclapi.h> +#include <winsock2.h> #include <stdio.h> #include <stdlib.h> @@ -138,6 +139,84 @@ } /** + * Writes the given pid_to_write to a pidfile (if non-NULL) and/or to a + * pipe (if non-NULL). Does nothing if pidfile and print_pid_pipe are both + * NULL. + * + * @param pidfile the file to write to or #NULL + * @param print_pid_pipe the pipe to write to or #NULL + * @param pid_to_write the pid to write out + * @param error error on failure + * @returns FALSE if error is set + */ +dbus_bool_t +_dbus_write_pid_to_file_and_pipe (const DBusString *pidfile, + DBusPipe *print_pid_pipe, + dbus_pid_t pid_to_write, + DBusError *error) +{ + if (pidfile) + { + _dbus_verbose ("writing pid file %s\n", _dbus_string_get_const_data (pidfile)); + if (!_dbus_write_pid_file (pidfile, + pid_to_write, + error)) + { + _dbus_verbose ("pid file write failed\n"); + _DBUS_ASSERT_ERROR_IS_SET(error); + return FALSE; + } + } + else + { + _dbus_verbose ("No pid file requested\n"); + } + + if (print_pid_pipe != NULL && _dbus_pipe_is_valid (print_pid_pipe)) + { + DBusString pid; + int bytes; + + _dbus_verbose ("writing our pid to pipe %d\n", print_pid_pipe->fd_or_handle); + + if (!_dbus_string_init (&pid)) + { + _DBUS_SET_OOM (error); + return FALSE; + } + + if (!_dbus_string_append_int (&pid, pid_to_write) || + !_dbus_string_append (&pid, "\n")) + { + _dbus_string_free (&pid); + _DBUS_SET_OOM (error); + return FALSE; + } + + bytes = _dbus_string_get_length (&pid); + if (_dbus_pipe_write (print_pid_pipe, &pid, 0, bytes, error) != bytes) + { + /* _dbus_pipe_write sets error only on failure, not short write */ + if (error != NULL && !dbus_error_is_set(error)) + { + dbus_set_error (error, DBUS_ERROR_FAILED, + "Printing message bus PID: did not write enough bytes\n"); + } + _dbus_string_free (&pid); + return FALSE; + } + + _dbus_string_free (&pid); + } + else + { + _dbus_verbose ("No pid pipe to write to\n"); + } + + return TRUE; +} + +/** * Verify that after the fork we can successfully change to this user. * * @param user the username given in the daemon configuration Modified: branches/import/dbus/dbus-sysdeps-win.c =================================================================== --- branches/import/dbus/dbus-sysdeps-win.c 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/dbus/dbus-sysdeps-win.c 2008-03-10 17:09:14 UTC (rev 768) @@ -47,6 +47,7 @@ #include "dbus-credentials.h" #include <windows.h> +#include <ws2tcpip.h> #include <fcntl.h> #include <process.h> @@ -1445,21 +1446,21 @@ * and port. The connection fd is returned, and is set up as * nonblocking. * - * @param host the host name to connect to, NULL for loopback - * @param port the prot to connect to + * @param host the host name to connect to + * @param port the port to connect to + * @param family the address family to listen on, NULL for all * @param error return location for error code * @returns connection file descriptor or -1 on error */ int _dbus_connect_tcp_socket (const char *host, - dbus_uint32_t port, + const char *port, + const char *family, DBusError *error) { - int fd; - struct sockaddr_in addr; - struct hostent *he; - struct in_addr *haddr; - struct in_addr ina; + int fd = -1, res; + struct addrinfo hints; + struct addrinfo *ai, *tmp; _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -1478,50 +1479,81 @@ return -1; } - if (host == NULL) + _DBUS_ASSERT_ERROR_IS_CLEAR(error); + + _DBUS_ZERO (hints); + + if (!family) + hints.ai_family = AF_UNSPEC; + else if (!strcmp(family, "ipv4")) + hints.ai_family = AF_INET; + else if (!strcmp(family, "ipv6")) + hints.ai_family = AF_INET6; + else { - host = "localhost"; - ina.s_addr = htonl (INADDR_LOOPBACK); - haddr = &ina; + dbus_set_error (error, + _dbus_error_from_errno (errno), + "Unknown address family %s", family); + return -1; } + fprintf(stderr, "Family %s\n", family ? family : "none"); + hints.ai_protocol = IPPROTO_TCP; + hints.ai_socktype = SOCK_STREAM; +#ifdef AI_ADDRCONFIG + hints.ai_flags = AI_ADDRCONFIG; +#else + hints.ai_flags = 0; +#endif - he = gethostbyname (host); - if (he == NULL) + if ((res = getaddrinfo(host, port, &hints, &ai)) != 0) { - DBUS_SOCKET_SET_ERRNO (); dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to lookup hostname: %s", - host); - DBUS_CLOSE_SOCKET (fd); + "Failed to lookup host/port: \"%s:%s\": %s (%d)", + host, port, gai_strerror(res), res); + closesocket (fd); return -1; } - haddr = ((struct in_addr *) (he->h_addr_list)[0]); + tmp = ai; + while (tmp) + { + if ((fd = socket (tmp->ai_family, SOCK_STREAM, 0)) < 0) + { + freeaddrinfo(ai); + dbus_set_error(error, + _dbus_error_from_errno (errno), + "Failed to open socket: %s", + _dbus_strerror (errno)); + return -1; + } + _DBUS_ASSERT_ERROR_IS_CLEAR(error); - _DBUS_ZERO (addr); - memcpy (&addr.sin_addr, haddr, sizeof(struct in_addr)); - addr.sin_family = AF_INET; - addr.sin_port = htons (port); + if (connect (fd, (struct sockaddr*) tmp->ai_addr, tmp->ai_addrlen) < 0) + { + closesocket(fd); + fd = -1; + tmp = tmp->ai_next; + continue; + } - if (DBUS_SOCKET_API_RETURNS_ERROR - (connect (fd, (struct sockaddr*) &addr, sizeof (addr)) < 0)) + break; + } + freeaddrinfo(ai); + + if (fd == -1) { - DBUS_SOCKET_SET_ERRNO (); dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to connect to socket %s:%d %s", - host, port, _dbus_strerror (errno)); - - DBUS_CLOSE_SOCKET (fd); - fd = -1; - + "Failed to connect to socket \"%s:%s\" %s", + host, port, _dbus_strerror(errno)); return -1; } + if (!_dbus_set_fd_nonblocking (fd, error)) { - _dbus_close_socket (fd, NULL); + closesocket (fd); fd = -1; return -1; @@ -1530,114 +1562,202 @@ return fd; } + void _dbus_daemon_init(const char *host, dbus_uint32_t port); + /** - * Creates a socket and binds it to the given port, - * then listens on the socket. The socket is - * set to be nonblocking. - * In case of port=0 a random free port is used and - * returned in the port parameter. + * Creates a socket and binds it to the given path, then listens on + * the socket. The socket is set to be nonblocking. In case of port=0 + * a random free port is used and returned in the port parameter. + * If inaddr_any is specified, the hostname is ignored. * - * @param host the interface to listen on, NULL for loopback, empty for any - * @param port the port to listen on, if zero a free port will be used + * @param host the host name to listen on + * @param port the port to listen on, if zero a free port will be used + * @param family the address family to listen on, NULL for all + * @param retport string to return the actual port listened on + * @param fds_p location to store returned file descriptors * @param error return location for errors - * @returns the listening file descriptor or -1 on error + * @returns the number of listening file descriptors or -1 on error */ int _dbus_listen_tcp_socket (const char *host, - dbus_uint32_t *port, - dbus_bool_t inaddr_any, + const char *port, + const char *family, + DBusString *retport, + int **fds_p, DBusError *error) { - int fd; - struct sockaddr_in addr; - struct hostent *he; - struct in_addr *haddr; - socklen_t len = (socklen_t) sizeof (struct sockaddr); - struct in_addr ina; + int nlisten_fd = 0, *listen_fd = NULL, res, i, port_num = -1; + struct addrinfo hints; + struct addrinfo *ai, *tmp; - + *fds_p = NULL; _DBUS_ASSERT_ERROR_IS_CLEAR (error); _dbus_win_startup_winsock (); - fd = socket (AF_INET, SOCK_STREAM, 0); + _DBUS_ZERO (hints); - if (DBUS_SOCKET_IS_INVALID (fd)) + if (!family) + hints.ai_family = AF_UNSPEC; + else if (!strcmp(family, "ipv4")) + hints.ai_family = AF_INET; + else if (!strcmp(family, "ipv6")) + hints.ai_family = AF_INET6; + else { - DBUS_SOCKET_SET_ERRNO (); - dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to create socket \"%s:%d\": %s", - host, port, _dbus_strerror (errno)); + dbus_set_error (error, + _dbus_error_from_errno (errno), + "Unknown address family %s", family); return -1; } - if (host == NULL) + + hints.ai_protocol = IPPROTO_TCP; + hints.ai_socktype = SOCK_STREAM; +#ifdef AI_ADDRCONFIG + hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE; +#else + hints.ai_flags = AI_PASSIVE; +#endif + + redo_lookup_with_port: + if ((res = getaddrinfo(host, port, &hints, &ai)) != 0 || !ai) { - host = "localhost"; - ina.s_addr = htonl (INADDR_LOOPBACK); - haddr = &ina; + dbus_set_error (error, + _dbus_error_from_errno (errno), + "Failed to lookup host/port: \"%s:%s\": %s (%d)", + host ? host : "*", port, gai_strerror(res), res); + return -1; } - else if (!host[0]) + + tmp = ai; + while (tmp) { - ina.s_addr = htonl (INADDR_ANY); - haddr = &ina; - } - else - { - he = gethostbyname (host); - if (he == NULL) + int fd = -1, *newlisten_fd; + if ((fd = socket (tmp->ai_family, SOCK_STREAM, 0)) < 0) { - DBUS_SOCKET_SET_ERRNO (); - dbus_set_error (error, - _dbus_error_from_errno (errno), - "Failed to lookup hostname: %s", - host); - DBUS_CLOSE_SOCKET (fd); - return -1; + dbus_set_error(error, + _dbus_error_from_errno (errno), + "Failed to open socket: %s", + _dbus_strerror (errno)); + goto failed; } + _DBUS_ASSERT_ERROR_IS_CLEAR(error); - haddr = ((struct in_addr *) (he->h_addr_list)[0]); - } + if (bind (fd, (struct sockaddr*) tmp->ai_addr, tmp->ai_addrlen) < 0) + { + closesocket (fd); + dbus_set_error (error, _dbus_error_from_errno (errno), + "Failed to bind socket \"%s:%s\": %s", + host ? host : "*", port, _dbus_strerror (errno)); + goto failed; + } - _DBUS_ZERO (addr); - memcpy (&addr.sin_addr, haddr, sizeof (struct in_addr)); - addr.sin_family = AF_INET; - addr.sin_port = htons (*port); + if (listen (fd, 30 /* backlog */) < 0) + { + closesocket (fd); + dbus_set_error (error, _dbus_error_from_errno (errno), + "Failed to listen on socket \"%s:%s\": %s", + host ? host : "*", port, _dbus_strerror (errno)); + goto failed; + } - if (bind (fd, (struct sockaddr*) &addr, sizeof (struct sockaddr))) - { - DBUS_SOCKET_SET_ERRNO (); - dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to bind socket \"%s:%d\": %s", - host, *port, _dbus_strerror (errno)); - DBUS_CLOSE_SOCKET (fd); - return -1; + newlisten_fd = dbus_realloc(listen_fd, sizeof(int)*(nlisten_fd+1)); + if (!newlisten_fd) + { + closesocket (fd); + dbus_set_error (error, _dbus_error_from_errno (errno), + "Failed to allocate file handle array: %s", + _dbus_strerror (errno)); + goto failed; + } + listen_fd = newlisten_fd; + listen_fd[nlisten_fd] = fd; + nlisten_fd++; + + if (!_dbus_string_get_length(retport)) + { + /* If the user didn't specify a port, or used 0, then + the kernel chooses a port. After the first address + is bound to, we need to force all remaining addresses + to use the same port */ + if (!port || !strcmp(port, "0")) + { + struct sockaddr_storage addr; + socklen_t addrlen; + char portbuf[50]; + + addrlen = sizeof(addr); + getsockname(fd, (struct sockaddr*) &addr, &addrlen); + + if ((res = getnameinfo((struct sockaddr*)&addr, addrlen, NULL, 0, + portbuf, sizeof(portbuf), + NI_NUMERICHOST)) != 0) + { + dbus_set_error (error, _dbus_error_from_errno (errno), + "Failed to resolve port \"%s:%s\": %s (%s)", + host ? host : "*", port, gai_strerror(res), res); + goto failed; + } + if (!_dbus_string_append(retport, portbuf)) + { + dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); + goto failed; + } + + /* Release current address list & redo lookup */ + port = _dbus_string_get_const_data(retport); + freeaddrinfo(ai); + goto redo_lookup_with_port; + } + else + { + if (!_dbus_string_append(retport, port)) + { + dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); + goto failed; + } + } + } + + tmp = tmp->ai_next; } + freeaddrinfo(ai); + ai = NULL; - if (DBUS_SOCKET_API_RETURNS_ERROR (listen (fd, 30 /* backlog */))) + if (!nlisten_fd) { - DBUS_SOCKET_SET_ERRNO (); + errno = WSAEADDRINUSE; dbus_set_error (error, _dbus_error_from_errno (errno), - "Failed to listen on socket \"%s:%d\": %s", - host, *port, _dbus_strerror (errno)); - DBUS_CLOSE_SOCKET (fd); + "Failed to bind socket \"%s:%s\": %s", + host ? host : "*", port, _dbus_strerror (errno)); return -1; } - getsockname(fd, (struct sockaddr*) &addr, &len); - *port = (dbus_uint32_t) ntohs(addr.sin_port); - - _dbus_daemon_init(host, ntohs(addr.sin_port)); + sscanf(_dbus_string_get_const_data(retport), "%d", &port_num); + _dbus_daemon_init(host, port_num); - if (!_dbus_set_fd_nonblocking (fd, error)) + for (i = 0 ; i < nlisten_fd ; i++) { - _dbus_close_socket (fd, NULL); - return -1; + if (!_dbus_set_fd_nonblocking (listen_fd[i], error)) + { + goto failed; + } } - return fd; + *fds_p = listen_fd; + + return nlisten_fd; + + failed: + if (ai) + freeaddrinfo(ai); + for (i = 0 ; i < nlisten_fd ; i++) + closesocket (listen_fd[i]); + dbus_free(listen_fd); + return -1; } @@ -1652,14 +1772,10 @@ _dbus_accept (int listen_fd) { int client_fd; - struct sockaddr addr; - socklen_t addrlen; - addrlen = sizeof (addr); + retry: + client_fd = accept (listen_fd, NULL, NULL); - retry: - client_fd = accept (listen_fd, &addr, &addrlen); - if (DBUS_SOCKET_IS_INVALID (client_fd)) { DBUS_SOCKET_SET_ERRNO (); @@ -3108,6 +3224,31 @@ return FALSE; } +/** + * Returns the standard directories for a system bus to look for service + * activation files + * + * On UNIX this should be the standard xdg freedesktop.org data directories: + * + * XDG_DATA_DIRS=${XDG_DATA_DIRS-/usr/local/share:/usr/share} + * + * and + * + * DBUS_DATADIR + * + * On Windows there is no system bus and this function can return nothing. + * + * @param dirs the directory list we are returning + * @returns #FALSE on OOM + */ + +dbus_bool_t +_dbus_get_standard_system_servicedirs (DBusList **dirs) +{ + *dirs = NULL; + return TRUE; +} + _DBUS_DEFINE_GLOBAL_LOCK (atomic); /** Modified: branches/import/dbus/dbus-sysdeps.c =================================================================== --- branches/import/dbus/dbus-sysdeps.c 2008-03-09 19:34:46 UTC (rev 767) +++ branches/import/dbus/dbus-sysdeps.c 2008-03-10 17:09:14 UTC (rev 768) @@ -185,7 +185,11 @@ dbus_bool_t _dbus_clearenv (void) { +#ifdef _WIN32 + return 1; // FIXME! +#else return (clearenv () == 0); +#endif } /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-03-09 19:34:58
|
Revision: 767 http://windbus.svn.sourceforge.net/windbus/?rev=767&view=rev Author: chehrlic Date: 2008-03-09 12:34:46 -0700 (Sun, 09 Mar 2008) Log Message: ----------- update to 1.1.2 - don't know if it compiles, cmake scripts are not updated yet Modified Paths: -------------- branches/import/AUTHORS branches/import/ChangeLog branches/import/NEWS branches/import/bus/Makefile.am branches/import/bus/activation-helper.c branches/import/bus/activation.c branches/import/bus/bus.c branches/import/bus/bus.h branches/import/bus/config-parser.c branches/import/bus/config-parser.h branches/import/bus/dbus-daemon.1.in branches/import/bus/desktop-file.h branches/import/bus/dispatch.c branches/import/bus/system.conf.in branches/import/bus/test.h branches/import/configure.in branches/import/dbus/dbus-address.c branches/import/dbus/dbus-protocol.h branches/import/dbus/dbus-server-socket.c branches/import/dbus/dbus-server-socket.h branches/import/dbus/dbus-server-unix.c branches/import/dbus/dbus-spawn.c branches/import/dbus/dbus-spawn.h branches/import/dbus/dbus-sysdeps-unix.c branches/import/dbus/dbus-sysdeps.c branches/import/dbus/dbus-sysdeps.h branches/import/dbus/dbus-transport-socket.c branches/import/dbus/dbus-transport-socket.h branches/import/doc/Makefile.am branches/import/doc/busconfig.dtd branches/import/doc/introspect.xsl branches/import/test/Makefile.am branches/import/test/data/valid-config-files/debug-allow-all-sha1.conf.in branches/import/test/data/valid-config-files/debug-allow-all.conf.in branches/import/test/name-test/test-names.c Added Paths: ----------- branches/import/compile branches/import/config.h.in branches/import/test/data/invalid-config-files-system/ branches/import/test/data/invalid-service-files-system/ branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service.in branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service branches/import/test/data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in branches/import/test/data/valid-config-files-system/ branches/import/test/data/valid-config-files-system/debug-allow-all-fail.conf branches/import/test/data/valid-config-files-system/debug-allow-all-fail.conf.in branches/import/test/data/valid-config-files-system/debug-allow-all-pass.conf branches/import/test/data/valid-config-files-system/debug-allow-all-pass.conf.in branches/import/test/data/valid-service-files-system/ branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteEchoService.service.in branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteSegfaultService.service.in branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceFail.service.in branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service branches/import/test/data/valid-service-files-system/org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess.service.in Modified: branches/import/AUTHORS =================================================================== --- branches/import/AUTHORS 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/AUTHORS 2008-03-09 19:34:46 UTC (rev 767) @@ -17,6 +17,7 @@ Kimmo Hämäläinen <kim...@no...> Kristian Høgsberg <kr...@re...> Iain Holmes <ia...@op...> +Richard Hughes <ri...@hu...> Richard Hult <rh...@co...> Peter Kuemmel <syn...@gm...> Alex Larsson <al...@re...> Modified: branches/import/ChangeLog =================================================================== --- branches/import/ChangeLog 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/ChangeLog 2008-03-09 19:34:46 UTC (rev 767) @@ -1,3 +1,328 @@ +2007-07-27 Havoc Pennington <hp...@re...> + + * release 1.1.2 + +2007-07-26 Havoc Pennington <hp...@re...> + + * bus/config-parser-trivial.c (check_return_values): disable a + test that hardcoded the bus user's name + + * bus/dispatch.c (bus_dispatch_test_conf): remove the "if + (!use_launcher)" around the tests, they were only failing because + we didn't pass through all the expected errors from the helper. + + * bus/activation-exit-codes.h + (BUS_SPAWN_EXIT_CODE_CHILD_SIGNALED): add a code for child segfaulting + (BUS_SPAWN_EXIT_CODE_GENERIC_FAILURE): make "1" be a generic + failure code, so if a third party launch helper were written it + could just always return 1 on failure. + +2007-07-24 Daniel P. Berrange <da...@be...> + + * bus/dbus-daemon.1: Add docs on new syntax options for the bus + address strings + + * dbus/dbus-address.c: Allow * in addresses (for binding to all + addresses). + + * dbus/dbus-sysdeps.h: + * dbus/dbus-sysdeps-unix.c: Re-write to use getaddrinfo instead + of gethostbyname to enable protocol independant name lookup, + making IPv6 work + + * dbus/dbus-server-socket.h: + * dbus/dbus-server-socket.c: Add support for 'family' in the + address string to specify ipv4 vs ipv6. Use a port string to + allow for service resolution. Allow for binding to multiple + sockets at once in case of dual IPv4 & IPv6 stacks. + + * dbus/dbus-server-unix.c: Pass in an array of file descriptors + instead of a single one. + + * dbus/dbus-transport-socket.h: + * dbus/dbus-transport-socket.c: Add support for 'family' in the + address string to specify ipv4 vs ipv6. Use a port string to + allow for service resolution. + +2007-07-24 Havoc Pennington <hp...@re...> + + * configure.in: add AM_PROG_CC_C_O to allow per-target CPPFLAGS + + * bus/dispatch.c (bus_dispatch_test_conf): Fix up setting + TEST_LAUNCH_HELPER_CONFIG to include the full path, and enable + test shell_fail_service_auto_start when use_launcher==TRUE + + * bus/activation-helper-bin.c (convert_error_to_exit_code): pass + through the INVALID_ARGS error so the test suite works + + * bus/activation.c (handle_activation_exit_error): return + DBUS_ERROR_NO_MEMORY if we get BUS_SPAWN_EXIT_CODE_NO_MEMORY + + * dbus/dbus-spawn.c (_dbus_babysitter_get_child_exit_status): + return only the exit code of the child, not the entire thingy from + waitpid(), and make the return value indicate whether the child + exited normally (with a status code) + + * bus/bus.c (process_config_first_time_only): _dbus_strdup works + on NULL so no need to check + (process_config_every_time): move servicehelper init here, so we + reload it on HUP or config file change + + * bus/Makefile.am (install-data-hook): remove comment because + Emacs make mode seems to be grumpy about it + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/Makefile.am: + * bus/test-system.c: (die), (check_memleaks), (test_pre_hook), + (test_post_hook), (main): + Add back the test-system.c file - not sure now this got ignored in the + diff. I blame git. + +2007-07-24 Richard Hughes <ri...@hu...> + + * configure.in: + Use ustar to generate the tarball; this fixes the make distcheck + problem when the data files do not fit in the archive: + tar: dbus-1.1.2/test/data/valid-service-files/org.freedesktop.DBus. + TestSuiteShellEchoServiceFail.service.in: file name is too + long (max 99); not dumped + + We have to have the 'long' names as the service helper matches by + filename rather than by the name in the service file. + +2007-07-24 Richard Hughes <ri...@hu...> + + * configure.in: + * test/Makefile.am: + * test/data/invalid-service-files-system/org.freedesktop.DBus.TestS + uiteNoExec.service.in: + * test/data/invalid-service-files-system/org.freedesktop.DBus.TestS + uiteNoService.service.in: + * test/data/invalid-service-files-system/org.freedesktop.DBus.TestS + uiteNoUser.service.in: + * test/data/valid-config-files-system/debug-allow-all-fail.conf.in: + * test/data/valid-config-files-system/debug-allow-all-pass.conf.in: + * test/data/valid-config-files/debug-allow-all-sha1.conf.in: + * test/data/valid-config-files/debug-allow-all.conf.in: + * test/data/valid-service-files-system/org.freedesktop.DBus.TestSui + teEchoService.service.in: + * test/data/valid-service-files-system/org.freedesktop.DBus.TestSui + teSegfaultService.service.in: + * test/data/valid-service-files-system/org.freedesktop.DBus.TestSui + teShellEchoServiceFail.service.in: + * test/data/valid-service-files-system/org.freedesktop.DBus.TestSui + teShellEchoServiceSuccess.service.in: + * test/data/valid-service-files/debug-echo.service.in: + * test/data/valid-service-files/debug-segfault.service.in: + * test/data/valid-service-files/debug-shell-echo-fail.service.in: + * test/data/valid-service-files/debug-shell-echo-success.service.in: + * test/data/valid-service-files/org.freedesktop.DBus.TestSuiteEchoS + ervice.service.in: + * test/data/valid-service-files/org.freedesktop.DBus.TestSuiteSegfa + ultService.service.in: + * test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShell + EchoServiceFail.service.in: + * test/data/valid-service-files/org.freedesktop.DBus.TestSuiteShell + EchoServiceSuccess.service.in: + Add the data files needed by the system activation unit checks. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/dispatch.c: (check_segfault_service_no_auto_start), + (check_launch_service_file_missing), + (check_launch_service_user_missing), + (check_launch_service_exec_missing), + (check_launch_service_service_missing), (bus_dispatch_test_conf), + (bus_dispatch_test_conf_fail), (bus_dispatch_test): + Add unit tests for system activation. Most are copied from the + session activation tests, but some didn't apply when using a laucher. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/activation.c: (bus_activation_activate_service): + If the bus uses a service-laucher, then use the setuid laucher. + +2007-07-24 Richard Hughes <ri...@hu...> + + * configure.in: + Add the needed library exports for the new laucher. + +2007-07-24 Richard Hughes <ri...@hu...> + + * configure.in: + Check for -Wl,--gc-sections so we can really reduce the size of the + setuid binary. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/activation.c: (handle_activation_exit_error), + (babysitter_watch_callback): + Map the child exit status integer to a proper dbus error. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/bus.c: (process_config_first_time_only), + (process_config_every_time), (bus_context_unref), + (bus_context_get_servicehelper): + * bus/bus.h: + Add the concept of a service-helper and allow it's value to be read. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/activation.c: (bus_activation_entry_unref), + (update_desktop_file_entry): + Add the concept of, and read the value of user from the desktop file. + The user string is not required unless we are using system activation. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/activation.c: + * bus/desktop-file.h: + Move the defines into the header file, as we use these in the lauch + helper as well as the desktop file parsing. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/.cvsignore: + Add the autogenerated binary files. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/Makefile.am: + * bus/test.h: + Add the build glue for the lauch helper, and also add the launch-helper + OOM checks into make check. I've probably broken the build, give me 2. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/test-launch-helper.c: (die), (check_memleaks), + (test_post_hook), (bus_activation_helper_oom_test), (main): + Add a test wrapper to allow OOM checks on the launch helper. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/activation-helper-bin.c: (convert_error_to_exit_code), + (main): + * bus/activation-helper.c: (desktop_file_for_name), + (clear_environment), (check_permissions), (check_service_name), + (get_parameters_for_service), (switch_user), + (exec_for_correct_user), (check_bus_name), (get_correct_parser), + (launch_bus_name), (check_dbus_user), (run_launch_helper): + * bus/activation-helper.h: + Add the initial launch-helper. This is split into a main section and a + binary loader that allows us to lauch the main section in another test + harness to do stuff like OOM testing. No build glue yet. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/Makefile.am: + * bus/config-parser.c: (bus_config_parser_unref), + (start_busconfig_child), (bus_config_parser_end_element), + (servicehelper_path), (bus_config_parser_content), + (bus_config_parser_finished), + (bus_config_parser_get_servicehelper), + (test_default_session_servicedirs), + (test_default_system_servicedirs), (bus_config_parser_test): + * bus/config-parser.h: + Make the config-parser code use the common config code. + Also add the session and systemdirs stuff, and make the config parser + aware of the servicehelper field. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/system.conf.in: + Add new servicehelper fields to the default system.conf file. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/config-parser-trivial.c: (service_dirs_find_dir), + (service_dirs_append_link_unique_or_free), (bus_config_parser_new), + (bus_config_parser_unref), (bus_config_parser_start_element), + (bus_config_parser_end_element), (bus_config_parser_content), + (bus_config_parser_finished), (bus_config_parser_get_user), + (bus_config_parser_get_type), (bus_config_parser_get_service_dirs), + (check_return_values), (do_load), (check_loader_oom_func), + (process_test_valid_subdir), (make_full_path), (check_file_valid), + (bus_config_parser_trivial_test): + * bus/config-parser-trivial.h: + Add a security sensitive stripped down config parser for the setuid + launcher. This file only reads what it needs, and doesn't try to do + anything remotely clever like including external files. + It is not intended to validate the config file; it is expected that + config-parser will do that before the setuid program tries to read it. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/config-parser-common.c: + (bus_config_parser_element_name_to_type), + (bus_config_parser_element_type_to_name): + * bus/config-parser-common.h: + We don't want to run the whole config parser with all it's deps in the + setuid program. We need to implement a stripped down config parser just + for the launcher, and to do so I need some common functions and + defines; add them here. + +2007-07-24 Richard Hughes <ri...@hu...> + + * dbus/dbus-sysdeps-unix.c: + (_dbus_get_standard_system_servicedirs): + * dbus/dbus-sysdeps-win.c: + Provide a way to get the standard system servicedirs, just like we do + for the session service dirs. These should be seporate, as there may + be a security issue starting up some session stuff as root. + The use-case for the same binary starting up per-system _and_ + per-session is also not valid. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/dbus-daemon.1.in: + Add standard_system_servicedirs and servicehelper into the man file + and explain what each does. + +2007-07-24 Richard Hughes <ri...@hu...> + + * doc/busconfig.dtd: + Add servicehelper into the dtd, it will soon be a valid part of the + config file. + +2007-07-24 Richard Hughes <ri...@hu...> + + * dbus/dbus-spawn.c: (read_data), + (_dbus_babysitter_get_child_exit_status): + * dbus/dbus-spawn.h: + Add a function so we can get access to the exit status of the launch + helper. + By providing the return code and not the error we can leave the + 'what does this mean?' to the bus launch code and not include it in the + dbus directory. + +2007-07-24 Richard Hughes <ri...@hu...> + + * bus/activation-exit-codes.h: + Add defines which specify the output codes of the launch helper. + We have to use exit codes as this is the only way we can return failure + type without going grotty things like redirecting possibly-nonsecure + stderr into the error. + +2007-07-24 Richard Hughes <ri...@hu...> + + * dbus/dbus-protocol.h: + Add new error names needed for the launch helper. + +2007-07-24 Richard Hughes <ri...@hu...> + + * dbus/dbus-sysdeps.c: (_dbus_clearenv): + * dbus/dbus-sysdeps.h: + Add a wrapper for clearenv. + +2007-07-24 Richard Hughes <ri...@hu...> + + * doc/system-activation.txt: + Add design document for the system activation parts. I'll shortly be + committing many patches that add system activation using a setuid + launcher into CVS, so expect things to be broken for a few hours. + 2007-07-19 Ralf Habacker <ral...@fr...> * cmake/modules/FindKDEWIN.cmake: fixed comment Modified: branches/import/NEWS =================================================================== --- branches/import/NEWS 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/NEWS 2008-03-09 19:34:46 UTC (rev 767) @@ -1,3 +1,35 @@ +D-Bus 1.1.2 (27 July 2007) +== + +- This release is intended to be a feature complete beta for stable + release 1.2.0, please test it. 1.2.0 will follow pretty soon if no + major problems are found. We'll do more betas if significant + changes are made. + +- This is a development release, so API's may still change if problems + are found (though we will try hard not to). + +- The system bus now supports starting services on demand. This uses a + setuid helper program because system bus daemon runs as a nobody + user, while services it launches may need to run as a different + user. + + ***Extra eyes auditing the setuid helper are encouraged and would be + timely right now, before 1.2.0*** + + A design doc is available in doc/system-activation.txt + +- The TCP address format has been enhanced, such that TCP may be + actually usable. The dbus-daemon man page describes the new + elements in the address format. 1.1.1 had added an all_interfaces + flag to the format, which has been removed in favor of a cleaner + approach. + +- Some thread-related bugs have been fixed, these are important fixes + if you are using multiple threads with libdbus, and not important + otherwise. + + D-Bus 1.1.1 (18 June 2007) == - This is a development release, unless you need specific Modified: branches/import/bus/Makefile.am =================================================================== --- branches/import/bus/Makefile.am 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/Makefile.am 2008-03-09 19:34:46 UTC (rev 767) @@ -2,6 +2,7 @@ configdir=$(sysconfdir)/dbus-1 INCLUDES=-I$(top_srcdir) $(DBUS_BUS_CFLAGS) \ + -DDBUS_SYSTEM_CONFIG_FILE=\""$(configdir)/system.conf"\" \ -DDAEMON_NAME=\"dbus-daemon\" -DDBUS_COMPILATION EFENCE= @@ -34,10 +35,13 @@ BUS_SOURCES= \ activation.c \ activation.h \ + activation-exit-codes.h \ bus.c \ bus.h \ config-parser.c \ config-parser.h \ + config-parser-common.c \ + config-parser-common.h \ connection.c \ connection.h \ desktop-file.c \ @@ -73,22 +77,89 @@ $(DBUS_BUS_LIBS) \ $(top_builddir)/dbus/libdbus-convenience.la -dbus_daemon_LDFLAGS=@R_DYNAMIC_LDFLAG@ +dbus_daemon_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@ +LAUNCH_HELPER_SOURCES= \ + $(XML_SOURCES) \ + config-parser-common.c \ + config-parser-common.h \ + config-parser-trivial.c \ + config-parser-trivial.h \ + desktop-file.c \ + desktop-file.h \ + utils.c \ + utils.h \ + activation-exit-codes.h \ + activation-helper.h \ + activation-helper.c + +## This is the installed launch helper with the setuid checks +dbus_daemon_launch_helper_SOURCES= \ + activation-helper-bin.c \ + $(LAUNCH_HELPER_SOURCES) + +dbus_daemon_launch_helper_LDADD= \ + $(DBUS_LAUNCHER_LIBS) \ + $(top_builddir)/dbus/libdbus-convenience.la + +dbus_daemon_launch_helper_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@ + +## we build another binary so we can do the launch testing without root privs. +## DO NOT INSTALL THIS FILE +dbus_daemon_launch_helper_test_SOURCES= \ + activation-helper-bin.c \ + $(LAUNCH_HELPER_SOURCES) + +dbus_daemon_launch_helper_test_LDADD= \ + $(DBUS_LAUNCHER_LIBS) \ + $(top_builddir)/dbus/libdbus-convenience.la + +dbus_daemon_launch_helper_test_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@ +dbus_daemon_launch_helper_test_CPPFLAGS= \ + -DACTIVATION_LAUNCHER_TEST + +## we build yet another binary so we can do the OOM tests +## DO NOT INSTALL THIS FILE +bus_test_launch_helper_SOURCES= \ + test-launch-helper.c \ + $(LAUNCH_HELPER_SOURCES) + +bus_test_launch_helper_LDADD= \ + $(DBUS_LAUNCHER_LIBS) \ + $(top_builddir)/dbus/libdbus-convenience.la + +bus_test_launch_helper_LDFLAGS=@R_DYNAMIC_LDFLAG@ @SECTION_LDFLAGS@ +bus_test_launch_helper_CPPFLAGS= \ + -DACTIVATION_LAUNCHER_TEST \ + -DACTIVATION_LAUNCHER_DO_OOM + ## note that TESTS has special meaning (stuff to use in make check) ## so if adding tests not to be run in make check, don't add them to ## TESTS if DBUS_BUILD_TESTS TESTS_ENVIRONMENT=DBUS_TEST_DATA=$(top_builddir)/test/data DBUS_TEST_HOMEDIR=$(top_builddir)/dbus DBUS_FATAL_WARNINGS=1 DBUS_BLOCK_ON_ABORT=1 -TESTS=bus-test +TESTS=bus-test bus-test-system bus-test-launch-helper else TESTS= endif ## we use noinst_PROGRAMS not check_PROGRAMS so that we build ## even when not doing "make check" -noinst_PROGRAMS=$(TESTS) dbus-daemon +noinst_PROGRAMS=$(TESTS) dbus-daemon dbus-daemon-launch-helper-test dbus-daemon-launch-helper +bus_test_system_SOURCES= \ + $(XML_SOURCES) \ + config-parser-common.c \ + config-parser-common.h \ + config-parser-trivial.c \ + config-parser-trivial.h \ + utils.c \ + utils.h \ + test-system.c + +bus_test_system_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_BUS_LIBS) +bus_test_system_LDFLAGS=@R_DYNAMIC_LDFLAG@ + bus_test_SOURCES= \ $(BUS_SOURCES) \ test-main.c @@ -102,6 +173,7 @@ uninstall-hook: rm -f $(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon + rm -f $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper install-data-hook: if test '!' -d $(DESTDIR)$(DBUS_DAEMONDIR); then \ @@ -113,6 +185,16 @@ $(mkinstalldirs) $(DESTDIR)$(configdir)/system.d $(mkinstalldirs) $(DESTDIR)$(configdir)/session.d $(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/services + $(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/system-services + $(mkinstalldirs) $(DESTDIR)$(libexecdir)/dbus-1 + $(INSTALL_PROGRAM) dbus-daemon-launch-helper $(DESTDIR)$(libexecdir) + if test `id -u` -eq 0; then \ + chown root:$(DBUS_USER) $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper; \ + chmod 4750 $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper; \ + else \ + echo "Not installing $(DESTDIR)$(libexecdir)/dbus-daemon-launch-helper binary setuid!"; \ + echo "You'll need to manually set permissions to root:$(DBUS_USER) and permissions 4750"; \ + fi #### Init scripts fun SCRIPT_IN_FILES=messagebus.in \ Modified: branches/import/bus/activation-helper.c =================================================================== --- branches/import/bus/activation-helper.c 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/activation-helper.c 2008-03-09 19:34:46 UTC (rev 767) @@ -381,20 +381,14 @@ } static dbus_bool_t -check_bus_name (const char *bus_name, - DBusError *error) +check_bus_name (const char *bus_name, DBusError *error) { - DBusString str; - - _dbus_string_init_const (&str, bus_name); - if (!_dbus_validate_bus_name (&str, 0, _dbus_string_get_length (&str))) + if (!_dbus_check_is_valid_bus_name (bus_name)) { dbus_set_error (error, DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND, - "bus name '%s' is not a valid bus name\n", - bus_name); + "bus name '%s' not found\n", bus_name); return FALSE; } - return TRUE; } @@ -523,8 +517,7 @@ } dbus_bool_t -run_launch_helper (const char *bus_name, - DBusError *error) +run_launch_helper (const char *bus_name, DBusError *error) { BusConfigParser *parser; dbus_bool_t retval; Modified: branches/import/bus/activation.c =================================================================== --- branches/import/bus/activation.c 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/activation.c 2008-03-09 19:34:46 UTC (rev 767) @@ -23,6 +23,7 @@ * */ #include "activation.h" +#include "activation-exit-codes.h" #include "desktop-file.h" #include "services.h" #include "test.h" @@ -38,10 +39,6 @@ #include <errno.h> #endif -#define DBUS_SERVICE_SECTION "D-BUS Service" -#define DBUS_SERVICE_NAME "Name" -#define DBUS_SERVICE_EXEC "Exec" - struct BusActivation { int refcount; @@ -68,6 +65,7 @@ int refcount; char *name; char *exec; + char *user; unsigned long mtime; BusServiceDirectory *s_dir; char *filename; @@ -240,6 +238,7 @@ dbus_free (entry->name); dbus_free (entry->exec); + dbus_free (entry->user); dbus_free (entry->filename); dbus_free (entry); @@ -252,17 +251,21 @@ BusDesktopFile *desktop_file, DBusError *error) { - char *name, *exec; + char *name, *exec, *user; BusActivationEntry *entry; DBusStat stat_buf; DBusString file_path; + DBusError tmp_error; _DBUS_ASSERT_ERROR_IS_CLEAR (error); name = NULL; exec = NULL; + user = NULL; entry = NULL; + dbus_error_init (&tmp_error); + if (!_dbus_string_init (&file_path)) { BUS_SET_OOM (error); @@ -297,6 +300,29 @@ error)) goto failed; + /* user is not _required_ unless we are using system activation */ + if (!bus_desktop_file_get_string (desktop_file, + DBUS_SERVICE_SECTION, + DBUS_SERVICE_USER, + &user, &tmp_error)) + { + _DBUS_ASSERT_ERROR_IS_SET (&tmp_error); + /* if we got OOM, then exit */ + if (dbus_error_has_name (&tmp_error, DBUS_ERROR_NO_MEMORY)) + { + dbus_move_error (&tmp_error, error); + goto failed; + } + else + { + /* if we have error because we didn't find anything then continue */ + dbus_error_free (&tmp_error); + dbus_free (user); + user = NULL; + } + } + _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error); + entry = _dbus_hash_table_lookup_string (s_dir->entries, _dbus_string_get_const_data (filename)); if (entry == NULL) /* New file */ @@ -320,6 +346,7 @@ entry->name = name; entry->exec = exec; + entry->user = user; entry->refcount = 1; entry->s_dir = s_dir; @@ -360,8 +387,10 @@ dbus_free (entry->name); dbus_free (entry->exec); + dbus_free (entry->user); entry->name = name; entry->exec = exec; + entry->user = user; if (!_dbus_hash_table_insert_string (activation->entries, entry->name, bus_activation_entry_ref(entry))) { @@ -385,6 +414,7 @@ failed: dbus_free (name); dbus_free (exec); + dbus_free (user); _dbus_string_free (&file_path); if (entry) @@ -1088,6 +1118,58 @@ pending_activation->service_name); } +/** + * Depending on the exit code of the helper, set the error accordingly + */ +static void +handle_activation_exit_error (int exit_code, + DBusError *error) +{ + switch (exit_code) + { + case BUS_SPAWN_EXIT_CODE_NO_MEMORY: + dbus_set_error (error, DBUS_ERROR_NO_MEMORY, + "Launcher could not run (out of memory)"); + break; + case BUS_SPAWN_EXIT_CODE_SETUP_FAILED: + dbus_set_error (error, DBUS_ERROR_SPAWN_SETUP_FAILED, + "Failed to setup environment correctly"); + break; + case BUS_SPAWN_EXIT_CODE_NAME_INVALID: + dbus_set_error (error, DBUS_ERROR_SPAWN_SERVICE_INVALID, + "Bus name is not valid or missing"); + break; + case BUS_SPAWN_EXIT_CODE_SERVICE_NOT_FOUND: + dbus_set_error (error, DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND, + "Bus name not found in system service directory"); + break; + case BUS_SPAWN_EXIT_CODE_PERMISSIONS_INVALID: + dbus_set_error (error, DBUS_ERROR_SPAWN_PERMISSIONS_INVALID, + "The permission of the setuid helper is not correct"); + break; + case BUS_SPAWN_EXIT_CODE_FILE_INVALID: + dbus_set_error (error, DBUS_ERROR_SPAWN_PERMISSIONS_INVALID, + "The service file is incorrect or does not have all required attributes"); + break; + case BUS_SPAWN_EXIT_CODE_EXEC_FAILED: + dbus_set_error (error, DBUS_ERROR_SPAWN_EXEC_FAILED, + "Cannot launch daemon, file not found or permissions invalid"); + break; + case BUS_SPAWN_EXIT_CODE_INVALID_ARGS: + dbus_set_error (error, DBUS_ERROR_INVALID_ARGS, + "Invalid arguments to command line"); + break; + case BUS_SPAWN_EXIT_CODE_CHILD_SIGNALED: + dbus_set_error (error, DBUS_ERROR_SPAWN_CHILD_SIGNALED, + "Launched child was signaled, it probably crashed"); + break; + default: + dbus_set_error (error, DBUS_ERROR_SPAWN_CHILD_EXITED, + "Launch helper exited with unknown return code %i", exit_code); + break; + } +} + static dbus_bool_t babysitter_watch_callback (DBusWatch *watch, unsigned int condition, @@ -1121,6 +1203,17 @@ dbus_error_init (&error); _dbus_babysitter_set_child_exit_error (babysitter, &error); + /* refine the error code if we got an exit code */ + if (dbus_error_has_name (&error, DBUS_ERROR_SPAWN_CHILD_EXITED)) + { + int exit_code = 0; + if (_dbus_babysitter_get_child_exit_status (babysitter, &exit_code)) + { + dbus_error_free (&error); + handle_activation_exit_error (exit_code, &error); + } + } + /* Destroy all pending activations with the same exec */ _dbus_hash_iter_init (pending_activation->activation->pending_activations, &iter); @@ -1310,12 +1403,14 @@ BusPendingActivationEntry *pending_activation_entry; DBusMessage *message; DBusString service_str; + const char *servicehelper; char **argv; char **envp = NULL; int argc; dbus_bool_t retval; DBusHashIter iter; dbus_bool_t activated; + DBusString command; activated = TRUE; @@ -1529,17 +1624,69 @@ if (activated) return TRUE; - /* Now try to spawn the process */ - if (!_dbus_shell_parse_argv (entry->exec, &argc, &argv, error)) + /* use command as system and session different */ + if (!_dbus_string_init (&command)) { + BUS_SET_OOM (error); + return FALSE; + } + + /* does the bus use a helper? */ + servicehelper = bus_context_get_servicehelper (activation->context); + if (servicehelper != NULL) + { + if (entry->user == NULL) + { + _dbus_string_free (&command); + dbus_set_error (error, DBUS_ERROR_SPAWN_FILE_INVALID, + "Cannot do system-bus activation with no user\n"); + return FALSE; + } + + /* join the helper path and the service name */ + if (!_dbus_string_append (&command, servicehelper)) + { + _dbus_string_free (&command); + BUS_SET_OOM (error); + return FALSE; + } + if (!_dbus_string_append (&command, " ")) + { + _dbus_string_free (&command); + BUS_SET_OOM (error); + return FALSE; + } + if (!_dbus_string_append (&command, service_name)) + { + _dbus_string_free (&command); + BUS_SET_OOM (error); + return FALSE; + } + } + else + { + /* the bus does not use a helper, so we can append arguments with the exec line */ + if (!_dbus_string_append (&command, entry->exec)) + { + _dbus_string_free (&command); + BUS_SET_OOM (error); + return FALSE; + } + } + + /* convert command into arguments */ + if (!_dbus_shell_parse_argv (_dbus_string_get_const_data (&command), &argc, &argv, error)) + { _dbus_verbose ("Failed to parse command line: %s\n", entry->exec); _DBUS_ASSERT_ERROR_IS_SET (error); _dbus_hash_table_remove_string (activation->pending_activations, pending_activation->service_name); + _dbus_string_free (&command); return FALSE; } + _dbus_string_free (&command); _dbus_verbose ("Spawning %s ...\n", argv[0]); if (!_dbus_spawn_async_with_babysitter (&pending_activation->babysitter, argv, Modified: branches/import/bus/bus.c =================================================================== --- branches/import/bus/bus.c 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/bus.c 2008-03-09 19:34:46 UTC (rev 767) @@ -41,6 +41,7 @@ DBusGUID uuid; char *config_file; char *type; + char *servicehelper; char *address; char *pidfile; char *user; @@ -253,8 +254,9 @@ } /* This code only gets executed the first time the - config files are parsed. It is not executed - when config files are reloaded.*/ + * config files are parsed. It is not executed + * when config files are reloaded. + */ static dbus_bool_t process_config_first_time_only (BusContext *context, BusConfigParser *parser, @@ -392,8 +394,11 @@ } /* This code gets executed every time the config files - are parsed: both during BusContext construction - and on reloads. */ + * are parsed: both during BusContext construction + * and on reloads. This function is slightly screwy + * since it can do a "half reload" in out-of-memory + * situations. Realistically, unlikely to ever matter. + */ static dbus_bool_t process_config_every_time (BusContext *context, BusConfigParser *parser, @@ -402,9 +407,12 @@ { DBusString full_address; DBusList *link; + DBusList **dirs; BusActivation *new_activation; char *addr; - + const char *servicehelper; + char *s; + dbus_bool_t retval; _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -467,10 +475,27 @@ goto failed; } + /* get the service directories */ + dirs = bus_config_parser_get_service_dirs (parser); + + /* and the service helper */ + servicehelper = bus_config_parser_get_servicehelper (parser); + + s = _dbus_strdup(servicehelper); + if (s == NULL && servicehelper != NULL) + { + BUS_SET_OOM (error); + goto failed; + } + else + { + dbus_free(context->servicehelper); + context->servicehelper = s; + } + /* Create activation subsystem */ new_activation = bus_activation_new (context, &full_address, - bus_config_parser_get_service_dirs (parser), - error); + dirs, error); if (new_activation == NULL) { _DBUS_ASSERT_ERROR_IS_SET (error); @@ -941,6 +966,7 @@ dbus_free (context->type); dbus_free (context->address); dbus_free (context->user); + dbus_free (context->servicehelper); if (context->pidfile) { @@ -973,6 +999,12 @@ return context->address; } +const char* +bus_context_get_servicehelper (BusContext *context) +{ + return context->servicehelper; +} + BusRegistry* bus_context_get_registry (BusContext *context) { Modified: branches/import/bus/bus.h =================================================================== --- branches/import/bus/bus.h 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/bus.h 2008-03-09 19:34:46 UTC (rev 767) @@ -82,6 +82,7 @@ DBusString *uuid); const char* bus_context_get_type (BusContext *context); const char* bus_context_get_address (BusContext *context); +const char* bus_context_get_servicehelper (BusContext *context); BusRegistry* bus_context_get_registry (BusContext *context); BusConnections* bus_context_get_connections (BusContext *context); BusActivation* bus_context_get_activation (BusContext *context); Modified: branches/import/bus/config-parser.c =================================================================== --- branches/import/bus/config-parser.c 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/config-parser.c 2008-03-09 19:34:46 UTC (rev 767) @@ -20,6 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ +#include "config-parser-common.h" #include "config-parser.h" #include "test.h" #include "utils.h" @@ -31,28 +32,6 @@ typedef enum { - ELEMENT_NONE, - ELEMENT_BUSCONFIG, - ELEMENT_INCLUDE, - ELEMENT_USER, - ELEMENT_LISTEN, - ELEMENT_AUTH, - ELEMENT_POLICY, - ELEMENT_LIMIT, - ELEMENT_ALLOW, - ELEMENT_DENY, - ELEMENT_FORK, - ELEMENT_PIDFILE, - ELEMENT_SERVICEDIR, - ELEMENT_INCLUDEDIR, - ELEMENT_TYPE, - ELEMENT_SELINUX, - ELEMENT_ASSOCIATE, - ELEMENT_STANDARD_SESSION_SERVICEDIRS -} ElementType; - -typedef enum -{ /* we ignore policies for unknown groups/users */ POLICY_IGNORED, @@ -108,13 +87,15 @@ char *user; /**< user to run as */ + char *servicehelper; /**< location of the setuid helper */ + char *bus_type; /**< Message bus type */ DBusList *listen_on; /**< List of addresses to listen to */ DBusList *mechanisms; /**< Auth mechanisms */ - DBusList *service_dirs; /**< Directories to look for services in */ + DBusList *service_dirs; /**< Directories to look for session services in */ DBusList *conf_dirs; /**< Directories to look for policy configuration in */ @@ -133,54 +114,6 @@ unsigned int is_toplevel : 1; /**< FALSE if we are a sub-config-file inside another one */ }; -static const char* -element_type_to_name (ElementType type) -{ - switch (type) - { - case ELEMENT_NONE: - return NULL; - case ELEMENT_BUSCONFIG: - return "busconfig"; - case ELEMENT_INCLUDE: - return "include"; - case ELEMENT_USER: - return "user"; - case ELEMENT_LISTEN: - return "listen"; - case ELEMENT_AUTH: - return "auth"; - case ELEMENT_POLICY: - return "policy"; - case ELEMENT_LIMIT: - return "limit"; - case ELEMENT_ALLOW: - return "allow"; - case ELEMENT_DENY: - return "deny"; - case ELEMENT_FORK: - return "fork"; - case ELEMENT_PIDFILE: - return "pidfile"; - case ELEMENT_STANDARD_SESSION_SERVICEDIRS: - return "standard_session_servicedirs"; - case ELEMENT_SERVICEDIR: - return "servicedir"; - case ELEMENT_INCLUDEDIR: - return "includedir"; - case ELEMENT_TYPE: - return "type"; - case ELEMENT_SELINUX: - return "selinux"; - case ELEMENT_ASSOCIATE: - return "associate"; - } - - _dbus_assert_not_reached ("bad element type"); - - return NULL; -} - static Element* push_element (BusConfigParser *parser, ElementType type) @@ -534,6 +467,7 @@ pop_element (parser); dbus_free (parser->user); + dbus_free (parser->servicehelper); dbus_free (parser->bus_type); dbus_free (parser->pidfile); @@ -722,7 +656,11 @@ const char **attribute_values, DBusError *error) { - if (strcmp (element_name, "user") == 0) + ElementType element_type; + + element_type = bus_config_parser_element_name_to_type (element_name); + + if (element_type == ELEMENT_USER) { if (!check_no_attributes (parser, "user", attribute_names, attribute_values, error)) return FALSE; @@ -735,7 +673,7 @@ return TRUE; } - else if (strcmp (element_name, "type") == 0) + else if (element_type == ELEMENT_TYPE) { if (!check_no_attributes (parser, "type", attribute_names, attribute_values, error)) return FALSE; @@ -748,7 +686,7 @@ return TRUE; } - else if (strcmp (element_name, "fork") == 0) + else if (element_type == ELEMENT_FORK) { if (!check_no_attributes (parser, "fork", attribute_names, attribute_values, error)) return FALSE; @@ -763,7 +701,7 @@ return TRUE; } - else if (strcmp (element_name, "pidfile") == 0) + else if (element_type == ELEMENT_PIDFILE) { if (!check_no_attributes (parser, "pidfile", attribute_names, attribute_values, error)) return FALSE; @@ -776,7 +714,7 @@ return TRUE; } - else if (strcmp (element_name, "listen") == 0) + else if (element_type == ELEMENT_LISTEN) { if (!check_no_attributes (parser, "listen", attribute_names, attribute_values, error)) return FALSE; @@ -789,7 +727,7 @@ return TRUE; } - else if (strcmp (element_name, "auth") == 0) + else if (element_type == ELEMENT_AUTH) { if (!check_no_attributes (parser, "auth", attribute_names, attribute_values, error)) return FALSE; @@ -802,8 +740,21 @@ return TRUE; } - else if (strcmp (element_name, "includedir") == 0) + else if (element_type == ELEMENT_SERVICEHELPER) { + if (!check_no_attributes (parser, "servicehelper", attribute_names, attribute_values, error)) + return FALSE; + + if (push_element (parser, ELEMENT_SERVICEHELPER) == NULL) + { + BUS_SET_OOM (error); + return FALSE; + } + + return TRUE; + } + else if (element_type == ELEMENT_INCLUDEDIR) + { if (!check_no_attributes (parser, "includedir", attribute_names, attribute_values, error)) return FALSE; @@ -815,7 +766,7 @@ return TRUE; } - else if (strcmp (element_name, "standard_session_servicedirs") == 0) + else if (element_type == ELEMENT_STANDARD_SESSION_SERVICEDIRS) { DBusList *link; DBusList *dirs; @@ -841,8 +792,34 @@ return TRUE; } - else if (strcmp (element_name, "servicedir") == 0) + else if (element_type == ELEMENT_STANDARD_SYSTEM_SERVICEDIRS) { + DBusList *link; + DBusList *dirs; + dirs = NULL; + + if (!check_no_attributes (parser, "standard_system_servicedirs", attribute_names, attribute_values, error)) + return FALSE; + + if (push_element (parser, ELEMENT_STANDARD_SYSTEM_SERVICEDIRS) == NULL) + { + BUS_SET_OOM (error); + return FALSE; + } + + if (!_dbus_get_standard_system_servicedirs (&dirs)) + { + BUS_SET_OOM (error); + return FALSE; + } + + while ((link = _dbus_list_pop_first_link (&dirs))) + service_dirs_append_link_unique_or_free (&parser->service_dirs, link); + + return TRUE; + } + else if (element_type == ELEMENT_SERVICEDIR) + { if (!check_no_attributes (parser, "servicedir", attribute_names, attribute_values, error)) return FALSE; @@ -854,7 +831,7 @@ return TRUE; } - else if (strcmp (element_name, "include") == 0) + else if (element_type == ELEMENT_INCLUDE) { Element *e; const char *if_selinux_enabled; @@ -927,7 +904,7 @@ return TRUE; } - else if (strcmp (element_name, "policy") == 0) + else if (element_type == ELEMENT_POLICY) { Element *e; const char *context; @@ -1034,7 +1011,7 @@ return TRUE; } - else if (strcmp (element_name, "limit") == 0) + else if (element_type == ELEMENT_LIMIT) { Element *e; const char *name; @@ -1069,7 +1046,7 @@ return TRUE; } - else if (strcmp (element_name, "selinux") == 0) + else if (element_type == ELEMENT_SELINUX) { if (!check_no_attributes (parser, "selinux", attribute_names, attribute_values, error)) return FALSE; @@ -1920,7 +1897,7 @@ return FALSE; } - n = element_type_to_name (t); + n = bus_config_parser_element_type_to_name (t); _dbus_assert (n != NULL); if (strcmp (n, element_name) != 0) { @@ -1949,13 +1926,14 @@ case ELEMENT_PIDFILE: case ELEMENT_AUTH: case ELEMENT_SERVICEDIR: + case ELEMENT_SERVICEHELPER: case ELEMENT_INCLUDEDIR: case ELEMENT_LIMIT: if (!e->had_content) { dbus_set_error (error, DBUS_ERROR_FAILED, "XML element <%s> was expected to have content inside it", - element_type_to_name (e->type)); + bus_config_parser_element_type_to_name (e->type)); return FALSE; } @@ -1975,6 +1953,7 @@ case ELEMENT_SELINUX: case ELEMENT_ASSOCIATE: case ELEMENT_STANDARD_SESSION_SERVICEDIRS: + case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS: break; } @@ -2088,6 +2067,40 @@ } static dbus_bool_t +servicehelper_path (BusConfigParser *parser, + const DBusString *filename, + DBusError *error) +{ + const char *filename_str; + char *servicehelper; + + filename_str = _dbus_string_get_const_data (filename); + + /* copy to avoid overwriting with NULL on OOM */ + servicehelper = _dbus_strdup (filename_str); + + /* check for OOM */ + if (servicehelper == NULL) + { + BUS_SET_OOM (error); + return FALSE; + } + + /* save the latest servicehelper only if not OOM */ + dbus_free (parser->servicehelper); + parser->servicehelper = servicehelper; + + /* We don't check whether the helper exists; instead we + * would just fail to ever activate anything if it doesn't. + * This allows an admin to fix the problem if it doesn't exist. + * It also allows the parser test suite to successfully parse + * test cases without installing the helper. ;-) + */ + + return TRUE; +} + +static dbus_bool_t include_dir (BusConfigParser *parser, const DBusString *dirname, DBusError *error) @@ -2223,6 +2236,7 @@ case ELEMENT_DENY: case ELEMENT_FORK: case ELEMENT_STANDARD_SESSION_SERVICEDIRS: + case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS: case ELEMENT_SELINUX: case ELEMENT_ASSOCIATE: if (all_whitespace (content)) @@ -2231,7 +2245,7 @@ { dbus_set_error (error, DBUS_ERROR_FAILED, "No text content expected inside XML element %s in configuration file", - element_type_to_name (top_element_type (parser))); + bus_config_parser_element_type_to_name (top_element_type (parser))); return FALSE; } @@ -2296,6 +2310,31 @@ } break; + case ELEMENT_SERVICEHELPER: + { + DBusString full_path; + + e->had_content = TRUE; + + if (!_dbus_string_init (&full_path)) + goto nomem; + + if (!make_full_path (&parser->basedir, content, &full_path)) + { + _dbus_string_free (&full_path); + goto nomem; + } + + if (!servicehelper_path (parser, &full_path, error)) + { + _dbus_string_free (&full_path); + return FALSE; + } + + _dbus_string_free (&full_path); + } + break; + case ELEMENT_INCLUDEDIR: { DBusString full_path; @@ -2407,6 +2446,7 @@ goto nomem; } + /* _only_ extra session directories can be specified */ if (!service_dirs_append_unique_or_free (&parser->service_dirs, s)) { _dbus_string_free (&full_path); @@ -2460,7 +2500,7 @@ { dbus_set_error (error, DBUS_ERROR_FAILED, "Element <%s> was not closed in configuration file", - element_type_to_name (top_element_type (parser))); + bus_config_parser_element_type_to_name (top_element_type (parser))); return FALSE; } @@ -2523,6 +2563,12 @@ return parser->pidfile; } +const char * +bus_config_parser_get_servicehelper (BusConfigParser *parser) +{ + return parser->servicehelper; +} + BusPolicy* bus_config_parser_steal_policy (BusConfigParser *parser) { @@ -3082,7 +3128,7 @@ } -static const char *test_service_dir_matches[] = +static const char *test_session_service_dir_matches[] = { #ifdef DBUS_UNIX "/testusr/testlocal/testshare/dbus-1/services", @@ -3124,7 +3170,7 @@ _dbus_string_free (&progs); return FALSE; } - test_service_dir_matches[1] = _dbus_string_get_const_data(&progs); + test_session_service_dir_matches[1] = _dbus_string_get_const_data(&progs); } #endif dirs = NULL; @@ -3168,7 +3214,7 @@ while ((link = _dbus_list_pop_first_link (&dirs))) { printf (" test service dir: %s\n", (char *)link->data); - if (test_service_dir_matches[i] == NULL) + if (test_session_service_dir_matches[i] == NULL) { printf ("more directories parsed than in match set\n"); dbus_free (link->data); @@ -3177,12 +3223,12 @@ return FALSE; } - if (strcmp (test_service_dir_matches[i], + if (strcmp (test_session_service_dir_matches[i], (char *)link->data) != 0) { printf ("%s directory does not match %s in the match set\n", (char *)link->data, - test_service_dir_matches[i]); + test_session_service_dir_matches[i]); dbus_free (link->data); _dbus_list_free_link (link); _dbus_string_free (&progs); @@ -3195,10 +3241,10 @@ _dbus_list_free_link (link); } - if (test_service_dir_matches[i] != NULL) + if (test_session_service_dir_matches[i] != NULL) { printf ("extra data %s in the match set was not matched\n", - test_service_dir_matches[i]); + test_session_service_dir_matches[i]); _dbus_string_free (&progs); return FALSE; @@ -3207,7 +3253,130 @@ _dbus_string_free (&progs); return TRUE; } - + +static const char *test_system_service_dir_matches[] = + { +#ifdef DBUS_UNIX + "/testusr/testlocal/testshare/dbus-1/system-services", + "/testusr/testshare/dbus-1/system-services", +#endif + DBUS_DATADIR"/dbus-1/system-services", + NULL + }; + +static dbus_bool_t +test_default_system_servicedirs (void) +{ + DBusList *dirs; + DBusList *link; + DBusString progs; + const char *common_progs; + int i; + + /* On Unix we don't actually use this variable, but it's easier to handle the + * deallocation if we always allocate it, whether needed or not */ + if (!_dbus_string_init (&progs)) + _dbus_assert_not_reached ("OOM allocating progs"); + + common_progs = _dbus_getenv ("CommonProgramFiles"); +#ifndef DBUS_UNIX + if (common_progs) + { + if (!_dbus_string_append (&progs, common_progs)) + { + _dbus_string_free (&progs); + return FALSE; + } + + if (!_dbus_string_append (&progs, "/dbus-1/system-services")) + { + _dbus_string_free (&progs); + return FALSE; + } + test_system_service_dir_matches[1] = _dbus_string_get_const_data(&progs); + } +#endif + dirs = NULL; + + printf ("Testing retrieving the default system service directories\n"); + if (!_dbus_get_standard_system_servicedirs (&dirs)) + _dbus_assert_not_reached ("couldn't get stardard dirs"); + + /* make sure our defaults end with share/dbus-1/system-service */ + while ((link = _dbus_list_pop_first_link (&dirs))) + { + DBusString path; + + printf (" default service dir: %s\n", (char *)link->data); + _dbus_string_init_const (&path, (char *)link->data); + if (!_dbus_string_ends_with_c_str (&path, "dbus-1/system-services")) + { + printf ("error with default system service directories\n"); + dbus_free (link->data); + _dbus_list_free_link (link); + _dbus_string_free (&progs); + return FALSE; + } + + dbus_free (link->data); + _dbus_list_free_link (link); + } + +#ifdef DBUS_UNIX + if (!_dbus_setenv ("XDG_DATA_HOME", "/testhome/foo/.testlocal/testshare")) + _dbus_assert_not_reached ("couldn't setenv XDG_DATA_HOME"); + + if (!_dbus_setenv ("XDG_DATA_DIRS", ":/testusr/testlocal/testshare: :/testusr/testshare:")) + _dbus_assert_not_reached ("couldn't setenv XDG_DATA_DIRS"); +#endif + if (!_dbus_get_standard_system_servicedirs (&dirs)) + _dbus_assert_not_reached ("couldn't get stardard dirs"); + + /* make sure we read and parse the env variable correctly */ + i = 0; + while ((link = _dbus_list_pop_first_link (&dirs))) + { + printf (" test service dir: %s\n", (char *)link->data); + if (test_system_service_dir_matches[i] == NULL) + { + printf ("more directories parsed than in match set\n"); + dbus_free (link->data); + _dbus_list_free_link (link); + _dbus_string_free (&progs); + return FALSE; + } + + if (strcmp (test_system_service_dir_matches[i], + (char *)link->data) != 0) + { + printf ("%s directory does not match %s in the match set\n", + (char *)link->data, + test_system_service_dir_matches[i]); + dbus_free (link->data); + _dbus_list_free_link (link); + _dbus_string_free (&progs); + return FALSE; + } + + ++i; + + dbus_free (link->data); + _dbus_list_free_link (link); + } + + if (test_system_service_dir_matches[i] != NULL) + { + printf ("extra data %s in the match set was not matched\n", + test_system_service_dir_matches[i]); + + _dbus_string_free (&progs); + return FALSE; + } + + _dbus_string_free (&progs); + return TRUE; +} + dbus_bool_t bus_config_parser_test (const DBusString *test_data_dir) { @@ -3221,6 +3390,9 @@ if (!test_default_session_servicedirs()) return FALSE; + if (!test_default_system_servicedirs()) + return FALSE; + if (!process_test_valid_subdir (test_data_dir, "valid-config-files", VALID)) return FALSE; Modified: branches/import/bus/config-parser.h =================================================================== --- branches/import/bus/config-parser.h 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/config-parser.h 2008-03-09 19:34:46 UTC (rev 767) @@ -66,6 +66,7 @@ DBusList** bus_config_parser_get_mechanisms (BusConfigParser *parser); dbus_bool_t bus_config_parser_get_fork (BusConfigParser *parser); const char* bus_config_parser_get_pidfile (BusConfigParser *parser); +const char* bus_config_parser_get_servicehelper (BusConfigParser *parser); DBusList** bus_config_parser_get_service_dirs (BusConfigParser *parser); DBusList** bus_config_parser_get_conf_dirs (BusConfigParser *parser); BusPolicy* bus_config_parser_steal_policy (BusConfigParser *parser); Modified: branches/import/bus/dbus-daemon.1.in =================================================================== --- branches/import/bus/dbus-daemon.1.in 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/dbus-daemon.1.in 2008-03-09 19:34:46 UTC (rev 767) @@ -221,22 +221,36 @@ apps will try to connect to the last <listen> address first. .PP +tcp sockets can accept IPv4 addresses, IPv6 addresses or hostnames. +If a hostname resolves to multiple addresses, the server will bind +to all of them. The family=ipv4 or family=ipv6 options can be used +to force it to bind to a subset of addresses + +.PP +Example: <listen>tcp:host=localhost,port=0,family=ipv4</listen> + +.PP A special case is using a port number of zero (or omitting the port), which means to choose an available port selected by the operating -system. The port number chosen can be with the --print-address command -line parameter and will be present in other cases where the server -reports its own address, such as when DBUS_SESSION_BUS_ADDRESS is set. +system. The port number chosen can be obtained with the +--print-address command line parameter and will be present in other +cases where the server reports its own address, such as when +DBUS_SESSION_BUS_ADDRESS is set. .PP Example: <listen>tcp:host=localhost,port=0</listen> .PP -tcp addresses also allow an all_interfaces=true option, which will -cause the bus to listen on all local address (INADDR_ANY) and not only -the specified host. However, the specified host will still be used as -the reported address of the server. The specified host should be a -valid name of the local machine or weird stuff will happen. +tcp addresses also allow a bind=hostname option, which will override +the host option specifying what address to bind to, without changing +the address reported by the bus. The bind option can also take a +special name '*' to cause the bus to listen on all local address +(INADDR_ANY). The specified host should be a valid name of the local +machine or weird stuff will happen. +.PP +Example: <listen>tcp:host=localhost,bind=*,port=0</listen> + .TP .I "<auth>" @@ -288,6 +302,33 @@ configuration file would probably be nonsense. .TP +.I "<standard_system_servicedirs/>" + +.PP +<standard_system_servicedirs/> specifies the standard system-wide +activation directories that should be searched for service files. +This option defaults to @EXPANDED_DATADIR@/dbus-1/system-services. + +.PP +The <standard_system_servicedirs/> option is only relevant to the +per-system bus daemon defined in +@EXPANDED_SYSCONFDIR@/dbus-1/system.conf. Putting it in any other +configuration file would probably be nonsense. + +.TP +.I "<servicehelper/>" + +.PP +<servicehelper/> specifies the setuid helper that is used to launch +system daemons with an alternate user. Typically this should be +the dbus-daemon-launch-helper executable in located in libexec. + +.PP +The <servicehelper/> option is only relevant to the per-system bus daemon +defined in @EXPANDED_SYSCONFDIR@/dbus-1/system.conf. Putting it in any other +configuration file would probably be nonsense. + +.TP .I "<limit>" .PP Modified: branches/import/bus/desktop-file.h =================================================================== --- branches/import/bus/desktop-file.h 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/desktop-file.h 2008-03-09 19:34:46 UTC (rev 767) @@ -30,6 +30,12 @@ #define BUS_DESKTOP_PARSE_ERROR_INVALID_ESCAPES "org.freedesktop.DBus.DesktopParseError.InvalidEscapes" #define BUS_DESKTOP_PARSE_ERROR_INVALID_CHARS "org.freedesktop.DBus.DesktopParseError.InvalidChars" +#define DBUS_SERVICE_SECTION "D-BUS Service" +#define DBUS_SERVICE_NAME "Name" +#define DBUS_SERVICE_EXEC "Exec" +#define DBUS_SERVICE_USER "User" +#define DBUS_SERVICE_GROUP "Group" + typedef struct BusDesktopFile BusDesktopFile; BusDesktopFile *bus_desktop_file_load (DBusString *filename, Modified: branches/import/bus/dispatch.c =================================================================== --- branches/import/bus/dispatch.c 2008-03-09 18:19:40 UTC (rev 766) +++ branches/import/bus/dispatch.c 2008-03-09 19:34:46 UTC (rev 767) @@ -2708,6 +2708,14 @@ ; /* good, this is a valid response */ } else if (dbus_message_is_error (message, + DBUS_ERROR_F... [truncated message content] |
From: <che...@us...> - 2008-03-09 18:19:44
|
Revision: 766 http://windbus.svn.sourceforge.net/windbus/?rev=766&view=rev Author: chehrlic Date: 2008-03-09 11:19:40 -0700 (Sun, 09 Mar 2008) Log Message: ----------- we try to rely on official releases - CVS is just confusing here Removed Paths: ------------- branches/import/.cvsignore branches/import/CVS/ branches/import/bus/.cvsignore branches/import/bus/CVS/ branches/import/cmake/CVS/ branches/import/cmake/bus/CVS/ branches/import/cmake/dbus/CVS/ branches/import/cmake/doc/CVS/ branches/import/cmake/modules/CVS/ branches/import/cmake/test/CVS/ branches/import/cmake/test/data/CVS/ branches/import/cmake/test/data/valid-config-files/CVS/ branches/import/cmake/test/name-test/CVS/ branches/import/cmake/tools/CVS/ branches/import/dbus/.cvsignore branches/import/dbus/CVS/ branches/import/doc/.cvsignore branches/import/doc/CVS/ branches/import/test/.cvsignore branches/import/test/CVS/ branches/import/test/data/CVS/ branches/import/test/data/auth/CVS/ branches/import/test/data/equiv-config-files/CVS/ branches/import/test/data/equiv-config-files/basic/CVS/ branches/import/test/data/equiv-config-files/basic/basic.d/CVS/ branches/import/test/data/equiv-config-files/entities/CVS/ branches/import/test/data/equiv-config-files/entities/basic.d/CVS/ branches/import/test/data/incomplete-messages/CVS/ branches/import/test/data/invalid-config-files/CVS/ branches/import/test/data/invalid-messages/CVS/ branches/import/test/data/sha-1/CVS/ branches/import/test/data/valid-config-files/.cvsignore branches/import/test/data/valid-config-files/CVS/ branches/import/test/data/valid-config-files/basic.d/CVS/ branches/import/test/data/valid-config-files/system.d/CVS/ branches/import/test/data/valid-introspection-files/CVS/ branches/import/test/data/valid-messages/CVS/ branches/import/test/data/valid-service-files/.cvsignore branches/import/test/data/valid-service-files/CVS/ branches/import/test/name-test/.cvsignore branches/import/test/name-test/CVS/ branches/import/tools/.cvsignore branches/import/tools/CVS/ Deleted: branches/import/.cvsignore =================================================================== --- branches/import/.cvsignore 2008-03-09 18:14:18 UTC (rev 765) +++ branches/import/.cvsignore 2008-03-09 18:19:40 UTC (rev 766) @@ -1,22 +0,0 @@ -config.log -config.status -config.sub -configure -*.pc -libtool -ltmain.sh -stamp-h1 -stamp-h -stamp-h.in -Doxyfile -Makefile -Makefile.in -aclocal.m4 -autom4te.cache -config.guess -config.h -config.h.in -*.bb -*.bbg -*.da -*.gcov Deleted: branches/import/bus/.cvsignore =================================================================== --- branches/import/bus/.cvsignore 2008-03-09 18:14:18 UTC (rev 765) +++ branches/import/bus/.cvsignore 2008-03-09 18:19:40 UTC (rev 766) @@ -1,17 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -dbus-daemon -*.bb -*.bbg -*.da -*.gcov -bus-test -rc.messagebus -messagebus -session.conf -system.conf -dbus-daemon.1 Deleted: branches/import/dbus/.cvsignore =================================================================== --- branches/import/dbus/.cvsignore 2008-03-09 18:14:18 UTC (rev 765) +++ branches/import/dbus/.cvsignore 2008-03-09 18:19:40 UTC (rev 766) @@ -1,16 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -dbus-test -*.bb -*.bbg -*.gcov -*.da -dbus-arch-deps.h -.dbus-keyrings -dbus-glib-error-enum.h -*.gcno -*.gcda Deleted: branches/import/doc/.cvsignore =================================================================== --- branches/import/doc/.cvsignore 2008-03-09 18:14:18 UTC (rev 765) +++ branches/import/doc/.cvsignore 2008-03-09 18:19:40 UTC (rev 766) @@ -1,12 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -*.o -api -dbus-specification.html -dbus-test-plan.html -dbus-tutorial.html -dbus-faq.html Deleted: branches/import/test/.cvsignore =================================================================== --- branches/import/test/.cvsignore 2008-03-09 18:14:18 UTC (rev 765) +++ branches/import/test/.cvsignore 2008-03-09 18:19:40 UTC (rev 766) @@ -1,25 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -*.o -echo-server -echo-client -bus-test -unbase64 -*.bb -*.bbg -*.da -*.gcov -break-loader -spawn-test -test-exit -test-segfault -test-service -test-sleep-forever -decode-gcov -shell-test -test-shell-service -test-names Deleted: branches/import/test/data/valid-config-files/.cvsignore =================================================================== --- branches/import/test/data/valid-config-files/.cvsignore 2008-03-09 18:14:18 UTC (rev 765) +++ branches/import/test/data/valid-config-files/.cvsignore 2008-03-09 18:19:40 UTC (rev 766) @@ -1,5 +0,0 @@ -debug-allow-all.conf -debug-allow-all-sha1.conf -session.conf -system.conf -run-with-tmp-session-bus.conf Deleted: branches/import/test/data/valid-service-files/.cvsignore =================================================================== --- branches/import/test/data/valid-service-files/.cvsignore 2008-03-09 18:14:18 UTC (rev 765) +++ branches/import/test/data/valid-service-files/.cvsignore 2008-03-09 18:19:40 UTC (rev 766) @@ -1,6 +0,0 @@ -debug-echo.service -debug-glib.service -debug-python.service -debug-segfault.service -debug-shell-echo-fail.service -debug-shell-echo-success.service Deleted: branches/import/test/name-test/.cvsignore =================================================================== --- branches/import/test/name-test/.cvsignore 2008-03-09 18:14:18 UTC (rev 765) +++ branches/import/test/name-test/.cvsignore 2008-03-09 18:19:40 UTC (rev 766) @@ -1,7 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -test-names -test-pending-call-dispatch -test-threads-init Deleted: branches/import/tools/.cvsignore =================================================================== --- branches/import/tools/.cvsignore 2008-03-09 18:14:18 UTC (rev 765) +++ branches/import/tools/.cvsignore 2008-03-09 18:19:40 UTC (rev 766) @@ -1,20 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -dbus-send -dbus-monitor -dbus-cleanup-sockets -dbus-launch -dbus-uuidgen -*.bb -*.bbg -*.gcov -*.da -dbus-viewer -dbus-glib-bindings.h -run-with-tmp-session-bus.conf -print-introspect -dbus-bus-introspect.xml This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-03-09 18:14:22
|
Revision: 765 http://windbus.svn.sourceforge.net/windbus/?rev=765&view=rev Author: chehrlic Date: 2008-03-09 11:14:18 -0700 (Sun, 09 Mar 2008) Log Message: ----------- Renamed remotely Added Paths: ----------- branches/import/ Removed Paths: ------------- branches/trunk/ Copied: branches/import (from rev 764, branches/trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-03-09 18:13:38
|
Revision: 764 http://windbus.svn.sourceforge.net/windbus/?rev=764&view=rev Author: chehrlic Date: 2008-03-09 11:13:25 -0700 (Sun, 09 Mar 2008) Log Message: ----------- branch for import Added Paths: ----------- branches/trunk/ Copied: branches/trunk (from rev 763, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <che...@us...> - 2008-02-16 14:26:32
|
Revision: 763 http://windbus.svn.sourceforge.net/windbus/?rev=763&view=rev Author: chehrlic Date: 2008-02-16 06:26:29 -0800 (Sat, 16 Feb 2008) Log Message: ----------- need debug postfix on windows - not only for msvc Modified Paths: -------------- trunk/cmake/CMakeLists.txt Modified: trunk/cmake/CMakeLists.txt =================================================================== --- trunk/cmake/CMakeLists.txt 2007-12-24 08:42:31 UTC (rev 762) +++ trunk/cmake/CMakeLists.txt 2008-02-16 14:26:29 UTC (rev 763) @@ -92,9 +92,11 @@ # used by executables, CMAKE_DEBUG_POSTFIX does not handle this case #set (CMAKE_EXE_POSTFIX "d") - set (CMAKE_DEBUG_POSTFIX "d") endif(MSVC) +if(WIN32) + set (CMAKE_DEBUG_POSTFIX "d") +endif(WIN32) ######################################################################### # Windows CE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hab...@us...> - 2007-12-24 08:42:34
|
Revision: 762 http://windbus.svn.sourceforge.net/windbus/?rev=762&view=rev Author: habacker Date: 2007-12-24 00:42:31 -0800 (Mon, 24 Dec 2007) Log Message: ----------- hide console when autostarting dbus-daemon Modified Paths: -------------- trunk/dbus/dbus-sysdeps-win.c Modified: trunk/dbus/dbus-sysdeps-win.c =================================================================== --- trunk/dbus/dbus-sysdeps-win.c 2007-12-23 21:26:58 UTC (rev 761) +++ trunk/dbus/dbus-sysdeps-win.c 2007-12-24 08:42:31 UTC (rev 762) @@ -3014,7 +3014,7 @@ // argv[i] = "--config-file=bus\\session.conf"; printf("create process \"%s\" %s\n", dbus_exe_path, dbus_args); - if(CreateProcessA(dbus_exe_path, dbus_args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) + if(CreateProcessA(dbus_exe_path, dbus_args, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) { retval = TRUE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hab...@us...> - 2007-12-23 21:27:00
|
Revision: 761 http://windbus.svn.sourceforge.net/windbus/?rev=761&view=rev Author: habacker Date: 2007-12-23 13:26:58 -0800 (Sun, 23 Dec 2007) Log Message: ----------- fixed import library generating for RelWithDebInfo and MinSizeRel build mode Modified Paths: -------------- trunk/cmake/dbus/CMakeLists.txt Modified: trunk/cmake/dbus/CMakeLists.txt =================================================================== --- trunk/cmake/dbus/CMakeLists.txt 2007-08-13 18:27:39 UTC (rev 760) +++ trunk/cmake/dbus/CMakeLists.txt 2007-12-23 21:26:58 UTC (rev 761) @@ -263,7 +263,9 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/dbus-1.def.cmake" "${CMAKE_BINARY_DIR}/dbus-1.def") set(DEF_LIBRARY_NAME dbus-1d.dll) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/dbus-1.def.cmake" "${CMAKE_BINARY_DIR}/dbus-1d.def") + set_target_properties(dbus-1 PROPERTIES LINK_FLAGS_RELWITHDEBINFO /def:"${CMAKE_BINARY_DIR}/dbus-1.def") set_target_properties(dbus-1 PROPERTIES LINK_FLAGS_RELEASE /def:"${CMAKE_BINARY_DIR}/dbus-1.def") + set_target_properties(dbus-1 PROPERTIES LINK_FLAGS_MINSIZEREL /def:"${CMAKE_BINARY_DIR}/dbus-1.def") set_target_properties(dbus-1 PROPERTIES LINK_FLAGS_DEBUG /def:"${CMAKE_BINARY_DIR}/dbus-1d.def") endif(MSVC) if(MSVC_IDE) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hab...@us...> - 2007-08-13 18:27:40
|
Revision: 760 http://windbus.svn.sourceforge.net/windbus/?rev=760&view=rev Author: habacker Date: 2007-08-13 11:27:39 -0700 (Mon, 13 Aug 2007) Log Message: ----------- dbus-sysdeps-win.c (_dbus_get_autolaunch_address): uses GetModuleFileNameA instead of GetModuleFileName, msvc has a problem using the generic function Modified Paths: -------------- branches/sync/dbus/dbus-sysdeps-win.c Modified: branches/sync/dbus/dbus-sysdeps-win.c =================================================================== --- branches/sync/dbus/dbus-sysdeps-win.c 2007-08-13 17:44:09 UTC (rev 759) +++ branches/sync/dbus/dbus-sysdeps-win.c 2007-08-13 18:27:39 UTC (rev 760) @@ -3248,7 +3248,7 @@ } /* set search path to path of libdbus dll, if found */ - res = GetModuleFileName(hInstance,buf,sizeof(buf)); + res = GetModuleFileNameA(hInstance,buf,sizeof(buf)); if (res) { if (p = strrchr(buf,'\\')) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hab...@us...> - 2007-08-13 17:44:13
|
Revision: 759 http://windbus.svn.sourceforge.net/windbus/?rev=759&view=rev Author: habacker Date: 2007-08-13 10:44:09 -0700 (Mon, 13 Aug 2007) Log Message: ----------- dbus-sysdeps-win.c (_dbus_get_autolaunch_address): set search path to path of libdbus dll, if found dbus-sysdeps-thread-win.c (DllMain): save module instance for further usage Modified Paths: -------------- branches/sync/dbus/dbus-sysdeps-thread-win.c branches/sync/dbus/dbus-sysdeps-win.c Modified: branches/sync/dbus/dbus-sysdeps-thread-win.c =================================================================== --- branches/sync/dbus/dbus-sysdeps-thread-win.c 2007-08-13 15:08:51 UTC (rev 758) +++ branches/sync/dbus/dbus-sysdeps-thread-win.c 2007-08-13 17:44:09 UTC (rev 759) @@ -35,6 +35,7 @@ static DWORD dbus_cond_event_tls = TLS_OUT_OF_INDEXES; +HINSTANCE hInstance; BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, @@ -49,6 +50,11 @@ HANDLE event; switch (fdwReason) { + case DLL_PROCESS_ATTACH: + /* save instance handle, it is used in dbus-sysdeps-win.c */ + hInstance = hinstDLL; + break; + case DLL_THREAD_DETACH: if (dbus_cond_event_tls != TLS_OUT_OF_INDEXES) { Modified: branches/sync/dbus/dbus-sysdeps-win.c =================================================================== --- branches/sync/dbus/dbus-sysdeps-win.c 2007-08-13 15:08:51 UTC (rev 758) +++ branches/sync/dbus/dbus-sysdeps-win.c 2007-08-13 17:44:09 UTC (rev 759) @@ -63,6 +63,7 @@ #define socklen_t int #endif +extern HINSTANCE hInstance; #if defined(__MINGW32__) && (_WIN32_WINNT < 0x0501) @@ -151,7 +152,6 @@ #endif - /** * File interface * @@ -3232,7 +3232,10 @@ LPSTR lpFile; char dbus_exe_path[MAX_PATH]; char dbus_args[MAX_PATH * 2]; - + char buf[MAX_PATH]; + char *p; + BOOL res; + mutex = _dbus_global_lock ( cDBusAutolaunchMutex ); _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -3244,7 +3247,18 @@ goto out; } - if (!SearchPathA(NULL, "dbus-daemon.exe", NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile)) + /* set search path to path of libdbus dll, if found */ + res = GetModuleFileName(hInstance,buf,sizeof(buf)); + if (res) + { + if (p = strrchr(buf,'\\')) + *p = '\0'; + p = buf; + } + else + p = NULL; + + if (!SearchPathA(p, "dbus-daemon.exe", NULL, sizeof(dbus_exe_path), dbus_exe_path, &lpFile)) { printf ("could not find dbus-daemon executable\n"); goto out; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Hab...@us...> - 2007-08-13 15:35:10
|
Revision: 758 http://windbus.svn.sourceforge.net/windbus/?rev=758&view=rev Author: Habacker Date: 2007-08-13 08:08:51 -0700 (Mon, 13 Aug 2007) Log Message: ----------- _dbus_append_keyring_directory_for_credentials(): fixed generating of keyring directory, homedrive was missing Modified Paths: -------------- branches/sync/dbus/dbus-sysdeps-win.c Modified: branches/sync/dbus/dbus-sysdeps-win.c =================================================================== --- branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 15:34:31 UTC (rev 757) +++ branches/sync/dbus/dbus-sysdeps-win.c 2007-08-13 15:08:51 UTC (rev 758) @@ -3564,6 +3564,7 @@ DBusString dotdir; dbus_uid_t uid; const char *homepath; + const char *homedrive; _dbus_assert (credentials != NULL); _dbus_assert (!_dbus_credentials_are_anonymous (credentials)); @@ -3571,6 +3572,12 @@ if (!_dbus_string_init (&homedir)) return FALSE; + homedrive = _dbus_getenv("HOMEDRIVE"); + if (homedrive != NULL && *homedrive != '\0') + { + _dbus_string_append(&homedir,homedrive); + } + homepath = _dbus_getenv("HOMEPATH"); if (homepath != NULL && *homepath != '\0') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2007-08-12 15:34:38
|
Revision: 757 http://windbus.svn.sourceforge.net/windbus/?rev=757&view=rev Author: syntheticpp Date: 2007-08-12 08:34:31 -0700 (Sun, 12 Aug 2007) Log Message: ----------- enable addrinfo functions for win2k Modified Paths: -------------- branches/sync/dbus/dbus-sysdeps-win.c Modified: branches/sync/dbus/dbus-sysdeps-win.c =================================================================== --- branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 15:25:10 UTC (rev 756) +++ branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 15:34:31 UTC (rev 757) @@ -31,23 +31,8 @@ #define STRSAFE_NO_DEPRECATE #ifndef DBUS_WINCE -#ifdef _MSC_VER #define _WIN32_WINNT 0x0500 #endif -#ifdef __MINGW32__ -/* MinGW does not support getaddrinfo, getnameinfo, and freeaddrinfo on Windows 2000. - * It works for MSVC because the functions are defined in wspiapi.h. - * To support Windows 2000 the IPv6 WinSock library wship6.dll is needed. -*/ -#define _WIN32_WINNT 0x0501 -/* - * TODO: load functions dynamically: first try ws2_32.dll, then wship6.dll. - * Post patch to MinGW, it is a FIXME in the mingw header. - * See *_ws2_* functions below. Needs more testing before. - */ -//#define _WIN32_WINNT 0x0500 // enable after more tests -#endif -#endif #include "dbus-internals.h" @@ -81,9 +66,14 @@ #if defined(__MINGW32__) && (_WIN32_WINNT < 0x0501) -/* +/* MinGW does not support getaddrinfo, getnameinfo, and freeaddrinfo on Windows 2000. + * It works for MSVC because the functions are defined inline in wspiapi.h. + * + * To support Windows 2000 with MinGW the IPv6 WinSock library wship6.dll is needed. * http://msdn.microsoft.com/downloads/sdks/platform/tpipv6.asp - * Windows 2000: extract wship6.dll only + * Windows 2000 only: don't run the exe, extract only wship6.dll + * + * Post patch to MinGW, it is a FIXME in the mingw header. */ FARPROC _get_ws2_function(const char* funcname) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2007-08-12 15:25:17
|
Revision: 756 http://windbus.svn.sourceforge.net/windbus/?rev=756&view=rev Author: syntheticpp Date: 2007-08-12 08:25:10 -0700 (Sun, 12 Aug 2007) Log Message: ----------- add missing winsock init Modified Paths: -------------- branches/sync/dbus/dbus-sysdeps-win.c Modified: branches/sync/dbus/dbus-sysdeps-win.c =================================================================== --- branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 14:05:19 UTC (rev 755) +++ branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 15:25:10 UTC (rev 756) @@ -1639,6 +1639,8 @@ hints.ai_socktype = SOCK_STREAM; #ifndef DBUS_WIN hints.ai_flags = AI_ADDRCONFIG; +#else + _dbus_win_startup_winsock (); #endif if ((res = getaddrinfo(host, port, &hints, &ai)) != 0) { @@ -1750,6 +1752,7 @@ hints.ai_flags = AI_ADDRCONFIG | AI_PASSIVE; #else hints.ai_flags = AI_PASSIVE; + _dbus_win_startup_winsock (); #endif redo_lookup_with_port: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2007-08-12 14:05:30
|
Revision: 755 http://windbus.svn.sourceforge.net/windbus/?rev=755&view=rev Author: syntheticpp Date: 2007-08-12 07:05:19 -0700 (Sun, 12 Aug 2007) Log Message: ----------- FIX: addrinfo functions are not supported under Window 2000 by mingw Modified Paths: -------------- branches/sync/dbus/dbus-sysdeps-win.c Modified: branches/sync/dbus/dbus-sysdeps-win.c =================================================================== --- branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 13:18:34 UTC (rev 754) +++ branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 14:05:19 UTC (rev 755) @@ -45,7 +45,7 @@ * Post patch to MinGW, it is a FIXME in the mingw header. * See *_ws2_* functions below. Needs more testing before. */ -//#define _WIN32_WINNT 0x0500 +//#define _WIN32_WINNT 0x0500 // enable after more tests #endif #endif @@ -81,29 +81,36 @@ #if defined(__MINGW32__) && (_WIN32_WINNT < 0x0501) -FARPROC _get_ws2_function(const char* ws2_name) +/* + * http://msdn.microsoft.com/downloads/sdks/platform/tpipv6.asp + * Windows 2000: extract wship6.dll only + */ + +FARPROC _get_ws2_function(const char* funcname) { FARPROC func = NULL; HMODULE dll = LoadLibraryA("ws2_32.dll"); if (dll != NULL) { - func = GetProcAddress(dll, ws2_name); + func = GetProcAddress(dll, funcname); if (func == NULL) { FreeLibrary(dll); dll = NULL; } } - dll = LoadLibraryA("ws2_32.dll"); + dll = LoadLibraryA("wship6.dll"); if (dll != NULL) { - func = GetProcAddress(dll, ws2_name); + func = GetProcAddress(dll, funcname); if (func == NULL) { FreeLibrary(dll); dll = NULL; } } + if (!func) + printf("\n\nerror: could not load function %s \n\n", funcname); return func; } @@ -114,13 +121,11 @@ static _Ws2_getaddrinfo func = NULL; if (!func) func = (_Ws2_getaddrinfo) _get_ws2_function("getaddrinfo"); - if (func) { - err = (*func)(nodename, servname, hints, res); - WSASetLastError(err); - return err; - } - _dbus_verbose("error: getaddrinfo not available"); - return 1; // TODO ERROR CODE + if (!func) + return 1; // TODO ERROR CODE + err = (*func)(nodename, servname, hints, res); + WSASetLastError(err); + return err; } typedef int (*_Ws2_getnameinfo)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int); @@ -131,13 +136,12 @@ static _Ws2_getnameinfo func = NULL; if (!func) func = (_Ws2_getnameinfo) _get_ws2_function("getnameinfo"); - if (func) { - err = (*func)(sa, salen, node, nodelen, service, servicelen, flags); - WSASetLastError(err); - return err; - } - _dbus_verbose("error: getaddrinfo not available"); - return 1; // TODO ERROR CODE + if (func) + return 1; // TODO ERROR CODE + + err = (*func)(sa, salen, node, nodelen, service, servicelen, flags); + WSASetLastError(err); + return err; } typedef void (*_Ws2_freeaddrinfo)(struct addrinfo *ai); @@ -148,8 +152,6 @@ func = (_Ws2_freeaddrinfo) _get_ws2_function("freeaddrinfo"); if (func) (*func)(ai); - else - _dbus_verbose("error: freeaddrinfo not available"); } #define getaddrinfo _ws2_getaddrinfo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2007-08-12 13:18:36
|
Revision: 754 http://windbus.svn.sourceforge.net/windbus/?rev=754&view=rev Author: syntheticpp Date: 2007-08-12 06:18:34 -0700 (Sun, 12 Aug 2007) Log Message: ----------- FIX: addrinfo functions are not supported under Window 2000 by mingw Modified Paths: -------------- branches/sync/dbus/dbus-sysdeps-win.c Modified: branches/sync/dbus/dbus-sysdeps-win.c =================================================================== --- branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 12:27:40 UTC (rev 753) +++ branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 13:18:34 UTC (rev 754) @@ -38,13 +38,18 @@ /* MinGW does not support getaddrinfo, getnameinfo, and freeaddrinfo on Windows 2000. * It works for MSVC because the functions are defined in wspiapi.h. * To support Windows 2000 the IPv6 WinSock library wship6.dll is needed. +*/ +#define _WIN32_WINNT 0x0501 +/* * TODO: load functions dynamically: first try ws2_32.dll, then wship6.dll. * Post patch to MinGW, it is a FIXME in the mingw header. -*/ -#define _WIN32_WINNT 0x0501 + * See *_ws2_* functions below. Needs more testing before. + */ +//#define _WIN32_WINNT 0x0500 #endif #endif + #include "dbus-internals.h" #include "dbus-sysdeps.h" #include "dbus-threads.h" @@ -65,7 +70,6 @@ #include <sys/stat.h> #include <sys/types.h> - #ifndef O_BINARY #define O_BINARY 0 #endif @@ -75,6 +79,87 @@ #endif +#if defined(__MINGW32__) && (_WIN32_WINNT < 0x0501) + +FARPROC _get_ws2_function(const char* ws2_name) +{ + FARPROC func = NULL; + HMODULE dll = LoadLibraryA("ws2_32.dll"); + if (dll != NULL) + { + func = GetProcAddress(dll, ws2_name); + if (func == NULL) + { + FreeLibrary(dll); + dll = NULL; + } + } + dll = LoadLibraryA("ws2_32.dll"); + if (dll != NULL) + { + func = GetProcAddress(dll, ws2_name); + if (func == NULL) + { + FreeLibrary(dll); + dll = NULL; + } + } + return func; +} + +typedef int (*_Ws2_getaddrinfo)(const char*,const char*,const struct addrinfo*, struct addrinfo**); +int _ws2_getaddrinfo(const char* nodename, const char* servname, const struct addrinfo* hints, struct addrinfo** res) +{ + int err; + static _Ws2_getaddrinfo func = NULL; + if (!func) + func = (_Ws2_getaddrinfo) _get_ws2_function("getaddrinfo"); + if (func) { + err = (*func)(nodename, servname, hints, res); + WSASetLastError(err); + return err; + } + _dbus_verbose("error: getaddrinfo not available"); + return 1; // TODO ERROR CODE +} + +typedef int (*_Ws2_getnameinfo)(const struct sockaddr*,socklen_t,char*,DWORD,char*,DWORD,int); +int _ws2_getnameinfo(const struct sockaddr* sa, socklen_t salen, char* node, socklen_t nodelen, + char* service, socklen_t servicelen, int flags) +{ + int err; + static _Ws2_getnameinfo func = NULL; + if (!func) + func = (_Ws2_getnameinfo) _get_ws2_function("getnameinfo"); + if (func) { + err = (*func)(sa, salen, node, nodelen, service, servicelen, flags); + WSASetLastError(err); + return err; + } + _dbus_verbose("error: getaddrinfo not available"); + return 1; // TODO ERROR CODE +} + +typedef void (*_Ws2_freeaddrinfo)(struct addrinfo *ai); +void _ws2_freeaddrinfo(struct addrinfo *ai) +{ + static _Ws2_freeaddrinfo func = NULL; + if (!func) + func = (_Ws2_freeaddrinfo) _get_ws2_function("freeaddrinfo"); + if (func) + (*func)(ai); + else + _dbus_verbose("error: freeaddrinfo not available"); +} + +#define getaddrinfo _ws2_getaddrinfo +#define getnameinfo _ws2_getnameinfo +#define freeaddrinfo _ws2_freeaddrinfo + +#endif + + + /** * File interface * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <syn...@us...> - 2007-08-12 12:27:43
|
Revision: 753 http://windbus.svn.sourceforge.net/windbus/?rev=753&view=rev Author: syntheticpp Date: 2007-08-12 05:27:40 -0700 (Sun, 12 Aug 2007) Log Message: ----------- addrinfo functions are not supported under Window 2000 by mingw Modified Paths: -------------- branches/sync/dbus/dbus-sysdeps-win.c Modified: branches/sync/dbus/dbus-sysdeps-win.c =================================================================== --- branches/sync/dbus/dbus-sysdeps-win.c 2007-08-11 17:20:24 UTC (rev 752) +++ branches/sync/dbus/dbus-sysdeps-win.c 2007-08-12 12:27:40 UTC (rev 753) @@ -31,8 +31,19 @@ #define STRSAFE_NO_DEPRECATE #ifndef DBUS_WINCE +#ifdef _MSC_VER #define _WIN32_WINNT 0x0500 #endif +#ifdef __MINGW32__ +/* MinGW does not support getaddrinfo, getnameinfo, and freeaddrinfo on Windows 2000. + * It works for MSVC because the functions are defined in wspiapi.h. + * To support Windows 2000 the IPv6 WinSock library wship6.dll is needed. + * TODO: load functions dynamically: first try ws2_32.dll, then wship6.dll. + * Post patch to MinGW, it is a FIXME in the mingw header. +*/ +#define _WIN32_WINNT 0x0501 +#endif +#endif #include "dbus-internals.h" #include "dbus-sysdeps.h" @@ -54,6 +65,7 @@ #include <sys/stat.h> #include <sys/types.h> + #ifndef O_BINARY #define O_BINARY 0 #endif @@ -62,17 +74,7 @@ #define socklen_t int #endif -// gai_strerror inline only in msvc headers, and defined to A/W -#ifndef gai_strerror -char * -gai_strerror(int ecode) -{ - static char* buff = "unknown gai_strerror"; - return buff; -} -#endif - /** * File interface * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |