#include "php_open_temporary_file.h" #define FILE_PREFIX "sess_" typedef struct { int fd; char *lastkey; char *basedir; size_t basedir_len; size_t dirdepth; size_t st_size; int filemode; } ps_files; ps_module ps_mod_files = { PS_MOD(files) }; /* If you change the logic here, please also update the error message in * ps_files_open() appropriately */ static int ps_files_valid_key(const char *key) { size_t len; const char *p; char c; int ret = 1; for (p = key; (c = *p); p++) { /* valid characters are a..z,A..Z,0..9 */ if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
#include "common.h" #include "ext/standard/info.h" #include "php_redis.h" #include "redis_session.h" #include <zend_exceptions.h> #include "library.h" #include "php.h" #include "php_ini.h" #include "php_variables.h" #include "SAPI.h" #include "ext/standard/url.h" ps_module ps_mod_redis = { PS_MOD(redis) }; typedef struct redis_pool_member_ { RedisSock *redis_sock; int weight; int database; char *prefix; size_t prefix_len; char *auth; size_t auth_len; struct redis_pool_member_ *next;
#include "php.h" #if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION) #include "ext/session/php_session.h" #include "ext/standard/php_lcg.h" #include <sqlite.h> #define SQLITE_RETVAL(__r) ((__r) == SQLITE_OK ? SUCCESS : FAILURE) #define PS_SQLITE_DATA sqlite *db = (sqlite*)PS_GET_MOD_DATA() extern int sqlite_encode_binary(const unsigned char *in, int n, unsigned char *out); extern int sqlite_decode_binary(const unsigned char *in, unsigned char *out); PS_FUNCS(sqlite); ps_module ps_mod_sqlite = { PS_MOD(sqlite) }; PS_OPEN_FUNC(sqlite) { char *errmsg = NULL; sqlite *db; /* TODO: do we need a safe_mode check here? */ db = sqlite_open(save_path, 0666, &errmsg); if (db == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "SQLite: failed to open/create session database `%s' - %s", save_path, errmsg); sqlite_freemem(errmsg); return FAILURE; }
/* Move the entry to the top of the linked list */ if (prev) { prev->next = ret->next; } ret->next = data->hash[slot]; data->hash[slot] = ret; } ps_mm_debug(("lookup(%s): ret=%p,hv=%u,slot=%d\n", key, ret, hv, slot)); return ret; } ps_module ps_mod_mm = { PS_MOD(mm) }; #define PS_MM_DATA ps_mm *data = PS_GET_MOD_DATA() static int ps_mm_initialize(ps_mm *data, const char *path) { data->owner = getpid(); data->mm = mm_create(0, path); if (!data->mm) { return FAILURE; } data->hash_cnt = 0; data->hash_max = 511; data->hash = mm_calloc(data->mm, data->hash_max + 1, sizeof(ps_sd *));
| If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | [email protected] so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Author: Sascha Schumann <*****@*****.**> | +----------------------------------------------------------------------+ */ /* $Id: mod_user.c 280729 2009-05-18 16:10:09Z jani $ */ #include "php.h" #include "php_session.h" #include "mod_user.h" ps_module ps_mod_user = { PS_MOD(user) }; #define SESS_ZVAL_LONG(val, a) \ { \ MAKE_STD_ZVAL(a); \ ZVAL_LONG(a, val); \ } #define SESS_ZVAL_STRING(vl, a) \ { \ char *__vl = vl; \ SESS_ZVAL_STRINGN(__vl, strlen(__vl), a); \ } #define SESS_ZVAL_STRINGN(vl, ln, a) \
#include "ext/standard/info.h" #include "php_redis.h" #include "redis_session.h" #include <zend_exceptions.h> #include "library.h" #include "cluster_library.h" #include "php.h" #include "php_ini.h" #include "php_variables.h" #include "SAPI.h" #include "ext/standard/url.h" ps_module ps_mod_redis = { PS_MOD(redis) }; ps_module ps_mod_redis_cluster = { PS_MOD(rediscluster) }; typedef struct redis_pool_member_ { RedisSock *redis_sock; int weight; int database; char *prefix; size_t prefix_len; char *auth;
#include <ctype.h> #include "php.h" #include "php_ini.h" #include "php_variables.h" #include "SAPI.h" #include "ext/standard/url.h" #include "php_memcache.h" #if HAVE_MEMCACHE_SESSION #include "ext/session/php_session.h" #endif ps_module ps_mod_memcache = { PS_MOD(memcache) }; /* {{{ PS_OPEN_FUNC */ PS_OPEN_FUNC(memcache) { mmc_pool_t *pool; mmc_t *mmc; php_url *url; zval *params, **param; int i, j, path_len; pool = mmc_pool_new(TSRMLS_C);
#include "aerospike/aerospike_key.h" #include "aerospike/as_config.h" #include "aerospike_common.h" #define AEROSPIKE_SESSION_BIN "PHP_SESSION" extern int persist; /* ******************************************************************************************************* * Sesion handler structure instance for Aerospike. ******************************************************************************************************* */ PS_FUNCS(aerospike); ps_module ps_mod_aerospike = { PS_MOD(aerospike) }; /* ******************************************************************************************************* * Function to check validity of session object. * * @param session_p The aerospike_session object whose validity is to * be checked. * @param error_p The C SDK's as_error object to be populated by this * method in case of any errors if encountered. * * @return AEROSPIKE::OK if success. Otherwise AEROSPIKE_x. ******************************************************************************************************* */ static as_status
*vallen = valsize; return SUCCESS; } PS_WRITE_FUNC(uwsgi) { char *cache = PS_GET_MOD_DATA(); if (vallen == 0) return SUCCESS; if (!uwsgi_cache_magic_set((char *)key, strlen(key), (char *)val, vallen, 0, UWSGI_CACHE_FLAG_UPDATE, cache)) { return SUCCESS; } return FAILURE; } PS_DESTROY_FUNC(uwsgi) { char *cache = PS_GET_MOD_DATA(); if (!uwsgi_cache_magic_del((char *)key, strlen(key), cache)) { return SUCCESS; } return FAILURE; } PS_GC_FUNC(uwsgi) { return SUCCESS; } ps_module ps_mod_uwsgi = { PS_MOD(uwsgi) };
| COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE| | GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | | OF THE POSSIBILITY OF SUCH DAMAGE. | +----------------------------------------------------------------------------------------------+ | Module: wincache_session.c | +----------------------------------------------------------------------------------------------+ | Author: Kanwaljeet Singla <*****@*****.**> | +----------------------------------------------------------------------------------------------+ */ #include "precomp.h" ps_module ps_mod_wincache = { PS_MOD(wincache) }; static void scache_destructor(void * pdestination) { zvcache_context ** ppcache = NULL; _ASSERT(pdestination != NULL); ppcache = (zvcache_context **)pdestination; zvcache_terminate(*ppcache); zvcache_destroy(*ppcache); ppcache = NULL; return; }