Summary: | samba-3.0.23 causes segfault with WINS resolution | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Giacomo Graziosi <g.graziosi> |
Component: | [OLD] Server | Assignee: | Gentoo's SAMBA Team <samba> |
Status: | RESOLVED UPSTREAM | ||
Severity: | critical | CC: | jakub, jjrussell, mozilla, office, siryes |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
samba-3.0.23-util_unistr.patch
samba-3.0.23.ebuild.diff |
Description
Giacomo Graziosi
2006-07-14 03:33:44 UTC
I found a way to "disable" the bug: changing hosts: files dns wins mdns to hosts: files dns mdns in /etc/nsswitch.conf appears to be a workaround for the bug. I tried to recompile samba, glibc and firefox but the problem is still here, this is the only way I found to disable the crashes. *** Bug 140996 has been marked as a duplicate of this bug. *** This Ubuntu thread has a patch for the fix https://launchpad.net/distros/ubuntu/+source/samba/+bug/39990 Err, can you package.mask this badly broken stuff meanwhile? samba-3.0.23 masked. There is also a problem in ldap filter calls... Staying tuned with upstream. Created attachment 92325 [details, diff]
samba-3.0.23-util_unistr.patch
I've looked at the Ubuntu patch mentioned and there's a function in the
samba's source, lazy_initialize_conv(). It's already called from within
check_dos_char().
In original it looks like this:
/*
see if a ucs2 character can be mapped correctly to a dos character
and mapped back to the same character in ucs2
*/
int check_dos_char(smb_ucs2_t c)
{
lazy_initialize_conv();
/* Find the right byte, and right bit within the byte; return
* 1 or 0 */
return (doschar_table[(c & 0xffff) / 8] & (1 << (c & 7))) != 0;
}
and the lazy function in question looks like this:
void lazy_initialize_conv(void)
{
static int initialized = False;
if (!initialized) {
initialized = True;
load_case_tables();
init_iconv();
}
}
So I guess it's more efficient to call lazy_initialize_conv() instead
of load_case_tables() every time one of the offending functions gets
called and uses uninitialized tables. This way load_case_tables() is
used as well, but only when necessary.
I've just added a required call to these functions, like this:
/*******************************************************************
Convert a wchar to upper case.
********************************************************************/
smb_ucs2_t toupper_w(smb_ucs2_t val)
{
lazy_initialize_conv();
return upcase_table[SVAL(&val,0)];
}
Is this a good workaround for this bug?
Created attachment 92326 [details, diff]
samba-3.0.23.ebuild.diff
A diff against samba-3.0.23.ebuild from my overlay - for easier reference.
|