diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-01-02 09:07:17 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-01-02 09:07:17 +0000 |
commit | 6d66fb308ab85bd9691d541764e683e6040cf724 (patch) | |
tree | 10b705921665cb7bafdd332ca53b8a943e13f0e5 /source3/utils/net.c | |
parent | c105c12d122e599fe57dde8b2b73c52231f0c1d2 (diff) | |
download | samba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.gz samba-6d66fb308ab85bd9691d541764e683e6040cf724.tar.bz2 samba-6d66fb308ab85bd9691d541764e683e6040cf724.zip |
BIG patch...
This patch makes Samba compile cleanly with -Wwrite-strings.
- That is, all string literals are marked as 'const'. These strings are
always read only, this just marks them as such for passing to other functions.
What is most supprising is that I didn't need to change more than a few lines of code (all
in 'net', which got a small cleanup of net.h and extern variables). The rest
is just adding a lot of 'const'.
As far as I can tell, I have not added any new warnings - apart from making all
of tdbutil.c's function const (so they warn for adding that const string to
struct).
Andrew Bartlett
(This used to be commit 92a777d0eaa4fb3a1c7835816f93c6bdd456816d)
Diffstat (limited to 'source3/utils/net.c')
-rw-r--r-- | source3/utils/net.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/utils/net.c b/source3/utils/net.c index ba08feae19..34822670d1 100644 --- a/source3/utils/net.c +++ b/source3/utils/net.c @@ -56,10 +56,10 @@ /************************************************************************************/ /* Yes, these buggers are globals.... */ -char *opt_requester_name = NULL; -char *opt_host = NULL; -char *opt_password = NULL; -char *opt_user_name = NULL; +const char *opt_requester_name = NULL; +const char *opt_host = NULL; +const char *opt_password = NULL; +const char *opt_user_name = NULL; BOOL opt_user_specified = False; const char *opt_workgroup = NULL; int opt_long_list_entries = 0; @@ -67,11 +67,11 @@ int opt_reboot = 0; int opt_force = 0; int opt_port = 0; int opt_maxusers = -1; -char *opt_comment = ""; +const char *opt_comment = ""; int opt_flags = -1; int opt_jobid = 0; int opt_timeout = 0; -char *opt_target_workgroup = NULL; +const char *opt_target_workgroup = NULL; static int opt_machine_pass = 0; BOOL opt_have_ip = False; @@ -615,6 +615,7 @@ static struct functable net_func[] = { load_interfaces(); if (opt_machine_pass) { + char *user; /* it is very useful to be able to make ads queries as the machine account for testing purposes and for domain leave */ @@ -623,7 +624,8 @@ static struct functable net_func[] = { exit(1); } - asprintf(&opt_user_name,"%s$", global_myname()); + asprintf(&user,"%s$", global_myname()); + opt_user_name = user; opt_password = secrets_fetch_machine_password(); if (!opt_password) { d_printf("ERROR: Unable to fetch machine password\n"); |