projects
/
platform
/
upstream
/
dbus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add doc to load_ex_ip_helper_procedures().
[platform/upstream/dbus.git]
/
dbus
/
dbus-keyring.c
diff --git
a/dbus/dbus-keyring.c
b/dbus/dbus-keyring.c
index
4b7182d
..
0e433a8
100644
(file)
--- a/
dbus/dbus-keyring.c
+++ b/
dbus/dbus-keyring.c
@@
-17,10
+17,11
@@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
*
* 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., 5
9 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ * Foundation, Inc., 5
1 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
*
*/
*
*/
+#include <config.h>
#include "dbus-keyring.h"
#include "dbus-protocol.h"
#include <dbus/dbus-string.h>
#include "dbus-keyring.h"
#include "dbus-protocol.h"
#include <dbus/dbus-string.h>
@@
-79,7
+80,7
@@
* Maximum number of keys in the keyring before
* we just ignore the rest
*/
* Maximum number of keys in the keyring before
* we just ignore the rest
*/
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
#define MAX_KEYS_IN_FILE 10
#else
#define MAX_KEYS_IN_FILE 256
#define MAX_KEYS_IN_FILE 10
#else
#define MAX_KEYS_IN_FILE 256
@@
-142,8
+143,6
@@
_dbus_keyring_new (void)
return keyring;
return keyring;
- /* out_4: */
- _dbus_string_free (&keyring->filename_lock);
out_3:
_dbus_string_free (&keyring->filename);
out_2:
out_3:
_dbus_string_free (&keyring->filename);
out_2:
@@
-201,9
+200,8
@@
_dbus_keyring_lock (DBusKeyring *keyring)
n_timeouts = 0;
while (n_timeouts < MAX_LOCK_TIMEOUTS)
{
n_timeouts = 0;
while (n_timeouts < MAX_LOCK_TIMEOUTS)
{
- DBusError error;
+ DBusError error
= DBUS_ERROR_INIT
;
- dbus_error_init (&error);
if (_dbus_create_file_exclusively (&keyring->filename_lock,
&error))
break;
if (_dbus_create_file_exclusively (&keyring->filename_lock,
&error))
break;
@@
-219,13
+217,11
@@
_dbus_keyring_lock (DBusKeyring *keyring)
if (n_timeouts == MAX_LOCK_TIMEOUTS)
{
if (n_timeouts == MAX_LOCK_TIMEOUTS)
{
- DBusError error;
-
+ DBusError error
= DBUS_ERROR_INIT
;
+
_dbus_verbose ("Lock file timed out %d times, assuming stale\n",
n_timeouts);
_dbus_verbose ("Lock file timed out %d times, assuming stale\n",
n_timeouts);
- dbus_error_init (&error);
-
if (!_dbus_delete_file (&keyring->filename_lock, &error))
{
_dbus_verbose ("Couldn't delete old lock file: %s\n",
if (!_dbus_delete_file (&keyring->filename_lock, &error))
{
_dbus_verbose ("Couldn't delete old lock file: %s\n",
@@
-250,8
+246,8
@@
_dbus_keyring_lock (DBusKeyring *keyring)
static void
_dbus_keyring_unlock (DBusKeyring *keyring)
{
static void
_dbus_keyring_unlock (DBusKeyring *keyring)
{
- DBusError error;
- dbus_error_init (&error);
+ DBusError error
= DBUS_ERROR_INIT
;
+
if (!_dbus_delete_file (&keyring->filename_lock, &error))
{
_dbus_warn ("Failed to delete lock file: %s\n",
if (!_dbus_delete_file (&keyring->filename_lock, &error))
{
_dbus_warn ("Failed to delete lock file: %s\n",
@@
-357,7
+353,7
@@
add_new_key (DBusKey **keys_p,
goto out;
}
goto out;
}
- _dbus_get_
current
_time (×tamp, NULL);
+ _dbus_get_
real
_time (×tamp, NULL);
keys[n_keys-1].id = id;
keys[n_keys-1].creation_time = timestamp;
keys[n_keys-1].id = id;
keys[n_keys-1].creation_time = timestamp;
@@
-432,7
+428,7
@@
_dbus_keyring_reload (DBusKeyring *keyring,
retval = FALSE;
have_lock = FALSE;
retval = FALSE;
have_lock = FALSE;
- _dbus_get_
current
_time (&now, NULL);
+ _dbus_get_
real
_time (&now, NULL);
if (add_new)
{
if (add_new)
{
@@
-607,7
+603,7
@@
_dbus_keyring_reload (DBusKeyring *keyring,
}
if (!_dbus_string_save_to_file (&contents, &keyring->filename,
}
if (!_dbus_string_save_to_file (&contents, &keyring->filename,
- error))
+
FALSE,
error))
goto out;
}
goto out;
}
@@
-721,6
+717,13
@@
_dbus_keyring_new_for_credentials (DBusCredentials *credentials,
DBusCredentials *our_credentials;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
DBusCredentials *our_credentials;
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+ if (_dbus_check_setuid ())
+ {
+ dbus_set_error_const (error, DBUS_ERROR_NOT_SUPPORTED,
+ "Unable to create DBus keyring when setuid");
+ return NULL;
+ }
keyring = NULL;
error_set = FALSE;
keyring = NULL;
error_set = FALSE;
@@
-912,7
+915,7
@@
find_recent_key (DBusKeyring *keyring)
int i;
long tv_sec, tv_usec;
int i;
long tv_sec, tv_usec;
- _dbus_get_
current
_time (&tv_sec, &tv_usec);
+ _dbus_get_
real
_time (&tv_sec, &tv_usec);
i = 0;
while (i < keyring->n_keys)
i = 0;
while (i < keyring->n_keys)
@@
-1020,7
+1023,7
@@
_dbus_keyring_get_hex_key (DBusKeyring *keyring,
/** @} */ /* end of exposed API */
/** @} */ /* end of exposed API */
-#ifdef DBUS_
BUIL
D_TESTS
+#ifdef DBUS_
ENABLE_EMBEDDE
D_TESTS
#include "dbus-test.h"
#include <stdio.h>
#include "dbus-test.h"
#include <stdio.h>
@@
-1078,7
+1081,7
@@
_dbus_keyring_test (void)
dbus_error_init (&error);
ring1 = _dbus_keyring_new_for_credentials (NULL, &context,
&error);
dbus_error_init (&error);
ring1 = _dbus_keyring_new_for_credentials (NULL, &context,
&error);
- _dbus_assert (ring1);
+ _dbus_assert (ring1
!= NULL
);
_dbus_assert (error.name == NULL);
id = _dbus_keyring_get_best_key (ring1, &error);
_dbus_assert (error.name == NULL);
id = _dbus_keyring_get_best_key (ring1, &error);
@@
-1090,7
+1093,7
@@
_dbus_keyring_test (void)
}
ring2 = _dbus_keyring_new_for_credentials (NULL, &context, &error);
}
ring2 = _dbus_keyring_new_for_credentials (NULL, &context, &error);
- _dbus_assert (ring2);
+ _dbus_assert (ring2
!= NULL
);
_dbus_assert (error.name == NULL);
if (ring1->n_keys != ring2->n_keys)
_dbus_assert (error.name == NULL);
if (ring1->n_keys != ring2->n_keys)
@@
-1153,5
+1156,5
@@
_dbus_keyring_test (void)
return FALSE;
}
return FALSE;
}
-#endif /* DBUS_
BUIL
D_TESTS */
+#endif /* DBUS_
ENABLE_EMBEDDE
D_TESTS */