Debian Codegraph @

t_stub.c

raw symbols SCIP
1 /*
2 * This file contains really simple implementations for rsync global
3 * functions, so that module test harnesses can run standalone.
4 *
5 * Copyright (C) 2001, 2002 Martin Pool <[email protected]>
6 * Copyright (C) 2003-2022 Wayne Davison
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, visit the http://fsf.org website.
20 */
21
22 #include "rsync.h"
23
24 int do_fsync = 0;
25 int inplace = 0;
26 int am_daemon = 0;
27 int am_chrooted = 0;
28 int insecure_links = 0;
29 int modify_window = 0;
30 int preallocate_files = 0;
31 int sparse_files = 0;
32 int protect_args = 0;
33 int module_id = -1;
34 int relative_paths = 0;
35 unsigned int module_dirlen = 0;
36 int preserve_xattrs = 0;
37 int preserve_perms = 0;
38 int preserve_executability = 0;
39 int omit_link_times = 0;
40 int open_noatime = 0;
41 size_t max_alloc = (size_t)-1; /* test helpers are not memory-constrained;
42 * 0 here makes every my_alloc()/my_strdup() in
43 * util2.c trip the "exceeded --max-alloc=0"
44 * check, which any helper exercising the
45 * per-component fallback of secure_relative_open()
46 * hits at its first my_strdup() call. */
47 char *partial_dir;
48 char *module_dir;
49 int module_dirfd = -1;
50 char *confine_root;
51 unsigned int confine_rootlen = 0;
52 /* curr_dir[]/curr_dir_len (read by secure_relative_open) are defined in
53 * syscall.c, which every helper links -- no stub needed here. */
54 filter_rule_list daemon_filter_list;
55
56 void rprintf(UNUSED(enum logcode code), const char *format, ...)
57 {
58 va_list ap;
59 va_start(ap, format);
60 vfprintf(stderr, format, ap);
61 va_end(ap);
62 }
63
64 void rsyserr(UNUSED(enum logcode code), int errcode, const char *format, ...)
65 {
66 va_list ap;
67 fputs(RSYNC_NAME ": ", stderr);
68 va_start(ap, format);
69 vfprintf(stderr, format, ap);
70 va_end(ap);
71 fprintf(stderr, ": %s (%d)\n", strerror(errcode), errcode);
72 }
73
74 void _exit_cleanup(int code, const char *file, int line)
75 {
76 fprintf(stderr, "exit(%d): %s(%d)\n",
77 code, file, line);
78 exit(code);
79 }
80
81 int check_filter(UNUSED(filter_rule_list *listp), UNUSED(enum logcode code),
82 UNUSED(const char *name), UNUSED(int name_is_dir))
83 {
84 /* This function doesn't really get called in this test context, so
85 * just return 0. */
86 return 0;
87 }
88
89 int copy_xattrs(UNUSED(const char *source), UNUSED(int source_fd), UNUSED(const char *dest), UNUSED(int dest_fd))
90 {
91 return -1;
92 }
93
94 void free_xattr(UNUSED(stat_x *sxp))
95 {
96 return;
97 }
98
99 void free_acl(UNUSED(stat_x *sxp))
100 {
101 return;
102 }
103
104 char *lp_name(UNUSED(int mod))
105 {
106 return NULL;
107 }
108
109 BOOL lp_use_chroot(UNUSED(int mod))
110 {
111 return 0;
112 }
113
114 BOOL lp_insecure_links(UNUSED(int mod))
115 {
116 return 0;
117 }
118
119 const char *who_am_i(void)
120 {
121 return "tester";
122 }
123
124 int csum_len_for_type(int cst, int flg)
125 {
126 return cst || !flg ? 16 : 1;
127 }
128
129 int canonical_checksum(int cst)
130 {
131 return cst ? 0 : 0;
132 }