X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dbus%2Fdbus-auth-script.c;h=c1f0c88ec7e7994d81b01149becffc374bd00c11;hb=cc28d8d91055e7640932c67031ca0ec86dddac06;hp=eb145e49bd25eb9f2b931a2baa71aedd39bca53c;hpb=94125e89b6be74cb20100d5321a98aa6529187a9;p=platform%2Fupstream%2Fdbus.git diff --git a/dbus/dbus-auth-script.c b/dbus/dbus-auth-script.c index eb145e4..c1f0c88 100644 --- a/dbus/dbus-auth-script.c +++ b/dbus/dbus-auth-script.c @@ -1,4 +1,4 @@ -/* -*- mode: C; c-file-style: "gnu" -*- */ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /* dbus-auth-script.c Test DBusAuth using a special script file (internal to D-Bus implementation) * * Copyright (C) 2003 Red Hat, Inc. @@ -17,12 +17,12 @@ * * 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 -#ifdef DBUS_BUILD_TESTS +#ifdef DBUS_ENABLE_EMBEDDED_TESTS #include "dbus-auth-script.h" #include "dbus-auth.h" @@ -223,7 +223,7 @@ auth_set_unix_credentials(DBusAuth *auth, if (uid != DBUS_UID_UNSET) _dbus_credentials_add_unix_uid (credentials, uid); if (pid != DBUS_PID_UNSET) - _dbus_credentials_add_unix_pid (credentials, pid); + _dbus_credentials_add_pid (credentials, pid); _dbus_auth_set_credentials (auth, credentials); @@ -244,7 +244,7 @@ dbus_bool_t _dbus_auth_script_run (const DBusString *filename) { DBusString file; - DBusError error; + DBusError error = DBUS_ERROR_INIT; DBusString line; dbus_bool_t retval; int line_no; @@ -276,7 +276,6 @@ _dbus_auth_script_run (const DBusString *filename) return FALSE; } - dbus_error_init (&error); if (!_dbus_file_get_contents (&file, filename, &error)) { _dbus_warn ("Getting contents of %s failed: %s\n", _dbus_string_get_const_data (filename), error.message); @@ -324,6 +323,38 @@ _dbus_auth_script_run (const DBusString *filename) /* Ignore this comment */ goto next_iteration; } +#ifdef DBUS_WIN + else if (_dbus_string_starts_with_c_str (&line, + "WIN_ONLY")) + { + /* Ignore this line */ + goto next_iteration; + } + else if (_dbus_string_starts_with_c_str (&line, + "UNIX_ONLY")) + { + /* skip this file */ + _dbus_warn ("skipping unix only auth script\n"); + retval = TRUE; + goto out; + } +#endif +#ifdef DBUS_UNIX + else if (_dbus_string_starts_with_c_str (&line, + "UNIX_ONLY")) + { + /* Ignore this line */ + goto next_iteration; + } + else if (_dbus_string_starts_with_c_str (&line, + "WIN_ONLY")) + { + /* skip this file */ + _dbus_warn ("skipping windows only auth script\n"); + retval = TRUE; + goto out; + } +#endif else if (_dbus_string_starts_with_c_str (&line, "CLIENT")) { @@ -488,7 +519,7 @@ _dbus_auth_script_run (const DBusString *filename) goto out; } - if (!_dbus_append_desired_identity (&username)) + if (!_dbus_append_user_from_current_process (&username)) { _dbus_warn ("no memory for userid\n"); _dbus_string_free (&username); @@ -513,7 +544,6 @@ _dbus_auth_script_run (const DBusString *filename) "USERNAME_HEX", &where)) { DBusString username; - const DBusString *u; if (!_dbus_string_init (&username)) { @@ -522,9 +552,7 @@ _dbus_auth_script_run (const DBusString *filename) goto out; } - if (!_dbus_username_from_current_process (&u) || - !_dbus_string_copy (u, 0, &username, - _dbus_string_get_length (&username))) + if (!_dbus_append_user_from_current_process (&username)) { _dbus_warn ("no memory for username\n"); _dbus_string_free (&username); @@ -772,4 +800,4 @@ _dbus_auth_script_run (const DBusString *filename) } /** @} */ -#endif /* DBUS_BUILD_TESTS */ +#endif /* DBUS_ENABLE_EMBEDDED_TESTS */