Commit Diff
Diff:
3cb3dd4d422cdead2dd09f1e3ce3eff35a9e6dc8
52418c8d828bc25e0e84cc25d5e349a84be0b397
Commit:
52418c8d828bc25e0e84cc25d5e349a84be0b397
Tree:
480166acacfecd667dcd69e68df8f6a305792277
Author:
Omar Polo <op@omarpolo.com>
Date:
Fri Feb 12 12:47:20 2021 UTC
Message:
fix various compilation errors

Include gmid.h as first header in every file, as it then includes
config.h (that defines _GNU_SOURCE for instance).

Fix also a warning about unsigned vs signed const char pointers in
openssl.
commit - 3cb3dd4d422cdead2dd09f1e3ce3eff35a9e6dc8
commit + 52418c8d828bc25e0e84cc25d5e349a84be0b397
blob - ff215093e67bcf907bf3b4c78c9abb336a1d726d
blob + 6975a292ba057a14d96f9ade27ab5f43d3cd6cb0
--- configure
+++ configure
@@ -295,8 +295,6 @@ __HEREDOC__
#define HAVE_VASPRINTF ${HAVE_VASPRINTF}
__HEREDOC__
-
-[ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
[ ${HAVE_EXPLICIT_BZERO} -eq 0 -o \
${HAVE_RECALLOCARRAY} -eq 0 -o \
blob - 8d9f4965a03450f16e513f9818f33d329989f2ce
blob + f1b4fa5df52ee194cc7c703fe826a2dfa6855599
--- ex.c
+++ ex.c
@@ -13,6 +13,8 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
+#include "gmid.h"
#include <err.h>
#include <errno.h>
@@ -23,8 +25,6 @@
#include <signal.h>
#include <stdarg.h>
#include <string.h>
-
-#include "gmid.h"
int
send_string(int fd, const char *str)
blob - eb5098ac5d9020814a5e072b48005558a51e7f5d
blob + 8a1e7eb445d39a1bc140c48d929f6d0415e3f0c2
--- gg.c
+++ gg.c
@@ -14,10 +14,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <string.h>
-
#include "gmid.h"
+#include <string.h>
+
int flag2, flag3, bflag, cflag, hflag, Nflag, Vflag, vflag;
const char *cert, *key;
blob - bcebfbc716d8bae384ef5fd3de20a54e246f8ac9
blob + b17fb4fd9ae9e71c72760aaebfce18ec8af2310f
--- gmid.c
+++ gmid.c
@@ -13,6 +13,8 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
+#include "gmid.h"
#include <sys/stat.h>
@@ -22,8 +24,6 @@
#include <pwd.h>
#include <signal.h>
#include <string.h>
-
-#include "gmid.h"
volatile sig_atomic_t hupped;
blob - a2e6be54cfe610e54da4e1772264b99d7d671b22
blob + a8fd595731dc2f7a058b304f745ab7499134ce1a
--- gmid.h
+++ gmid.h
@@ -16,6 +16,8 @@
#ifndef GMID_H
#define GMID_H
+
+#include "config.h"
#include <sys/socket.h>
#include <sys/types.h>
@@ -33,8 +35,6 @@
#include <openssl/x509.h>
-#include "config.h"
-
#define GEMINI_URL_LEN (1024+3) /* URL max len + \r\n + \0 */
#define SUCCESS 20
blob - b911b0dd6408e147ca0a6beb908dfc8d5ef53d9c
blob + 442af15efbc4f16171083fe27bd80d7d836631af
--- iri.c
+++ iri.c
@@ -13,11 +13,11 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
+#include "gmid.h"
#include <ctype.h>
#include <string.h>
-
-#include "gmid.h"
static inline int
unreserved(int p)
blob - 26bd98850aee4bb0188725c4f265c3cacda9a917
blob + 7f2d5557679b5efcdf3805191a9eafa100a25c2a
--- log.c
+++ log.c
@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "gmid.h"
+
#include <errno.h>
#include <netdb.h>
#include <stdarg.h>
@@ -21,8 +23,6 @@
#include <string.h>
#include <syslog.h>
-#include "gmid.h"
-
void
fatal(const char *fmt, ...)
{
blob - f8fdd67e54afb7e57d9e0575b552a98258b264fd
blob + 7fb444d79281b38d4d4f971f7b85fb3aab478282
--- mime.c
+++ mime.c
@@ -14,12 +14,12 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "gmid.h"
+
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include "gmid.h"
-
void
init_mime(struct mime *mime)
{
blob - b28065cd5df384c3c9fa25fb454789ce99c458f2
blob + 7c3c92e44bd2c94761d452d3df7cc28193a0b4aa
--- puny.c
+++ puny.c
@@ -13,13 +13,13 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
+#include "gmid.h"
#include <stddef.h>
#include <stdint.h>
#include <string.h>
-#include "gmid.h"
-
#define BASE 36
#define TMIN 1
#define TMAX 26
blob - 777815ebc046d1d6f387c30627e15d8c6f3574ea
blob + a677ab5a25704fccddd43fe59264f42bd503d563
--- server.c
+++ server.c
@@ -13,6 +13,8 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+
+#include "gmid.h"
#include <sys/stat.h>
@@ -25,8 +27,6 @@
#include <fnmatch.h>
#include <limits.h>
#include <string.h>
-
-#include "gmid.h"
struct server {
struct client clients[MAX_USERS];
blob - 20985b4237e53d58b551f6eaaf283e20859f3813
blob + 341da330169c7050c05b46fbe6337da7c133f590
--- utf8.c
+++ utf8.c
@@ -21,11 +21,11 @@
* SOFTWARE.
*/
+#include "gmid.h"
+
#include <stddef.h>
#include <stdint.h>
-#include "gmid.h"
-
#define UTF8_ACCEPT 0
#define UTF8_REJECT 1
blob - 9c88b8363aa57ec08a5a884431e50a01a5cee042
blob + e35357bd2fff59218a514cf538dc4344292e6525
--- utils.c
+++ utils.c
@@ -14,6 +14,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include "gmid.h"
+
#include <errno.h>
#include <string.h>
@@ -22,8 +24,6 @@
#include <openssl/x509_vfy.h>
#include <openssl/x509v3.h>
-#include "gmid.h"
-
static sigset_t set;
void
@@ -115,7 +115,7 @@ gen_certificate(const char *host, const char *certpath
}
void
-gen_certificate(const char *host, const char *certpath, const char *keypath)
+gen_certificate(const char *hostname, const char *certpath, const char *keypath)
{
BIGNUM *e;
EVP_PKEY *pkey;
@@ -123,7 +123,8 @@ gen_certificate(const char *host, const char *certpath
X509 *x509;
X509_NAME *name;
FILE *f;
- const char *org = "gmid";
+ const unsigned char *org = (const unsigned char*)"gmid";
+ const unsigned char *host = (const unsigned char*)hostname;
log_notice(NULL,
"generating new certificate for %s (it could take a while)",
Omar Polo