diff options
| author | Xinchen Hui <laruence@gmail.com> | 2014-02-24 18:48:22 +0800 |
|---|---|---|
| committer | Xinchen Hui <laruence@gmail.com> | 2014-02-24 18:48:22 +0800 |
| commit | 93428dc6b902f23e56bf01e87c63ea0d6d6c03a4 (patch) | |
| tree | b90898523b92e51deab4cf0339d09fe2c65c264a /main/main.c | |
| parent | 1e5a4f281d21abab8101301ea155f9c0394ab02f (diff) | |
| download | php-git-93428dc6b902f23e56bf01e87c63ea0d6d6c03a4.tar.gz | |
Refactor base64 to returning zend_string
Diffstat (limited to 'main/main.c')
| -rw-r--r-- | main/main.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/main/main.c b/main/main.c index 9d6fe67755..821a1a7bfb 100644 --- a/main/main.c +++ b/main/main.c @@ -2584,19 +2584,18 @@ PHPAPI int php_handle_auth_data(const char *auth TSRMLS_DC) if (auth && auth[0] != '\0' && strncmp(auth, "Basic ", 6) == 0) { char *pass; - char *user; + zend_string *user; - user = php_base64_decode(auth + 6, strlen(auth) - 6, NULL); + user = php_base64_decode(auth + 6, strlen(auth) - 6); if (user) { - pass = strchr(user, ':'); + pass = strchr(user->val, ':'); if (pass) { *pass++ = '\0'; - SG(request_info).auth_user = user; + SG(request_info).auth_user = estrndup(user->val, user->len); SG(request_info).auth_password = estrdup(pass); ret = 0; - } else { - efree(user); - } + } + STR_FREE(user); } } |
