[SSSD] [PATCH] PAM: Fix problem with missing declaration

Lukas Slebodnik lslebodn at redhat.com
Sat May 17 17:32:14 UTC 2014


ehlo,

The functions strdup and strncmp are used in pam_test_client,
but header file string.h was not included directly in this file.
The header file string.h was indirectly included by the header file
security/pam_client.h.

sh-4.2$ nm --undefined-only ./pam_test_client | grep -E "strdup|strncmp"
    U __strdup@@GLIBC_2.2.5
    U strncmp@@GLIBC_2.2.5

patch is attached.

LS
-------------- next part --------------
>From 7e91aa5b7336528b77301cec7f4883f4fc85286b Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Sat, 17 May 2014 17:31:17 +0200
Subject: [PATCH 1/5] PAM: Fix problem with missing declaration.

The functions strdup and strncmp are used in pam_test_client,
but header file string.h was not included directly in this file.
The header file string.h was indirectly included by the header file
security/pam_client.h.

src/sss_client/pam_test_client.c: In function 'main':
src/sss_client/pam_test_client.c:45:
    error: implicit declaration of function 'strdup'
src/sss_client/pam_test_client.c:45:
    warning: incompatible implicit declaration of built-in function 'strdup'
src/sss_client/pam_test_client.c:49:
    warning: incompatible implicit declaration of built-in function 'strdup'
src/sss_client/pam_test_client.c:52:
    warning: incompatible implicit declaration of built-in function 'strdup'
src/sss_client/pam_test_client.c:64:
    error: implicit declaration of function 'strncmp'
gmake[2]: *** [src/sss_client/pam_test_client.o] Error 1

sh-4.2$ nm --undefined-only ./pam_test_client | grep -E "strdup|strncmp"
                 U __strdup@@GLIBC_2.2.5
                 U strncmp@@GLIBC_2.2.5
---
 src/sss_client/pam_test_client.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/sss_client/pam_test_client.c b/src/sss_client/pam_test_client.c
index af8a0da9090a755041ed968b6ec60ae81bacf142..c9cbffaf4a74b5c9f831cb3feec5de305a8dc182 100644
--- a/src/sss_client/pam_test_client.c
+++ b/src/sss_client/pam_test_client.c
@@ -24,6 +24,7 @@
 
 #include <stdio.h>
 #include <unistd.h>
+#include <string.h>
 
 #include <security/pam_appl.h>
 #include <security/pam_misc.h>
-- 
1.9.0



More information about the sssd-devel mailing list