From: "Tim Van Holder" To: "DJGPP-Workers" Subject: Re-Submit: add extra fields to structs group and passwd Date: Sun, 3 Jun 2001 11:43:09 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0000_01C0EC22.5CDE7560" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal Reply-To: djgpp-workers AT delorie DOT com This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C0EC22.5CDE7560 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Rationale: several packages use the gr_passwd, pw_passwd and pw_gecos fields without testing for them (even though they're not mandated by POSIX). So we provide reasonable values for them. Since Linux returns the empty string for a group's passwd, I expect it's OK to return that for a user's passwd as well (an alternative would be 'x', which is returned if a shadowed user database is used). ------=_NextPart_000_0000_01C0EC22.5CDE7560 Content-Type: application/octet-stream; name="grp-pwd.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="grp-pwd.diff" Index: include/grp.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/djgpp/djgpp/include/grp.h,v=0A= retrieving revision 1.2=0A= diff -u -r1.2 grp.h=0A= --- include/grp.h 2000/12/05 14:05:52 1.2=0A= +++ include/grp.h 2001/06/03 09:09:15=0A= @@ -18,9 +18,10 @@=0A= #endif=0A= =0A= struct group {=0A= - gid_t gr_gid;=0A= - char ** gr_mem;=0A= - char * gr_name;=0A= + gid_t gr_gid; /* Group ID. */=0A= + char ** gr_mem; /* Member list. */=0A= + char * gr_name; /* Group name. */=0A= + char * gr_passwd; /* Password. */=0A= };=0A= =0A= struct group * getgrgid(gid_t _gid);=0A= Index: include/pwd.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/djgpp/djgpp/include/pwd.h,v=0A= retrieving revision 1.2=0A= diff -u -r1.2 pwd.h=0A= --- include/pwd.h 2000/12/05 14:05:53 1.2=0A= +++ include/pwd.h 2001/06/03 09:09:15=0A= @@ -22,11 +22,13 @@=0A= #endif=0A= =0A= struct passwd {=0A= - char * pw_name;=0A= - uid_t pw_uid;=0A= - gid_t pw_gid;=0A= - char * pw_dir;=0A= - char * pw_shell;=0A= + char * pw_name; /* Username. */=0A= + uid_t pw_uid; /* User ID. */=0A= + gid_t pw_gid; /* Group ID. */=0A= + char * pw_dir; /* Home directory. */=0A= + char * pw_shell; /* Shell program. */=0A= + char * pw_gecos; /* Real name. */=0A= + char * pw_passwd; /* Password. */=0A= };=0A= =0A= struct passwd * getpwuid(uid_t _uid);=0A= Index: src/libc/posix/grp/getgrent.txh=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/djgpp/djgpp/src/libc/posix/grp/getgrent.txh,v=0A= retrieving revision 1.3=0A= diff -u -r1.3 getgrent.txh=0A= --- src/libc/posix/grp/getgrent.txh 1999/06/20 08:53:40 1.3=0A= +++ src/libc/posix/grp/getgrent.txh 2001/06/03 09:09:17=0A= @@ -24,6 +24,7 @@=0A= char ** gr_mem; /* gr_mem[0] points to=0A= getenv("USER"/"LOGNAME") or "user" */=0A= char * gr_name; /* getenv("GROUP") or "dos" */=0A= + char * gr_passwd; /* "" */=0A= @};=0A= @end example=0A= =0A= Index: src/libc/posix/grp/getgrgid.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/djgpp/djgpp/src/libc/posix/grp/getgrgid.c,v=0A= retrieving revision 1.1=0A= diff -u -r1.1 getgrgid.c=0A= --- src/libc/posix/grp/getgrgid.c 1995/05/21 06:52:42 1.1=0A= +++ src/libc/posix/grp/getgrgid.c 2001/06/03 09:09:17=0A= @@ -10,6 +10,7 @@=0A= static char *mem[2];=0A= static char def_name[] =3D "user";=0A= static char def_grp[] =3D "dos";=0A= +static char def_passwd[] =3D "";=0A= =0A= static void=0A= grp_init(void)=0A= @@ -45,6 +46,7 @@=0A= g.gr_gid =3D getgid();=0A= g.gr_mem =3D mem;=0A= g.gr_name =3D grp;=0A= + g.gr_passwd =3D def_passwd;=0A= }=0A= =0A= struct group *=0A= Index: src/libc/posix/pwd/getpwnam.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/djgpp/djgpp/src/libc/posix/pwd/getpwnam.c,v=0A= retrieving revision 1.2=0A= diff -u -r1.2 getpwnam.c=0A= --- src/libc/posix/pwd/getpwnam.c 1998/06/28 22:19:40 1.2=0A= +++ src/libc/posix/pwd/getpwnam.c 2001/06/03 09:09:17=0A= @@ -5,8 +5,9 @@=0A= #include =0A= #include =0A= =0A= -static char slash[] =3D "/";=0A= -static char shell[] =3D "sh";=0A= +static char passwd[] =3D "x";=0A= +static char slash [] =3D "/";=0A= +static char shell [] =3D "sh";=0A= =0A= struct passwd *=0A= getpwnam(const char *name)=0A= @@ -25,5 +26,7 @@=0A= rv.pw_shell =3D getenv("COMSPEC");=0A= if (rv.pw_shell =3D=3D 0)=0A= rv.pw_shell =3D shell;=0A= + rv.pw_gecos =3D getlogin();=0A= + rv.pw_passwd =3D passwd;=0A= return &rv;=0A= }=0A= Index: src/libc/posix/pwd/getpwuid.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/djgpp/djgpp/src/libc/posix/pwd/getpwuid.c,v=0A= retrieving revision 1.1=0A= diff -u -r1.1 getpwuid.c=0A= --- src/libc/posix/pwd/getpwuid.c 1995/05/10 03:58:12 1.1=0A= +++ src/libc/posix/pwd/getpwuid.c 2001/06/03 09:09:17=0A= @@ -3,8 +3,9 @@=0A= #include =0A= #include =0A= =0A= -static char slash[] =3D "/";=0A= -static char shell[] =3D "sh";=0A= +static char passwd[] =3D "x";=0A= +static char slash [] =3D "/";=0A= +static char shell [] =3D "sh";=0A= =0A= struct passwd *=0A= getpwuid(uid_t uid)=0A= @@ -23,5 +24,7 @@=0A= rv.pw_shell =3D getenv("COMSPEC");=0A= if (rv.pw_shell =3D=3D 0)=0A= rv.pw_shell =3D shell;=0A= + rv.pw_gecos =3D getlogin();=0A= + rv.pw_passwd =3D passwd;=0A= return &rv;=0A= }=0A= Index: src/libc/posix/pwd/pwent.txh=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/djgpp/djgpp/src/libc/posix/pwd/pwent.txh,v=0A= retrieving revision 1.3=0A= diff -u -r1.3 pwent.txh=0A= --- src/libc/posix/pwd/pwent.txh 1999/08/09 10:27:24 1.3=0A= +++ src/libc/posix/pwd/pwent.txh 2001/06/03 09:09:18=0A= @@ -19,13 +19,16 @@=0A= int pw_gid; /* getgid() */=0A= char * pw_dir; /* "/" or getenv("HOME") */=0A= char * pw_shell; /* "/bin/sh" or getenv("SHELL") */=0A= + char * pw_gecos; /* getlogin() */=0A= + char * pw_passwd; /* "" */=0A= @};=0A= @end example=0A= =0A= -The @code{pw_name} member is returned as described under @code{getlogin}=0A= -(@pxref{getlogin}). The @code{pw_uid} member is returned as described=0A= -under @code{getuid} (@pxref{getuid}). @code{pw_gid} is returned as=0A= -described under @code{getgid} (@pxref{getgid}). The @code{pw_dir}=0A= +The @code{pw_name} and @code{pw_gecos} members are returned as described=0A= +under @code{getlogin} (@pxref{getlogin}). The @code{pw_uid} member is=0A= +returned as described under @code{getuid} (@pxref{getuid}). = @code{pw_gid}=0A= +is returned as described under @code{getgid} (@pxref{getgid}). The=0A= +@code{pw_passwd} member is set to the empty string. The @code{pw_dir}=0A= member is set to the value of the environment variable @code{HOME} if it=0A= is defined, or to @file{/} otherwise. @code{pw_shell} is set as=0A= follows:=0A= ------=_NextPart_000_0000_01C0EC22.5CDE7560--