-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Implemented posix_getspnam() function #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -49,6 +49,9 @@ | |||
#include <errno.h> | |||
#include <grp.h> | |||
#include <pwd.h> | |||
#ifdef HAVE_GETSPNAM | |||
# include <shadow.h> | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be a test for HAVE_SHADOW_H here instead? (or as well?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AC_CHECK_FUNCS() should take care of that. You either have it and it's in shadow.h, or you don't. I haven't seen it done in a different way. It's not POSIX, so we might run into other implementations.
getspwnam is not part of the POSIX.1, POSIX.1b or POSIX.1c standard. From the Linux Manpages:
I'm not sure if this should belong to ext/posix, but then on the other hand there is no suitable other extension to add this function too. |
The reason I've put it in ext/posix because similar functions are also in that extension. It's not POSIX, I agree, but it also serves special use cases. It's harmless in all other cases. |
array_init(return_value); | ||
|
||
if (!php_posix_spwd_to_array(spw, return_value)) { | ||
zval_dtor(return_value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in case you have ZTS and GETSPANAM_R so
#if defined(ZTS) && defined(HAVE_GETSPNAM_R)
get's execute you have buf allocated. In case php_posix_spwd_to_array fails you are not
freeing buf anymore.
@igmar ping |
@igmar ping again |
Comment on behalf of stas at php.net: No response for a year. If this patch is still relevant please update it according to comments and reopen the pull. |
Added posix_getspnam() function to the posix extension.