Skip to content

Instantly share code, notes, and snippets.

@phako
Created September 7, 2017 19:08
Show Gist options
  • Save phako/4762d8527bc97e7b853a2937efc28420 to your computer and use it in GitHub Desktop.
Save phako/4762d8527bc97e7b853a2937efc28420 to your computer and use it in GitHub Desktop.
Tr-064 hack fritzbox/gupnp-tools
diff --git a/src/universal-cp/main.c b/src/universal-cp/main.c
index 8e78b0b..80e3c0c 100644
--- a/src/universal-cp/main.c
+++ b/src/universal-cp/main.c
@@ -25,6 +25,7 @@
#endif
#include <libgupnp/gupnp.h>
+#include <libsoup/soup.h>
#include "gui.h"
#include <string.h>
#include <stdlib.h>
@@ -63,6 +64,11 @@ device_proxy_unavailable_cb (GUPnPControlPoint *cp,
remove_device (GUPNP_DEVICE_INFO (proxy));
}
+static void on_auth(SoupSession *session, SoupMessage *message, SoupAuth *auth, gboolean retrying, gpointer user_data)
+{
+ soup_auth_authenticate (auth, "", "MyFritzPassword");
+}
+
static void
on_context_available (GUPnPContextManager *manager,
GUPnPContext *context,
@@ -71,7 +77,7 @@ on_context_available (GUPnPContextManager *manager,
GUPnPControlPoint *cp;
/* We're interested in everything */
- cp = gupnp_control_point_new (context, "upnp:rootdevice");
+ cp = gupnp_control_point_new (context, "urn:dslforum-org:device:InternetGatewayDevice:1");
g_signal_connect (cp,
"device-proxy-available",
@@ -82,6 +88,13 @@ on_context_available (GUPnPContextManager *manager,
G_CALLBACK (device_proxy_unavailable_cb),
NULL);
+ {
+ SoupSession *session = NULL;
+
+ g_object_get (G_OBJECT (context), "session", &session, NULL);
+ g_signal_connect (G_OBJECT (session), "authenticate", G_CALLBACK (on_auth), NULL);
+ }
+
gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp), TRUE);
/* Let context manager take care of the control point life cycle */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment