Remove function from header.
[citadel.git] / webcit / crypto.c
index aa509887b733f9afb3a61d759460a0ddb1db2cc0..6925dfa8f362eccce3bab46133b8eb85fa3ee369 100644 (file)
@@ -29,6 +29,8 @@ char *ssl_cipher_list = DEFAULT_SSL_CIPHER_LIST;
 
 pthread_key_t ThreadSSL;       /* Per-thread SSL context */
 
+void ssl_lock(int mode, int n, const char *file, int line);
+
 static unsigned long id_callback(void)
 {
        return (unsigned long) pthread_self();
@@ -83,7 +85,7 @@ void init_ssl(void)
                for (a = 0; a < CRYPTO_num_locks(); a++) {
                        SSLCritters[a] = malloc(sizeof(pthread_mutex_t));
                        if (!SSLCritters[a]) {
-                               syslog(1,
+                               syslog(LOG_EMERG,
                                        "citserver: can't allocate memory!!\n");
                                /** Nothing's been initialized, just die */
                                ShutDownWebcit();
@@ -130,13 +132,13 @@ void init_ssl(void)
        if (!strcasecmp(ctdlhost, "uds")) {
                sprintf(buf, "%s/keys/citadel.key", ctdlport);
                rv = symlink(buf, CTDL_KEY_PATH);
-               if (!rv) syslog(1, "%s\n", strerror(errno));
+               if (!rv) syslog(LOG_DEBUG, "%s\n", strerror(errno));
                sprintf(buf, "%s/keys/citadel.csr", ctdlport);
                rv = symlink(buf, CTDL_CSR_PATH);
-               if (!rv) syslog(1, "%s\n", strerror(errno));
+               if (!rv) syslog(LOG_DEBUG, "%s\n", strerror(errno));
                sprintf(buf, "%s/keys/citadel.cer", ctdlport);
                rv = symlink(buf, CTDL_CER_PATH);
-               if (!rv) syslog(1, "%s\n", strerror(errno));
+               if (!rv) syslog(LOG_DEBUG, "%s\n", strerror(errno));
        }
 
        /*
@@ -475,7 +477,7 @@ void endtls(void)
        /* I don't think this is needed, and it crashes the server anyway
         *
         *      if (ctx != NULL) {
-        *              syslog(9, "Freeing CTX at %x\n", (int)ctx );
+        *              syslog(LOG_DEBUG, "Freeing CTX at %x\n", (int)ctx );
         *              SSL_CTX_free(ctx);
         *      }
         */
@@ -501,7 +503,7 @@ void ssl_lock(int mode, int n, const char *file, int line)
 /*
  * Send binary data to the client encrypted.
  */
-void client_write_ssl(const StrBuf *Buf)
+int client_write_ssl(const StrBuf *Buf)
 {
        const char *buf;
        int retval;
@@ -509,7 +511,7 @@ void client_write_ssl(const StrBuf *Buf)
        long nbytes;
        char junk[1];
 
-       if (THREADSSL == NULL) return;
+       if (THREADSSL == NULL) return -1;
 
        nbytes = nremain = StrLength(Buf);
        buf = ChrPtr(Buf);
@@ -535,10 +537,11 @@ void client_write_ssl(const StrBuf *Buf)
                                syslog(LOG_WARNING, "errno is %d\n", errno);
                        }
                        endtls();
-                       return;
+                       return -1;
                }
                nremain -= retval;
        }
+       return 0;
 }