]> 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 7ab3b7027dee37ec340ef92011de4c450f737dbc..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,7 +448,8 @@ 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 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;