]> git.siccegge.de Git - frida/frida.git/commitdiff
Use protected domainsocket for geiser
authorChristoph Egger <christoph@christoph-egger.org>
Mon, 25 May 2015 05:23:35 +0000 (07:23 +0200)
committerChristoph Egger <christoph@christoph-egger.org>
Mon, 25 May 2015 05:35:56 +0000 (07:35 +0200)
Instead of opening a TCP port on localhost, use a UNIX domainsocket to
listen for connections. This way frida is properly protected against
other users on the same system.

CMakeLists.txt
src/bindings/Guile.cxx

index b793c67a3137e7d33f655ad18af9e6db4385b504..8c7fad6e72ccee825f8c1342523f593ba1a42dd9 100644 (file)
@@ -119,7 +119,7 @@ set(plugin_guile_HEADERS
   src/bindings/Guile.hxx)
 
 add_library(guilePlugin MODULE ${plugin_guile_SOURCES} ${plugin_guile_HEADERS_MOC})
-qt5_use_modules(guilePlugin Core)
+qt5_use_modules(guilePlugin Core Widgets)
 target_link_libraries(guilePlugin ${QT_LIBRARIES} ${GUILE_LDFLAGS})
 
 ##################
index 356757d095ccb7ffb6d4a7bc4575bf4a7e70b74a..d4295c475411d2ae939c1dc0925c5f955938c200 100644 (file)
@@ -1,5 +1,6 @@
 #include "Guile.hxx"
 #include "Config.hxx"
+#include "core/Settings.hxx"
 
 namespace {
        SCM handler (void*, SCM tag, SCM throw_args) {
@@ -10,10 +11,17 @@ namespace {
 
 GuileInterpreter::GuileInterpreter()
        : logger(log4cxx::Logger::getLogger("bindings.Guile")) {
+
+       QString socketpath = Settings::get()->getRuntimeDirectory()->canonicalPath()
+               + "/frida." + QString::number(QCoreApplication::applicationPid(), 16) + ".geiser.sock";
+
        scm_init_guile();
 
+       SCM scm_socketpath = scm_from_locale_string(socketpath.toStdString().c_str());
        scm_c_use_module("system repl server");
-       scm_call_0(scm_c_public_ref("system repl server", "spawn-server"));
+       SCM socket = scm_call_2(scm_c_public_ref("system repl server", "make-unix-domain-server-socket"),
+                               scm_from_locale_keyword("path"), scm_socketpath);
+       scm_call_1(scm_c_public_ref("system repl server", "spawn-server"), socket);
        scm_c_load_extension("libguile-frida-binding",
                             "scm_init_frida_module");