The Samba-Bugzilla – Attachment 595 Details for
Bug 1578
The "best effort" charset conversion path is potentially insecure
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
This patch implements the "default character" solution
samba-3.0.5-default-char.patch (text/plain), 4.75 KB, created by
Alexander E. Patrakov
on 2004-08-05 21:36:20 UTC
(
hide
)
Description:
This patch implements the "default character" solution
Filename:
MIME Type:
Creator:
Alexander E. Patrakov
Created:
2004-08-05 21:36:20 UTC
Size:
4.75 KB
patch
obsolete
>diff -ur samba-3.0.5/source/lib/charcnv.c samba-3.0.5-fixed/source/lib/charcnv.c >--- samba-3.0.5/source/lib/charcnv.c 2004-04-04 13:37:36.000000000 +0600 >+++ samba-3.0.5-fixed/source/lib/charcnv.c 2004-08-06 10:02:59.154773720 +0600 >@@ -259,11 +259,11 @@ > return destlen - o_len; > > if (from == CH_UCS2 && to != CH_UCS2) { >- /* Can't convert from ucs2 to multibyte. Just truncate this char to ascii. */ >+ /* Can't convert from ucs2 to multibyte. Substitute with the default character. */ > if (i_len < 2) > return destlen - o_len; > if (i_len >= 2) { >- *outbuf = inbuf[0]; >+ *outbuf = lp_default_char(); > > outbuf++; > o_len--; >@@ -279,11 +279,11 @@ > goto again; > > } else if (from != CH_UCS2 && to == CH_UCS2) { >- /* Can't convert to ucs2 - just widen by adding zero. */ >+ /* Can't convert to ucs2 - substitute with the default character. */ > if (o_len < 2) > return destlen - o_len; > >- outbuf[0] = inbuf[0]; >+ outbuf[0] = lp_default_char(); > outbuf[1] = '\0'; > > inbuf++; >@@ -299,9 +299,9 @@ > goto again; > > } else if (from != CH_UCS2 && to != CH_UCS2) { >- /* Failed multibyte to multibyte. Just copy 1 char and >+ /* Failed multibyte to multibyte. Just add default character and > try again. */ >- outbuf[0] = inbuf[0]; >+ outbuf[0] = lp_default_char(); > > inbuf++; > i_len--; >@@ -581,12 +581,12 @@ > goto out; > > if (from == CH_UCS2 && to != CH_UCS2) { >- /* Can't convert from ucs2 to multibyte. Just truncate this char to ascii. */ >+ /* Can't convert from ucs2 to multibyte. Substitute with the default character. */ > if (i_len < 2) > goto out; > > if (i_len >= 2) { >- *outbuf = inbuf[0]; >+ *outbuf = lp_default_char(); > > outbuf++; > o_len--; >@@ -602,11 +602,11 @@ > goto again; > > } else if (from != CH_UCS2 && to == CH_UCS2) { >- /* Can't convert to ucs2 - just widen by adding zero. */ >+ /* Can't convert to ucs2 - substitute with the default character. */ > if (o_len < 2) > goto out; > >- outbuf[0] = inbuf[0]; >+ outbuf[0] = lp_default_char(); > outbuf[1] = '\0'; > > inbuf++; >@@ -622,9 +622,9 @@ > goto again; > > } else if (from != CH_UCS2 && to != CH_UCS2) { >- /* Failed multibyte to multibyte. Just copy 1 char and >+ /* Failed multibyte to multibyte. Just add default character and > try again. */ >- outbuf[0] = inbuf[0]; >+ outbuf[0] = lp_default_char(); > > inbuf++; > i_len--; >diff -ur samba-3.0.5/source/param/loadparm.c samba-3.0.5-fixed/source/param/loadparm.c >--- samba-3.0.5/source/param/loadparm.c 2004-04-21 02:42:54.000000000 +0600 >+++ samba-3.0.5-fixed/source/param/loadparm.c 2004-08-06 09:35:18.658207568 +0600 >@@ -99,6 +99,7 @@ > char *dos_charset; > char *unix_charset; > char *display_charset; >+ char default_char; > char *szPrintcapname; > char *szEnumPortsCommand; > char *szAddPrinterCommand; >@@ -763,6 +764,7 @@ > {"dos charset", P_STRING, P_GLOBAL, &Globals.dos_charset, handle_charset, NULL, FLAG_ADVANCED}, > {"unix charset", P_STRING, P_GLOBAL, &Globals.unix_charset, handle_charset, NULL, FLAG_ADVANCED}, > {"display charset", P_STRING, P_GLOBAL, &Globals.display_charset, handle_charset, NULL, FLAG_ADVANCED}, >+ {"default_char", P_CHAR, P_GLOBAL, &Globals.default_char, NULL, NULL, FLAG_ADVANCED}, > {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT}, > {"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT}, > {"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_HIDE}, >@@ -1329,6 +1331,9 @@ > /* Use codepage 850 as a default for the dos character set */ > string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET); > >+ /* Use underscore bt default instead of characters we can't convert */ >+ Globals.default_char = '_'; >+ > /* > * Allow the default PASSWD_CHAT to be overridden in local.h. > */ >@@ -1611,6 +1616,7 @@ > FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset) > FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset) > FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset) >+FN_GLOBAL_CHAR(lp_default_char, &Globals.default_char) > FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile) > FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile) > FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile) >ТолÑко в samba-3.0.5-fixed/source/script: gen-8bit-gap.sh >diff -ur samba-3.0.5/source/script/mkproto.awk samba-3.0.5-fixed/source/script/mkproto.awk >--- samba-3.0.5/source/script/mkproto.awk 2004-04-04 13:37:42.000000000 +0600 >+++ samba-3.0.5-fixed/source/script/mkproto.awk 2004-08-06 09:49:48.346994776 +0600 >@@ -98,6 +98,11 @@ > printf "int %s(void);\n", a[2] > } > >+/^FN_GLOBAL_CHAR/ { >+ split($0,a,"[,()]") >+ printf "char %s(void);\n", a[2] >+} >+ > /^static|^extern/ || !/^[a-zA-Z]/ || /[;]/ { > next; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1578
:
595
|
596