passwd/group parsing

Pierre A. Humblet
Sun Jan 26 01:47:00 GMT 2003


I had a quick look at your changes and have a few comments:
- soon the uid/gid will be __uid32_t and the code should support it. 
  It is legal for next_int () to return negative values, even -1.
  That's why the original code was using another error detection
- It looks like fields such as pw_gecos, pw_dir, etc.. could be set
  to NULL when a line is incomplete. That is a new behavior, not 
  expected by internal code nor by programs such as login (I only 
  checked that one).
  It comes from the code in next_str. By the way, why do you add 
  two \0 in "search" used by strpbrk? The second never has any effect.
- 99.99% of /etc/group lines at cygwin installations have an empty
  last field. That's why when that was detected (dp == NULL with your 
  new code, *dp == 0 with the old or new) gr_mem was set to null_ptr
  rather than pointing dp to a static empty string, scanning it twice 
  and calling calloc.
  I believe the old code was also setting gr_mem to a non-NULL legal 
  value in the unlikely event where calloc failed.
  Incidentally setting namearray[i] = NULL is useless, calloc has
  already done it (that may be legacy code).


More information about the Cygwin-developers mailing list