src/server/security-server-cookie.c
/* Generage a random stream value of size to cookie *
 * by reading /dev/uranddom file */
Generage a random stream value of size to cookie
by reading /dev/uranddom file
Generage a random stream value of size to cookie by reading / dev / uranddom file
int generate_random_cookie(unsigned char *cookie, int size)
{
	int fd, ret;
		fd = open("/dev/urandom", O_RDONLY);
		if(fd < 0)
		{
			SEC_SVR_DBG("%s", "Cannot open /dev/urandom");
			return SECURITY_SERVER_ERROR_FILE_OPERATION;
		}
		ret = read(fd, cookie, size);
		if(ret < size)
		{
			SEC_SVR_DBG("Cannot read /dev/urandom: %d", ret);
			ret = SECURITY_SERVER_ERROR_FILE_OPERATION;
			goto error;
		}
		close(fd);
		ret = SECURITY_SERVER_SUCCESS;
error:
	if(fd > 0)
		close(fd);
	return ret;
}
int generate_random_cookie ( unsigned char * cookie , int size ) { int fd , ret ; fd = open ( " " , O_RDONLY ) ; if ( fd < 0 ) { SEC_SVR_DBG ( " " , " " ) ; return SECURITY_SERVER_ERROR_FILE_OPERATION ; } ret = read ( fd , cookie , size ) ; if ( ret < size ) { SEC_SVR_DBG ( " " , ret ) ; ret = SECURITY_SERVER_ERROR_FILE_OPERATION ; goto error ; } close ( fd ) ; ret = SECURITY_SERVER_SUCCESS ; error : if ( fd > 0 ) close ( fd ) ; return ret ; }
Generage a random stream value of size to cookie
 by reading /dev/uranddom file
Generage a random stream value of size to cookie by reading / dev / uranddom file