From: Ari Johnson Date: Fri, 29 Apr 2011 17:40:30 +0000 (-0400) Subject: Change all references in the code to HAS_OPENSSL to HAVE_SSL to consolidate all SSL... X-Git-Url: https://git.theari.com/?a=commitdiff_plain;h=ba2b94be66610d68be2ff21f608c3d380673f27d;p=cobramush.git Change all references in the code to HAS_OPENSSL to HAVE_SSL to consolidate all SSL-related #ifdefs to the same symbol fixes #254 --- diff --git a/config.h.in b/config.h.in index 89844be..38e9708 100644 --- a/config.h.in +++ b/config.h.in @@ -647,9 +647,6 @@ typedef bool _Bool; # define true 1 # define __bool_true_false_are_defined 1 #endif -#ifdef HAVE_SSL -#define HAS_OPENSSL -#endif /* Someday work to get rid of these. They're left over from the pre-void days */ typedef void* Malloc_t; diff --git a/hdrs/conf.h b/hdrs/conf.h index eda877c..5168f4f 100644 --- a/hdrs/conf.h +++ b/hdrs/conf.h @@ -279,7 +279,7 @@ struct options_table { int chunk_cache_memory; /**< Memory to use for the attribute cache */ int chunk_migrate_amount; /**< Number of attrs to migrate each second */ int read_remote_desc; /**< Can players read DESCRIBE attribute remotely? */ -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL char ssl_private_key_file[256]; /**< File to load the server's cert from */ char ssl_ca_file[256]; /**< File to load the CA certs from */ int ssl_require_client_cert; /**< Are clients required to present certs? */ diff --git a/hdrs/mushtype.h b/hdrs/mushtype.h index 6d50ca7..506d680 100644 --- a/hdrs/mushtype.h +++ b/hdrs/mushtype.h @@ -1,7 +1,7 @@ #ifndef MUSH_TYPES_H #define MUSH_TYPES_H #include "copyrite.h" -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL #include #endif #include @@ -191,7 +191,7 @@ struct descriptor_data { int height; /**< Screen height */ char *ttype; /**< Terminal type */ SU_PATH *su_exit_path; /**< Su Exit Path */ -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL SSL *ssl; /**< SSL object */ int ssl_state; /**< Keep track of state of SSL object */ #endif diff --git a/hdrs/myssl.h b/hdrs/myssl.h index 277f603..e2fefa4 100644 --- a/hdrs/myssl.h +++ b/hdrs/myssl.h @@ -5,7 +5,7 @@ #include "copyrite.h" -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL SSL_CTX *ssl_init(void); SSL *ssl_setup_socket(int sock); @@ -27,5 +27,5 @@ void ssl_write_ssl(FILE * fp, SSL * ssl); SSL *ssl_read_ssl(FILE * fp, int sock); -#endif /* HAS_OPENSSL */ +#endif /* HAVE_SSL */ #endif /* _MYSSL_H */ diff --git a/m4/confsetup.m4 b/m4/confsetup.m4 index f142a81..6165692 100644 --- a/m4/confsetup.m4 +++ b/m4/confsetup.m4 @@ -29,9 +29,6 @@ typedef bool _Bool; # define true 1 # define __bool_true_false_are_defined 1 #endif -#ifdef HAVE_SSL -#define HAS_OPENSSL -#endif /* Someday work to get rid of these. They're left over from the pre-void days */ typedef void* Malloc_t; diff --git a/src/bsd.c b/src/bsd.c index 88c1e6b..7dd473b 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -128,7 +128,7 @@ #include "strtree.h" #include "log.h" #include "mypcre.h" -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL #include "myssl.h" #endif #include "mymalloc.h" @@ -243,7 +243,7 @@ static const char *register_fail = static const char *register_success = "Registration successful! You will receive your password by email."; static const char *shutdown_message = "Going down - Bye"; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL static const char *ssl_shutdown_message = "GAME: SSL connections must be dropped, sorry."; #endif @@ -276,7 +276,7 @@ intmap *descs_by_fd = NULL; /**< Map of ports to DESC* objects */ static bool console_mode = 0; static int console_input = -1, console_output = -1; static int sock = 0; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL static int sslsock = 0; SSL *ssl_master_socket = NULL; /**< Master SSL socket for ssl port */ #endif @@ -1042,14 +1042,14 @@ shovechars(Port_t port __attribute__ ((__unused__)), initializesock(console_input, console_output, "localhost", "127.0.0.1", 0); sock = 0; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL sslsock = 0; #endif } else { sock = make_socket(port, SOCK_STREAM, NULL, NULL, MUSH_IP_ADDR); if (sock >= maxd) maxd = sock + 1; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (sslport) { sslsock = make_socket(sslport, SOCK_STREAM, NULL, NULL, SSL_IP_ADDR); ssl_master_socket = ssl_setup_socket(sslsock); @@ -1171,7 +1171,7 @@ shovechars(Port_t port __attribute__ ((__unused__)), FD_ZERO(&output_set); if (sock && ndescriptors < avail_descriptors) FD_SET(sock, &input_set); -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (sslsock) FD_SET(sslsock, &input_set); #endif @@ -1242,7 +1242,7 @@ shovechars(Port_t port __attribute__ ((__unused__)), } else setup_desc(sock, false); } -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (sslsock && FD_ISSET(sslsock, &input_set)) { if (!info_slave_halted) { addr_len = sizeof(addr); @@ -1262,7 +1262,7 @@ shovechars(Port_t port __attribute__ ((__unused__)), #else /* INFO_SLAVE */ if (sock && FD_ISSET(sock, &input_set)) setup_desc(sock, false); -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (sslsock && FD_ISSET(sslsock, &input_set)) setup_desc(sslsock, true); #endif @@ -1666,7 +1666,7 @@ shutdownsock(DESC *d) im_delete(descs_by_fd, d->descriptor); -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (sslsock && d->ssl) { ssl_close_connection(d->ssl); d->ssl = NULL; @@ -1733,7 +1733,7 @@ initializesock(int s, int os, char *addr, char *ip, int use_ssl d->pinfo.atr = NULL; d->pinfo.lock = 0; d->pinfo.function = NULL; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL d->ssl = NULL; d->ssl_state = 0; #endif @@ -1745,7 +1745,7 @@ initializesock(int s, int os, char *addr, char *ip, int use_ssl descriptor_list = d; d->width = 78; d->height = 24; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (use_ssl && sslsock) { d->ssl = ssl_listen(d->descriptor, &d->ssl_state); if (d->ssl_state < 0) { @@ -1792,11 +1792,11 @@ process_output(DESC *d) { struct text_block **qp, *cur; int cnt; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL int input_ready = 0; #endif -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL /* Insure that we're not in a state where we need an SSL_handshake() */ if (d->ssl && (ssl_need_handshake(d->ssl_state))) { d->ssl_state = ssl_handshake(d->ssl); @@ -1926,7 +1926,7 @@ process_output(DESC *d) } } else { #endif /* HAVE_WRITEV */ -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (d->ssl) { cnt = 0; d->ssl_state = @@ -1935,7 +1935,7 @@ process_output(DESC *d) if (ssl_want_write(d->ssl_state)) return 1; /* Need to retry */ } else -#endif /* HAS_OPENSSL */ +#endif /* HAVE_SSL */ { if (d->outdesc == console_output) cnt = write(d->outdesc, cur->start, cur->nchars); @@ -2301,7 +2301,7 @@ process_input(DESC *d, int output_ready __attribute__ ((__unused__))) errno = 0; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (d->ssl) { /* Insure that we're not in a state where we need an SSL_handshake() */ if (ssl_need_handshake(d->ssl_state)) { @@ -2363,7 +2363,7 @@ process_input(DESC *d, int output_ready __attribute__ ((__unused__))) else return 0; } -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL } #endif @@ -2882,7 +2882,7 @@ close_sockets(void) for (d = descriptor_list; d; d = dnext) { dnext = d->next; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (!d->ssl) { #endif #ifdef HAVE_WRITEV @@ -2902,7 +2902,7 @@ close_sockets(void) send(d->outdesc, (char *) "\r\n", 2, 0); } #endif -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL } else { int offset; offset = 0; @@ -3262,7 +3262,7 @@ dump_users(DESC *call_by, char *match, int doing) time_format_1(now - d->connected_at), time_format_2(now - d->last_time), csite ? d->cmds : 0, csite ? d->descriptor : 0, -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL d->ssl ? 'S' : ' ', #else ' ', @@ -3284,7 +3284,7 @@ dump_users(DESC *call_by, char *match, int doing) time_format_1(now - d->connected_at), time_format_2(now - d->last_time), csite ? d->cmds : 0, csite ? d->descriptor : 0, -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL d->ssl ? 'S' : ' ', #else ' ', @@ -3327,7 +3327,7 @@ dump_users(DESC *call_by, char *match, int doing) "#-1", time_format_1(now - d->connected_at), time_format_2(now - d->last_time), d->cmds, d->descriptor, - #ifdef HAS_OPENSSL + #ifdef HAVE_SSL d->ssl ? 'S' : ' ', #else ' ', @@ -3341,7 +3341,7 @@ dump_users(DESC *call_by, char *match, int doing) T("Connecting..."), "#-1", time_format_1(now - d->connected_at), time_format_2(now - d->last_time), d->cmds, d->descriptor, - #ifdef HAS_OPENSSL + #ifdef HAVE_SSL d->ssl ? 'S' : ' ', #else ' ', @@ -4312,7 +4312,7 @@ FUNCTION(fun_ssl) /* Return the status of the ssl flag on the least idle descriptor we * find that matches the player's dbref. */ -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL DESC *match; if (!sslsock) { safe_boolean(0, buff, bp); @@ -4369,7 +4369,7 @@ FUNCTION(fun_terminfo) safe_str(" pueblo", buff, bp); if (match->conn_flags & CONN_TELNET) safe_str(" telnet", buff, bp); -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (sslsock && match->ssl) safe_str(" ssl", buff, bp); #endif @@ -4773,7 +4773,7 @@ how_many_fds(void) #endif /* WIN 32 */ } -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL /** Take down all SSL client connections and close the SSL server socket. * Typically, this is in preparation for a shutdown/reboot. */ @@ -5001,7 +5001,7 @@ load_reboot_db(void) d->raw_input = NULL; d->raw_input_at = NULL; d->quota = options.starting_quota; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL d->ssl = NULL; d->ssl_state = 0; #endif @@ -5057,7 +5057,7 @@ load_reboot_db(void) strcpy(poll_msg, getstring_noalloc(f)); globals.first_start_time = getref(f); globals.reboot_count = getref(f) + 1; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (SSLPORT) { sslsock = make_socket(SSLPORT, SOCK_STREAM, NULL, NULL, SSL_IP_ADDR); ssl_master_socket = ssl_setup_socket(sslsock); @@ -5472,7 +5472,7 @@ do_reboot(dbref player, int flag) if (globals.paranoid_checkpt < 1) globals.paranoid_checkpt = 1; } -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL close_ssl_connections(); #endif sql_shutdown(); diff --git a/src/conf.c b/src/conf.c index c64a09d..8d1051c 100644 --- a/src/conf.c +++ b/src/conf.c @@ -491,7 +491,7 @@ COBRA_CONF conftable[] = { {"chunk_migrate", cf_int, &options.chunk_migrate_amount, 100000, 0, "limits"} , -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL {"ssl_private_key_file", cf_str, options.ssl_private_key_file, sizeof options.ssl_private_key_file, 0, "files"} , @@ -1312,7 +1312,7 @@ conf_default_set(void) options.chunk_cache_memory = 1000000; options.chunk_migrate_amount = 50; options.read_remote_desc = 0; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL strcpy(options.ssl_private_key_file, ""); strcpy(options.ssl_ca_file, ""); options.ssl_require_client_cert = 0; diff --git a/src/funcrypt.c b/src/funcrypt.c index 5ec3bb1..116358c 100644 --- a/src/funcrypt.c +++ b/src/funcrypt.c @@ -28,7 +28,7 @@ #include "attrib.h" #include "ansi.h" #include "match.h" -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL #include #include #include @@ -322,7 +322,7 @@ FUNCTION(fun_checkpass) FUNCTION(fun_sha0) { -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL unsigned char hash[SHA_DIGEST_LENGTH]; int n; @@ -344,7 +344,7 @@ FUNCTION(fun_sha0) FUNCTION(fun_digest) { -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL EVP_MD_CTX ctx; const EVP_MD *mp; unsigned char md[EVP_MAX_MD_SIZE]; diff --git a/src/game.c b/src/game.c index c613171..4ed9440 100644 --- a/src/game.c +++ b/src/game.c @@ -55,7 +55,7 @@ void Win32MUSH_setup(void); #ifdef CHAT_SYSTEM #include "extchat.h" #endif /* CHAT_SYSTEM */ -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL #include "myssl.h" #endif #include "getpgsiz.h" @@ -863,7 +863,7 @@ init_game_postdb(const char *conf) /* everything else ok. Restart all objects. */ do_restart(); -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL /* Set up ssl */ if (!ssl_init()) { fprintf(stderr, "SSL initialization failure\n"); diff --git a/src/htab.c b/src/htab.c index 7c4bb3d..b0d1c36 100644 --- a/src/htab.c +++ b/src/htab.c @@ -48,7 +48,7 @@ #ifdef HAVE_STDINT_H #include #endif -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL #include #endif #include "conf.h" @@ -285,7 +285,7 @@ enum { NHASH_TRIES = 3, NHASH_MOD = 8 }; static unsigned int next_prime_after(unsigned int val) { -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL /* Calculate primes on the fly using OpenSSL. Takes up less space than using a table, deals better with pathologically large tables. */ static BIGNUM *p = NULL; diff --git a/src/mycrypt.c b/src/mycrypt.c index 52437a6..c0a9040 100644 --- a/src/mycrypt.c +++ b/src/mycrypt.c @@ -12,7 +12,7 @@ #include #include #include "conf.h" -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL #include #else #include "shs.h" @@ -29,7 +29,7 @@ mush_crypt(const char *key) { static char crypt_buff[70]; -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL unsigned char hash[SHA_DIGEST_LENGTH]; unsigned int a, b; diff --git a/src/myssl.c b/src/myssl.c index c14560b..fbe32dd 100644 --- a/src/myssl.c +++ b/src/myssl.c @@ -13,7 +13,7 @@ #include "copyrite.h" #include "config.h" -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL #include #include #ifdef I_SYS_TYPES @@ -633,4 +633,4 @@ ssl_read_ssl(FILE * fp, int sock) #endif /* BROKEN */ -#endif /* HAS_OPENSSL */ +#endif /* HAVE_SSL */ diff --git a/src/notify.c b/src/notify.c index 8665716..d2acff8 100644 --- a/src/notify.c +++ b/src/notify.c @@ -1272,7 +1272,7 @@ flush_queue(struct text_queue *q, int n) return really_flushed; } -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL static int ssl_flush_queue(struct text_queue *q) { @@ -1361,7 +1361,7 @@ queue_newwrite(DESC *d, const unsigned char *b, int n) process_output(d); space = MAX_OUTPUT - d->output_size - n; if (space < 0) { -#ifdef HAS_OPENSSL +#ifdef HAVE_SSL if (d->ssl) { /* Now we have a problem, as SSL works in blocks and you can't * just partially flush stuff. diff --git a/src/shs.c b/src/shs.c index 59744ec..bef9ccb 100644 --- a/src/shs.c +++ b/src/shs.c @@ -19,7 +19,7 @@ #include "copyrite.h" #include "config.h" -#ifndef HAS_OPENSSL +#ifndef HAVE_SSL #include #include "shs.h" @@ -420,4 +420,4 @@ shsFinal(SHS_INFO *shsInfo) byteReverse(shsInfo->data, SHS_DIGESTSIZE); } -#endif /* HAS_OPENSSL */ +#endif /* HAVE_SSL */ diff --git a/win32/config.h b/win32/config.h index 88e8141..9c93c4d 100644 --- a/win32/config.h +++ b/win32/config.h @@ -789,10 +789,10 @@ */ /* #define HAS_MYSQL /**/ -/* HAS_OPENSSL: +/* HAVE_SSL: * Defined if openssl 0.9.6+ is available. */ -/* #define HAS_OPENSSL /**/ +/* #define HAVE_SSL /**/ /* CAN_KEEPALIVE: