summaryrefslogtreecommitdiff
path: root/bus
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-04-11 20:10:36 +0000
committerHavoc Pennington <hp@redhat.com>2003-04-11 20:10:36 +0000
commitfff4709be676718a54e280fd3b4ac4b742554982 (patch)
treeb5179eed629641652f91a56a1a39a0aaa8065550 /bus
parent477507c4e93382496a1655e85b0dfec649a00e46 (diff)
downloaddbus-fff4709be676718a54e280fd3b4ac4b742554982.tar.gz
2003-04-11 Havoc Pennington <hp@redhat.com>
* bus/bus.c (bus_context_new): move credentials change after creating pidfile
Diffstat (limited to 'bus')
-rw-r--r--bus/bus.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/bus/bus.c b/bus/bus.c
index d8d2a9c1..3b2ffc0c 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -455,31 +455,6 @@ bus_context_new (const DBusString *config_file,
link = _dbus_list_get_next_link (addresses, link);
}
- /* Here we change our credentials if required,
- * as soon as we've set up our sockets
- */
- user = bus_config_parser_get_user (parser);
- if (user != NULL)
- {
- DBusCredentials creds;
- DBusString u;
-
- _dbus_string_init_const (&u, user);
-
- if (!_dbus_credentials_from_username (&u, &creds) ||
- creds.uid < 0 ||
- creds.gid < 0)
- {
- dbus_set_error (error, DBUS_ERROR_FAILED,
- "Could not get UID and GID for username \"%s\"",
- user);
- goto failed;
- }
-
- if (!_dbus_change_identity (creds.uid, creds.gid, error))
- goto failed;
- }
-
/* note that type may be NULL */
context->type = _dbus_strdup (bus_config_parser_get_type (parser));
@@ -636,6 +611,31 @@ bus_context_new (const DBusString *config_file,
/* keep around the pid filename so we can delete it later */
context->pidfile = _dbus_strdup (pidfile);
+
+ /* Here we change our credentials if required,
+ * as soon as we've set up our sockets and pidfile
+ */
+ user = bus_config_parser_get_user (parser);
+ if (user != NULL)
+ {
+ DBusCredentials creds;
+ DBusString u;
+
+ _dbus_string_init_const (&u, user);
+
+ if (!_dbus_credentials_from_username (&u, &creds) ||
+ creds.uid < 0 ||
+ creds.gid < 0)
+ {
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+ "Could not get UID and GID for username \"%s\"",
+ user);
+ goto failed;
+ }
+
+ if (!_dbus_change_identity (creds.uid, creds.gid, error))
+ goto failed;
+ }
bus_config_parser_unref (parser);
_dbus_string_free (&full_address);