Code

:) Wrong line Josh :D
[inkscape.git] / src / pedro / pedroutil.cpp
index 6d988c719a7844a109e1e6033d3c21ad8d0f6af8..13577bf8f716dd1bf99c57492fe7886a08ef5442 100644 (file)
@@ -48,6 +48,9 @@
 
 #endif /* UNIX */
 
+#ifdef HAVE_SSL
+RELAYTOOL_SSL
+#endif
 
 
 namespace Pedro
@@ -581,6 +584,14 @@ void Md5::append(const DOMString &str)
     append((unsigned char *)str.c_str(), str.size());
 }
 
+/*
+ * Update context to reflect the concatenation of a single character
+ */
+void Md5::append(unsigned char ch)
+{
+    append(&ch, 1);
+}
+
 /*
  * Final wrapup - pad to 64-byte boundary with the bit pattern
  * 1 0* (64-bit count of bits processed, MSB-first)
@@ -987,12 +998,15 @@ void TcpSocket::init()
         WSAStartup( wVersionRequested, &wsaData );
 #endif
 #ifdef HAVE_SSL
+       if (libssl_is_present)
+       {
         sslStream  = NULL;
         sslContext = NULL;
            CRYPTO_set_locking_callback(cryptoLockCallback);
         CRYPTO_set_id_callback(cryptoIdCallback);
         SSL_library_init();
         SSL_load_error_strings();
+       }
 #endif
         tcp_socket_inited = true;
         }
@@ -1019,7 +1033,12 @@ bool TcpSocket::isConnected()
 bool TcpSocket::getHaveSSL()
 {
 #ifdef HAVE_SSL
-    return true;
+    if (libssl_is_present)
+    {
+        return true;
+    } else {
+       return false;
+    }
 #else
     return false;
 #endif
@@ -1085,8 +1104,14 @@ bool TcpSocket::startTls()
     fprintf(stderr,
            "SSL starttls() error:  client not compiled with SSL enabled\n");
     return false;
-#endif /*HAVE_SSL*/
-
+#else /*HAVE_SSL*/
+    if (!libssl_is_present)
+    {
+    fprintf(stderr,
+           "SSL starttls() error:  the correct version of libssl was not found \n");
+    return false;
+    } else {
+           
     sslStream  = NULL;
     sslContext = NULL;
 
@@ -1149,6 +1174,8 @@ bool TcpSocket::startTls()
 
     sslEnabled = true;
     return true;
+    }
+#endif /* HAVE_SSL */
 }
 
 
@@ -1209,6 +1236,8 @@ bool TcpSocket::disconnect()
     bool ret  = true;
     connected = false;
 #ifdef HAVE_SSL
+    if (libssl_is_present)
+    {
     if (sslEnabled)
         {
         if (sslStream)
@@ -1231,6 +1260,7 @@ bool TcpSocket::disconnect()
         }
     sslStream  = NULL;
     sslContext = NULL;
+    }
 #endif /*HAVE_SSL*/
 
 #ifdef __WIN32__
@@ -1272,7 +1302,10 @@ long TcpSocket::available()
     if (count<=0 && sslEnabled)
         {
 #ifdef HAVE_SSL
-        return SSL_pending(sslStream);
+       if (libssl_is_present)
+       {
+            return SSL_pending(sslStream);
+       }
 #endif
         }
     return count;
@@ -1292,6 +1325,8 @@ bool TcpSocket::write(int ch)
     if (sslEnabled)
         {
 #ifdef HAVE_SSL
+       if (libssl_is_present)
+       {
         int r = SSL_write(sslStream, &c, 1);
         if (r<=0)
             {
@@ -1302,6 +1337,7 @@ bool TcpSocket::write(int ch)
                     return -1;
                 }
             }
+       }
 #endif
         }
     else
@@ -1328,6 +1364,8 @@ bool TcpSocket::write(char *str)
     if (sslEnabled)
         {
 #ifdef HAVE_SSL
+       if (libssl_is_present)
+       {
         int r = SSL_write(sslStream, (unsigned char *)str, len);
         if (r<=0)
             {
@@ -1338,6 +1376,7 @@ bool TcpSocket::write(char *str)
                     return -1;
                 }
             }
+       }
 #endif
         }
     else
@@ -1387,6 +1426,8 @@ int TcpSocket::read()
     if (sslEnabled)
         {
 #ifdef HAVE_SSL
+       if (libssl_is_present)
+       {
         if (!sslStream)
             return -1;
         int r = SSL_read(sslStream, &ch, 1);
@@ -1406,6 +1447,7 @@ int TcpSocket::read()
                      ERR_error_string(ERR_get_error(), NULL));
                 return -1;
             }
+       }
 #endif
         }
     else