URL: https://github.com/freeipa/freeipa/pull/501
Author: tiran
 Title: #501: C compilation fixes and hardening
Action: opened

PR body:
"""
Fix "implicit declaration of function ‘strlen’" in ipa_pwd_ntlm.c,
credits to Lukas.

Add -Werror=implicit-function-declaration to CFLAGS to point developers
to missing includes. It causes compilation to fail when a developer
forgets to add a required include. The problem is no longer hidden in a
massive wall of text from make.

Silence a harmless error from 389-DS slapi.h until the bug is fixed in
downstream, https://pagure.io/389-ds-base/issue/48979

Signed-off-by: Christian Heimes <chei...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/501/head:pr501
git checkout pr501
From bbf04dbc1637327d91a83e743d2dc877edf98d5d Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Fri, 24 Feb 2017 08:20:15 +0100
Subject: [PATCH] C compilation fixes and hardening
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix "implicit declaration of function ‘strlen’" in ipa_pwd_ntlm.c,
credits to Lukas.

Add -Werror=implicit-function-declaration to CFLAGS to point developers
to missing includes. It causes compilation to fail when a developer
forgets to add a required include. The problem is no longer hidden in a
massive wall of text from make.

Silence a harmless error from 389-DS slapi.h until the bug is fixed in
downstream, https://pagure.io/389-ds-base/issue/48979

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 configure.ac        | 4 ++++
 util/ipa_pwd_ntlm.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index 9ee281a..369f2ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,10 @@ LT_INIT
 
 AC_HEADER_STDC
 
+dnl 389-DS' slapi-plugin.h contains wrong prototype
+dnl warn about missing includes
+CFLAGS+=" -Wno-strict-prototypes -Werror=implicit-function-declaration"
+
 PKG_PROG_PKG_CONFIG
 
 AC_ARG_ENABLE([server],
diff --git a/util/ipa_pwd_ntlm.c b/util/ipa_pwd_ntlm.c
index f709981..263816d 100644
--- a/util/ipa_pwd_ntlm.c
+++ b/util/ipa_pwd_ntlm.c
@@ -26,6 +26,7 @@
 
 #include <stdlib.h>
 #include <stdbool.h>
+#include <string.h>
 #include <iconv.h>
 #include <openssl/md4.h>
 
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to