Improve README file; set the default prefix to /usr; add debugging of

the remapping process.
This commit is contained in:
hpa 2001-07-26 22:36:14 +00:00
parent 304cb0877c
commit b98d08b5d4
4 changed files with 31 additions and 4 deletions

6
README
View file

@ -118,7 +118,7 @@ support, although I made a fair amount of mostly stylistic changes to
their code. their code.
Adding the -r option (disable a specific option), the "timeout" Adding the -r option (disable a specific option), the "timeout"
option, and converting to using autoconf for setup was my own code, as option, converting to using autoconf for setup, and any additions
are any bugs introduced in this merge, and any features added to the listed in the Changes list above, has all been my own code, as are any
Changes list above. bugs introduced in the merge.

View file

@ -3,6 +3,7 @@ dnl autoconf input file to generate MCONFIG
dnl dnl
AC_INIT(MCONFIG.in) AC_INIT(MCONFIG.in)
AC_PREFIX_DEFAULT(/usr)
AC_PROG_CC AC_PROG_CC
AC_C_CONST AC_C_CONST

View file

@ -21,6 +21,7 @@
#include <ctype.h> #include <ctype.h>
#include <syslog.h> #include <syslog.h>
#include <regex.h> #include <regex.h>
#include <syslog.h>
#include "tftpd.h" #include "tftpd.h"
#include "remap.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 was_match = 0;
int deadman = DEADMAN_MAX_STEPS; int deadman = DEADMAN_MAX_STEPS;
if ( verbosity >= 3 ) {
syslog(LOG_INFO, "remap: input: %s", current);
}
for ( ruleptr = rules ; ruleptr ; ruleptr = ruleptr->next ) { for ( ruleptr = rules ; ruleptr ; ruleptr = ruleptr->next ) {
if ( ((ruleptr->rule_flags & RULE_GETONLY) && is_put) || if ( ((ruleptr->rule_flags & RULE_GETONLY) && is_put) ||
((ruleptr->rule_flags & RULE_PUTONLY) && !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-- ) { if ( ! deadman-- ) {
syslog(LOG_WARNING, "remap: Breaking loop, input = %s, last = %s",
input, current);
free(current); free(current);
return NULL; /* Did not terminate! */ 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; was_match = 1;
if ( ruleptr->rule_flags & RULE_ABORT ) { if ( ruleptr->rule_flags & RULE_ABORT ) {
if ( verbosity >= 3 ) {
syslog(LOG_INFO, "remap: rule %d: abort",
ruleptr->nrule, current);
}
free(current); free(current);
return(NULL); 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); genmatchstring(newstr, ruleptr->pattern, current, pmatch);
free(current); free(current);
current = newstr; current = newstr;
if ( verbosity >= 3 ) {
syslog(LOG_INFO, "remap: rule %d: rewrite: %s",
ruleptr->nrule, current);
}
} }
} else { } else {
break; /* No match, terminate unconditionally */ 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; was_match = 0;
if ( ruleptr->rule_flags & RULE_EXIT ) { 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 ) { } else if ( ruleptr->rule_flags & RULE_RESTART ) {
ruleptr = rules; /* Start from the top */ 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; return current;
} }

View file

@ -51,6 +51,8 @@ void set_signal(int, void (*)(int), int);
void *tfmalloc(size_t); void *tfmalloc(size_t);
char *tfstrdup(const char *); char *tfstrdup(const char *);
extern int verbosity;
#ifdef __GNUC__ #ifdef __GNUC__
#define UNUSED __attribute__((unused)) #define UNUSED __attribute__((unused))
#else #else