diff options
author | Jeremy Allison <jra@samba.org> | 2001-03-26 23:13:02 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-03-26 23:13:02 +0000 |
commit | 1452c2d8c4a2124e4c97bb51a1e58bcfda620ef0 (patch) | |
tree | c988c7a9424838a16e0d49bf37c8eb37922921c0 /source3/web | |
parent | 4e35283a8b2c4b816b7aec821c719378a1ef10a6 (diff) | |
download | samba-1452c2d8c4a2124e4c97bb51a1e58bcfda620ef0.tar.gz samba-1452c2d8c4a2124e4c97bb51a1e58bcfda620ef0.tar.bz2 samba-1452c2d8c4a2124e4c97bb51a1e58bcfda620ef0.zip |
Fix from Ryo Kawahara <rkawa@lbe.co.jp> to make SWAT correctly write and smb.conf
file in utf8.
Jeremy.
(This used to be commit 42052d6079479452aa43eb37ad3d679d28337779)
Diffstat (limited to 'source3/web')
-rw-r--r-- | source3/web/swat.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c index 1e8d23f6e3..9817327618 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -326,13 +326,13 @@ static BOOL load_config(BOOL save_def) /**************************************************************************** write a config file ****************************************************************************/ -static void write_config(FILE *f, BOOL show_defaults) +static void write_config(FILE *f, BOOL show_defaults, char *(*dos_to_ext)(char *, BOOL)) { fprintf(f, "# Samba config file created using SWAT\n"); fprintf(f, "# from %s (%s)\n", cgi_remote_host(), cgi_remote_addr()); fprintf(f, "# Date: %s\n\n", timestring(False)); - lp_dump(f, show_defaults, iNumNonAutoPrintServices); + lp_dump(f, show_defaults, iNumNonAutoPrintServices, dos_to_ext); } /**************************************************************************** @@ -348,9 +348,9 @@ static int save_reload(int snum) return 0; } - write_config(f, False); + write_config(f, False, _dos_to_unix); if (snum) - lp_dump_one(f, False, snum); + lp_dump_one(f, False, snum, _dos_to_unix); fclose(f); lp_killunused(NULL); @@ -373,6 +373,10 @@ static void commit_parameter(int snum, struct parm_struct *parm, char *v) int i; char *s; + /* lp_do_parameter() will do unix_to_dos(v). */ + if(parm->flags & FLAG_DOS_STRING) + dos_to_unix(v, True); + if (snum < 0 && parm->class == P_LOCAL) { /* this handles the case where we are changing a local variable globally. We need to change the parameter in @@ -472,7 +476,7 @@ static void viewconfig_page(void) } printf("<p><pre>"); - write_config(stdout, full_view); + write_config(stdout, full_view, _dos_to_dos); printf("</pre>"); printf("</form>\n"); } @@ -552,8 +556,12 @@ static void shares_page(void) } if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) { + /* add_a_service() which is called by lp_copy_service() + will do unix_to_dos() conversion, so we need dos_to_unix() before the lp_copy_service(). */ + pstring unix_share; + pstrcpy(unix_share, dos_to_unix(share, False)); load_config(False); - lp_copy_service(GLOBALS_SNUM, share); + lp_copy_service(GLOBALS_SNUM, unix_share); iNumNonAutoPrintServices = lp_numservices(); save_reload(0); snum = lp_servicenumber(share); @@ -887,8 +895,12 @@ static void printers_page(void) } if (cgi_variable("createshare") && (share=cgi_variable("newshare"))) { + /* add_a_service() which is called by lp_copy_service() + will do unix_to_dos() conversion, so we need dos_to_unix() before the lp_copy_service(). */ + pstring unix_share; + pstrcpy(unix_share, dos_to_unix(share, False)); load_config(False); - lp_copy_service(GLOBALS_SNUM, share); + lp_copy_service(GLOBALS_SNUM, unix_share); iNumNonAutoPrintServices = lp_numservices(); snum = lp_servicenumber(share); lp_do_parameter(snum, "print ok", "Yes"); |