edwardcapriolo commented on PR #8177:
URL: https://github.com/apache/hadoop/pull/8177#issuecomment-3750743216

   here is my final summary of the issue. IMHO The code as it is in master 
amazingly works only in limited contexts. Here is why:
   
   ```c
   hile ((s = getpwnam_r(user, &pwd, buf, bufsize, &result)) == ERANGE){
   ``` 
   
   This is the proper way to use this method. It may return ERANGE which means 
the buffer is not big enough and you need to keep trying.
   
   Next the big problem: the passwd stuct has pointers to buffers that can be 
recyled by other calls to getpwnam_r. So the global object could be corrupted 
by further calls.
   ```c
    //struct to store the user details
   -struct passwd *user_detail = NULL;
   +struct serialized_passwd *user_detail = NULL;
   ```
   This was effectively the root error I originally observed when I tried to 
take this to alpine. The implementation of passwd is sufficiently different 
that it exposed the problem above, which amazingly works on my systems.
   
   Please review @cnauroth and other people who are skilled with c/c++. Thanks.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to