Bug 2086 - passwd struct does not have pw_gecos member on Android
Summary: passwd struct does not have pw_gecos member on Android
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 6.2p1
Hardware: All Linux
: P5 minor
Assignee: Damien Miller
URL:
Keywords:
Depends on:
Blocks: V_6_3
  Show dependency treegraph
 
Reported: 2013-04-05 05:49 AEDT by Nathan Osman
Modified: 2015-08-11 23:04 AEST (History)
0 users

See Also:


Attachments
adds definition for HAVE_PW_GECOS_IN_PASSWD where appropriate (2.59 KB, patch)
2013-04-05 05:49 AEDT, Nathan Osman
no flags Details | Diff
Tweak autoconf detection (3.21 KB, patch)
2013-04-05 10:59 AEDT, Damien Miller
no flags Details | Diff
use AC_CHECK_MEMBERS for all struct passwd member checks (5.50 KB, patch)
2013-04-18 12:13 AEST, Damien Miller
no flags Details | Diff
configure.ac tweeks (4.76 KB, patch)
2013-04-18 15:48 AEST, Tim Rice
dtucker: ok+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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