FreeBSD Bugzilla – Attachment 189344 Details for
Bug 224843
security/pecl-pam: fix with PHP 7.X
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
pecl-pam PHP7 patch
pecl-pam-php7.diff (text/plain), 4.60 KB, created by
Florian Smeets
on 2018-01-02 18:10:49 UTC
(
hide
)
Description:
pecl-pam PHP7 patch
Filename:
MIME Type:
Creator:
Florian Smeets
Created:
2018-01-02 18:10:49 UTC
Size:
4.60 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 457630) >+++ Makefile (working copy) >@@ -3,7 +3,7 @@ > > PORTNAME= pam > PORTVERSION= 1.0.3 >-PORTREVISION= 1 >+PORTREVISION= 2 > CATEGORIES= security pear > > MAINTAINER= joneum@FreeBSD.org >@@ -11,7 +11,6 @@ > > LICENSE= PHP202 > >-USES= php:pecl >-IGNORE_WITH_PHP=70 71 72 >+USES= php:pecl dos2unix > > .include <bsd.port.mk> >Index: files/patch-pam.c >=================================================================== >--- files/patch-pam.c (nonexistent) >+++ files/patch-pam.c (working copy) >@@ -0,0 +1,118 @@ >+--- pam.c.orig 2018-01-02 11:11:25 UTC >++++ pam.c >+@@ -227,8 +227,13 @@ int chpass_pam_talker(int num_msg, >+ PHP_FUNCTION(pam_auth) >+ { >+ char *username, *password; >++#if PHP_MAJOR_VERSION >= 7 >++ size_t username_len, password_len; >++ zval *status = NULL, *server, *remote_addr; >++#else >+ int username_len, password_len; >+ zval *status = NULL, **server, **remote_addr; >++#endif >+ zend_bool checkacctmgmt = 1; >+ >+ pam_auth_t userinfo = {NULL, NULL}; >+@@ -248,22 +253,37 @@ PHP_FUNCTION(pam_auth) >+ if (status) { >+ spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_start"); >+ zval_dtor(status); >++#if PHP_MAJOR_VERSION >= 7 >++ ZVAL_STRING(status, error_msg); >++ efree(error_msg); >++#else >+ ZVAL_STRING(status, error_msg, 0); >++#endif >+ } >+ RETURN_FALSE; >+ } >+ >++#if PHP_MAJOR_VERSION >= 7 >++ if ((remote_addr = zend_hash_str_find(Z_ARR(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", sizeof("REMOTE_ADDR")-1)) != NULL && Z_TYPE_P(remote_addr) == IS_STRING) { >++ pam_set_item(pamh, PAM_RHOST, Z_STRVAL_P(remote_addr)); >++#else >+ if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **)&server) == SUCCESS && Z_TYPE_PP(server) == IS_ARRAY) { >+ if (zend_hash_find(Z_ARRVAL_PP(server), "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **)&remote_addr) == SUCCESS && Z_TYPE_PP(remote_addr) == IS_STRING) { >+ pam_set_item(pamh, PAM_RHOST, Z_STRVAL_PP(remote_addr)); >+ } >++#endif >+ } >+ >+ if ((result = pam_authenticate(pamh, PAM_DISALLOW_NULL_AUTHTOK)) != PAM_SUCCESS) { >+ if (status) { >+ spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_authenticate"); >+ zval_dtor(status); >++#if PHP_MAJOR_VERSION >= 7 >++ ZVAL_STRING(status, error_msg); >++ efree(error_msg); >++#else >+ ZVAL_STRING(status, error_msg, 0); >++#endif >+ } >+ pam_end(pamh, PAM_SUCCESS); >+ RETURN_FALSE; >+@@ -274,7 +294,12 @@ PHP_FUNCTION(pam_auth) >+ if (status) { >+ spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_acct_mgmt"); >+ zval_dtor(status); >++#if PHP_MAJOR_VERSION >= 7 >++ ZVAL_STRING(status, error_msg); >++ efree(error_msg); >++#else >+ ZVAL_STRING(status, error_msg, 0); >++#endif >+ } >+ pam_end(pamh, PAM_SUCCESS); >+ RETURN_FALSE; >+@@ -291,7 +316,11 @@ PHP_FUNCTION(pam_auth) >+ PHP_FUNCTION(pam_chpass) >+ { >+ char *username, *oldpass, *newpass; >++#if PHP_MAJOR_VERSION >= 7 >++ size_t username_len, oldpass_len, newpass_len; >++#else >+ int username_len, oldpass_len, newpass_len; >++#endif >+ zval *status = NULL; >+ >+ pam_chpass_t userinfo = {NULL, NULL, NULL, 0}; >+@@ -312,7 +341,12 @@ PHP_FUNCTION(pam_chpass) >+ if (status) { >+ spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_start"); >+ zval_dtor(status); >++#if PHP_MAJOR_VERSION >= 7 >++ ZVAL_STRING(status, error_msg); >++ efree(error_msg); >++#else >+ ZVAL_STRING(status, error_msg, 0); >++#endif >+ } >+ RETURN_FALSE; >+ } >+@@ -321,7 +355,12 @@ PHP_FUNCTION(pam_chpass) >+ if (status) { >+ spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_authenticate"); >+ zval_dtor(status); >++#if PHP_MAJOR_VERSION >= 7 >++ ZVAL_STRING(status, error_msg); >++ efree(error_msg); >++#else >+ ZVAL_STRING(status, error_msg, 0); >++#endif >+ } >+ pam_end(pamh, PAM_SUCCESS); >+ RETURN_FALSE; >+@@ -331,7 +370,12 @@ PHP_FUNCTION(pam_chpass) >+ if (status) { >+ spprintf(&error_msg, 0, "%s (in %s)", (char *) pam_strerror(pamh, result), "pam_chauthtok"); >+ zval_dtor(status); >++#if PHP_MAJOR_VERSION >= 7 >++ ZVAL_STRING(status, error_msg); >++ efree(error_msg); >++#else >+ ZVAL_STRING(status, error_msg, 0); >++#endif >+ } >+ pam_end(pamh, PAM_SUCCESS); >+ RETURN_FALSE; > >Property changes on: files/patch-pam.c >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 224843
: 189344