]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
m_ssl_gnutls Add GnuTLS::Priority::GetDefault()
authorAttila Molnar <attilamolnar@hush.com>
Wed, 11 Nov 2015 09:38:28 +0000 (10:38 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Wed, 11 Nov 2015 09:38:28 +0000 (10:38 +0100)
src/modules/extra/m_ssl_gnutls.cpp

index d0b9bbe880b9ae8fb0fefc7e660024aea80de54b..cc61ababc28d0b42cd577ed738eb13f91a95ff9b 100644 (file)
@@ -345,6 +345,11 @@ namespace GnuTLS
                {
                        gnutls_priority_set(sess, priority);
                }
+
+               static const char* GetDefault()
+               {
+                       return "NORMAL";
+               }
        };
 #else
        /** Dummy class, used when gnutls_priority_set() is not available
@@ -354,7 +359,7 @@ namespace GnuTLS
         public:
                Priority(const std::string& priorities)
                {
-                       if (priorities != "NORMAL")
+                       if (priorities != GetDefault())
                                throw Exception("You've set a non-default priority string, but GnuTLS lacks support for it");
                }
 
@@ -363,6 +368,11 @@ namespace GnuTLS
                        // Always set the default priorities
                        gnutls_set_default_priority(sess);
                }
+
+               static const char* GetDefault()
+               {
+                       return "NORMAL";
+               }
        };
 #endif
 
@@ -565,7 +575,7 @@ namespace GnuTLS
                        std::auto_ptr<DHParams> dh = DHParams::Import(ReadFile(tag->getString("dhfile", "dhparams.pem")));
 
                        // Use default priority string if this tag does not specify one
-                       std::string priostr = tag->getString("priority", "NORMAL");
+                       std::string priostr = tag->getString("priority", GnuTLS::Priority::GetDefault());
                        unsigned int mindh = tag->getInt("mindhbits", 1024);
                        std::string hashstr = tag->getString("hash", "md5");