diff --git a/src/66/66.c b/src/66/66.c index e099488c2e48b6c0a597f2559d2f5f3b52013eaa..0a63d9464592bb4a2189a4b1ae4420c63a436d09 100644 --- a/src/66/66.c +++ b/src/66/66.c @@ -27,22 +27,6 @@ #include <66/tree.h> #include <66/hpr.h> -void set_treeinfo(ssexec_t *info) -{ - log_flow() ; - - int r = tree_sethome(info) ; - if (r == -1) - log_dieu(LOG_EXIT_USER, "set the tree name") ; - if (!r) - log_dieu(LOG_EXIT_USER, "parse seed file") ; - - if (!tree_get_permissions(info->base.s, info->treename.s)) - log_die(LOG_EXIT_USER,"You're not allowed to use the tree: ",info->treename.s) ; - - info->treeallow = 1 ; -} - static void set_info(ssexec_t *info) { log_flow() ; diff --git a/src/include/66/ssexec.h b/src/include/66/ssexec.h index cc50f550858616f694f9467ed3230977acbd1890..f3a6c717b4e2d45813062f0715e736266802b8c7 100644 --- a/src/include/66/ssexec.h +++ b/src/include/66/ssexec.h @@ -88,7 +88,6 @@ typedef ssexec_func_t *ssexec_func_t_ref ; extern void ssexec_free(ssexec_t *info) ; extern void ssexec_copy(ssexec_t *dest, ssexec_t *src) ; extern ssexec_t const ssexec_zero ; -extern void set_treeinfo(ssexec_t *info) ; /** main */ extern ssexec_func_t ssexec_parse ; diff --git a/src/include/66/utils.h b/src/include/66/utils.h index 48ab09a99965df12fedd0b164811b18c157455dc..128b2e830969eb66d25b33af22d631c9fce1321f 100644 --- a/src/include/66/utils.h +++ b/src/include/66/utils.h @@ -59,5 +59,6 @@ extern void name_isvalid(char const *name) ; extern int set_ownerhome_stack(char *store) ; extern int set_ownersysdir_stack(char *base, uid_t owner) ; +extern void set_treeinfo(ssexec_t *info) ; #endif diff --git a/src/lib66/utils/deps-lib/deps b/src/lib66/utils/deps-lib/deps index 014c51bb674b5eea090f93e2a79379aa700705ad..b0b411ede2c1b703d5d3ac38c906cadfc57be368 100644 --- a/src/lib66/utils/deps-lib/deps +++ b/src/lib66/utils/deps-lib/deps @@ -6,6 +6,7 @@ set_livescan.o set_livestate.o set_ownerhome.o set_ownersysdir.o +set_treeinfo.o visit.o yourgid.o youruid.o diff --git a/src/lib66/utils/set_treeinfo.c b/src/lib66/utils/set_treeinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..3495a5e4fec41ccb9a37328b15247454e6d5d944 --- /dev/null +++ b/src/lib66/utils/set_treeinfo.c @@ -0,0 +1,37 @@ +/* + * set_treeinfo.c + * + * Copyright (c) 2018-2021 Eric Vidal <eric@obarun.org> + * + * All rights reserved. + * + * This file is part of Obarun. It is subject to the license terms in + * the LICENSE file found in the top-level directory of this + * distribution. + * This file may not be copied, modified, propagated, or distributed + * except according to the terms contained in the LICENSE file./ + */ + +#include <stddef.h> + +#include <oblibs/log.h> + +#include <66/utils.h> +#include <66/ssexec.h> +#include <66/tree.h> + +void set_treeinfo(ssexec_t *info) +{ + log_flow() ; + + int r = tree_sethome(info) ; + if (r == -1) + log_dieu(LOG_EXIT_USER, "set the tree name") ; + if (!r) + log_dieu(LOG_EXIT_USER, "parse seed file") ; + + if (!tree_get_permissions(info->base.s, info->treename.s)) + log_die(LOG_EXIT_USER,"You're not allowed to use the tree: ",info->treename.s) ; + + info->treeallow = 1 ; +}