Apache HTTPD
Classes | Macros | Functions | Variables
mod_session_cookie.c File Reference
#include "mod_session.h"
#include "apr_lib.h"
#include "apr_strings.h"
#include "http_log.h"
#include "util_cookies.h"

Go to the source code of this file.

Classes

struct  session_cookie_dir_conf
 

Macros

#define MOD_SESSION_COOKIE   "mod_session_cookie"
 

Functions

static apr_status_t session_cookie_save (request_rec *r, session_rec *z)
 
static apr_status_t session_cookie_load (request_rec *r, session_rec **z)
 
static void * create_session_cookie_dir_config (apr_pool_t *p, char *dummy)
 
static void * merge_session_cookie_dir_config (apr_pool_t *p, void *basev, void *addv)
 
static const charcheck_string (cmd_parms *cmd, const char *string)
 
static const charset_cookie_name (cmd_parms *cmd, void *config, const char *args)
 
static const charset_cookie_name2 (cmd_parms *cmd, void *config, const char *args)
 
static const charset_remove (cmd_parms *parms, void *dconf, int flag)
 
static void register_hooks (apr_pool_t *p)
 

Variables

static const command_rec session_cookie_cmds []
 
static int *const aplog_module_index = &( session_cookie_module.module_index)
 

Macro Definition Documentation

◆ MOD_SESSION_COOKIE

#define MOD_SESSION_COOKIE   "mod_session_cookie"

Definition at line 23 of file mod_session_cookie.c.

Function Documentation

◆ check_string()

static const char * check_string ( cmd_parms cmd,
const char string 
)
static

Sanity check a given string that it exists, is not empty, and does not contain special characters.

Definition at line 203 of file mod_session_cookie.c.

◆ create_session_cookie_dir_config()

static void * create_session_cookie_dir_config ( apr_pool_t p,
char dummy 
)
static

Definition at line 171 of file mod_session_cookie.c.

◆ merge_session_cookie_dir_config()

static void * merge_session_cookie_dir_config ( apr_pool_t p,
void *  basev,
void *  addv 
)
static

Definition at line 179 of file mod_session_cookie.c.

◆ register_hooks()

static void register_hooks ( apr_pool_t p)
static

Definition at line 268 of file mod_session_cookie.c.

◆ session_cookie_load()

static apr_status_t session_cookie_load ( request_rec r,
session_rec **  z 
)
static

Isolate the cookie with the name "name", and if present, extract the payload from the cookie.

If the cookie is found, the cookie and any other cookies with the same name are removed from the cookies passed in the request, so that credentials are not leaked to a backend server or process.

A missing or malformed cookie will cause this function to return APR_EGENERAL.

On success, this returns APR_SUCCESS.

< Module declines to handle

< Module has handled this stage.

< Module has handled this stage.

Definition at line 109 of file mod_session_cookie.c.

◆ session_cookie_save()

static apr_status_t session_cookie_save ( request_rec r,
session_rec z 
)
static

Set the cookie and embed the session within it.

This function adds an RFC2109 compliant Set-Cookie header for the cookie specified in SessionCookieName, and an RFC2965 compliant Set-Cookie2 header for the cookie specified in SessionCookieName2.

If specified, the optional cookie attributes will be added to each cookie. If defaults are not specified, DEFAULT_ATTRS will be used.

On success, this method will return APR_SUCCESS.

Parameters
rThe request pointer.
zA pointer to where the session will be written.

< Module has handled this stage.

< Module declines to handle

Definition at line 57 of file mod_session_cookie.c.

◆ set_cookie_name()

static const char * set_cookie_name ( cmd_parms cmd,
void *  config,
const char args 
)
static

Definition at line 213 of file mod_session_cookie.c.

◆ set_cookie_name2()

static const char * set_cookie_name2 ( cmd_parms cmd,
void *  config,
const char args 
)
static

Definition at line 229 of file mod_session_cookie.c.

◆ set_remove()

static const char * set_remove ( cmd_parms parms,
void *  dconf,
int  flag 
)
static

Definition at line 246 of file mod_session_cookie.c.

Variable Documentation

◆ aplog_module_index

int* const aplog_module_index = &( session_cookie_module.module_index)
static

Definition at line 274 of file mod_session_cookie.c.

◆ session_cookie_cmds

const command_rec session_cookie_cmds[]
static
Initial value:
=
{
{ "SessionCookieName" , set_cookie_name , NULL , 128 | 8 , RAW_ARGS, "The name of the RFC2109 cookie carrying the session" },
{ "SessionCookieName2" , set_cookie_name2 , NULL , 128 | 8 , RAW_ARGS, "The name of the RFC2965 cookie carrying the session" },
{ "SessionCookieRemove" , set_remove , NULL , 128 | 8 , FLAG, "Set to 'On' to remove the session cookie from the headers " "and hide the cookie from a backend server or process" },
{NULL}
}
@ RAW_ARGS
Definition http_config.h:50
@ FLAG
Definition http_config.h:59
return NULL
Definition mod_so.c:359

Definition at line 256 of file mod_session_cookie.c.