# USA
#
+noinst_DATA=$(HTMLMAN)
+pkgdata_DATA=$(TMPLMAN)
+
SEDFILES=disorder.1 disorderd.8 disorder_config.5 \
disorder-dump.8 disorder_protocol.5 disorder-deadlock.8 \
disorder-rescan.8 disobedience.1 disorderfm.1 disorder-playrtp.1 \
noinst_MANS=tkdisorder.1
HTMLMAN=$(foreach man,$(man_MANS),$(man).html)
-
$(HTMLMAN) : %.html : % $(top_srcdir)/scripts/htmlman
rm -f $@.new
- $(top_srcdir)/scripts/htmlman -stdhead $< >$@.new
+ $(top_srcdir)/scripts/htmlman $< >$@.new
chmod 444 $@.new
mv -f $@.new $@
-pkgdata_DATA=$(HTMLMAN)
+TMPLMAN=$(foreach man,$(man_MANS),$(man).tmpl)
+$(TMPLMAN) : %.tmpl : % $(top_srcdir)/scripts/htmlman
+ rm -f $@.new
+ $(top_srcdir)/scripts/htmlman -stdhead $< >$@.new
+ chmod 444 $@.new
+ mv -f $@.new $@
EXTRA_DIST=disorderd.8.in disorder.1.in disorder_config.5.in \
disorder.3 disorder-dump.8.in disorder_protocol.5.in \
disorder-playrtp.1.in disorder-decode.8.in disorder-normalize.8 \
disorder-stats.8.in disorder-dbupgrade.8.in
-CLEANFILES=$(SEDFILES) $(HTMLMAN)
+CLEANFILES=$(SEDFILES) $(HTMLMAN) $(TMPLMAN)
export GNUSED
{ "remove", act_remove },
};
+/** @brief Check that an action name is valid
+ * @param name Action
+ * @return 1 if valid, 0 if not
+ */
+static int dcgi_valid_action(const char *name) {
+ int c;
+
+ /* First character must be letter or digit (this also requires there to _be_
+ * a first character) */
+ if(!isalnum((unsigned char)*name))
+ return 0;
+ /* Only letters, digits, '.' and '-' allowed */
+ while((c = (unsigned char)*name++)) {
+ if(!(isalnum(c)
+ || c == '.'
+ || c == '_'))
+ return 0;
+ }
+ return 1;
+}
+
/** @brief Expand a template
* @param name Base name of template, or NULL to consult CGI args
*/
if((found = mx_find("macros.tmpl")))
mx_expand_file(found, sink_discard(), 0);
/* For unknown actions check that they aren't evil */
- for(p = name; *p && isalnum((unsigned char)*p); ++p)
- ;
- if(*p)
+ if(!dcgi_valid_action(name))
fatal(0, "invalid action name '%s'", name);
byte_xasprintf((char **)&p, "%s.tmpl", name);
if(!(found = mx_find(p)))