Author: lslezak
Date: Wed Jul 16 15:58:41 2008
New Revision: 49181
URL: http://svn.opensuse.org/viewcvs/yast?rev=49181&view=rev
Log:
- moved dbus code to /dbus directory
- created liby2dbus library for sharing the DBus code
Added:
branches/tmp/lslezak/workshop/core/dbus/
branches/tmp/lslezak/workshop/core/dbus/SCR_service/ (with props)
branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.cc
branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.h
branches/tmp/lslezak/workshop/core/dbus/SCR_service/Makefile.am
branches/tmp/lslezak/workshop/core/dbus/SCR_service/SCR_dbus_server.cc
branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.conf.in
branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.service.in
branches/tmp/lslezak/workshop/core/dbus/liby2dbus/
branches/tmp/lslezak/workshop/core/dbus/liby2dbus/DBusConn.cc (props changed)
- copied unchanged from r49149, branches/tmp/lslezak/workshop/core/scr/src/DBusConn.cc
branches/tmp/lslezak/workshop/core/dbus/liby2dbus/DBusConn.h (props changed)
- copied unchanged from r49149, branches/tmp/lslezak/workshop/core/scr/src/DBusConn.h
branches/tmp/lslezak/workshop/core/dbus/liby2dbus/DBusMsg.cc (props changed)
- copied unchanged from r49149, branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc
branches/tmp/lslezak/workshop/core/dbus/liby2dbus/DBusMsg.h (props changed)
- copied unchanged from r49149, branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h
branches/tmp/lslezak/workshop/core/dbus/liby2dbus/Makefile.am (contents, props changed)
- copied, changed from r49149, branches/tmp/lslezak/workshop/core/scr/src/Makefile.am
branches/tmp/lslezak/workshop/core/dbus/liby2dbus/PolKit.cc
- copied unchanged from r49152, branches/tmp/lslezak/workshop/core/scr/src/PolKit.cc
branches/tmp/lslezak/workshop/core/dbus/liby2dbus/PolKit.h
- copied unchanged from r49149, branches/tmp/lslezak/workshop/core/scr/src/PolKit.h
Removed:
branches/tmp/lslezak/workshop/core/scr/src/DBusConn.cc
branches/tmp/lslezak/workshop/core/scr/src/DBusConn.h
branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.cc
branches/tmp/lslezak/workshop/core/scr/src/DBusMsg.h
branches/tmp/lslezak/workshop/core/scr/src/DBusServer.cc
branches/tmp/lslezak/workshop/core/scr/src/DBusServer.h
branches/tmp/lslezak/workshop/core/scr/src/PolKit.cc
branches/tmp/lslezak/workshop/core/scr/src/PolKit.h
branches/tmp/lslezak/workshop/core/scr/src/SCR_dbus_server.cc
branches/tmp/lslezak/workshop/core/scr/src/org.opensuse.yast.SCR.conf.in
branches/tmp/lslezak/workshop/core/scr/src/org.opensuse.yast.SCR.service.in
Modified:
branches/tmp/lslezak/workshop/core/SUBDIRS
branches/tmp/lslezak/workshop/core/libscr/src/Makefile.am
branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc
branches/tmp/lslezak/workshop/core/libscr/testsuite/Makefile.am
branches/tmp/lslezak/workshop/core/scr/src/Makefile.am
Modified: branches/tmp/lslezak/workshop/core/SUBDIRS
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/SUBDIRS?rev=49181&r1=49180&r2=49181&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/SUBDIRS (original)
+++ branches/tmp/lslezak/workshop/core/SUBDIRS Wed Jul 16 15:58:41 2008
@@ -1 +1 @@
-liby2util-r liby2 libycp libscr agent-dummy scr agent-system agent-any agent-ini agent-modules agent-resolver agents-non-y2 agents-perl wfm base autodocs agent-process
+liby2util-r liby2 libycp dbus libscr agent-dummy scr agent-system agent-any agent-ini agent-modules agent-resolver agents-non-y2 agents-perl wfm base autodocs agent-process
Added: branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.cc?rev=49181&view=auto
==============================================================================
--- branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.cc (added)
+++ branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.cc Wed Jul 16 15:58:41 2008
@@ -0,0 +1,319 @@
+
+/*
+
+ DBus server
+
+ */
+
+#include "DBusServer.h"
+#include "DBusMsg.h"
+
+#ifdef HAVE_POLKIT
+#include "PolKit.h"
+#endif
+
+#include
+
+// nanosleep
+#include
+
+
+DBusServer::DBusServer()
+{
+ sa = new ScriptingAgent();
+}
+
+DBusServer::~DBusServer()
+{
+ if (sa != NULL)
+ {
+ delete sa;
+ }
+}
+
+
+bool DBusServer::connect()
+{
+ // connect to DBus, request a service name
+ return connection.connect(DBUS_BUS_SYSTEM, "org.opensuse.yast.SCR");
+}
+
+
+/**
+ * Server that exposes a method call and waits for it to be called
+ */
+void DBusServer::run()
+{
+ y2milestone("Listening for incoming DBus messages...");
+ timespec req, rem;
+
+ // TODO: use some better mechanism (e.g. file descriptor watch) instead of polling
+ // 0 seconds
+ req.tv_sec = 0;
+ // 50 miliseconds
+ req.tv_nsec = 50000000;
+
+ // mainloop
+ while (true)
+ {
+ // set 100 milisecond timeout
+ connection.setTimeout(100);
+ // try reading a message from DBus
+ DBusMsg request(connection.receive());
+
+ // check if a message was received
+ if (request.empty())
+ {
+ nanosleep(&req, &rem);
+ continue;
+ }
+
+ // create a reply to the message
+ DBusMsg reply;
+
+ y2milestone("Received request from %s: interface: %s, method: %s", request.sender().c_str(),
+ request.interface().c_str(), request.method().c_str());
+
+ // check this is a method call for the right object, interface & method
+ if (request.type() == DBUS_MESSAGE_TYPE_METHOD_CALL && request.interface() == "org.opensuse.yast.SCR.Methods" && request.path() == "/SCR")
+ {
+ std::string method(request.method());
+
+ YCPValue arg0;
+ YCPPath pth;
+
+ bool check_ok = false;
+
+ // check missing arguments
+ if (method == "Read" || method == "Write" || method == "Execute" ||
+ method == "Dir" || method == "Error" || method == "UnregisterAgent" ||
+ method == "UnmountAgent" || method == "RegisterAgent")
+ {
+ if (request.arguments() == 0)
+ {
+ // return an ERROR
+ reply.createError(request, "Missing arguments", DBUS_ERROR_INVALID_ARGS);
+ }
+ else
+ {
+ arg0 = request.getYCPValue(0);
+
+ if (arg0.isNull() || !arg0->isPath())
+ {
+ // return an ERROR
+ reply.createError(request, "Expecting YCPPath as the first argument", DBUS_ERROR_INVALID_ARGS);
+ }
+ else
+ {
+ pth = arg0->asPath();
+ check_ok = true;
+ }
+ }
+ }
+ else if (method == "UnregisterAllAgents" || method != "RegisterNewAgents")
+ {
+ check_ok = true;
+ }
+
+ if (check_ok)
+ {
+ YCPValue arg = request.getYCPValue(1);
+ YCPValue opt = request.getYCPValue(2);
+
+#ifdef HAVE_POLKIT
+ std::string caller(request.sender()), arg_str, opt_str;
+
+ if (!arg.isNull())
+ {
+ arg_str = arg->toString();
+ }
+
+ if (!opt.isNull())
+ {
+ opt_str = opt->toString();
+ }
+
+ // PolicyKit check
+ if (!isActionAllowed(caller, pth->toString(), method, arg_str, opt_str))
+ {
+ // access denied
+ reply.createError(request, "System policy does not allow you to do the action", DBUS_ERROR_ACCESS_DENIED);
+ }
+ else
+#endif
+ {
+ YCPValue ret;
+
+ if (method == "Read")
+ ret = sa->Read(pth, arg, opt);
+ else if (method == "Write")
+ ret = sa->Write(pth, arg, opt);
+ else if (method == "Execute")
+ ret = sa->Execute(pth, arg, opt);
+ else if (method == "Dir")
+ {
+ ret = sa->Dir(pth);
+ if (ret.isNull())
+ ret = YCPList();
+ }
+ else if (method == "Error")
+ ret = sa->Error(pth);
+ else if (method == "UnregisterAgent")
+ ret = sa->UnregisterAgent(pth);
+ else if (method == "UnregisterAllAgents")
+ ret = sa->UnregisterAllAgents();
+ else if (method == "UnmountAgent")
+ ret = sa->UnmountAgent(pth);
+ else if (method == "RegisterNewAgents")
+ ret = sa->RegisterNewAgents();
+ else if (method == "RegisterAgent")
+ ret = sa->RegisterAgent(pth, arg);
+ else
+ y2internal("Unhandled method %s", method.c_str());
+
+ reply.createReply(request);
+
+ if (!ret.isNull())
+ {
+ y2milestone("Result: %s", ret->toString().c_str());
+ reply.addYCPValue(ret);
+ }
+ else
+ reply.addYCPValue(YCPVoid());
+ }
+ }
+ }
+ // handle Introspection request from "org.freedesktop.DBus.Introspectable" "Introspect"
+ else if (request.isMethodCall(DBUS_INTERFACE_INTROSPECTABLE, "Introspect"))
+ {
+ y2milestone("Requesting path: %s", request.path().c_str());
+ // define all exported methods here
+ const char *introspect = (request.path() != "/SCR") ?
+// introcpection data for the root node
+DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
+"<node>"
+" <interface name='org.freedesktop.DBus.Introspectable'>"
+" <method name='Introspect'>"
+" <arg name='xml_data' type='s' direction='out'/>"
+" </method>"
+" </interface>"
+" <node name='SCR'/>"
+"</node>" :
+
+// introcpection data for SCR node
+DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE
+"<node>"
+" <interface name='org.opensuse.yast.SCR.Methods'>"
+" <method name='Read'>"
+" <arg name='path' type='(bsv)' direction='in'/>"
+" <arg name='arg' type='(bsv)' direction='in'/>"
+" <arg name='opt' type='(bsv)' direction='in'/>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <method name='Write'>"
+" <arg name='path' type='(bsv)' direction='in'/>"
+" <arg name='arg' type='(bsv)' direction='in'/>"
+" <arg name='opt' type='(bsv)' direction='in'/>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <method name='Execute'>"
+" <arg name='path' type='(bsv)' direction='in'/>"
+" <arg name='arg' type='(bsv)' direction='in'/>"
+" <arg name='opt' type='(bsv)' direction='in'/>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <method name='Dir'>"
+" <arg name='path' type='(bsv)' direction='in'/>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <method name='Error'>"
+" <arg name='path' type='(bsv)' direction='in'/>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <method name='UnregisterAgent'>"
+" <arg name='path' type='(bsv)' direction='in'/>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <method name='UnregisterAllAgents'>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <method name='RegisterNewAgents'>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <method name='RegisterAgent'>"
+" <arg name='path' type='(bsv)' direction='in'/>"
+" <arg name='arg' type='(bsv)' direction='in'/>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <method name='UnmountAgent'>"
+" <arg name='path' type='(bsv)' direction='in'/>"
+" <arg name='ret' type='(bsv)' direction='out'/>"
+" </method>"
+" <interface name='org.freedesktop.DBus.Introspectable'>"
+" <method name='Introspect'>"
+" <arg name='xml_data' type='s' direction='out'/>"
+" </method>"
+" </interface>"
+" </interface>"
+"</node>";
+
+ // create a reply to the request
+ reply.createReply(request);
+ reply.addString(introspect);
+ }
+ else
+ {
+ y2warning("Ignoring unknown interface or method call: interface: %s, method: %s",
+ request.interface().c_str(), request.method().c_str());
+
+ if (!request.method().empty() && !request.interface().empty())
+ {
+ // report error
+ reply.createError(request, "Unknown object, interface or method", DBUS_ERROR_UNKNOWN_METHOD);
+ }
+ }
+
+ // was a reply set?
+ if (!reply.empty())
+ {
+ // send the reply
+ if (!connection.send(reply))
+ {
+ y2error("Cannot send the result");
+ }
+ else
+ {
+ y2milestone("Flushing connection...");
+ connection.flush();
+ y2milestone("...done");
+ }
+ }
+
+ y2milestone("Message processed");
+ }
+}
+
+#ifdef HAVE_POLKIT
+bool DBusServer::isActionAllowed(const std::string &caller, const std::string &path, const std::string &method,
+ const std::string &arg, const std::string &opt)
+{
+ // create actionId
+ static const char *polkit_prefix = "org.opensuse.yast.scr";
+ std::string action_id(PolKit::createActionId(polkit_prefix, path, method, arg, opt));
+
+ bool ret = false;
+
+ // check the policy here
+ if (policykit.isDBusUserAuthorized(action_id, caller, connection.getConnection()))
+ {
+ y2security("User is authorized to do action %s", action_id.c_str());
+ ret = true;
+ }
+ else
+ {
+ y2security("User is NOT authorized to do action %s", action_id.c_str());
+ }
+
+ return ret;
+}
+#endif
Added: branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.h?rev=49181&view=auto
==============================================================================
--- branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.h (added)
+++ branches/tmp/lslezak/workshop/core/dbus/SCR_service/DBusServer.h Wed Jul 16 15:58:41 2008
@@ -0,0 +1,50 @@
+
+/*
+ DBusServer.h
+*/
+
+#ifndef DBUSSERVER_H
+#define DBUSSERVER_H
+
+#include "config.h"
+
+#include
+
+#include "DBusConn.h"
+#include "ScriptingAgent.h"
+
+#ifdef HAVE_POLKIT
+#include "PolKit.h"
+#endif
+
+class DBusServer
+{
+ public:
+
+ DBusServer();
+ ~DBusServer();
+
+ bool connect();
+ void run();
+
+ private:
+
+ DBusConn connection;
+
+#ifdef HAVE_POLKIT
+ PolKit policykit;
+ bool isActionAllowed(const std::string &caller, const std::string &path,
+ const std::string &method, const std::string &arg, const std::string &opt);
+#endif
+
+ // SCR access
+ ScriptingAgent *sa;
+
+ // disable copying
+ DBusServer(const DBusServer&);
+ DBusServer& operator=(const DBusServer&);
+};
+
+
+#endif
+
Added: branches/tmp/lslezak/workshop/core/dbus/SCR_service/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/dbus/SCR_service/Makefile.am?rev=49181&view=auto
==============================================================================
--- branches/tmp/lslezak/workshop/core/dbus/SCR_service/Makefile.am (added)
+++ branches/tmp/lslezak/workshop/core/dbus/SCR_service/Makefile.am Wed Jul 16 15:58:41 2008
@@ -0,0 +1,48 @@
+#
+# Makefile.am for dbus/service
+#
+
+AM_CXXFLAGS = -DY2LOG=\"SCR-service\" -DSUSEVERSION=\"${SUSEVERSION}\"
+
+INCLUDES = ${AGENT_INCLUDES}
+
+ybin_PROGRAMS = SCR_dbus_server
+
+SCR_dbus_server_SOURCES = SCR_dbus_server.cc DBusServer.cc DBusServer.h
+
+SCR_dbus_server_CPPFLAGS = $(AM_CPPFLAGS) $(DBUS_CFLAGS) $(POLKIT_CFLAGS) -I$(srcdir)/../liby2dbus -I$(srcdir)/../../scr/src -I$(top_builddir)/libscr/src/include
+
+SCR_dbus_server_LDADD = ${AGENT_LIBADD} $(srcdir)/../liby2dbus/liby2dbus.la $(DBUS_LIBS) $(POLKIT_LIBS) $(top_builddir)/scr/src/libpy2scr.la
+
+
+# service activation config
+
+# FIXME?? dbus pkgconfig provides only 'session_bus_services_dir'
+dbus_servicesdir = `pkg-config --print-errors --variable prefix dbus-1`/share/dbus-1/system-services
+
+dbus_services_in_files = org.opensuse.yast.SCR.service.in
+
+dbus_services_DATA = $(dbus_services_in_files:.service.in=.service)
+
+$(dbus_services_DATA): $(dbus_services_in_files)
+ sed -e "s|\@YBINDIR\@|$(ybindir)|" $< > $@
+
+# service config
+
+dbus_confdir = `pkg-config --print-errors --variable sysconfdir dbus-1`/dbus-1/system.d
+
+dbus_conf_in_files = org.opensuse.yast.SCR.conf.in
+
+dbus_conf_DATA = $(dbus_conf_in_files:.conf.in=.conf)
+
+# set access mode according to the PolicyKit status
+# if policykit is disabled only root can access the service
+if HAVE_POLKIT
+dbus_access_mode=allow
+else
+dbus_access_mode=deny
+endif
+
+$(dbus_conf_DATA): $(dbus_conf_in_files)
+ sed -e "s|\@ACCESS_MODE\@|$(dbus_access_mode)|" $< > $@
+
Added: branches/tmp/lslezak/workshop/core/dbus/SCR_service/SCR_dbus_server.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/dbus/SCR_service/SCR_dbus_server.cc?rev=49181&view=auto
==============================================================================
--- branches/tmp/lslezak/workshop/core/dbus/SCR_service/SCR_dbus_server.cc (added)
+++ branches/tmp/lslezak/workshop/core/dbus/SCR_service/SCR_dbus_server.cc Wed Jul 16 15:58:41 2008
@@ -0,0 +1,23 @@
+
+/*
+
+*/
+
+#include "DBusServer.h"
+
+int main(int argc, char **argv)
+{
+
+ DBusServer server;
+
+ bool connected = server.connect();
+
+ if (connected)
+ {
+ server.run();
+ return 0;
+ }
+
+ // indicate an error
+ return 1;
+}
Added: branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.conf.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.conf.in?rev=49181&view=auto
==============================================================================
--- branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.conf.in (added)
+++ branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.conf.in Wed Jul 16 15:58:41 2008
@@ -0,0 +1,11 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy user="root">
+ <allow own="org.opensuse.yast.SCR"/>
+ <allow send_interface="org.opensuse.yast.SCR.Methods"/>
+ </policy>
+ <policy context="default">
+ <deny own="org.opensuse.yast.SCR"/>
+ <@ACCESS_MODE@ send_interface="org.opensuse.yast.SCR.Methods"/>
+ </policy>
+</busconfig>
Added: branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.service.in
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.service.in?rev=49181&view=auto
==============================================================================
--- branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.service.in (added)
+++ branches/tmp/lslezak/workshop/core/dbus/SCR_service/org.opensuse.yast.SCR.service.in Wed Jul 16 15:58:41 2008
@@ -0,0 +1,5 @@
+# DBus service activation config
+[D-BUS Service]
+Name=org.opensuse.yast.SCR
+Exec=@YBINDIR@/SCR_dbus_server
+User=root
Copied: branches/tmp/lslezak/workshop/core/dbus/liby2dbus/Makefile.am (from r49149, branches/tmp/lslezak/workshop/core/scr/src/Makefile.am)
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/dbus/liby2dbus/Makefile.am?p2=branches/tmp/lslezak/workshop/core/dbus/liby2dbus/Makefile.am&p1=branches/tmp/lslezak/workshop/core/scr/src/Makefile.am&r1=49149&r2=49181&rev=49181&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/scr/src/Makefile.am (original)
+++ branches/tmp/lslezak/workshop/core/dbus/liby2dbus/Makefile.am Wed Jul 16 15:58:41 2008
@@ -1,81 +1,22 @@
#
-# Makefile.am for core/scr/src
+# Makefile.am for core/dbus/libdbus
#
-AM_CXXFLAGS = -DY2LOG=\"scr\" -DSUSEVERSION=\"${SUSEVERSION}\"
+AM_CXXFLAGS = -DY2LOG=\"y2dbus\" -DSUSEVERSION=\"${SUSEVERSION}\"
-serversdir = $(execcompdir)/servers
-servers_PROGRAMS = scr
-scr_SOURCES = \
- scr.cc
-
-scr_LDADD = ${AGENT_LIBADD} \
- $(top_builddir)/liby2/src/liby2.la
-
-scr_DEPENDENCIES = libpy2scr.la
-
-scr_LDFLAGS = \
- -Xlinker --whole-archive \
- libpy2scr.la \
- -Xlinker --no-whole-archive
-
-plugin_LTLIBRARIES = libpy2scr.la
-
-libpy2scr_la_SOURCES = \
- Y2CCSCR.cc \
- ScriptingAgent.cc ScriptingAgent.h \
- StdioSCRAgent.cc StdioSCRAgent.h \
- SCRSubAgent.cc SCRSubAgent.h
-
-libpy2scr_la_LDFLAGS = -version-info 2:0
-
-INCLUDES = ${AGENT_INCLUDES}
-
-
-# SCR DBus service section
-
-ybin_PROGRAMS = SCR_dbus_server
-
-SCR_dbus_server_SOURCES = SCR_dbus_server.cc DBusServer.cc DBusServer.h \
- DBusMsg.cc DBusMsg.h DBusConn.cc DBusConn.h
+plugin_LTLIBRARIES = liby2dbus.la
+liby2dbus_la_SOURCES = DBusMsg.cc DBusMsg.h DBusConn.cc DBusConn.h
if HAVE_POLKIT
- SCR_dbus_server_SOURCES += PolKit.cc PolKit.h
+ liby2dbus_la_SOURCES += PolKit.cc PolKit.h
endif
-SCR_dbus_server_CPPFLAGS = $(AM_CPPFLAGS) $(DBUS_CFLAGS) $(POLKIT_CFLAGS)
+liby2dbus_la_CPPFLAGS = $(DBUS_CFLAGS) $(POLKIT_CFLAGS)
-SCR_dbus_server_LDADD = ${AGENT_LIBADD} libpy2scr.la $(DBUS_LIBS) $(POLKIT_LIBS)
+liby2dbus_la_LIBADD = $(DBUS_LIBS) $(POLKIT_LIBS)
-# service activation config
+liby2dbus_la_LDFLAGS = -version-info 2:0
-# FIXME?? dbus pkgconfig provides only 'session_bus_services_dir'
-dbus_servicesdir = `pkg-config --print-errors --variable prefix dbus-1`/share/dbus-1/system-services
-
-dbus_services_in_files = org.opensuse.yast.SCR.service.in
-
-dbus_services_DATA = $(dbus_services_in_files:.service.in=.service)
-
-$(dbus_services_DATA): $(dbus_services_in_files)
- sed -e "s|\@YBINDIR\@|$(ybindir)|" $< > $@
-
-# service config
-
-dbus_confdir = `pkg-config --print-errors --variable sysconfdir dbus-1`/dbus-1/system.d
-
-dbus_conf_in_files = org.opensuse.yast.SCR.conf.in
-
-dbus_conf_DATA = $(dbus_conf_in_files:.conf.in=.conf)
-
-# set access mode according to the PolicyKit status
-# if policykit is disabled only root can access the service
-if HAVE_POLKIT
-dbus_access_mode=allow
-else
-dbus_access_mode=deny
-endif
-
-$(dbus_conf_DATA): $(dbus_conf_in_files)
- sed -e "s|\@ACCESS_MODE\@|$(dbus_access_mode)|" $< > $@
+INCLUDES = ${AGENT_INCLUDES}
Modified: branches/tmp/lslezak/workshop/core/libscr/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/libscr/src/Makefile.am?rev=49181&r1=49180&r2=49181&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/libscr/src/Makefile.am (original)
+++ branches/tmp/lslezak/workshop/core/libscr/src/Makefile.am Wed Jul 16 15:58:41 2008
@@ -9,14 +9,16 @@
lib_LTLIBRARIES = libscr.la
libscr_la_SOURCES = \
- SCRAgent.cc SCR.cc ../../scr/src/DBusConn.cc ../../scr/src/DBusMsg.cc
+ SCRAgent.cc SCR.cc
libscr_la_CPPFLAGS = $(DBUS_CFLAGS)
-libscr_la_LIBADD = $(DBUS_LIBS)
+
+libscr_la_LIBADD = $(srcdir)/../../dbus/liby2dbus/liby2dbus.la
INCLUDES = \
-I$(srcdir)/../../libycp/src/include \
-I$(srcdir)/../../liby2/src/include \
+ -I$(srcdir)/../../dbus/liby2dbus \
-I$(srcdir)/../../scr/src \
-I$(srcdir)/include \
${Y2UTIL_CFLAGS}
Modified: branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc?rev=49181&r1=49180&r2=49181&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc (original)
+++ branches/tmp/lslezak/workshop/core/libscr/src/SCR.cc Wed Jul 16 15:58:41 2008
@@ -80,7 +80,7 @@
// send the message and get the response
DBusMsg reply(connection->call(msg));
- y2debug("Reply type: %d", reply.type());
+ y2milestone("Received reply type: %d", reply.type());
// return the first argument from the reply
YCPValue ret = reply.getYCPValue(0);
Modified: branches/tmp/lslezak/workshop/core/libscr/testsuite/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/libscr/testsuite/Makefile.am?rev=49181&r1=49180&r2=49181&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/libscr/testsuite/Makefile.am (original)
+++ branches/tmp/lslezak/workshop/core/libscr/testsuite/Makefile.am Wed Jul 16 15:58:41 2008
@@ -13,7 +13,7 @@
noinst_PROGRAMS = runscr
runscr_SOURCES = runscr.cc
-runscr_LDADD = ../src/libscr.la ../../liby2/src/liby2.la ../../libycp/src/libycp.la ${Y2UTIL_LIBS} $(DBUS_LIBS)
+runscr_LDADD = ../src/libscr.la ../../liby2/src/liby2.la ../../libycp/src/libycp.la ${Y2UTIL_LIBS} ../../dbus/liby2dbus/liby2dbus.la
PACKAGE = libscr
AUTOMAKE_OPTIONS = dejagnu
Modified: branches/tmp/lslezak/workshop/core/scr/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/lslezak/workshop/core/scr/src/Makefile.am?rev=49181&r1=49180&r2=49181&view=diff
==============================================================================
--- branches/tmp/lslezak/workshop/core/scr/src/Makefile.am (original)
+++ branches/tmp/lslezak/workshop/core/scr/src/Makefile.am Wed Jul 16 15:58:41 2008
@@ -32,50 +32,3 @@
INCLUDES = ${AGENT_INCLUDES}
-
-# SCR DBus service section
-
-ybin_PROGRAMS = SCR_dbus_server
-
-SCR_dbus_server_SOURCES = SCR_dbus_server.cc DBusServer.cc DBusServer.h \
- DBusMsg.cc DBusMsg.h DBusConn.cc DBusConn.h
-
-if HAVE_POLKIT
- SCR_dbus_server_SOURCES += PolKit.cc PolKit.h
-endif
-
-SCR_dbus_server_CPPFLAGS = $(AM_CPPFLAGS) $(DBUS_CFLAGS) $(POLKIT_CFLAGS)
-
-SCR_dbus_server_LDADD = ${AGENT_LIBADD} libpy2scr.la $(DBUS_LIBS) $(POLKIT_LIBS)
-
-# service activation config
-
-# FIXME?? dbus pkgconfig provides only 'session_bus_services_dir'
-dbus_servicesdir = `pkg-config --print-errors --variable prefix dbus-1`/share/dbus-1/system-services
-
-dbus_services_in_files = org.opensuse.yast.SCR.service.in
-
-dbus_services_DATA = $(dbus_services_in_files:.service.in=.service)
-
-$(dbus_services_DATA): $(dbus_services_in_files)
- sed -e "s|\@YBINDIR\@|$(ybindir)|" $< > $@
-
-# service config
-
-dbus_confdir = `pkg-config --print-errors --variable sysconfdir dbus-1`/dbus-1/system.d
-
-dbus_conf_in_files = org.opensuse.yast.SCR.conf.in
-
-dbus_conf_DATA = $(dbus_conf_in_files:.conf.in=.conf)
-
-# set access mode according to the PolicyKit status
-# if policykit is disabled only root can access the service
-if HAVE_POLKIT
-dbus_access_mode=allow
-else
-dbus_access_mode=deny
-endif
-
-$(dbus_conf_DATA): $(dbus_conf_in_files)
- sed -e "s|\@ACCESS_MODE\@|$(dbus_access_mode)|" $< > $@
-
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org