From 6ddba1e99b48afc53cf5bc7a2900279490c7a8f6 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 10 Aug 2002 23:20:04 +0000 Subject: Fix the %m security bug again - and try to make it harder to reintroduce in future. This moves us from fstrcpy() and global variables to 'get' and 'set' functions. In particular, the 'set' function sainity-checks the input, in the same way as we always have. Andrew Bartlett (This used to be commit e57a896f06b16fe7e336e1ae63a0c9e4cc75fd36) --- source3/utils/testparm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c index 1d48249a75..3086019467 100644 --- a/source3/utils/testparm.c +++ b/source3/utils/testparm.c @@ -175,7 +175,6 @@ int main(int argc, char *argv[]) { extern char *optarg; extern int optind; - extern fstring local_machine; const char *config_file = dyn_CONFIGFILE; int s; static BOOL silent_mode = False; @@ -183,7 +182,7 @@ int main(int argc, char *argv[]) int opt; poptContext pc; static char *term_code = ""; - static char *new_local_machine = local_machine; + static char *new_local_machine = NULL; const char *cname; const char *caddr; @@ -207,8 +206,10 @@ int main(int argc, char *argv[]) cname = poptGetArg(pc); caddr = poptGetArg(pc); - - fstrcpy(local_machine,new_local_machine); + + if (new_local_machine) { + set_local_machine_name(new_local_machine); + } dbf = x_stdout; DEBUGLEVEL = 2; -- cgit