#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
"SERVER"))
{
DBusCredentials *creds;
- DBusAuthorization *authorization;
if (auth != NULL)
{
goto out;
}
- /* empty authorization, it will use default rules */
- authorization = _dbus_authorization_new ();
- if (authorization == NULL)
- {
- _dbus_warn ("no memory to create DBusAuthorization\n");
- goto out;
- }
- auth = _dbus_auth_server_new (&guid, authorization);
- /* DBusAuth owns it, or finalized on OOM */
- _dbus_authorization_unref (authorization);
+ auth = _dbus_auth_server_new (&guid);
if (auth == NULL)
{
_dbus_warn ("no memory to create DBusAuth\n");
#include "dbus-sha.h"
#include "dbus-protocol.h"
#include "dbus-credentials.h"
-#include "dbus-authorization.h"
/**
* @defgroup DBusAuth Authentication
{
DBusAuth base; /**< Parent class */
- DBusAuthorization *authorization; /* DBus Authorization callbacks */
-
int failures; /**< Number of times client has been rejected */
int max_failures; /**< Number of times we reject before disconnect */
DBUS_CREDENTIAL_ADT_AUDIT_DATA_ID,
auth->credentials))
return FALSE;
+
+ if (!send_ok (auth))
+ return FALSE;
- /* Do a first authorization of the transport, in order to REJECT
- * immediately connection if needed (FDO#39720), transport will
- * re-authorize later, but it will close the connection on fail,
- * we want to REJECT now if possible */
- if (_dbus_authorization_do_authorization (DBUS_AUTH_SERVER (auth)->authorization,
- auth->authorized_identity))
- {
- if (!send_ok (auth))
- return FALSE;
- }
- else
- {
- _dbus_verbose ("%s: desired identity does not match server identity: "
- "not authorized\n", DBUS_AUTH_NAME (auth));
- return send_rejected (auth);
- }
-
- _dbus_verbose ("%s: authenticated and authorized client based on "
- "socket credentials\n", DBUS_AUTH_NAME (auth));
+ _dbus_verbose ("%s: authenticated client based on socket credentials\n",
+ DBUS_AUTH_NAME (auth));
return TRUE;
}
* @returns the new object or #NULL if no memory
*/
DBusAuth*
-_dbus_auth_server_new (const DBusString *guid,
- DBusAuthorization *authorization)
+_dbus_auth_server_new (const DBusString *guid)
{
DBusAuth *auth;
DBusAuthServer *server_auth;
server_auth = DBUS_AUTH_SERVER (auth);
server_auth->guid = guid_copy;
- server_auth->authorization = _dbus_authorization_ref (authorization);
-
+
/* perhaps this should be per-mechanism with a lower
* max
*/
_dbus_assert (DBUS_AUTH_IS_SERVER (auth));
_dbus_string_free (& DBUS_AUTH_SERVER (auth)->guid);
- _dbus_authorization_unref (DBUS_AUTH_SERVER (auth)->authorization);
}
if (auth->keyring)
#include <dbus/dbus-errors.h>
#include <dbus/dbus-string.h>
#include <dbus/dbus-sysdeps.h>
-#include <dbus/dbus-authorization.h>
DBUS_BEGIN_DECLS
DBUS_AUTH_STATE_AUTHENTICATED
} DBusAuthState;
-DBusAuth* _dbus_auth_server_new (const DBusString *guid,
- DBusAuthorization *authorization);
+DBusAuth* _dbus_auth_server_new (const DBusString *guid);
DBusAuth* _dbus_auth_client_new (void);
DBusAuth* _dbus_auth_ref (DBusAuth *auth);
void _dbus_auth_unref (DBusAuth *auth);