]> Pileus Git - ~andy/fetchmail/blobdiff - socket.c
Compiler warnings fixes, preprocessor and minor general cleanup.
[~andy/fetchmail] / socket.c
index 389d861d8c96aaac5ee6b3990995036530672227..108f2e308594f2b1559254ad6359848ed95d7e74 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -14,6 +14,7 @@
 #include <memory.h>
 #endif /* HAVE_MEMORY_H */
 #include <sys/types.h>
+#include <sys/stat.h>
 #ifndef HAVE_NET_SOCKET_H
 #include <sys/socket.h>
 #else
@@ -72,14 +73,12 @@ static int h_errno;
 
 #endif /* ndef h_errno */
 
-extern int mailserver_socket_temp;     /* Socket to close if connect timeout */
-
-#if NET_SECURITY
+#ifdef NET_SECURITY
 #include <net/security.h>
 #endif /* NET_SECURITY */
 
 #ifdef HAVE_SOCKETPAIR
-char *const *parse_plugin(const char *plugin, const char *host, const char *service)
+static char *const *parse_plugin(const char *plugin, const char *host, const char *service)
 {      const char **argvec;
        const char *c, *p;
        char *cp, *plugin_copy;
@@ -170,7 +169,6 @@ static int handle_plugin(const char *host,
                /* error */
                report(stderr, GT_("fetchmail: fork failed\n"));
                return -1;
-               break;
        case 0: /* child */
                /* fds[1] is the parent's end; close it for proper EOF
                ** detection */
@@ -199,7 +197,6 @@ static int handle_plugin(const char *host,
 #endif /* HAVE_SOCKETPAIR */
 
 #ifdef __UNUSED__
-#include <sys/time.h>
 
 int SockCheckOpen(int fd)
 /* poll given socket; is it selectable? */
@@ -258,13 +255,13 @@ int UnixOpen(const char *path)
     return sock;
 }
 
-#if INET6_ENABLE
+#ifdef INET6_ENABLE
 int SockOpen(const char *host, const char *service, const char *options,
             const char *plugin)
 {
     struct addrinfo *ai, *ai0, req;
     int i;
-#if NET_SECURITY
+#ifdef NET_SECURITY
     void *request = NULL;
     int requestlen;
 #endif /* NET_SECURITY */
@@ -501,10 +498,11 @@ va_dcl {
 }
 
 #ifdef SSL_ENABLE
-#include "openssl/ssl.h"
-#include "openssl/err.h"
-#include "openssl/pem.h"
-#include "openssl/x509.h"
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+#include <openssl/pem.h>
+#include <openssl/x509.h>
+#include <openssl/rand.h>
 
 static SSL_CTX *_ctx = NULL;
 static SSL *_ssl_context[FD_SETSIZE];
@@ -751,14 +749,14 @@ SSL *SSLGetContext( int sock )
 }
 
 
-int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
+static int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
 {
        char buf[257];
        X509 *x509_cert;
        int err, depth;
        unsigned char digest[EVP_MAX_MD_SIZE];
        char text[EVP_MAX_MD_SIZE * 3 + 1], *tp, *te;
-       EVP_MD *digest_tp;
+       const EVP_MD *digest_tp;
        unsigned int dsz, i, esz;
        X509_NAME *subj, *issuer;
 
@@ -883,12 +881,12 @@ int SSL_verify_callback( int ok_return, X509_STORE_CTX *ctx, int strict )
        return (ok_return);
 }
 
-int SSL_nock_verify_callback( int ok_return, X509_STORE_CTX *ctx )
+static int SSL_nock_verify_callback( int ok_return, X509_STORE_CTX *ctx )
 {
        return SSL_verify_callback(ok_return, ctx, 0);
 }
 
-int SSL_ck_verify_callback( int ok_return, X509_STORE_CTX *ctx )
+static int SSL_ck_verify_callback( int ok_return, X509_STORE_CTX *ctx )
 {
        return SSL_verify_callback(ok_return, ctx, 1);
 }