Репозитории ALT
S: | 0.9.0-alt3 |
5.1: | 0.5.0-alt11 |
4.1: | 0.5.0-alt2 |
4.0: | 0.5.0-alt0.M40.2 |
Группа :: Система/Библиотеки
Пакет: libdbus-c++
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: libdbus-c++-0.9.0-alt-enable_anon.patch
Скачать
Скачать
--- a/include/dbus-c++/server.h
+++ b/include/dbus-c++/server.h
@@ -58,6 +58,8 @@ public:
void enable_auth(bool);
+ void enable_anon(bool);
+
struct Private;
protected:
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -32,11 +32,12 @@
#include "server_p.h"
#include "connection_p.h"
#include "dispatcher_p.h"
+#include "error.h"
using namespace DBus;
Server::Private::Private(DBusServer *s)
- : server(s), auth_enabled(false)
+ : server(s), auth_enabled(false), anon_enabled(false)
{
}
@@ -57,6 +58,9 @@ void Server::Private::on_new_conn_cb(DBu
if (s->_pvt->auth_enabled)
dbus_connection_set_unix_user_function (conn, Private::on_unix_auth_cb, s, NULL);
+ if (s->_pvt->anon_enabled)
+ dbus_connection_set_allow_anonymous (conn, true);
+
debug_log("incoming connection 0x%08x", conn);
}
@@ -146,3 +150,18 @@ void Server::enable_auth(bool enable)
{
_pvt->auth_enabled = enable;
}
+
+void Server::enable_anon(bool enable)
+{
+ const char *anon_mech[] = {"ANONYMOUS", 0};
+ const char *default_mech[] = {"EXTERNAL", "DBUS_COOKIE_SHA1", "ANONYMOUS", 0};
+ const char **used_mech = default_mech;
+
+ if (enable)
+ used_mech = anon_mech;
+
+ if (!dbus_server_set_auth_mechanisms(_pvt->server, used_mech))
+ throw ErrorSetAuthMechanisms();
+
+ _pvt->anon_enabled = enable;
+}
--- a/src/server_p.h
+++ b/src/server_p.h
@@ -48,6 +48,8 @@ struct DXXAPILOCAL Server::Private
bool auth_enabled;
+ bool anon_enabled;
+
Private(DBusServer *);
~Private();
--- a/include/dbus-c++/error.h~ 2013-02-18 18:34:42.000000000 +0400
+++ b/include/dbus-c++/error.h 2013-02-18 18:45:09.000000000 +0400
@@ -281,6 +281,14 @@ struct DXXAPI ErrorSELinuxSecurityContex
{}
};
+struct DXXAPI ErrorSetAuthMechanisms: public Error
+{
+public:
+ ErrorSetAuthMechanisms()
+ : Error("org.freedesktop.DBus.Error.ErrorSetAuthMechanisms", "set authentificaton mechanisms")
+ {}
+};
+
} /* namespace DBus */
#endif//__DBUSXX_ERROR_H