tincctl: Use replace_name to properly replace and validate input hostnames
This commit is contained in:
parent
511b51ffe6
commit
38d7e730e6
4 changed files with 13 additions and 4 deletions
|
@ -65,6 +65,8 @@ enum {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
extern debug_t debug_level;
|
extern debug_t debug_level;
|
||||||
extern bool logcontrol;
|
extern bool logcontrol;
|
||||||
extern void openlogger(const char *, logmode_t);
|
extern void openlogger(const char *, logmode_t);
|
||||||
|
|
|
@ -27,6 +27,14 @@
|
||||||
|
|
||||||
static char *program_name;
|
static char *program_name;
|
||||||
|
|
||||||
|
void logger(int level, int priority, const char *format, ...) {
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
vfprintf(stderr, format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
fputc('\n', stderr);
|
||||||
|
}
|
||||||
|
|
||||||
static void usage() {
|
static void usage() {
|
||||||
fprintf(stderr, "Usage: %s [options] private_key_file public_key_file\n\n", program_name);
|
fprintf(stderr, "Usage: %s [options] private_key_file public_key_file\n\n", program_name);
|
||||||
fprintf(stderr, "Valid options are:\n"
|
fprintf(stderr, "Valid options are:\n"
|
||||||
|
|
|
@ -1305,7 +1305,7 @@ char *get_my_name(bool verbose) {
|
||||||
continue;
|
continue;
|
||||||
if(*value) {
|
if(*value) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return strdup(value);
|
return replace_name(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,10 @@
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "logger.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "xalloc.h"
|
|
||||||
|
|
||||||
#include "../src/logger.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "xalloc.h"
|
||||||
|
|
||||||
static const char hexadecimals[] = "0123456789ABCDEF";
|
static const char hexadecimals[] = "0123456789ABCDEF";
|
||||||
static const char base64_original[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
static const char base64_original[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
|
Loading…
Add table
Reference in a new issue