]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/openssl.c
Implement first cut of Copy Job
[bacula/bacula] / bacula / src / lib / openssl.c
index 96ffcb52bf111ff13db4905cbbaf1ba2fa512e42..af4a46fb5821113791fc96738cfcc357ea736e3c 100644 (file)
@@ -7,8 +7,8 @@
    many others, a complete list can be found in the file AUTHORS.
    This program is Free Software; you can redistribute it and/or
    modify it under the terms of version two of the GNU General Public
-   License as published by the Free Software Foundation plus additions
-   that are listed in the file LICENSE.
+   License as published by the Free Software Foundation and included
+   in the file LICENSE.
 
    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -82,8 +82,8 @@ void openssl_post_errors(JCR *jcr, int code, const char *errstring)
    while((sslerr = ERR_get_error()) != 0) {
       /* Acquire the human readable string */
       ERR_error_string_n(sslerr, buf, sizeof(buf));
-      Dmsg3(100, "jcr=%p %s: ERR=%s\n", jcr, errstring, buf);
-      Jmsg2(jcr, M_ERROR, 0, "%s: ERR=%s\n", errstring, buf);
+      Dmsg3(50, "jcr=%p %s: ERR=%s\n", jcr, errstring, buf);
+      Qmsg2(jcr, M_ERROR, 0, "%s: ERR=%s\n", errstring, buf);
    }
 }
 
@@ -95,6 +95,11 @@ void openssl_post_errors(JCR *jcr, int code, const char *errstring)
 static unsigned long get_openssl_thread_id(void)
 {
    /* Comparison without use of pthread_equal() is mandated by the OpenSSL API */
+   /*
+    * Note that this creates problems with the new Win32 pthreads
+    *   emulation code, which defines pthread_t as a structure. For
+    *   this reason, we continue to use a very old implementation.
+    */
    return ((unsigned long)pthread_self());
 }
 
@@ -110,7 +115,7 @@ static struct CRYPTO_dynlock_value *openssl_create_dynamic_mutex (const char *fi
 
    if ((stat = pthread_mutex_init(&dynlock->mutex, NULL)) != 0) {
       berrno be;
-      Emsg1(M_ABORT, 0, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(stat));
+      Jmsg1(NULL, M_ABORT, 0, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(stat));
    }
 
    return dynlock;
@@ -131,7 +136,7 @@ static void openssl_destroy_dynamic_mutex(struct CRYPTO_dynlock_value *dynlock,
 
    if ((stat = pthread_mutex_destroy(&dynlock->mutex)) != 0) {
       berrno be;
-      Emsg1(M_ABORT, 0, _("Unable to destroy mutex: ERR=%s\n"), be.bstrerror(stat));
+      Jmsg1(NULL, M_ABORT, 0, _("Unable to destroy mutex: ERR=%s\n"), be.bstrerror(stat));
    }
 
    free(dynlock);
@@ -169,7 +174,7 @@ int openssl_init_threads (void)
    for (i = 0; i < numlocks; i++) {
       if ((stat = pthread_mutex_init(&mutexes[i], NULL)) != 0) {
          berrno be;
-         Emsg1(M_ERROR, 0, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(stat));
+         Jmsg1(NULL, M_FATAL, 0, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(stat));
          return stat;
       }
    }
@@ -202,7 +207,8 @@ void openssl_cleanup_threads(void)
       if ((stat = pthread_mutex_destroy(&mutexes[i])) != 0) {
          berrno be;
          /* We don't halt execution, reporting the error should be sufficient */
-         Emsg1(M_ERROR, 0, _("Unable to destroy mutex: ERR=%s\n"), be.bstrerror(stat));
+         Jmsg1(NULL, M_ERROR, 0, _("Unable to destroy mutex: ERR=%s\n"), 
+               be.bstrerror(stat));
       }
    }