aboutsummaryrefslogtreecommitdiff
path: root/src/wydawca.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-07-20 14:55:38 +0300
committerSergey Poznyakoff <gray@gnu.org>2019-07-20 14:55:38 +0300
commitf338532e1ae9b79c666d2ff66cc8be33ab7e5759 (patch)
treec67afd62dd2e7ac0eec28c95fc8d9af71bf0130c /src/wydawca.h
parentdd9d9c1240774e21c7eb50052225ff1e4cc376ee (diff)
downloadwydawca-f338532e1ae9b79c666d2ff66cc8be33ab7e5759.tar.gz
wydawca-f338532e1ae9b79c666d2ff66cc8be33ab7e5759.tar.bz2
Create backup storage directories.
Any spool directories are actually created only if create-directories yes; appears in the configuration file. The global directory-mode and directory-owner statements provide global defaults for the directory metadata. These two keywords can also appear within a spool.archive block. * src/backup.c (split_filename): Change to extern. * src/config.c: Global directory-mode and directory-owner statements. New global statement create-directories. spool.archive.directory-mode and directory-owner statements. (cb_user,cb_supp_groups): Set wydawca_runas. (create_spool_dir): Don't mkdir unless create-directories was set. Honor wy_dry_run. Don't bail out on EPERM wheb uid is not 0. (create_spool_dirs): Compute effective metadata. Create archive directories. * src/diskio.c (create_hierarchy): Fix stack overflow if baselen==0. * src/wydawca.c (wydawca_runas): New global. (main): Intitialize wydawca_uid and wydawca_gid to current values. Run wydawca_userprivs only if wydawca_runas is set. * src/wydawca.h (archive_descr) <metadata>: New member. (wydawca_runas): New extern. * tests/etc/wydawca.rcin: Add create-directories statement. * tests/upload-dry.at: Fix expected output.
Diffstat (limited to 'src/wydawca.h')
-rw-r--r--src/wydawca.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/wydawca.h b/src/wydawca.h
index cfd3ae2..581a7fe 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -118,6 +118,18 @@ enum backup_type {
extern char const *simple_backup_suffix;
char *find_backup_file_name(char const *, enum backup_type);
+const char *split_filename(char const *file, char **pdir);
+
+#define METADATA_NONE 0
+#define METADATA_MODE 0x1
+#define METADATA_OWNER 0x2
+
+struct directory_metadata {
+ int flags;
+ mode_t mode;
+ uid_t uid;
+ gid_t gid;
+};
/* Archive types */
@@ -135,6 +147,7 @@ struct archive_descr {
archive file name if type==archive_tar */
enum backup_type backup_type; /* Requested backup type if
type == archive_directory */
+ struct directory_metadata metadata; /* Directory metadata */
};
/* Type of file in a triplet */
@@ -216,17 +229,6 @@ struct virt_tab {
const char *file_name);
};
-#define METADATA_NONE 0
-#define METADATA_MODE 0x1
-#define METADATA_OWNER 0x2
-
-struct directory_metadata {
- int flags;
- mode_t mode;
- uid_t uid;
- gid_t gid;
-};
-
/* An upload spool. This structure contains all data necessary for releasing
files from source to destination */
struct spool {
@@ -344,6 +346,7 @@ extern uid_t wydawca_uid;
extern gid_t wydawca_gid;
extern size_t wydawca_supp_groupc;
extern gid_t *wydawca_supp_groups;
+extern int wydawca_runas;
extern char *conffile; /* Configuration file name */
extern int syslog_include_prio; /* Syslog priority indication */
extern time_t file_sweep_time; /* Unlink stale file after this amount of time

Return to:

Send suggestions and report system problems to the System administrator.