]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_gnutls.cpp
Extra checks to not set the ssl marker twice on re-handshake (nonfatal but wasteful)
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_gnutls.cpp
index c58db87bb8269d56815e928b87f82dd7f8746455..93b904958c4fac7437b1e827c3f4f8fef4654236 100644 (file)
@@ -13,7 +13,7 @@
 
 /* $ModDesc: Provides SSL support for clients */
 /* $CompileFlags: `libgnutls-config --cflags` */
-/* $LinkerFlags: `libgnutls-config --libs` */
+/* $LinkerFlags: `libgnutls-config --libs` `perl ../gnutls_rpath.pl` */
 
 enum issl_status { ISSL_NONE, ISSL_HANDSHAKING_READ, ISSL_HANDSHAKING_WRITE, ISSL_HANDSHAKEN, ISSL_CLOSING, ISSL_CLOSED };
 
@@ -448,9 +448,10 @@ class ModuleSSLGnuTLS : public Module
        // :kenny.chatspike.net 320 Om Epy|AFK :is a Secure Connection
        virtual void OnWhois(userrec* source, userrec* dest)
        {
-               if(dest->GetExt("ssl"))
+               // Bugfix, only send this numeric for *our* SSL users
+               if(dest->GetExt("ssl") && isin(dest->port, listenports))
                {
-                       WriteServ(source->fd, "320 %s %s :is a secure connection", source->nick, dest->nick);
+                       WriteServ(source->fd, "320 %s %s :is using a secure connection", source->nick, dest->nick);
                }
        }
        
@@ -524,7 +525,11 @@ class ModuleSSLGnuTLS : public Module
                        
                        // This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater.
                        userrec* extendme = Srv->FindDescriptor(session->fd);
-                       extendme->Extend("ssl", "ON");
+                       if (extendme)
+                       {
+                               if (!extendme->GetExt("ssl"))
+                                       extendme->Extend("ssl", "ON");
+                       }
 
                        // Change the seesion state
                        session->status = ISSL_HANDSHAKEN;
@@ -544,11 +549,11 @@ class ModuleSSLGnuTLS : public Module
                {
                        // Tell whatever protocol module we're using that we need to inform other servers of this metadata NOW.
                        std::deque<std::string>* metadata = new std::deque<std::string>;
-                       metadata->push_back(extendme->nick);
-                       metadata->push_back("ssl");
-                       metadata->push_back("ON");
+                       metadata->push_back(user->nick);
+                       metadata->push_back("ssl");             // The metadata id
+                       metadata->push_back("ON");              // The value to send
                        Event* event = new Event((char*)metadata,(Module*)this,"send_metadata");
-                       event->Send();
+                       event->Send();                          // Trigger the event. We don't care what module picks it up.
                        delete event;
                        delete metadata;
                }