CMD_DECLARE (cmd_spec_mirror);
CMD_DECLARE (cmd_spec_progress);
CMD_DECLARE (cmd_spec_recursive);
+CMD_DECLARE (cmd_spec_restrict_file_names);
CMD_DECLARE (cmd_spec_useragent);
/* List of recognized commands, each consisting of name, closure and function.
{ "reject", &opt.rejects, cmd_vector },
{ "relativeonly", &opt.relative_only, cmd_boolean },
{ "removelisting", &opt.remove_listing, cmd_boolean },
+ { "restrictfilenames", NULL, cmd_spec_restrict_file_names },
{ "retrsymlinks", &opt.retr_symlinks, cmd_boolean },
{ "retryconnrefused", &opt.retry_connrefused, cmd_boolean },
{ "robots", &opt.use_robots, cmd_boolean },
{ "sslcheckcert", &opt.sslcheckcert, cmd_number },
{ "sslprotocol", &opt.sslprotocol, cmd_number },
#endif /* HAVE_SSL */
+ { "strictcomments", &opt.strict_comments, cmd_boolean },
{ "timeout", &opt.timeout, cmd_time },
{ "timestamping", &opt.timestamping, cmd_boolean },
{ "tries", &opt.ntry, cmd_number_inf },
opt.dots_in_line = 50;
opt.dns_cache = 1;
+
+ /* The default for file name restriction defaults to the OS type. */
+#if !defined(WINDOWS) && !defined(__CYGWIN__)
+ opt.restrict_files_os = restrict_unix;
+#else
+ opt.restrict_files_os = restrict_windows;
+#endif
+ opt.restrict_files_ctrl = 1;
}
\f
/* Return the user's home directory (strdup-ed), or NULL if none is
return 1;
}
+static int
+cmd_spec_restrict_file_names (const char *com, const char *val, void *closure)
+{
+ int restrict_os = opt.restrict_files_os;
+ int restrict_ctrl = opt.restrict_files_ctrl;
+
+ const char *end = strchr (val, ',');
+ if (!end)
+ end = val + strlen (val);
+
+#define VAL_IS(string_literal) BOUNDED_EQUAL (val, end, string_literal)
+
+ if (VAL_IS ("unix"))
+ restrict_os = restrict_unix;
+ else if (VAL_IS ("windows"))
+ restrict_os = restrict_windows;
+ else if (VAL_IS ("nocontrol"))
+ restrict_ctrl = 0;
+ else
+ {
+ err:
+ fprintf (stderr, _("%s: %s: Invalid specification `%s'.\n"),
+ exec_name, com, val);
+ return 0;
+ }
+
+#undef VAL_IS
+
+ if (*end)
+ {
+ if (!strcmp (end + 1, "nocontrol"))
+ restrict_ctrl = 0;
+ else
+ goto err;
+ }
+
+ opt.restrict_files_os = restrict_os;
+ opt.restrict_files_ctrl = restrict_ctrl;
+ return 1;
+}
+
static int
cmd_spec_useragent (const char *com, const char *val, void *closure)
{
return res;
}
-#define ISODIGIT(x) ((x) >= '0' && (x) <= '7')
-
static int
check_user_specified_header (const char *s)
{