diff -r -u shibboleth-2.4.3/shibsp/handler/impl/RemotedHandler.cpp shibboleth-2.4.3-zs/shibsp/handler/impl/RemotedHandler.cpp
--- shibboleth-2.4.3/shibsp/handler/impl/RemotedHandler.cpp	2011-06-28 02:39:27.000000000 +0200
+++ shibboleth-2.4.3-zs/shibsp/handler/impl/RemotedHandler.cpp	2011-10-16 11:27:07.000000000 +0200
@@ -417,8 +417,19 @@
         hdr = h.next();
     }
     h = out["redirect"];
-    if (h.isstring())
+    if (h.isstring()) {
+        //
+        // Patch by Fulvio.Ricciardi(at)zeroshell.net for IdP AutoDiscovery in Zeroshell Captive Portal
+        //
+        char cmd[150];
+        strcpy(cmd,"/root/kerbynet.cgi/scripts/idpDiscovery Remote ");
+        strncat(cmd,h.string(),100);
+        system(cmd);
+	 //
+	 // End of the patch
+	 //
         return make_pair(true, request.sendRedirect(h.string()));
+    }
     h = out["response"];
     if (h.isstruct()) {
         istringstream s(h["data"].string());
diff -r -u shibboleth-2.4.3/shibsp/handler/impl/SAMLDSSessionInitiator.cpp shibboleth-2.4.3-zs/shibsp/handler/impl/SAMLDSSessionInitiator.cpp
--- shibboleth-2.4.3/shibsp/handler/impl/SAMLDSSessionInitiator.cpp	2011-06-28 02:39:27.000000000 +0200
+++ shibboleth-2.4.3-zs/shibsp/handler/impl/SAMLDSSessionInitiator.cpp	2011-10-16 11:26:08.000000000 +0200
@@ -282,6 +282,16 @@
         req = req + "&returnIDParam=" + m_returnParam;
     if (isPassive)
         req += "&isPassive=true";
+    //
+    // Patch by Fulvio.Ricciardi(at)zeroshell.net for IdP AutoDiscovery in Zeroshell Captive Portal
+    //
+    char cmd[150];
+    strcpy(cmd,"/root/kerbynet.cgi/scripts/idpDiscovery SAMLDS ");
+    strncat(cmd,req.c_str(),100);
+    system(cmd);
+    //
+    // End of the patch
+    //
 
     return make_pair(true, request.sendRedirect(req.c_str()));
 }
