Commit Graph

1209 Commits

Author SHA1 Message Date
David Zeuthen
bf24dff88e Return an error for calls into unknown interfaces or unknown objects
Ryan pointed out on IRC that we didn't do anything here. Looking at
the code, it's painfully obvious that we should be returning an error
here since a comment already says that we've exhausted all possible
options.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-21 12:11:04 -04:00
Christian Persch
c7f0f2c437 Use stack-allocated GVariantBuilders
This saves a few allocations.
Also simplify the code a bit in gdbusconnection.

Bug #618616.
2010-05-20 21:17:14 +02:00
Christian Persch
41b3f6885d Add g_dc[p]gettext, and use it in gsettings
Avoid using LC_MESSAGES, and just call g_d[c]gettext directly.

Bug #617004.
2010-05-20 21:16:29 +02:00
David Zeuthen
366b3ffcde Bug 619142 – Build fixes
- Fix various #include issues

 - Change #error to #warning for the EXTERNAL authentication mechanism.
   It is not clear if this should work on Win32 at all.

 - Call close() before unlink() for the SHA1 keyring

 - Change #error to #warning so we don't forget to do
   permission checking of the .dbus-keyrings directory

 - Use Win32 SID for the SHA1 auth mech

 - Apparently we can't use word 'interface' as an identifier

 - Implement a _g_dbus_win32_get_user_sid() function. For now it's
   private. Don't know if it should be public somewhere. Maybe in
   a future GCredentials support for Win32? I don't know.

 - GFileDescriptorBased is not available on Win32. So avoid using
   it in GLocalFile stuff. Now, Win32 still uses GLocalFile + friends
   (which works with file descriptors) so expose a private function
   to get the fd for an OutputStream so things still work.

 - Fixup gio.symbols

 - Fixup tests/gdbus-peer.c so it builds

With this, at least things compile and the gdbus-peer.exe test case
passes. Which is a great start. I've tested this by cross-compiling on
a x86_64 Fedora 13 host using mingw32 and running the code on a 32-bit
Windows 7 box.

https://bugzilla.gnome.org/show_bug.cgi?id=619142

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-20 10:53:08 -04:00
Ryan Lortie
caae8ac57a Add --uninstall option to glib-compile-schemas
If --uninstall is given then don't give an error if the schema directory
is empty.  Instead, erase the gschemas.compiled file, if it exists.
This is the right thing to do in the 'make uninstall' rule, where the
schema directory could very well be left empty as a result.

Modify gsettings.m4 to use this option.
2010-05-19 16:02:05 -04:00
Javier Jardón
257c519ba2 Fix trivial typo in GCredentials code
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=618839
2010-05-18 23:45:54 +02:00
Ryan Lortie
719e2dcb3b Bug 619031 - method-calls-in-thread test failing
The test was assuming that g_timeout_add() waited for at least the amount of
time given to it before running the function.  This is not the case -- the
function can be run as much as 1ms early.  Make the lower time bound asserted
in the test more permissive to account for this.
2010-05-18 17:25:43 -04:00
Ryan Lortie
6067f9f794 Bug 618839 - Typo at translation message
Fix trivial typo in GCredentials code
2010-05-18 16:43:36 -04:00
Ryan Lortie
12a8c0f50d Add sync method to GSettingsBackend, and pad 2010-05-18 16:14:50 -04:00
Ryan Lortie
7fcf353325 whitespace fix 2010-05-18 16:14:50 -04:00
Robert Ancell
587bdf3f0a Add missing gunixfdlist.h include in gdbus-example-server.c 2010-05-18 12:01:25 +10:00
David Zeuthen
a977f03235 GDBus: Fix obvious crasher when looking up annotations
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-17 19:52:09 -04:00
David Zeuthen
a621e0ed10 gdbus(1): Don't fetch props if introspection data indicates none are available
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-17 11:08:53 -04:00
David Zeuthen
98e4f7f6fb GDBus: Fix introspection of objects registered at /
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-17 11:08:40 -04:00
Ryan Lortie
799e0242ae improve thread safety in GDelayedSettingsBackend
- hold a lock while accessing the tree of delayed values
  - use weak reference counts with the owner object to avoid doing
    g_object_notify on a dead object
  - dispatch the "has-unapplied" notify to the proper main context
2010-05-17 07:16:37 -04:00
Ryan Lortie
61219e2640 GSettingsBackend: make signal dispatch threadsafe
This commit fixes up a few race conditions in the GSettingsBackend, mostly with
respect to change notifications occuring at the same time as the last reference
count on a GSettings is dropped.  With GDBus feeding us our incoming signals in
a separate thread, this is something that could easily happen.
2010-05-17 07:16:37 -04:00
Ryan Lortie
4967b6d2ab gitignore additions for gdbus, new test cases 2010-05-17 07:16:37 -04:00
Ryan Lortie
984258c662 GSettings: support emitting signals in threads
The thread-default context that was in effect at the time that the
GSettings was created will be used for emitting signals on that
GSettings.
2010-05-17 07:16:37 -04:00
Ryan Lortie
849684e540 GSettings tool: work-around GDBus issue
There is currently no way (near as I can tell) to ensure that a message
has been sent when using GDBus.  If we exit() before we are sure, then
it is very possible that the message isn't sent at all.  This behaviour
was observed when using the GSettings commandline tool with dconf.

A quick and dirty workaround for now.
2010-05-17 07:16:37 -04:00
Ryan Lortie
8e060adb2c intern a key name instead of using strdup() 2010-05-17 07:16:37 -04:00
Lin Ma
e5440f865d Reworked Solaris file event notification for GIO. See
https://defect.opensolaris.org/bz/show_bug.cgi?id=10194

Updated copyright.
2010-05-17 14:42:52 +08:00
Sebastian Dröge
5d379f1c37 Fix gio tests linking with binutils gold linker 2010-05-16 10:22:10 +02:00
Sebastian Dröge
e6c08a458c Fix build of gdbus tool with binutils gold linker 2010-05-16 10:22:10 +02:00
Matthias Clasen
2ad4b2d716 Fix build on !linux
Don't define __USE_GNU, thats a glibc-internal macro, and
don't use SOL_SOCKET when not including sys/socket.h.
Maybe this file should be called glinuxcredentialsmessage.c...

Bug #618730
2010-05-15 18:16:51 -04:00
Matthias Clasen
2ed13de153 Fix issues with GSETTINGS_CHECK_RULE
Rename the --schema-files option to --schema-file, since it only
accepts one file at a time. Change the GSETTINGS_CHECK_RULE to
use it that way, too. And also make it work better with !srcdir
builds.

Bugs #616731 and #616864
2010-05-14 21:58:08 -04:00
David Zeuthen
763c1dab1f GDBus: Use specific variant type in GetAll()
Without this fix, we segfault if the exported object returned an error
on all get_property() calls (in reality, this never happens).

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-14 21:08:01 -04:00
David Zeuthen
4baf104f0a GDBus: Fix a double free
Fix an unintentional double free introduced in commit
4ad4c306c3.

This bug manifested itself when trying to complete this

 $ gdbus introspect --system --dest <tab>
2010-05-14 20:52:15 -04:00
Christian Persch
661e5ea69f Plug mem leaks in gdbus tests & examples
Use "&s" instead of "s", and free the variant iters after use.

Bug #618663.
2010-05-15 00:12:18 +02:00
Christian Persch
60c53fef47 Plug a mem leak in gdbusauth
From valgrind running gdbus-peer test:

==20513== 32 bytes in 1 blocks are definitely lost in loss record 1 of 15
==20513==    at 0x4024E4C: realloc (vg_replace_malloc.c:429)
==20513==    by 0x4079BB1: g_realloc (gmem.c:174)
==20513==    by 0x4099472: g_string_maybe_expand (gstring.c:396)
==20513==    by 0x409A42A: g_string_insert_c (gstring.c:1050)
==20513==    by 0x42169AC: g_string_append_c_inline (gstring.h:153)
==20513==    by 0x421682C: _my_g_input_stream_read_line_safe (gdbusauth.c:336)
==20513==    by 0x421843E: _g_dbus_auth_run_server (gdbusauth.c:1265)
==20513==    by 0x4222B94: initable_init (gdbusconnection.c:1783)
==20513==    by 0x41CF8D5: g_initable_init (ginitable.c:106)
==20513==    by 0x41CFA8D: g_initable_new_valist (ginitable.c:219)
==20513==    by 0x41CF920: g_initable_new (ginitable.c:139)
==20513==    by 0x4223479: g_dbus_connection_new_sync (gdbusconnection.c:2046)

Bug #618650.
2010-05-15 00:12:18 +02:00
Christian Persch
5bc9d43288 Plug mem leak in g_dbus_address_get_stream_sync
==6279== 21,615 (4,708 direct, 16,907 indirect) bytes in 169 blocks are
definitely lost in loss record 12 of 13
==6279==    at 0x4024D2E: malloc (vg_replace_malloc.c:207)
==6279==    by 0x4079A90: g_malloc (gmem.c:135)
==6279==    by 0x4079DC8: g_malloc_n (gmem.c:252)
==6279==    by 0x4097E66: g_strsplit (gstrfuncs.c:2434)
==6279==    by 0x42169A2: g_dbus_address_get_stream_sync
(gdbusaddress.c:875)

Bug #618622.
2010-05-15 00:12:17 +02:00
Christian Persch
dc39825aa3 Plug a mem leak in get_uninitialized_connection
Free the bus address after creating the singleton.

==26308== 39,736 (10,517 direct, 29,219 indirect) bytes in 388 blocks
are definitely lost in loss record 14 of 15
==26308==    at 0x4024D2E: malloc (vg_replace_malloc.c:207)
==26308==    by 0x4079A90: g_malloc (gmem.c:135)
==26308==    by 0x4079DC8: g_malloc_n (gmem.c:252)
==26308==    by 0x4095607: g_strdup (gstrfuncs.c:102)
==26308==    by 0x4216B9A: g_dbus_address_get_for_bus_sync
(gdbusaddress.c:961)
==26308==    by 0x422A7AE: get_uninitialized_connection
(gdbusconnection.c:5241)

Bug #618622.
2010-05-15 00:12:17 +02:00
Christian Persch
5b2c7f10bd Plug mem leaks in parse_value_from_blob
The result of read_string() was leaked.

Bug #618615.
2010-05-15 00:12:17 +02:00
Christian Persch
0a7c0ac74b Plug a mem leak
This code leaked the return value of g_variant_get_child_value();
use g_variant_get() instead and free the iter when done.
2010-05-14 18:08:29 -04:00
David Zeuthen
ddc94bd0a6 GDBus: Remove cached value if a property is invalidated
Also add a test case to catch this.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-14 12:56:09 -04:00
David Zeuthen
bb6530eb34 GDBus: Fix serialization of empty arrays
It turns out that we didn't observe padding (neither when reading nor
writing) for empty arrays which (apparently) is needed according to
the D-Bus spec and reference implementation. A simple test case to
provoke this behavior is as follows (notice the lack of 4 bytes worth
of padding at position 0x0064):

 Error calling dbus_message_demarshal() on this blob: org.freedesktop.DBus.Error.InvalidArgs: Message is corrupted (Alignment padding not null)
 0000: 6c 01 00 01  2e 00 00 00  41 00 00 00  37 00 00 00    l.......A...7...
 0010: 08 01 67 00  08 73 61 7b  73 76 7d 61  73 00 00 00    ..g..sa{sv}as...
 0020: 01 01 6f 00  08 00 00 00  2f 66 6f 6f  2f 62 61 72    ..o...../foo/bar
 0030: 00 00 00 00  00 00 00 00  03 01 73 00  06 00 00 00    ..........s.....
 0040: 4d 65 6d 62  65 72 00 00  11 00 00 00  30 31 32 33    Member......0123
 0050: 34 35 36 37  38 39 30 31  32 33 34 35  36 00 00 00    4567890123456...
 0060: 00 00 00 00  0e 00 00 00  09 00 00 00  53 6f 6d 65    ............Some
 0070: 74 68 69 6e  67 00                                    thing.

 The blob was generated from the following GVariant value:
 ('01234567890123456', @a{sv} {}, ['Something'])

 If the blob was encoded using DBusMessageIter, the payload would have been:

 0000: 6c 01 00 01  32 00 00 00  41 00 00 00  36 00 00 00    l...2...A...6...
 0010: 01 01 6f 00  08 00 00 00  2f 66 6f 6f  2f 62 61 72    ..o...../foo/bar
 0020: 00 00 00 00  00 00 00 00  03 01 73 00  06 00 00 00    ..........s.....
 0030: 4d 65 6d 62  65 72 00 00  08 01 67 00  08 73 61 7b    Member....g..sa{
 0040: 73 76 7d 61  73 00 00 00  11 00 00 00  30 31 32 33    sv}as.......0123
 0050: 34 35 36 37  38 39 30 31  32 33 34 35  36 00 00 00    4567890123456...
 0060: 00 00 00 00  00 00 00 00  0e 00 00 00  09 00 00 00    ................
 0070: 53 6f 6d 65  74 68 69 6e  67 00                       Something.
 ** ERROR:gdbus-serialization.c:547:check_serialization: code should not be reached
 Aborted

and this is now in the libdbus-1-using serialization test case.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-05-14 12:56:09 -04:00
Matthias Clasen
ee9b16242c another !srcdir build fix 2010-05-14 10:49:03 -04:00
Matthias Clasen
159f533abf More !srcdir build fixes 2010-05-14 10:25:31 -04:00
Ryan Lortie
d8d1a02c55 include gunixcredentialsmessage from unixsocket
fixes a build issue
2010-05-14 15:31:14 +02:00
Matthias Clasen
1d22b64843 Cleanups
Sort #includes a bit better, and don't include platform-specific
headers in gio.h.
2010-05-14 08:38:07 -04:00
Matthias Clasen
0540798991 Fix !srcdir build
Thankfully we already had a SRCDIR define.
2010-05-14 01:36:25 -04:00
Matthias Clasen
4e7764fb2d Documentation cleanups 2010-05-14 00:21:39 -04:00
Matthias Clasen
6223341cac Merge branch 'gdbus-merge'
Conflicts:
	docs/reference/gio/gio-docs.xml
	docs/reference/gio/gio-sections.txt
	gio/tests/Makefile.am
2010-05-13 23:08:34 -04:00
Matthias Clasen
6e8637e478 The default timeout is 25s 2010-05-13 22:15:47 -04:00
Matthias Clasen
bdc29f82d3 Document more floating variant details. 2010-05-13 21:53:51 -04:00
Matthias Clasen
e72f7f52de Add some more details to the long description 2010-05-13 21:45:18 -04:00
Matthias Clasen
8f89b63930 Clean up platform-specific includes
The problem was pointed out in bug 618029. To solve it, we moved
the GUnixFDList typedef to giotypes.h.
2010-05-13 20:29:04 -04:00
Ryan Lortie
e1fb92551f check for working gettext() before running tests 2010-05-14 01:01:40 +02:00
David Zeuthen
68078ed648 GDBus: Nuke G_BUS_TYPE_NONE 2010-05-13 18:04:48 -04:00
David Zeuthen
1fd55b8bbf GDBus: Remove g_dbus_is_activated()
It's generally hard to get this right so don't attempt to do so.
2010-05-13 17:44:42 -04:00
David Zeuthen
51446baa52 GDBus: subscribe to PropertiesChanged() before calling GetAll()
Otherwise there's a slight chance of a race.
2010-05-13 17:20:39 -04:00