Bug 1673312 - ZERO_STRUCT() uses undefined C11 function memset_s()
Summary: ZERO_STRUCT() uses undefined C11 function memset_s()
Status: CLOSED DUPLICATE of bug 1672231
Alias: None
Product: Fedora
Classification: Fedora
Component: samba
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Guenther Deschner
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2019-02-07 10:57 UTC by Christian Heimes
Modified: 2019-02-07 11:11 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-02-07 11:11:08 UTC
Type: Bug

Attachments (Terms of Use)

Description Christian Heimes 2019-02-07 10:57:40 UTC
Description of problem:
samba-4.0/util/memory.h defines the ZERO_STRUCT macro as

  #define ZERO_STRUCT(x) memset_s((char *)&(x), sizeof(x), 0, sizeof(x))

however the C11 function memset_s is not available yet. There is mo function prototype in /usr/include for memset_s. I also tried gcc -std=gnu11 and -D__STDC_WANT_LIB_EXT1__=1 without success.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. git clone https://github.com/freeipa/freeipa.git
2. cd freeipa
3. ./autogen.sh && make

Actual results:
/bin/sh ../../libtool  --tag=CC   --mode=compile gcc -std=gnu11 -DHAVE_CONFIG_H -I. -I../..  -I. -I../../asn1 -I/usr/include/samba-4.0 -DPREFIX=\""/usr/local"\" -DBINDIR=\""/usr/local/bin"\" -DLIBDIR=\""/usr/local/lib"\" -DLIBEXECDIR=\""/usr/local/libexec"\" -DDATADIR=\""/usr/local/share"\" -DLDAPIDIR=\""/usr/local/var/run"\" -DHAVE_LDAP -I../../util      -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1  -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1    -I/usr/include/nspr4  -I/usr/include/nss3 -I/usr/include/nspr4   -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Werror-implicit-function-declaration  -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -MT ipa_sam.lo -MD -MP -MF .deps/ipa_sam.Tpo -c -o ipa_sam.lo ipa_sam.c
libtool: compile:  gcc -std=gnu11 -DHAVE_CONFIG_H -I. -I../.. -I. -I../../asn1 -I/usr/include/samba-4.0 -DPREFIX=\"/usr/local\" -DBINDIR=\"/usr/local/bin\" -DLIBDIR=\"/usr/local/lib\" -DLIBEXECDIR=\"/usr/local/libexec\" -DDATADIR=\"/usr/local/share\" -DLDAPIDIR=\"/usr/local/var/run\" -DHAVE_LDAP -I../../util -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1 -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 -I/usr/include/nspr4 -I/usr/include/nss3 -I/usr/include/nspr4 -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Werror-implicit-function-declaration -D__STDC_WANT_LIB_EXT1__=1 -D_DEFAULT_SOURCE=1 -D_POSIX_C_SOURCE=200809L -Werror=implicit-function-declaration -MT ipa_sam.lo -MD -MP -MF .deps/ipa_sam.Tpo -c ipa_sam.c  -fPIC -DPIC -o .libs/ipa_sam.o
In file included from /usr/include/samba-4.0/ndr.h:29,
                 from ipa_sam.c:18:
ipa_sam.c: In function ‘fill_pdb_trusted_domain’:
/usr/include/samba-4.0/util/memory.h:54:24: error: implicit declaration of function ‘memset_s’; did you mean ‘memset’? [-Werror=implicit-function-declaration]
   54 | #define ZERO_STRUCT(x) memset_s((char *)&(x), sizeof(x), 0, sizeof(x))
      |                        ^~~~~~~~
ipa_sam.c:2182:3: note: in expansion of macro ‘ZERO_STRUCT’
 2182 |   ZERO_STRUCT(td->security_identifier);
      |   ^~~~~~~~~~~
cc1: some warnings being treated as errors

Expected results:
no compile error

Additional info:

Comment 1 Christian Heimes 2019-02-07 11:11:08 UTC

*** This bug has been marked as a duplicate of bug 1672231 ***

Note You need to log in before you can comment on or make changes to this bug.