sssd_dbus_server.c revision 9acfdb15ab1b939b4ee9f764206598b83e4f4422
/*
SSSD
Service monitor - D-BUS features
Copyright (C) Stephen Gallagher 2008
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "tevent.h"
#include "sbus/sssd_dbus.h"
#include "sbus/sssd_dbus_private.h"
static int sbus_server_destructor(void *ctx);
/*
* new_connection_callback
* Actions to be run upon each new client connection
* Must either perform dbus_connection_ref() on the
* new connection or else close the connection with
* dbus_connection_close()
*/
void *data)
{
struct sbus_connection *server;
struct sbus_connection *conn;
int ret;
if (!server) {
return;
}
if (ret != 0) {
return;
}
/*
* Initialize connection-specific features
* This may set a more detailed destructor, but
* the default destructor will always be chained
* to handle connection cleanup.
* This function (or its callbacks) should also
* set up connection-specific methods.
*/
}
}
const char *
{
if (!use_symlink) {
}
return talloc_asprintf(mem_ctx,
}
static errno_t
{
errno = 0;
/* Perhaps cruft after a previous server? */
if (ret != 0) {
return EIO;
}
errno = 0;
}
if (ret != 0) {
return EIO;
}
return EOK;
}
static errno_t
remove_socket_symlink(const char *symlink_name)
{
errno = 0;
if (numread < 0) {
return ret;
}
/* We can only remove the symlink if it points to a socket with
* the same PID */
symlink_name, (unsigned long) getpid());
if (ret < 0) {
return EIO;
return EIO;
}
"another process\n"));
return EOK;
}
if (ret != 0) {
return ret;
}
return EOK;
}
/*
* dbus_new_server
* Set up a D-BUS server, integrate with the event loop
* for handling file descriptor and timed events
*/
struct tevent_context *ev,
const char *address,
struct sbus_interface *intf,
bool use_symlink,
struct sbus_connection **_server,
void *init_pvt_data)
{
struct sbus_connection *server;
char *tmp;
int ret;
char *filename;
char *symlink_filename = NULL;
const char *socket_address;
if (!socket_address) {
goto done;
}
/* Set up D-BUS server */
if (!dbus_server) {
goto done;
}
goto done;
}
if (use_symlink) {
if (symlink_filename == NULL) {
goto done;
}
goto done;
}
}
/* Both check_file and chmod can handle both the symlink and
* the socket */
goto done;
}
goto done;
}
}
if (!server) {
goto done;
}
if (use_symlink) {
goto done;
}
}
/* Set up D-BUS new connection handler */
/* Set up DBusWatch functions */
if (!dbret) {
goto done;
}
/* Set up DBusTimeout functions */
if (!dbret) {
goto done;
}
done:
}
return ret;
}
static int sbus_server_destructor(void *ctx)
{
struct sbus_connection *server;
}
}
return 0;
}