diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2009-03-09 07:38:33 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-03-09 07:46:15 -0400 |
commit | ecc93955d057987ae19f5b5292b868dedb05fb7f (patch) | |
tree | 6bdc73cbd58cb05beca6e7407e8533980fc737b0 /server | |
parent | 9a86aa6fb50926689befb0d8950312d2e97e30b0 (diff) | |
download | sssd-ecc93955d057987ae19f5b5292b868dedb05fb7f.tar.gz sssd-ecc93955d057987ae19f5b5292b868dedb05fb7f.tar.bz2 sssd-ecc93955d057987ae19f5b5292b868dedb05fb7f.zip |
Fix SIGSEGV in InfoPipe startup
If the user that starts InfoPipe is not permitted by the system
bus to request the InfoPipe name, the sssd_info process would
segfault, since the destructor for the connection object was
called before it was completely created. I have moved the
initialization of the destructor to later in the setup routine.
Diffstat (limited to 'server')
-rw-r--r-- | server/infopipe/sysbus.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/infopipe/sysbus.c b/server/infopipe/sysbus.c index a90f92d5..efb43b34 100644 --- a/server/infopipe/sysbus.c +++ b/server/infopipe/sysbus.c @@ -113,8 +113,6 @@ int sysbus_init(TALLOC_CTX *mem_ctx, struct sysbus_ctx **sysbus, return EIO; } dbus_connection_set_exit_on_disconnect(conn, FALSE); - talloc_set_destructor((TALLOC_CTX *)system_bus, - sysbus_destructor); ret = dbus_bus_request_name(conn, dbus_name, @@ -126,6 +124,7 @@ int sysbus_init(TALLOC_CTX *mem_ctx, struct sysbus_ctx **sysbus, /* We were unable to register on the system bus */ DEBUG(0, ("Unable to request name on the system bus. Error: %s\n", dbus_error.message)); if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error); + dbus_connection_unref(conn); talloc_free(system_bus); return EIO; } @@ -136,9 +135,12 @@ int sysbus_init(TALLOC_CTX *mem_ctx, struct sysbus_ctx **sysbus, ret = sbus_add_connection(system_bus, ev, conn, &system_bus->sconn, SBUS_CONN_TYPE_SHARED); if (ret != EOK) { DEBUG(0, ("Could not integrate D-BUS into mainloop.\n")); + dbus_connection_unref(conn); talloc_free(system_bus); return ret; } + talloc_set_destructor((TALLOC_CTX *)system_bus, + sysbus_destructor); /* Set up methods */ ret = sysbus_init_methods(system_bus, system_bus, interface, path, |