コード例 #1
0
ファイル: mod_mm.c プロジェクト: CooCoooo/php-src
static int ps_mm_key_exists(ps_mm *data, const char *key)
{
	ps_sd *sd;

	if (!key) {
		return FAILURE;
	}
	sd = ps_sd_lookup(data, key, 0);
	if (sd) {
		return SUCCESS;
	}
	return FAILURE;
}

ps_module ps_mod_mm = {
	PS_MOD_SID(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 *));
コード例 #2
0
ファイル: mod_user.c プロジェクト: ajacques-quatral/php-src
   | 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$ */

#include "php.h"
#include "php_session.h"
#include "mod_user.h"

ps_module ps_mod_user = {
	PS_MOD_SID(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)				\
コード例 #3
0
ファイル: mod_files.c プロジェクト: barracudanetworks/php-src
#  define O_NOFOLLOW 0
# endif
#endif

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_SID(files)
};


static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, const char *key)
{
	size_t key_len;
	const char *p;
	int i;
	int n;

	key_len = strlen(key);
	if (key_len <= data->dirdepth ||
		buflen < (strlen(data->basedir) + 2 * data->dirdepth + key_len + 5 + sizeof(FILE_PREFIX))) {
		return NULL;
	}