diff options
| author | Ben Fuhrmannek | 2021-12-20 17:58:23 +0100 |
|---|---|---|
| committer | Ben Fuhrmannek | 2021-12-20 17:58:23 +0100 |
| commit | f24151869a54a95da28b74beac5f1f87c06cfafe (patch) | |
| tree | 1a9da2a1cd993d771e96d4658ad3fc1b1276905b | |
| parent | 93c806a0e8e4b290a26ef62d726bfc936b2a5d1b (diff) | |
removed confusung newlines for better reading/searching
| -rw-r--r-- | src/sp_upload_validation.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/sp_upload_validation.c b/src/sp_upload_validation.c index bff7e43..38b4cb3 100644 --- a/src/sp_upload_validation.c +++ b/src/sp_upload_validation.c | |||
| @@ -36,12 +36,9 @@ int sp_rfc1867_callback(unsigned int event, void *event_data, void **extra) { | |||
| 36 | zval *file; | 36 | zval *file; |
| 37 | pid_t pid; | 37 | pid_t pid; |
| 38 | 38 | ||
| 39 | sp_log_debug( | 39 | sp_log_debug("Got %d files", zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_FILES]))); |
| 40 | "Got %d files", | ||
| 41 | zend_hash_num_elements(Z_ARRVAL(PG(http_globals)[TRACK_VARS_FILES]))); | ||
| 42 | 40 | ||
| 43 | ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL(PG(http_globals)[TRACK_VARS_FILES]), | 41 | ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL(PG(http_globals)[TRACK_VARS_FILES]), file_key, file) { // for each uploaded file |
| 44 | file_key, file) { // for each uploaded file | ||
| 45 | 42 | ||
| 46 | char *filename = Z_STRVAL_P(zend_hash_str_find(Z_ARRVAL_P(file), ZEND_STRL("name"))); | 43 | char *filename = Z_STRVAL_P(zend_hash_str_find(Z_ARRVAL_P(file), ZEND_STRL("name"))); |
| 47 | char *tmp_name = Z_STRVAL_P(zend_hash_str_find(Z_ARRVAL_P(file), ZEND_STRL("tmp_name"))); | 44 | char *tmp_name = Z_STRVAL_P(zend_hash_str_find(Z_ARRVAL_P(file), ZEND_STRL("tmp_name"))); |
| @@ -60,22 +57,19 @@ int sp_rfc1867_callback(unsigned int event, void *event_data, void **extra) { | |||
| 60 | 57 | ||
| 61 | spprintf(&env[0], 0, "SP_FILENAME=%s", filename); | 58 | spprintf(&env[0], 0, "SP_FILENAME=%s", filename); |
| 62 | spprintf(&env[1], 0, "SP_REMOTE_ADDR=%s", getenv("REMOTE_ADDR")); | 59 | spprintf(&env[1], 0, "SP_REMOTE_ADDR=%s", getenv("REMOTE_ADDR")); |
| 63 | spprintf(&env[2], 0, "SP_CURRENT_FILE=%s", | 60 | spprintf(&env[2], 0, "SP_CURRENT_FILE=%s", zend_get_executed_filename(TSRMLS_C)); |
| 64 | zend_get_executed_filename(TSRMLS_C)); | ||
| 65 | spprintf(&env[3], 0, "SP_FILESIZE=%zu", filesize); | 61 | spprintf(&env[3], 0, "SP_FILESIZE=%zu", filesize); |
| 66 | env[4] = NULL; | 62 | env[4] = NULL; |
| 67 | 63 | ||
| 68 | if ((pid = fork()) == 0) { | 64 | if ((pid = fork()) == 0) { |
| 69 | if (execve(ZSTR_VAL(config_upload->script), cmd, env) == -1) { | 65 | if (execve(ZSTR_VAL(config_upload->script), cmd, env) == -1) { |
| 70 | sp_log_warn("upload_validation", "Could not call '%s' : %s", | 66 | sp_log_warn("upload_validation", "Could not call '%s' : %s", ZSTR_VAL(config_upload->script), strerror(errno)); |
| 71 | ZSTR_VAL(config_upload->script), strerror(errno)); | ||
| 72 | EFREE_3(env); | 67 | EFREE_3(env); |
| 73 | exit(1); | 68 | exit(1); |
| 74 | } | 69 | } |
| 75 | } else if (pid == -1) { | 70 | } else if (pid == -1) { |
| 76 | // LCOV_EXCL_START | 71 | // LCOV_EXCL_START |
| 77 | sp_log_err("upload_validation", "Could not fork process : %s\n", | 72 | sp_log_err("upload_validation", "Could not fork process : %s\n", strerror(errno)); |
| 78 | strerror(errno)); | ||
| 79 | EFREE_3(env); | 73 | EFREE_3(env); |
| 80 | continue; | 74 | continue; |
| 81 | // LCOV_EXCL_STOP | 75 | // LCOV_EXCL_STOP |
| @@ -87,9 +81,7 @@ int sp_rfc1867_callback(unsigned int event, void *event_data, void **extra) { | |||
| 87 | if (WEXITSTATUS(waitstatus) != 0) { // Nope | 81 | if (WEXITSTATUS(waitstatus) != 0) { // Nope |
| 88 | char *uri = getenv("REQUEST_URI"); | 82 | char *uri = getenv("REQUEST_URI"); |
| 89 | int sim = config_upload->simulation; | 83 | int sim = config_upload->simulation; |
| 90 | sp_log_auto("upload_validation", sim, | 84 | sp_log_auto("upload_validation", sim, "The upload of %s on %s was rejected.", filename, uri ? uri : "?"); |
| 91 | "The upload of %s on %s was rejected.", filename, | ||
| 92 | uri ? uri : "?"); | ||
| 93 | } | 85 | } |
| 94 | } | 86 | } |
| 95 | ZEND_HASH_FOREACH_END(); | 87 | ZEND_HASH_FOREACH_END(); |
