"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/md_store_fs.c" between
mod_md-2.4.2.tar.gz and mod_md-2.4.4.tar.gz

About: mod_md is an Apache module that adds Let's Encrypt (ACME) support.

md_store_fs.c  (mod_md-2.4.2):md_store_fs.c  (mod_md-2.4.4)
skipping to change at line 113 skipping to change at line 113
static apr_status_t init_store_file(md_store_fs_t *s_fs, const char *fname, static apr_status_t init_store_file(md_store_fs_t *s_fs, const char *fname,
apr_pool_t *p, apr_pool_t *ptemp) apr_pool_t *p, apr_pool_t *ptemp)
{ {
md_json_t *json = md_json_create(p); md_json_t *json = md_json_create(p);
const char *key64; const char *key64;
apr_status_t rv; apr_status_t rv;
md_json_setn(MD_STORE_VERSION, json, MD_KEY_STORE, MD_KEY_VERSION, NULL); md_json_setn(MD_STORE_VERSION, json, MD_KEY_STORE, MD_KEY_VERSION, NULL);
s_fs->key.len = FS_STORE_KLEN; md_data_pinit(&s_fs->key, FS_STORE_KLEN, p);
s_fs->key.data = apr_pcalloc(p, FS_STORE_KLEN);
if (APR_SUCCESS != (rv = md_rand_bytes((unsigned char*)s_fs->key.data, s_fs- >key.len, p))) { if (APR_SUCCESS != (rv = md_rand_bytes((unsigned char*)s_fs->key.data, s_fs- >key.len, p))) {
return rv; return rv;
} }
key64 = md_util_base64url_encode(&s_fs->key, ptemp); key64 = md_util_base64url_encode(&s_fs->key, ptemp);
md_json_sets(key64, json, MD_KEY_KEY, NULL); md_json_sets(key64, json, MD_KEY_KEY, NULL);
rv = md_json_fcreatex(json, ptemp, MD_JSON_FMT_INDENT, fname, MD_FPROT_F_UON LY); rv = md_json_fcreatex(json, ptemp, MD_JSON_FMT_INDENT, fname, MD_FPROT_F_UON LY);
memset((char*)key64, 0, strlen(key64)); memset((char*)key64, 0, strlen(key64));
return rv; return rv;
skipping to change at line 320 skipping to change at line 319
s_fs->group_perms[MD_SG_STAGING].file = MD_FPROT_F_UALL_WREAD; s_fs->group_perms[MD_SG_STAGING].file = MD_FPROT_F_UALL_WREAD;
/* challenges dir and files are readable by all, no secrets involved */ /* challenges dir and files are readable by all, no secrets involved */
s_fs->group_perms[MD_SG_CHALLENGES].dir = MD_FPROT_D_UALL_WREAD; s_fs->group_perms[MD_SG_CHALLENGES].dir = MD_FPROT_D_UALL_WREAD;
s_fs->group_perms[MD_SG_CHALLENGES].file = MD_FPROT_F_UALL_WREAD; s_fs->group_perms[MD_SG_CHALLENGES].file = MD_FPROT_F_UALL_WREAD;
/* OCSP data is readable by all, no secrets involved */ /* OCSP data is readable by all, no secrets involved */
s_fs->group_perms[MD_SG_OCSP].dir = MD_FPROT_D_UALL_WREAD; s_fs->group_perms[MD_SG_OCSP].dir = MD_FPROT_D_UALL_WREAD;
s_fs->group_perms[MD_SG_OCSP].file = MD_FPROT_F_UALL_WREAD; s_fs->group_perms[MD_SG_OCSP].file = MD_FPROT_F_UALL_WREAD;
s_fs->base = apr_pstrdup(p, path); s_fs->base = apr_pstrdup(p, path);
if (APR_STATUS_IS_ENOENT(rv = md_util_is_dir(s_fs->base, p)) rv = md_util_is_dir(s_fs->base, p);
&& MD_OK(apr_dir_make_recursive(s_fs->base, s_fs->def_perms.dir, p))) { if (APR_STATUS_IS_ENOENT(rv)) {
md_log_perror(MD_LOG_MARK, MD_LOG_INFO, rv, p,
"store directory does not exist, creating %s", s_fs->base);
rv = apr_dir_make_recursive(s_fs->base, s_fs->def_perms.dir, p);
if (APR_SUCCESS != rv) goto cleanup;
rv = apr_file_perms_set(s_fs->base, MD_FPROT_D_UALL_WREAD); rv = apr_file_perms_set(s_fs->base, MD_FPROT_D_UALL_WREAD);
if (APR_STATUS_IS_ENOTIMPL(rv)) { if (APR_STATUS_IS_ENOTIMPL(rv)) {
rv = APR_SUCCESS; rv = APR_SUCCESS;
} }
if (APR_SUCCESS != rv) goto cleanup;
}
else if (APR_SUCCESS != rv) {
md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, p,
"not a plain directory, maybe a symlink? %s", s_fs->base);
} }
if ((APR_SUCCESS != rv) || !MD_OK(md_util_pool_vdo(setup_store_file, s_fs, p rv = md_util_pool_vdo(setup_store_file, s_fs, p, NULL);
, NULL))) { if (APR_SUCCESS != rv) {
md_log_perror(MD_LOG_MARK, MD_LOG_ERR, rv, p, "init fs store at %s", pat md_log_perror(MD_LOG_MARK, MD_LOG_ERR, rv, p, "init fs store at %s", s_f
h); s->base);
} }
cleanup:
*pstore = (rv == APR_SUCCESS)? &(s_fs->s) : NULL; *pstore = (rv == APR_SUCCESS)? &(s_fs->s) : NULL;
return rv; return rv;
} }
apr_status_t md_store_fs_default_perms_set(md_store_t *store, apr_status_t md_store_fs_default_perms_set(md_store_t *store,
apr_fileperms_t file_perms, apr_fileperms_t file_perms,
apr_fileperms_t dir_perms) apr_fileperms_t dir_perms)
{ {
md_store_fs_t *s_fs = FS_STORE(store); md_store_fs_t *s_fs = FS_STORE(store);
skipping to change at line 496 skipping to change at line 506
static apr_status_t mk_group_dir(const char **pdir, md_store_fs_t *s_fs, static apr_status_t mk_group_dir(const char **pdir, md_store_fs_t *s_fs,
md_store_group_t group, const char *name, md_store_group_t group, const char *name,
apr_pool_t *p) apr_pool_t *p)
{ {
const perms_t *perms; const perms_t *perms;
apr_status_t rv; apr_status_t rv;
perms = gperms(s_fs, group); perms = gperms(s_fs, group);
if (MD_OK(fs_get_dname(pdir, &s_fs->s, group, name, p)) && (MD_SG_NONE != gr rv = fs_get_dname(pdir, &s_fs->s, group, name, p);
oup)) { if ((APR_SUCCESS != rv) || (MD_SG_NONE == group)) goto cleanup;
if ( !MD_OK(md_util_is_dir(*pdir, p))
&& MD_OK(apr_dir_make_recursive(*pdir, perms->dir, p))) {
rv = dispatch(s_fs, MD_S_FS_EV_CREATED, group, *pdir, APR_DIR, p);
}
if (APR_SUCCESS == rv) { rv = md_util_is_dir(*pdir, p);
rv = apr_file_perms_set(*pdir, perms->dir); if (APR_STATUS_IS_ENOENT(rv)) {
md_log_perror(MD_LOG_MARK, MD_LOG_TRACE3, 0, p, "mk_group_dir %s per md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, p, "not a directory, creati
m set", *pdir); ng %s", *pdir);
if (APR_STATUS_IS_ENOTIMPL(rv)) { rv = apr_dir_make_recursive(*pdir, perms->dir, p);
rv = APR_SUCCESS; if (APR_SUCCESS != rv) goto cleanup;
} dispatch(s_fs, MD_S_FS_EV_CREATED, group, *pdir, APR_DIR, p);
} }
rv = apr_file_perms_set(*pdir, perms->dir);
md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, p, "mk_group_dir %s perm set",
*pdir);
if (APR_STATUS_IS_ENOTIMPL(rv)) {
rv = APR_SUCCESS;
} }
md_log_perror(MD_LOG_MARK, MD_LOG_TRACE3, 0, p, "mk_group_dir %d %s", group, cleanup:
name); md_log_perror(MD_LOG_MARK, MD_LOG_DEBUG, rv, p, "mk_group_dir %d %s", group,
name);
return rv; return rv;
} }
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_is_newer(void *baton, apr_pool_t *p, apr_pool_t *ptemp, va_list ap)
{ {
md_store_fs_t *s_fs = baton; md_store_fs_t *s_fs = baton;
const char *fname1, *fname2, *name, *aspect; const char *fname1, *fname2, *name, *aspect;
md_store_group_t group1, group2; md_store_group_t group1, group2;
apr_finfo_t inf1, inf2; apr_finfo_t inf1, inf2;
int *pnewer; int *pnewer;
 End of changes. 8 change blocks. 
24 lines changed or deleted 36 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)