Apache HTTPD
Classes | Macros | Typedefs | Functions
md_store_fs.c File Reference
#include <assert.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <apr_lib.h>
#include <apr_file_info.h>
#include <apr_file_io.h>
#include <apr_fnmatch.h>
#include <apr_hash.h>
#include <apr_strings.h>
#include "md.h"
#include "md_crypt.h"
#include "md_json.h"
#include "md_log.h"
#include "md_store.h"
#include "md_store_fs.h"
#include "md_util.h"
#include "md_version.h"

Go to the source code of this file.

Classes

struct  perms_t
 
struct  md_store_fs_t
 
struct  inspect_ctx
 

Macros

#define MD_STORE_VERSION   3
 
#define MD_FS_LOCK_NAME   "store.lock"
 
#define FS_STORE(store)   (md_store_fs_t*)(((char*)store)-offsetof(md_store_fs_t, s))
 
#define FS_STORE_JSON   "md_store.json"
 
#define FS_STORE_KLEN   48
 

Typedefs

typedef struct md_store_fs_t md_store_fs_t
 

Functions

static apr_status_t fs_load (md_store_t *store, md_store_group_t group, const char *name, const char *aspect, md_store_vtype_t vtype, void **pvalue, apr_pool_t *p)
 
static apr_status_t fs_save (md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name, const char *aspect, md_store_vtype_t vtype, void *value, int create)
 
static apr_status_t fs_remove (md_store_t *store, md_store_group_t group, const char *name, const char *aspect, apr_pool_t *p, int force)
 
static apr_status_t fs_purge (md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *name)
 
static apr_status_t fs_remove_nms (md_store_t *store, apr_pool_t *p, apr_time_t modified, md_store_group_t group, const char *name, const char *aspect)
 
static apr_status_t fs_move (md_store_t *store, apr_pool_t *p, md_store_group_t from, md_store_group_t to, const char *name, int archive)
 
static apr_status_t fs_rename (md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *from, const char *to)
 
static apr_status_t fs_iterate (md_store_inspect *inspect, void *baton, md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *pattern, const char *aspect, md_store_vtype_t vtype)
 
static apr_status_t fs_iterate_names (md_store_inspect *inspect, void *baton, md_store_t *store, apr_pool_t *p, md_store_group_t group, const char *pattern)
 
static apr_status_t fs_get_fname (const char **pfname, md_store_t *store, md_store_group_t group, const char *name, const char *aspect, apr_pool_t *p)
 
static int fs_is_newer (md_store_t *store, md_store_group_t group1, md_store_group_t group2, const char *name, const char *aspect, apr_pool_t *p)
 
static apr_time_t fs_get_modified (md_store_t *store, md_store_group_t group, const char *name, const char *aspect, apr_pool_t *p)
 
static apr_status_t fs_lock_global (md_store_t *store, apr_pool_t *p, apr_time_t max_wait)
 
static void fs_unlock_global (md_store_t *store, apr_pool_t *p)
 
static apr_status_t init_store_file (md_store_fs_t *s_fs, const char *fname, apr_pool_t *p, apr_pool_t *ptemp)
 
static apr_status_t rename_pkey (void *baton, apr_pool_t *p, apr_pool_t *ptemp, const char *dir, const char *name, apr_filetype_e ftype)
 
static apr_status_t mk_pubcert (void *baton, apr_pool_t *p, apr_pool_t *ptemp, const char *dir, const char *name, apr_filetype_e ftype)
 
static apr_status_t upgrade_from_1_0 (md_store_fs_t *s_fs, apr_pool_t *p, apr_pool_t *ptemp)
 
static apr_status_t read_store_file (md_store_fs_t *s_fs, const char *fname, apr_pool_t *p, apr_pool_t *ptemp)
 
static apr_status_t setup_store_file (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 
apr_status_t md_store_fs_init (md_store_t **pstore, apr_pool_t *p, const char *path)
 
apr_status_t md_store_fs_default_perms_set (md_store_t *store, apr_fileperms_t file_perms, apr_fileperms_t dir_perms)
 
apr_status_t md_store_fs_group_perms_set (md_store_t *store, md_store_group_t group, apr_fileperms_t file_perms, apr_fileperms_t dir_perms)
 
apr_status_t md_store_fs_set_event_cb (struct md_store_t *store, md_store_fs_cb *cb, void *baton)
 
static const perms_tgperms (md_store_fs_t *s_fs, md_store_group_t group)
 
static apr_status_t fs_get_dname (const char **pdname, md_store_t *store, md_store_group_t group, const char *name, apr_pool_t *p)
 
static void get_pass (const char **ppass, apr_size_t *plen, md_store_fs_t *s_fs, md_store_group_t group)
 
static apr_status_t fs_fload (void **pvalue, md_store_fs_t *s_fs, const char *fpath, md_store_group_t group, md_store_vtype_t vtype, apr_pool_t *p, apr_pool_t *ptemp)
 
static apr_status_t pfs_load (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 
static apr_status_t dispatch (md_store_fs_t *s_fs, md_store_fs_ev_t ev, unsigned int group, const char *fname, apr_filetype_e ftype, apr_pool_t *p)
 
static apr_status_t mk_group_dir (const char **pdir, md_store_fs_t *s_fs, md_store_group_t group, const char *name, apr_pool_t *p)
 
static apr_status_t pfs_is_newer (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 
static apr_status_t pfs_get_modified (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 
static apr_status_t pfs_save (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 
static apr_status_t pfs_remove (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 
static apr_status_t pfs_purge (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 
static apr_status_t insp (void *baton, apr_pool_t *p, apr_pool_t *ptemp, const char *dir, const char *name, apr_filetype_e ftype)
 
static apr_status_t insp_dir (void *baton, apr_pool_t *p, apr_pool_t *ptemp, const char *dir, const char *name, apr_filetype_e ftype)
 
static apr_status_t insp_name (void *baton, apr_pool_t *p, apr_pool_t *ptemp, const char *dir, const char *name, apr_filetype_e ftype)
 
static apr_status_t remove_nms_file (void *baton, apr_pool_t *p, apr_pool_t *ptemp, const char *dir, const char *name, apr_filetype_e ftype)
 
static apr_status_t remove_nms_dir (void *baton, apr_pool_t *p, apr_pool_t *ptemp, const char *dir, const char *name, apr_filetype_e ftype)
 
static apr_status_t pfs_move (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 
static apr_status_t pfs_rename (void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
 

Macro Definition Documentation

◆ FS_STORE

#define FS_STORE (   store)    (md_store_fs_t*)(((char*)store)-offsetof(md_store_fs_t, s))

Definition at line 68 of file md_store_fs.c.

◆ FS_STORE_JSON

#define FS_STORE_JSON   "md_store.json"

Definition at line 69 of file md_store_fs.c.

◆ FS_STORE_KLEN

#define FS_STORE_KLEN   48

Definition at line 70 of file md_store_fs.c.

◆ MD_FS_LOCK_NAME

#define MD_FS_LOCK_NAME   "store.lock"

Definition at line 42 of file md_store_fs.c.

◆ MD_STORE_VERSION

#define MD_STORE_VERSION   3

Definition at line 41 of file md_store_fs.c.

Typedef Documentation

◆ md_store_fs_t

Definition at line 49 of file md_store_fs.c.

Function Documentation

◆ dispatch()

static apr_status_t dispatch ( md_store_fs_t s_fs,
md_store_fs_ev_t  ev,
unsigned int  group,
const char fname,
apr_filetype_e  ftype,
apr_pool_t p 
)
static

Definition at line 494 of file md_store_fs.c.

◆ fs_fload()

static apr_status_t fs_fload ( void **  pvalue,
md_store_fs_t s_fs,
const char fpath,
md_store_group_t  group,
md_store_vtype_t  vtype,
apr_pool_t p,
apr_pool_t ptemp 
)
static

Definition at line 434 of file md_store_fs.c.

◆ fs_get_dname()

static apr_status_t fs_get_dname ( const char **  pdname,
md_store_t store,
md_store_group_t  group,
const char name,
apr_pool_t p 
)
static

Definition at line 409 of file md_store_fs.c.

◆ fs_get_fname()

static apr_status_t fs_get_fname ( const char **  pfname,
md_store_t store,
md_store_group_t  group,
const char name,
const char aspect,
apr_pool_t p 
)
static

Definition at line 396 of file md_store_fs.c.

◆ fs_get_modified()

static apr_time_t fs_get_modified ( md_store_t store,
md_store_group_t  group,
const char name,
const char aspect,
apr_pool_t p 
)
static

Definition at line 604 of file md_store_fs.c.

◆ fs_is_newer()

static int fs_is_newer ( md_store_t store,
md_store_group_t  group1,
md_store_group_t  group2,
const char name,
const char aspect,
apr_pool_t p 
)
static

Definition at line 566 of file md_store_fs.c.

◆ fs_iterate()

static apr_status_t fs_iterate ( md_store_inspect inspect,
void *  baton,
md_store_t store,
apr_pool_t p,
md_store_group_t  group,
const char pattern,
const char aspect,
md_store_vtype_t  vtype 
)
static

Definition at line 828 of file md_store_fs.c.

◆ fs_iterate_names()

static apr_status_t fs_iterate_names ( md_store_inspect inspect,
void *  baton,
md_store_t store,
apr_pool_t p,
md_store_group_t  group,
const char pattern 
)
static

Definition at line 861 of file md_store_fs.c.

◆ fs_load()

static apr_status_t fs_load ( md_store_t store,
md_store_group_t  group,
const char name,
const char aspect,
md_store_vtype_t  vtype,
void **  pvalue,
apr_pool_t p 
)
static

Definition at line 716 of file md_store_fs.c.

◆ fs_lock_global()

static apr_status_t fs_lock_global ( md_store_t store,
apr_pool_t p,
apr_time_t  max_wait 
)
static

< Open the file for writing

< Create the file if not there

< Read by user

< Write by user

< Read by group

< Exclusive lock. Only one process may hold an exclusive lock at any given time. This is analogous to a "write lock".

< do not block while acquiring the file lock

Definition at line 1107 of file md_store_fs.c.

◆ fs_move()

static apr_status_t fs_move ( md_store_t store,
apr_pool_t p,
md_store_group_t  from,
md_store_group_t  to,
const char name,
int  archive 
)
static

Definition at line 1063 of file md_store_fs.c.

◆ fs_purge()

static apr_status_t fs_purge ( md_store_t store,
apr_pool_t p,
md_store_group_t  group,
const char name 
)
static

Definition at line 764 of file md_store_fs.c.

◆ fs_remove()

static apr_status_t fs_remove ( md_store_t store,
md_store_group_t  group,
const char name,
const char aspect,
apr_pool_t p,
int  force 
)
static

Definition at line 733 of file md_store_fs.c.

◆ fs_remove_nms()

static apr_status_t fs_remove_nms ( md_store_t store,
apr_pool_t p,
apr_time_t  modified,
md_store_group_t  group,
const char name,
const char aspect 
)
static

Definition at line 920 of file md_store_fs.c.

◆ fs_rename()

static apr_status_t fs_rename ( md_store_t store,
apr_pool_t p,
md_store_group_t  group,
const char from,
const char to 
)
static

Definition at line 1100 of file md_store_fs.c.

◆ fs_save()

static apr_status_t fs_save ( md_store_t store,
apr_pool_t p,
md_store_group_t  group,
const char name,
const char aspect,
md_store_vtype_t  vtype,
void *  value,
int  create 
)
static

Definition at line 724 of file md_store_fs.c.

◆ fs_unlock_global()

static void fs_unlock_global ( md_store_t store,
apr_pool_t p 
)
static

Definition at line 1160 of file md_store_fs.c.

◆ get_pass()

static void get_pass ( const char **  ppass,
apr_size_t plen,
md_store_fs_t s_fs,
md_store_group_t  group 
)
static

Definition at line 421 of file md_store_fs.c.

◆ gperms()

static const perms_t * gperms ( md_store_fs_t s_fs,
md_store_group_t  group 
)
static

Definition at line 387 of file md_store_fs.c.

◆ init_store_file()

static apr_status_t init_store_file ( md_store_fs_t s_fs,
const char fname,
apr_pool_t p,
apr_pool_t ptemp 
)
static

< Read by user

< Write by user

Definition at line 110 of file md_store_fs.c.

◆ insp()

static apr_status_t insp ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
const char dir,
const char name,
apr_filetype_e  ftype 
)
static

Definition at line 786 of file md_store_fs.c.

◆ insp_dir()

static apr_status_t insp_dir ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
const char dir,
const char name,
apr_filetype_e  ftype 
)
static

Definition at line 809 of file md_store_fs.c.

◆ insp_name()

static apr_status_t insp_name ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
const char dir,
const char name,
apr_filetype_e  ftype 
)
static

Definition at line 850 of file md_store_fs.c.

◆ md_store_fs_default_perms_set()

apr_status_t md_store_fs_default_perms_set ( md_store_t store,
apr_fileperms_t  file_perms,
apr_fileperms_t  dir_perms 
)

Definition at line 353 of file md_store_fs.c.

◆ md_store_fs_group_perms_set()

apr_status_t md_store_fs_group_perms_set ( md_store_t store,
md_store_group_t  group,
apr_fileperms_t  file_perms,
apr_fileperms_t  dir_perms 
)

Definition at line 364 of file md_store_fs.c.

◆ md_store_fs_init()

apr_status_t md_store_fs_init ( md_store_t **  pstore,
apr_pool_t p,
const char path 
)

< Read by user

< Write by user

< Execute by user

< Read by user

< Write by user

< Read by user

< Write by user

< Execute by user

< Read by group

< Execute by group

< Read by others

< Execute by others

< Read by user

< Write by user

< Read by group

< Read by others

< Read by user

< Write by user

< Execute by user

< Read by group

< Execute by group

< Read by others

< Execute by others

< Read by user

< Write by user

< Read by group

< Read by others

< Read by user

< Write by user

< Execute by user

< Read by group

< Execute by group

< Read by others

< Execute by others

< Read by user

< Write by user

< Read by group

< Read by others

< Read by user

< Write by user

< Execute by user

< Read by group

< Execute by group

< Read by others

< Execute by others

< Read by user

< Write by user

< Read by group

< Read by others

< Read by user

< Write by user

< Execute by user

< Read by group

< Execute by group

< Read by others

< Execute by others

Definition at line 286 of file md_store_fs.c.

◆ md_store_fs_set_event_cb()

apr_status_t md_store_fs_set_event_cb ( struct md_store_t store,
md_store_fs_cb cb,
void *  baton 
)

Definition at line 378 of file md_store_fs.c.

◆ mk_group_dir()

static apr_status_t mk_group_dir ( const char **  pdir,
md_store_fs_t s_fs,
md_store_group_t  group,
const char name,
apr_pool_t p 
)
static

Definition at line 505 of file md_store_fs.c.

◆ mk_pubcert()

static apr_status_t mk_pubcert ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
const char dir,
const char name,
apr_filetype_e  ftype 
)
static

< Read by user

< Write by user

Definition at line 150 of file md_store_fs.c.

◆ pfs_get_modified()

static apr_status_t pfs_get_modified ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
va_list  ap 
)
static

< Modification Time

Definition at line 580 of file md_store_fs.c.

◆ pfs_is_newer()

static apr_status_t pfs_is_newer ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
va_list  ap 
)
static

< Modification Time

< Modification Time

Definition at line 539 of file md_store_fs.c.

◆ pfs_load()

static apr_status_t pfs_load ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
va_list  ap 
)
static

Definition at line 473 of file md_store_fs.c.

◆ pfs_move()

static apr_status_t pfs_move ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
va_list  ap 
)
static

< Read by user

< Write by user

< Execute by user

< Read by user

< Write by user

< Execute by user

Definition at line 943 of file md_store_fs.c.

◆ pfs_purge()

static apr_status_t pfs_purge ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
va_list  ap 
)
static

Definition at line 741 of file md_store_fs.c.

◆ pfs_remove()

static apr_status_t pfs_remove ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
va_list  ap 
)
static

< Type

Definition at line 679 of file md_store_fs.c.

◆ pfs_rename()

static apr_status_t pfs_rename ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
va_list  ap 
)
static

Definition at line 1071 of file md_store_fs.c.

◆ pfs_save()

static apr_status_t pfs_save ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
va_list  ap 
)
static

< Read by user

< Write by user

Definition at line 618 of file md_store_fs.c.

◆ read_store_file()

static apr_status_t read_store_file ( md_store_fs_t s_fs,
const char fname,
apr_pool_t p,
apr_pool_t ptemp 
)
static

< Read by user

< Write by user

Definition at line 203 of file md_store_fs.c.

◆ remove_nms_dir()

static apr_status_t remove_nms_dir ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
const char dir,
const char name,
apr_filetype_e  ftype 
)
static

Definition at line 901 of file md_store_fs.c.

◆ remove_nms_file()

static apr_status_t remove_nms_file ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
const char dir,
const char name,
apr_filetype_e  ftype 
)
static

< Modification Time

Definition at line 880 of file md_store_fs.c.

◆ rename_pkey()

static apr_status_t rename_pkey ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
const char dir,
const char name,
apr_filetype_e  ftype 
)
static

Definition at line 132 of file md_store_fs.c.

◆ setup_store_file()

static apr_status_t setup_store_file ( void *  baton,
apr_pool_t p,
apr_pool_t ptemp,
va_list  ap 
)
static

Definition at line 256 of file md_store_fs.c.

◆ upgrade_from_1_0()

static apr_status_t upgrade_from_1_0 ( md_store_fs_t s_fs,
apr_pool_t p,
apr_pool_t ptemp 
)
static

Definition at line 183 of file md_store_fs.c.