[SSSD] [PATCHES] Include header file in implementation module.

Lukas Slebodnik lslebodn at redhat.com
Mon Sep 23 13:03:27 UTC 2013


ehlo,

I wondered how could it happen that prototype function was different than
definition of function "RESPONDER: Use right function prototype".

Reason: we don't have enable warnings Wmissing-declarations.
gcc manual pages says:
           Warn if a global function is defined without a previous
           declaration.  Do so even if the definition itself provides a
           prototype.  Use this option to detect global functions that are not
           declared in header files.  In C, no warnings are issued for
           functions with previous non-prototype declarations; use
           -Wmissing-prototype to detect missing prototypes.  In C++, no
           warnings are issued for function templates, or for inline
           functions, or for functions in anonymous namespaces.


Attached patches include existing header files into implementation files,
but I think we should file a ticket to fix remaining warnings.
(Function should be declared as static or declaration should be in header file.

2nd patch fix warning for following functions

Function                   | Implementation file without included header file
---------------------------------------------------------
murmurhash3                 src/util/murmurhash3.c
ck_leak_check_setup         src/tests/common_check.c
sss_base64_encode           src/util/crypto/nss/nss_base64.c
sss_base64_decode           src/util/crypto/nss/nss_base64.c
nspr_nss_init               src/util/crypto/nss/nss_util.c
nspr_nss_cleanup            src/util/crypto/nss/nss_util.c
sss_parse_name_for_domains  src/util/usertools.c
sdap_dom_enum_send          src/providers/ldap/sdap_async_enum.c
sdap_nested_group_send      src/providers/ldap/sdap_async_nested_groups.c
sdap_nested_group_recv      src/providers/ldap/sdap_async_nested_groups.c
sdap_dyndns_update_send     src/providers/ldap/sdap_dyndns.c
sdap_dyndns_update_recv     src/providers/ldap/sdap_dyndns.c
become_user                 src/providers/krb5/krb5_become_user.c
switch_creds                src/providers/krb5/krb5_become_user.c
krb5_child_init             src/providers/krb5/krb5_init_shared.c
get_uid_table               src/util/find_uid.c
check_if_uid_is_active      src/util/find_uid.c
sdap_pam_access_handler     src/providers/ldap/ldap_access.c
pack_user_info_chpass_error src/util/user_info_msg.c
ipa_s2n_get_acct_info_send  src/providers/ipa/ipa_s2n_exop.c
ipa_srv_plugin_ctx_init     src/providers/ipa/ipa_srv.c
ipa_srv_plugin_send         src/providers/ipa/ipa_srv.c
ad_srv_plugin_send          src/providers/ad/ad_srv.c
ad_master_domain_send       src/providers/ad/ad_domain_info.c
sss_dp_get_ssh_host_send    src/responder/ssh/sshsrv_dp.c
sss_dp_get_ssh_host_recv    src/responder/ssh/sshsrv_dp.c

LS
-------------- next part --------------
>From bc5da45c3a6f332c746a3b41935edc4b0cb23375 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 21 Sep 2013 18:37:56 +0200
Subject: [PATCH 1/2] Include right header file

Public selinux functions are defined in file src/tools/selinux.c
(selinux_file_context, reset_selinux_file_context, set_seuser, del_seuser),
but wrong header file was included "util/util.h"
All declarations are in header file "tools/tools_util.h".

This patch include right header file.
---
 src/tools/selinux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tools/selinux.c b/src/tools/selinux.c
index 8eb19a236e91fbf713b11e74279ef5006211cf9c..e4a3078107ade550b08d857b3d5823fdf50e00b5 100644
--- a/src/tools/selinux.c
+++ b/src/tools/selinux.c
@@ -31,7 +31,7 @@
 #include <semanage/semanage.h>
 #endif
 
-#include "util/util.h"
+#include "tools/tools_util.h"
 
 #ifndef DEFAULT_SERANGE
 #define DEFAULT_SERANGE "s0"
-- 
1.8.3.1

-------------- next part --------------
>From 70becf8503395ca30e87610979d226ace24f50ab Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 21 Sep 2013 19:10:13 +0200
Subject: [PATCH 2/2] Include header file in implementation module.

Declarations of public functions was in header files,
but header files was not included in implementation file.
---
 src/providers/ad/ad_domain_info.c             | 1 +
 src/providers/ad/ad_srv.c                     | 1 +
 src/providers/ipa/ipa_auth.c                  | 1 +
 src/providers/ipa/ipa_s2n_exop.c              | 1 +
 src/providers/ipa/ipa_srv.c                   | 1 +
 src/providers/krb5/krb5_become_user.c         | 1 +
 src/providers/krb5/krb5_init_shared.c         | 1 +
 src/providers/ldap/ldap_access.c              | 1 +
 src/providers/ldap/sdap_async_autofs.c        | 1 +
 src/providers/ldap/sdap_async_enum.c          | 1 +
 src/providers/ldap/sdap_async_nested_groups.c | 1 +
 src/providers/ldap/sdap_dyndns.c              | 1 +
 src/responder/common/negcache.c               | 1 +
 src/responder/ssh/sshsrv_dp.c                 | 1 +
 src/tests/common_check.c                      | 1 +
 src/util/crypto/libcrypto/crypto_base64.c     | 1 +
 src/util/crypto/nss/nss_base64.c              | 1 +
 src/util/crypto/nss/nss_util.c                | 1 +
 src/util/find_uid.c                           | 1 +
 src/util/murmurhash3.c                        | 1 +
 src/util/user_info_msg.c                      | 1 +
 src/util/usertools.c                          | 1 +
 22 files changed, 22 insertions(+)

diff --git a/src/providers/ad/ad_domain_info.c b/src/providers/ad/ad_domain_info.c
index eff2034d12261510ed7535dee7098a6e68f1f2c2..c24da939feaa061e8f8bcc83813eb64f14523df0 100644
--- a/src/providers/ad/ad_domain_info.c
+++ b/src/providers/ad/ad_domain_info.c
@@ -31,6 +31,7 @@
 #include "providers/ldap/sdap.h"
 #include "providers/ldap/sdap_async.h"
 #include "providers/ldap/sdap_idmap.h"
+#include "providers/ad/ad_domain_info.h"
 #include "util/util.h"
 
 #define AD_AT_OBJECT_SID "objectSID"
diff --git a/src/providers/ad/ad_srv.c b/src/providers/ad/ad_srv.c
index a238c192e495c3ff6330123d8e53d7d480e88e1b..89186dd1264cdd5e84a34c934cfc6f4d5e12b173 100644
--- a/src/providers/ad/ad_srv.c
+++ b/src/providers/ad/ad_srv.c
@@ -28,6 +28,7 @@
 #include "util/sss_ldap.h"
 #include "resolv/async_resolv.h"
 #include "providers/dp_backend.h"
+#include "providers/ad/ad_srv.h"
 #include "providers/fail_over.h"
 #include "providers/fail_over_srv.h"
 #include "providers/ldap/sdap.h"
diff --git a/src/providers/ipa/ipa_auth.c b/src/providers/ipa/ipa_auth.c
index 651196a96400ebbc4e3575d0f447accdf5da408d..3db623f11c3e255d76a99498709ff571584d5f98 100644
--- a/src/providers/ipa/ipa_auth.c
+++ b/src/providers/ipa/ipa_auth.c
@@ -29,6 +29,7 @@
 #include "providers/ldap/ldap_common.h"
 #include "providers/ldap/sdap_async.h"
 #include "providers/krb5/krb5_auth.h"
+#include "providers/ipa/ipa_auth.h"
 #include "providers/ipa/ipa_common.h"
 #include "providers/ipa/ipa_config.h"
 
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
index d8506aaae2582f496033212e5abeef753244c21a..e7dbeb459cde2bb517f5d4f27f85f694e919fcfe 100644
--- a/src/providers/ipa/ipa_s2n_exop.c
+++ b/src/providers/ipa/ipa_s2n_exop.c
@@ -24,6 +24,7 @@
 #include "db/sysdb.h"
 #include "providers/ldap/sdap_async_private.h"
 #include "providers/ldap/ldap_common.h"
+#include "providers/ipa/ipa_id.h"
 #include "providers/ipa/ipa_subdomains.h"
 
 enum input_types {
diff --git a/src/providers/ipa/ipa_srv.c b/src/providers/ipa/ipa_srv.c
index aa07cf0542d294118728c7706bbfa50092d43b3b..21c75407605f02bcc2efd41fee9efc3c62106fed 100644
--- a/src/providers/ipa/ipa_srv.c
+++ b/src/providers/ipa/ipa_srv.c
@@ -25,6 +25,7 @@
 #include "util/util.h"
 #include "resolv/async_resolv.h"
 #include "providers/fail_over_srv.h"
+#include "providers/ipa/ipa_srv.h"
 
 #define IPA_DNS_LOCATION "_location"
 
diff --git a/src/providers/krb5/krb5_become_user.c b/src/providers/krb5/krb5_become_user.c
index 8cbeb1ce7ef1fe33389fb5def0836fc566ea5c0d..4d5346f379ebacf9342113ea988d6a5f70fffbcf 100644
--- a/src/providers/krb5/krb5_become_user.c
+++ b/src/providers/krb5/krb5_become_user.c
@@ -23,6 +23,7 @@
 */
 
 #include "util/util.h"
+#include "providers/krb5/krb5_utils.h"
 #include <grp.h>
 
 errno_t become_user(uid_t uid, gid_t gid)
diff --git a/src/providers/krb5/krb5_init_shared.c b/src/providers/krb5/krb5_init_shared.c
index c9eec2f8751c3e5e92d6c85fb84e161ad56d9c98..4573d75d24f50849905b433d3dbd3fe189c40db7 100644
--- a/src/providers/krb5/krb5_init_shared.c
+++ b/src/providers/krb5/krb5_init_shared.c
@@ -24,6 +24,7 @@
 
 #include "providers/krb5/krb5_common.h"
 #include "providers/krb5/krb5_auth.h"
+#include "providers/krb5/krb5_init_shared.h"
 
 errno_t krb5_child_init(struct krb5_ctx *krb5_auth_ctx,
                         struct be_ctx *bectx)
diff --git a/src/providers/ldap/ldap_access.c b/src/providers/ldap/ldap_access.c
index bb5c37f4418ae369e75847f4873650d45a3cc96a..8d5b5e22865219e13d0a090f0da4bce8ae06a234 100644
--- a/src/providers/ldap/ldap_access.c
+++ b/src/providers/ldap/ldap_access.c
@@ -27,6 +27,7 @@
 #include "src/providers/data_provider.h"
 #include "src/providers/dp_backend.h"
 #include "src/providers/ldap/sdap_access.h"
+#include "providers/ldap/ldap_common.h"
 
 static void sdap_access_reply(struct be_req *be_req, int pam_status)
 {
diff --git a/src/providers/ldap/sdap_async_autofs.c b/src/providers/ldap/sdap_async_autofs.c
index 4886150f92ec08ee82f9736a7b0cfd52bea7ff91..4d5e953d779a29066c94b929ca8638f5ab45fea3 100644
--- a/src/providers/ldap/sdap_async_autofs.c
+++ b/src/providers/ldap/sdap_async_autofs.c
@@ -27,6 +27,7 @@
 #include "providers/ldap/sdap_async_private.h"
 #include "db/sysdb_autofs.h"
 #include "providers/ldap/ldap_common.h"
+#include "providers/ldap/sdap_autofs.h"
 
 enum autofs_map_op {
     AUTOFS_MAP_OP_ADD,
diff --git a/src/providers/ldap/sdap_async_enum.c b/src/providers/ldap/sdap_async_enum.c
index 9a520ba5f35b56e26ec354b133b06379a1072465..b03c19a50d76466c8cb87f770cf0cc9b5531717c 100644
--- a/src/providers/ldap/sdap_async_enum.c
+++ b/src/providers/ldap/sdap_async_enum.c
@@ -29,6 +29,7 @@
 #include "db/sysdb.h"
 #include "providers/ldap/ldap_common.h"
 #include "providers/ldap/sdap_async.h"
+#include "providers/ldap/sdap_async_enum.h"
 #include "providers/ldap/sdap_idmap.h"
 
 static struct tevent_req *enum_users_send(TALLOC_CTX *memctx,
diff --git a/src/providers/ldap/sdap_async_nested_groups.c b/src/providers/ldap/sdap_async_nested_groups.c
index 6e7056618d801f84a706c06cefd9a9854b469222..7040c6e9bae8a4765f3ffd50f62e7f321d723465 100644
--- a/src/providers/ldap/sdap_async_nested_groups.c
+++ b/src/providers/ldap/sdap_async_nested_groups.c
@@ -33,6 +33,7 @@
 #include "db/sysdb.h"
 #include "providers/ldap/ldap_common.h"
 #include "providers/ldap/sdap_async.h"
+#include "providers/ldap/sdap_async_private.h"
 
 #define sdap_nested_group_sysdb_search_users(domain, filter) \
     sdap_nested_group_sysdb_search((domain), (filter), true)
diff --git a/src/providers/ldap/sdap_dyndns.c b/src/providers/ldap/sdap_dyndns.c
index 8fe2011d14ad0dda71b1cf2992b9493e6ae5ec90..bf5fb099eec75439125c2468a27e4ec0a46523e1 100644
--- a/src/providers/ldap/sdap_dyndns.c
+++ b/src/providers/ldap/sdap_dyndns.c
@@ -27,6 +27,7 @@
 #include "providers/dp_backend.h"
 #include "providers/dp_dyndns.h"
 #include "providers/ldap/sdap_async_private.h"
+#include "providers/ldap/sdap_dyndns.h"
 #include "providers/ldap/sdap_id_op.h"
 #include "providers/ldap/ldap_common.h"
 
diff --git a/src/responder/common/negcache.c b/src/responder/common/negcache.c
index 62c1537f25c71bf7d763e445b97d64655a5703f9..5d82e52b5d615f629ab4dd646bae64647bdfdc77 100644
--- a/src/responder/common/negcache.c
+++ b/src/responder/common/negcache.c
@@ -22,6 +22,7 @@
 #include "util/util.h"
 #include "confdb/confdb.h"
 #include "responder/common/responder.h"
+#include "responder/common/negcache.h"
 #include <fcntl.h>
 #include <time.h>
 #include "tdb.h"
diff --git a/src/responder/ssh/sshsrv_dp.c b/src/responder/ssh/sshsrv_dp.c
index dbdcd479ec2c604a0c0d433b4f5b711e0b6e39d8..812e0c7f6b0cb676917b04c64e0f41ad4591f04f 100644
--- a/src/responder/ssh/sshsrv_dp.c
+++ b/src/responder/ssh/sshsrv_dp.c
@@ -27,6 +27,7 @@
 #include "sbus/sbus_client.h"
 #include "providers/data_provider.h"
 #include "responder/common/responder.h"
+#include "responder/ssh/sshsrv_private.h"
 
 struct sss_dp_get_ssh_host_info {
     struct sss_domain_info *dom;
diff --git a/src/tests/common_check.c b/src/tests/common_check.c
index 94ca40ffe28543e2fee28a56ccc62e77831b2b67..d1b9d6c23bc1c93a768ef5a8a4bd94f3d19037ea 100644
--- a/src/tests/common_check.c
+++ b/src/tests/common_check.c
@@ -25,6 +25,7 @@
 #include <check.h>
 
 #include "tests/common.h"
+#include "tests/common_check.h"
 
 void ck_leak_check_setup(void)
 {
diff --git a/src/util/crypto/libcrypto/crypto_base64.c b/src/util/crypto/libcrypto/crypto_base64.c
index 3a119a0e907554bdcb6d5b2ea3b7d809d9bb9be8..15734a00d49190e88b8db793d894e07ea53e46a4 100644
--- a/src/util/crypto/libcrypto/crypto_base64.c
+++ b/src/util/crypto/libcrypto/crypto_base64.c
@@ -20,6 +20,7 @@
 */
 
 #include "util/util.h"
+#include "util/crypto/sss_crypto.h"
 
 #include <openssl/bio.h>
 #include <openssl/evp.h>
diff --git a/src/util/crypto/nss/nss_base64.c b/src/util/crypto/nss/nss_base64.c
index be3de487f9d9729d035dbd882ab5dcc628d25375..2062bfe36fd51eb4679a6102142f896a7ecb6125 100644
--- a/src/util/crypto/nss/nss_base64.c
+++ b/src/util/crypto/nss/nss_base64.c
@@ -22,6 +22,7 @@
 
 #include "util/util.h"
 #include "util/crypto/nss/nss_util.h"
+#include "util/crypto/sss_crypto.h"
 
 #include <base64.h>
 
diff --git a/src/util/crypto/nss/nss_util.c b/src/util/crypto/nss/nss_util.c
index 59390eb96b701ead3e092f79ccd790b290e7a240..9a272ca92983c64cdeb5fc401892f41d5140df1c 100644
--- a/src/util/crypto/nss/nss_util.c
+++ b/src/util/crypto/nss/nss_util.c
@@ -31,6 +31,7 @@
 #include <pk11func.h>
 
 #include "util/util.h"
+#include "util/crypto/nss/nss_util.h"
 
 static int nspr_nss_init_done = 0;
 
diff --git a/src/util/find_uid.c b/src/util/find_uid.c
index 63b34645748c8af589a0c2999fcf749ef4f75502..d9b911b85b7ef64cc22d9ce248e6f01fca1903a4 100644
--- a/src/util/find_uid.c
+++ b/src/util/find_uid.c
@@ -37,6 +37,7 @@
 #include <sys/time.h>
 
 #include "dhash.h"
+#include "util/find_uid.h"
 #include "util/util.h"
 #include "util/strtonum.h"
 
diff --git a/src/util/murmurhash3.c b/src/util/murmurhash3.c
index cab138e1761dfc2d6e3b74c8d355471c5cbfce57..03d10ff6ae360350dcc96e3e40ece0a0ce3d6b58 100644
--- a/src/util/murmurhash3.c
+++ b/src/util/murmurhash3.c
@@ -11,6 +11,7 @@
 #include <string.h>
 
 #include "config.h"
+#include "util/murmurhash3.h"
 #include "util/sss_endian.h"
 
 static uint32_t rotl(uint32_t x, int8_t r)
diff --git a/src/util/user_info_msg.c b/src/util/user_info_msg.c
index 505b03d9114ef2785095c25d4be624faf5e718bc..25e99d2b1df55805d513709a18beb134ddc41fc7 100644
--- a/src/util/user_info_msg.c
+++ b/src/util/user_info_msg.c
@@ -23,6 +23,7 @@
 */
 
 #include "util/util.h"
+#include "util/user_info_msg.h"
 #include "sss_client/sss_cli.h"
 
 errno_t pack_user_info_chpass_error(TALLOC_CTX *mem_ctx,
diff --git a/src/util/usertools.c b/src/util/usertools.c
index 9edae41e0f216f9f0d1660e473f3aa1bf7160b06..88f6480798e2bfc03499f3a4cb4cab4642cda5a1 100644
--- a/src/util/usertools.c
+++ b/src/util/usertools.c
@@ -26,6 +26,7 @@
 
 #include "confdb/confdb.h"
 #include "util/util.h"
+#include "responder/common/responder.h"
 
 #ifdef HAVE_LIBPCRE_LESSER_THAN_7
 #define NAME_DOMAIN_PATTERN_OPTIONS (PCRE_EXTENDED)
-- 
1.8.3.1



More information about the sssd-devel mailing list