forked from mirrors/tftp-hpa-google
Improve README file; set the default prefix to /usr; add debugging of
the remapping process.
This commit is contained in:
parent
304cb0877c
commit
b98d08b5d4
4 changed files with 31 additions and 4 deletions
6
README
6
README
|
@ -118,7 +118,7 @@ support, although I made a fair amount of mostly stylistic changes to
|
|||
their code.
|
||||
|
||||
Adding the -r option (disable a specific option), the "timeout"
|
||||
option, and converting to using autoconf for setup was my own code, as
|
||||
are any bugs introduced in this merge, and any features added to the
|
||||
Changes list above.
|
||||
option, converting to using autoconf for setup, and any additions
|
||||
listed in the Changes list above, has all been my own code, as are any
|
||||
bugs introduced in the merge.
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ dnl autoconf input file to generate MCONFIG
|
|||
dnl
|
||||
|
||||
AC_INIT(MCONFIG.in)
|
||||
AC_PREFIX_DEFAULT(/usr)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_C_CONST
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <ctype.h>
|
||||
#include <syslog.h>
|
||||
#include <regex.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "tftpd.h"
|
||||
#include "remap.h"
|
||||
|
@ -249,6 +250,10 @@ char *rewrite_string(const char *input, const struct rule *rules, int is_put)
|
|||
int was_match = 0;
|
||||
int deadman = DEADMAN_MAX_STEPS;
|
||||
|
||||
if ( verbosity >= 3 ) {
|
||||
syslog(LOG_INFO, "remap: input: %s", current);
|
||||
}
|
||||
|
||||
for ( ruleptr = rules ; ruleptr ; ruleptr = ruleptr->next ) {
|
||||
if ( ((ruleptr->rule_flags & RULE_GETONLY) && is_put) ||
|
||||
((ruleptr->rule_flags & RULE_PUTONLY) && !is_put) ) {
|
||||
|
@ -256,6 +261,8 @@ char *rewrite_string(const char *input, const struct rule *rules, int is_put)
|
|||
}
|
||||
|
||||
if ( ! deadman-- ) {
|
||||
syslog(LOG_WARNING, "remap: Breaking loop, input = %s, last = %s",
|
||||
input, current);
|
||||
free(current);
|
||||
return NULL; /* Did not terminate! */
|
||||
}
|
||||
|
@ -266,6 +273,10 @@ char *rewrite_string(const char *input, const struct rule *rules, int is_put)
|
|||
was_match = 1;
|
||||
|
||||
if ( ruleptr->rule_flags & RULE_ABORT ) {
|
||||
if ( verbosity >= 3 ) {
|
||||
syslog(LOG_INFO, "remap: rule %d: abort",
|
||||
ruleptr->nrule, current);
|
||||
}
|
||||
free(current);
|
||||
return(NULL);
|
||||
}
|
||||
|
@ -276,6 +287,10 @@ char *rewrite_string(const char *input, const struct rule *rules, int is_put)
|
|||
genmatchstring(newstr, ruleptr->pattern, current, pmatch);
|
||||
free(current);
|
||||
current = newstr;
|
||||
if ( verbosity >= 3 ) {
|
||||
syslog(LOG_INFO, "remap: rule %d: rewrite: %s",
|
||||
ruleptr->nrule, current);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break; /* No match, terminate unconditionally */
|
||||
|
@ -287,12 +302,21 @@ char *rewrite_string(const char *input, const struct rule *rules, int is_put)
|
|||
was_match = 0;
|
||||
|
||||
if ( ruleptr->rule_flags & RULE_EXIT ) {
|
||||
break; /* Exit here, we're done */
|
||||
if ( verbosity >= 3 ) {
|
||||
syslog(LOG_INFO, "remap: rule %d: exit", ruleptr->nrule);
|
||||
}
|
||||
return current; /* Exit here, we're done */
|
||||
} else if ( ruleptr->rule_flags & RULE_RESTART ) {
|
||||
ruleptr = rules; /* Start from the top */
|
||||
if ( verbosity >= 3 ) {
|
||||
syslog(LOG_INFO, "remap: rule %d: restart", ruleptr->nrule);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( verbosity >= 3 ) {
|
||||
syslog(LOG_INFO, "remap: done");
|
||||
}
|
||||
return current;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ void set_signal(int, void (*)(int), int);
|
|||
void *tfmalloc(size_t);
|
||||
char *tfstrdup(const char *);
|
||||
|
||||
extern int verbosity;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue