X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_ssl_gnutls.cpp;h=80c0761488078639c5436b3cb5fcfaf9f8a01a2e;hb=e96f1bb1571c864705c20a976ff64bb40d6b8d06;hp=56b60de260cab0d87830e4fb471f0a5783582f3f;hpb=565544fac966b14e046bb3042ab485f79bcf7c9e;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 56b60de26..80c076148 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -26,31 +26,41 @@ /// $LinkerFlags: find_linker_flags("gnutls" "-lgnutls") /// $LinkerFlags: require_version("gnutls" "1.0" "2.12") execute("libgcrypt-config --libs" "LIBGCRYPT_LDFLAGS") +/// $PackageInfo: require_system("arch") gnutls pkgconf /// $PackageInfo: require_system("centos") gnutls-devel pkgconfig /// $PackageInfo: require_system("darwin") gnutls pkg-config -/// $PackageInfo: require_system("debian" "1.0" "7.99") libgcrypt11-dev /// $PackageInfo: require_system("debian") gnutls-bin libgnutls28-dev pkg-config -/// $PackageInfo: require_system("ubuntu" "1.0" "13.10") libgcrypt11-dev /// $PackageInfo: require_system("ubuntu") gnutls-bin libgnutls-dev pkg-config #include "inspircd.h" #include "modules/ssl.h" #include +#ifdef __GNUC__ +# pragma GCC diagnostic push +#endif + // Fix warnings about the use of commas at end of enumerator lists on C++03. #if defined __clang__ # pragma clang diagnostic ignored "-Wc++11-extensions" #elif defined __GNUC__ -# if __GNUC__ < 6 -# pragma GCC diagnostic ignored "-pedantic" +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)) +# pragma GCC diagnostic ignored "-Wpedantic" # else -# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +# pragma GCC diagnostic ignored "-pedantic" # endif #endif #include #include +#ifdef __GNUC__ +# pragma GCC diagnostic pop +#endif + +// Fix warnings about using std::auto_ptr on C++11 or newer. +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #ifndef GNUTLS_VERSION_NUMBER #define GNUTLS_VERSION_NUMBER LIBGNUTLS_VERSION_NUMBER #define GNUTLS_VERSION LIBGNUTLS_VERSION @@ -184,14 +194,12 @@ namespace GnuTLS throw Exception("Unknown hash type " + hashname); gnutls_hash_deinit(is_digest, NULL); #else - if (hashname == "md5") + if (stdalgo::string::equalsci(hashname, "md5")) hash = GNUTLS_DIG_MD5; - else if (hashname == "sha1") + else if (stdalgo::string::equalsci(hashname, "sha1")) hash = GNUTLS_DIG_SHA1; -#ifdef INSPIRCD_GNUTLS_ENABLE_SHA256_FINGERPRINT - else if (hashname == "sha256") + else if (stdalgo::string::equalsci(hashname, "sha256")) hash = GNUTLS_DIG_SHA256; -#endif else throw Exception("Unknown hash type " + hashname); #endif @@ -650,7 +658,7 @@ namespace GnuTLS , keystr(ReadFile(tag->getString("keyfile", "key.pem"))) , dh(DHParams::Import(ReadFile(tag->getString("dhfile", "dhparams.pem")))) , priostr(GetPrioStr(profilename, tag)) - , mindh(tag->getInt("mindhbits", 1024)) + , mindh(tag->getUInt("mindhbits", 1024)) , hashstr(tag->getString("hash", "md5")) , requestclientcert(tag->getBool("requestclientcert", true)) { @@ -667,9 +675,9 @@ namespace GnuTLS #ifdef INSPIRCD_GNUTLS_HAS_CORK // If cork support is available outrecsize represents the (rough) max amount of data we give GnuTLS while corked - outrecsize = tag->getInt("outrecsize", 2048, 512); + outrecsize = tag->getUInt("outrecsize", 2048, 512); #else - outrecsize = tag->getInt("outrecsize", 2048, 512, 16384); + outrecsize = tag->getUInt("outrecsize", 2048, 512, 16384); #endif } }; @@ -1298,7 +1306,7 @@ class ModuleSSLGnuTLS : public Module for (ConfigIter i = tags.first; i != tags.second; ++i) { ConfigTag* tag = i->second; - if (tag->getString("provider") != "gnutls") + if (!stdalgo::string::equalsci(tag->getString("provider"), "gnutls")) continue; std::string name = tag->getString("name"); @@ -1386,7 +1394,7 @@ class ModuleSSLGnuTLS : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides SSL support for clients", VF_VENDOR); + return Version("Provides SSL support via GnuTLS", VF_VENDOR); } ModResult OnCheckReady(LocalUser* user) CXX11_OVERRIDE