Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
27ed20f7
Commit
27ed20f7
authored
Feb 21, 2004
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the "refuse options" setting in the daemon after Fabrice Bellet
identified what was wrong.
parent
f567e9b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
34 deletions
+39
-34
options.c
options.c
+39
-34
No files found.
options.c
View file @
27ed20f7
...
...
@@ -414,35 +414,28 @@ void option_error(void)
/**
* Check to see if we should refuse this option
* Tweak the option table to disable all options that the rsyncd.conf
* file has told us to refuse.
**/
static
int
check_refuse_options
(
char
*
ref
,
int
opt
)
static
void
set_refuse_options
(
char
*
bp
)
{
int
i
,
len
;
char
*
p
;
const
char
*
name
;
for
(
i
=
0
;
long_options
[
i
].
longName
;
i
++
)
{
if
(
long_options
[
i
].
val
==
opt
)
break
;
}
if
(
!
long_options
[
i
].
longName
)
return
0
;
name
=
long_options
[
i
].
longName
;
len
=
strlen
(
name
);
while
((
p
=
strstr
(
ref
,
name
)))
{
if
((
p
==
ref
||
p
[
-
1
]
==
' '
)
&&
(
p
[
len
]
==
' '
||
p
[
len
]
==
0
))
{
snprintf
(
err_buf
,
sizeof
err_buf
,
"The '%s' option is not supported by this server
\n
"
,
name
);
return
1
;
struct
poptOption
*
op
;
char
*
cp
;
while
(
1
)
{
if
((
cp
=
strchr
(
bp
,
' '
))
!=
NULL
)
*
cp
=
'\0'
;
for
(
op
=
long_options
;
op
->
longName
;
op
++
)
{
if
(
strcmp
(
bp
,
op
->
longName
)
==
0
)
{
op
->
val
=
-
(
op
-
long_options
)
-
1
;
break
;
}
}
ref
+=
len
;
if
(
!
cp
)
break
;
*
cp
=
' '
;
bp
=
cp
+
1
;
}
return
0
;
}
...
...
@@ -471,6 +464,9 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
char
*
ref
=
lp_refuse_options
(
module_id
);
poptContext
pc
;
if
(
ref
&&
*
ref
)
set_refuse_options
(
ref
);
/* TODO: Call poptReadDefaultConfig; handle errors. */
/* The context leaks in case of an error, but if there's a
...
...
@@ -478,9 +474,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
pc
=
poptGetContext
(
RSYNC_NAME
,
*
argc
,
*
argv
,
long_options
,
0
);
while
((
opt
=
poptGetNextOpt
(
pc
))
!=
-
1
)
{
if
(
ref
&&
check_refuse_options
(
ref
,
opt
))
return
0
;
/* most options are handled automatically by popt;
* only special cases are returned and listed here. */
...
...
@@ -577,13 +570,25 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
return
0
;
#endif
default:
snprintf
(
err_buf
,
sizeof
err_buf
,
"%s%s: %s
\n
"
,
am_server
?
"on remote machine: "
:
""
,
poptBadOption
(
pc
,
POPT_BADOPTION_NOALIAS
),
poptStrerror
(
opt
));
/* A negative opt value means that set_refuse_options()
* turned this option off (-opt-1 is its index). */
if
(
opt
<
0
)
{
struct
poptOption
*
op
=
&
long_options
[
-
opt
-
1
];
int
n
=
snprintf
(
err_buf
,
sizeof
err_buf
,
"This server does not support --%s
\n
"
,
op
->
longName
)
-
1
;
if
(
op
->
shortName
)
{
snprintf
(
err_buf
+
n
,
sizeof
err_buf
-
n
,
" (-%c)
\n
"
,
op
->
shortName
);
}
}
else
{
snprintf
(
err_buf
,
sizeof
err_buf
,
"%s%s: %s
\n
"
,
am_server
?
"on remote machine: "
:
""
,
poptBadOption
(
pc
,
POPT_BADOPTION_NOALIAS
),
poptStrerror
(
opt
));
}
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment