summaryrefslogtreecommitdiff
path: root/source3/utils/testparm.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-08-10 23:20:04 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-08-10 23:20:04 +0000
commit6ddba1e99b48afc53cf5bc7a2900279490c7a8f6 (patch)
tree132f199e9e0fa6bdf750488487f097f090a2f671 /source3/utils/testparm.c
parent3fce46ac7d790fbe9fcdd2426277857612bb252a (diff)
downloadsamba-6ddba1e99b48afc53cf5bc7a2900279490c7a8f6.tar.gz
samba-6ddba1e99b48afc53cf5bc7a2900279490c7a8f6.tar.bz2
samba-6ddba1e99b48afc53cf5bc7a2900279490c7a8f6.zip
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)
Diffstat (limited to 'source3/utils/testparm.c')
-rw-r--r--source3/utils/testparm.c9
1 files changed, 5 insertions, 4 deletions
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;