X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dbus%2Fdbus-auth-script.c;h=107c92b237f81cadd517120a6481bbaf2d6d4d32;hb=3006b952dbd939d01507d1397e8c4a0e03f2d7a6;hp=cbdd748f3c9048b5ded6198b28e054031698d8d4;hpb=5f12e6e081d8a881ac712927d1a0e6b7ff7d4cca;p=platform%2Fupstream%2Fdbus.git diff --git a/dbus/dbus-auth-script.c b/dbus/dbus-auth-script.c index cbdd748..107c92b 100644 --- a/dbus/dbus-auth-script.c +++ b/dbus/dbus-auth-script.c @@ -22,7 +22,7 @@ */ #include -#ifdef DBUS_BUILD_TESTS +#ifdef DBUS_ENABLE_EMBEDDED_TESTS #include "dbus-auth-script.h" #include "dbus-auth.h" @@ -30,6 +30,7 @@ #include "dbus-hash.h" #include "dbus-credentials.h" #include "dbus-internals.h" +#include "dbus-authorization.h" /** * @defgroup DBusAuthScript code for running unit test scripts for DBusAuth @@ -397,10 +398,11 @@ _dbus_auth_script_run (const DBusString *filename) _dbus_credentials_unref (creds); } - else if (_dbus_string_starts_with_c_str (&line, - "SERVER")) + else if (_dbus_string_starts_with_c_str (&line, "SERVER") || + _dbus_string_starts_with_c_str (&line, "SERVER_ANONYMOUS")) { DBusCredentials *creds; + DBusAuthorization *authorization; if (auth != NULL) { @@ -408,7 +410,21 @@ _dbus_auth_script_run (const DBusString *filename) goto out; } - auth = _dbus_auth_server_new (&guid); + /* empty authorization, it will use default rules */ + authorization = _dbus_authorization_new (); + if (authorization == NULL) + { + _dbus_warn ("no memory to create DBusAuthorization\n"); + goto out; + } + /* if we are testing an anonymous server, we need to enable + * anonymous authorization, or the mech will REJECT */ + if (_dbus_string_starts_with_c_str (&line, "SERVER_ANONYMOUS")) + _dbus_authorization_set_allow_anonymous (authorization, TRUE); + + auth = _dbus_auth_server_new (&guid, authorization); + /* DBusAuth owns it, or finalized on OOM */ + _dbus_authorization_unref (authorization); if (auth == NULL) { _dbus_warn ("no memory to create DBusAuth\n"); @@ -800,4 +816,4 @@ _dbus_auth_script_run (const DBusString *filename) } /** @} */ -#endif /* DBUS_BUILD_TESTS */ +#endif /* DBUS_ENABLE_EMBEDDED_TESTS */