Bug 2086

Summary: passwd struct does not have pw_gecos member on Android
Product: Portable OpenSSH Reporter: Nathan Osman <nathan.osman>
Component: sshAssignee: Damien Miller <djm>
Status: CLOSED FIXED    
Severity: minor    
Priority: P5    
Version: 6.2p1   
Hardware: All   
OS: Linux   
Bug Depends on:    
Bug Blocks: 2076    
Attachments:
Description Flags
adds definition for HAVE_PW_GECOS_IN_PASSWD where appropriate
none
Tweak autoconf detection
none
use AC_CHECK_MEMBERS for all struct passwd member checks
none
configure.ac tweeks dtucker: ok+

Description Nathan Osman 2013-04-05 05:49:28 AEDT
Created attachment 2232 [details]
adds definition for HAVE_PW_GECOS_IN_PASSWD where appropriate

The passwd struct in Android does not have a pw_gecos member, causing the following error message when cross-compiling:

  auth.c:724:30: error: 'struct passwd' has no member named 'pw_gecos'

The attached patch adds a check for this member in the configure.ac file and wraps all assignments to this member with #ifdef / #endif.
Comment 1 Damien Miller 2013-04-05 10:59:10 AEDT
Created attachment 2237 [details]
Tweak autoconf detection

This uses AC_CHECK_MEMBER() to detect it instead of AC_COMPILE_IFELSE()
Comment 2 Darren Tucker 2013-04-05 11:41:47 AEDT
Comment on attachment 2237 [details]
Tweak autoconf detection

>+AC_CHECK_MEMBER([struct passwd.pw_gecos], [AC_DEFINE(

Why not use the stock AC_CHECK_MEMBERS() macro?
Comment 3 Damien Miller 2013-04-18 12:13:59 AEST
Created attachment 2249 [details]
use AC_CHECK_MEMBERS for all struct passwd member checks

We actually have a few more struct passwd members that should be tested for using AC_CHECK_MEMBERS, so this cuts them all over.
Comment 4 Darren Tucker 2013-04-18 12:26:42 AEST
Comment on attachment 2249 [details]
use AC_CHECK_MEMBERS for all struct passwd member checks

diff looks OK, however you might want to check with tim if there's a reason it's done that way.
Comment 5 Tim Rice 2013-04-18 15:48:53 AEST
Created attachment 2251 [details]
configure.ac tweeks

The patch (2249) was mostly OK. I had to rework configure.ac to keep shell errors like this from showing up.
..........
checking for
      struct passwd.pw_gecos,... /opt/src/networking/openssh/
openssh/configure: line 2173: ${+:}: bad substitution
/opt/src/networking/openssh/openssh/configure: line 2208: =no: command not found
........
Comment 6 Darren Tucker 2013-04-18 18:08:40 AEST
Comment on attachment 2251 [details]
configure.ac tweeks

works for me (I see the change in config.h and get identical binaries)
Comment 7 Damien Miller 2013-04-23 19:03:33 AEST
Committed - will be in openssh-6.3. Thanks!
Comment 8 Damien Miller 2015-08-11 23:04:53 AEST
Set all RESOLVED bugs to CLOSED with release of OpenSSH 7.1