X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dbus%2Fdbus-keyring.c;h=f0c64de3ebc50d20ff71b27c29f942b4deddc171;hb=61d97215c317a4154df47fbfb882aab60b92fbab;hp=8cc4048fec4a5f037b2f6c40b3d84447352f4634;hpb=3c89788fa483ebda858ab66797e2834af94b798f;p=platform%2Fupstream%2Fdbus.git diff --git a/dbus/dbus-keyring.c b/dbus/dbus-keyring.c index 8cc4048..f0c64de 100644 --- 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 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ +#include #include "dbus-keyring.h" #include "dbus-protocol.h" #include @@ -79,7 +80,7 @@ * Maximum number of keys in the keyring before * we just ignore the rest */ -#ifdef DBUS_BUILD_TESTS +#ifdef DBUS_ENABLE_EMBEDDED_TESTS #define MAX_KEYS_IN_FILE 10 #else #define MAX_KEYS_IN_FILE 256 @@ -142,8 +143,6 @@ _dbus_keyring_new (void) return keyring; - /* out_4: */ - _dbus_string_free (&keyring->filename_lock); out_3: _dbus_string_free (&keyring->filename); out_2: @@ -354,7 +353,7 @@ add_new_key (DBusKey **keys_p, 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; @@ -429,7 +428,7 @@ _dbus_keyring_reload (DBusKeyring *keyring, retval = FALSE; have_lock = FALSE; - _dbus_get_current_time (&now, NULL); + _dbus_get_real_time (&now, NULL); if (add_new) { @@ -604,7 +603,7 @@ _dbus_keyring_reload (DBusKeyring *keyring, } if (!_dbus_string_save_to_file (&contents, &keyring->filename, - error)) + FALSE, error)) goto out; } @@ -698,10 +697,10 @@ _dbus_keyring_unref (DBusKeyring *keyring) /** * Creates a new keyring that lives in the ~/.dbus-keyrings directory - * of the given user credentials. If the credentials are #NULL or - * empty, uses those of the current process. + * of the user represented by @p credentials. If the @p credentials are + * #NULL or empty, uses those of the current process. * - * @param username username to get keyring for, or #NULL + * @param credentials a set of credentials representing a user or #NULL * @param context which keyring to get * @param error return location for errors * @returns the keyring or #NULL on error @@ -718,6 +717,13 @@ _dbus_keyring_new_for_credentials (DBusCredentials *credentials, 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; @@ -909,7 +915,7 @@ find_recent_key (DBusKeyring *keyring) 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) @@ -1017,7 +1023,7 @@ _dbus_keyring_get_hex_key (DBusKeyring *keyring, /** @} */ /* end of exposed API */ -#ifdef DBUS_BUILD_TESTS +#ifdef DBUS_ENABLE_EMBEDDED_TESTS #include "dbus-test.h" #include @@ -1150,5 +1156,5 @@ _dbus_keyring_test (void) return FALSE; } -#endif /* DBUS_BUILD_TESTS */ +#endif /* DBUS_ENABLE_EMBEDDED_TESTS */