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/smbd/server.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source3/smbd/server.c') diff --git a/source3/smbd/server.c b/source3/smbd/server.c index d173fec00e..45295896e8 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -38,8 +38,6 @@ extern pstring user_socket_options; extern int dcelogin_atmost_once; #endif /* WITH_DFS */ -extern fstring remote_machine; - /* really we should have a top level context structure that has the client file descriptor as an element. That would require a major rewrite :( @@ -366,7 +364,7 @@ static BOOL open_sockets_smbd(BOOL is_daemon,const char *smb_ports) /* this is needed so that we get decent entries in smbstatus for port 445 connects */ - fstrcpy(remote_machine, get_socket_addr(smbd_server_fd())); + set_remote_machine_name(get_socket_addr(smbd_server_fd())); /* Reset global variables in util.c so that client substitutions will be @@ -742,7 +740,7 @@ static void usage(char *pname) lp_set_logfile(logfile); } - fstrcpy(remote_machine, "smbd"); + set_remote_machine_name("smbd"); setup_logging(argv[0],interactive); -- cgit