Bug 686

Summary: signame.c should include unistd.h (when available)
Product: Sudo Reporter: Gustavo Zacarias <gustavo>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: low    
Version: 1.8.12   
Hardware: PC   
OS: Linux   
Attachments: Proposed fix

Description Gustavo Zacarias 2015-02-17 05:52:14 MST
Created attachment 443 [details]
Proposed fix

signame.c uses sudo_compat.h which in turn uses gid_t definitions that are normally defined in unistd.h
This doesn't seem to cause issues with (e)glibc systems, but it does break uClibc-based builds:

----------

libtool: compile:  /home/gustavoz/b/sec/output/host/usr/bin/mips-buildroot-linux-uclibc-gcc -c -I../../include -I../.. -I. -I../.. -D__STDC_WANT_LIB_EXT1__=1 -Os -fvisibility=hidden -D_GNU_SOURCE -D_PATH_SUDO_CONF=\"/etc/sudo.conf\" signame.c  -fPIC -DPIC -o .libs/signame.o
In file included from signame.c:3:0:
../../include/sudo_compat.h:347:1: warning: parameter names (without types) in function declaration [enabled by default]
 int setresgid(gid_t, gid_t, gid_t);
 ^
../../include/sudo_compat.h:351:15: error: unknown type name ‘gid_t’
 int getresgid(gid_t *, gid_t *, gid_t *);
               ^
../../include/sudo_compat.h:351:24: error: unknown type name ‘gid_t’
 int getresgid(gid_t *, gid_t *, gid_t *);
                        ^
../../include/sudo_compat.h:351:33: error: unknown type name ‘gid_t’
 int getresgid(gid_t *, gid_t *, gid_t *);
                                 ^
Makefile:458: recipe for target 'signame.lo' failed
make[2]: *** [signame.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/gustavoz/b/sec/output/build/sudo-1.8.12/lib/util'
Makefile:90: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/gustavoz/b/sec/output/build/sudo-1.8.12'
package/pkg-generic.mk:182: recipe for target '/home/gustavoz/b/sec/output/build/sudo-1.8.12/.stamp_built' failed
make: *** [/home/gustavoz/b/sec/output/build/sudo-1.8.12/.stamp_built] Error 2

---------
Comment 1 Todd C. Miller 2015-02-17 06:22:53 MST
I've committed the diff, thanks.  The same thing applies to siglist.c but uClibc probably has strsignal() so it doesn't affect you.
Comment 2 Todd C. Miller 2015-03-21 19:16:49 MDT
Fixed in sudo 1.8.13, available now.