samba-tool domain join segfaults (4.16)
Michael Tokarev
mjt at tls.msk.ru
Tue May 24 12:52:31 UTC 2022
Hi!
I'm facing a segfault in samba-tool when doing domain join, in
source3/utils/py_net.c py_net_join_member(). Here it is (with some
omissions for brevity):
static PyObject *py_net_join_member(py_net_Object *self, PyObject *args, PyObject *kwargs)
{
struct libnet_JoinCtx *r = NULL;
...
werr = libnet_init_JoinCtx(mem_ctx, &r); <= here, &r is initialized okay
// r = (struct libnet_JoinCtx *) 0xa5f850
...
// but after this call: r becomes.. NULL.
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|sssssszpp:Join",
discard_const_p(char *, kwnames),
&r->in.dnshostname,
&r->in.upn,
&r->in.account_ou,
&r->in.os_name,
&r->in.os_version,
&r->in.os_servicepack,
&r->in.machine_password,
&r->in.debug,
&no_dns_updates)) {
talloc_free(mem_ctx);
PyErr_FromString(_("Invalid arguments\n"));
return NULL;
}
// r = (struct libnet_JoinCtx *) 0x0
...
// and here, it gets a segfault.
r->in.domain_name = lpcfg_realm(self->lp_ctx);
r->in.domain_name_type = JoinDomNameTypeDNS;
Unfortunately I don't know how to print *args and *kwargs there.
They're PyTuple_Type and PyDict_Type, respectively.
The backtrace:
BACKTRACE: 36 stack frames:
#0 /lib/x86_64-linux-gnu/libsamba-util.so.0(log_stack_trace+0x30) [0x7ffff70510f0]
#1 /lib/x86_64-linux-gnu/libsamba-util.so.0(smb_panic+0x9) [0x7ffff7051339]
#2 /lib/x86_64-linux-gnu/libsamba-util.so.0(+0xf3d1) [0x7ffff70513d1]
#3 /lib/x86_64-linux-gnu/libpthread.so.0(+0x14140) [0x7ffff7fad140]
#4 /usr/lib/python3/dist-packages/samba/net_s3.cpython-39-x86_64-linux-gnu.so(+0x7558) [0x7ffff221c558]
#5 /usr/bin/python3() [0x53f350]
#6 /usr/bin/python3(_PyObject_MakeTpCall+0x39b) [0x51d89b]
#7 /usr/bin/python3(_PyEval_EvalFrameDefault+0x5f7f) [0x517a0f]
#8 /usr/bin/python3() [0x5106ed]
#9 /usr/bin/python3(_PyFunction_Vectorcall+0x361) [0x528d21]
#10 /usr/bin/python3() [0x53bcfb]
#11 /usr/bin/python3(PyObject_Call+0xc1) [0x53c361]
#12 /usr/bin/python3(_PyEval_EvalFrameDefault+0x23fb) [0x513e8b]
#13 /usr/bin/python3() [0x5106ed]
#14 /usr/bin/python3(_PyFunction_Vectorcall+0x361) [0x528d21]
#15 /usr/bin/python3() [0x53be7e]
#16 /usr/bin/python3(_PyEval_EvalFrameDefault+0x23fb) [0x513e8b]
#17 /usr/bin/python3() [0x5106ed]
#18 /usr/bin/python3(_PyFunction_Vectorcall+0x361) [0x528d21]
#19 /usr/bin/python3() [0x53be7e]
#20 /usr/bin/python3(_PyEval_EvalFrameDefault+0x23fb) [0x513e8b]
#21 /usr/bin/python3() [0x5106ed]
#22 /usr/bin/python3(_PyFunction_Vectorcall+0x361) [0x528d21]
#23 /usr/bin/python3() [0x53be7e]
#24 /usr/bin/python3(_PyEval_EvalFrameDefault+0x23fb) [0x513e8b]
#25 /usr/bin/python3() [0x5106ed]
#26 /usr/bin/python3(_PyEval_EvalCodeWithName+0x47) [0x510497]
#27 /usr/bin/python3(PyEval_EvalCode+0x23) [0x5f5be3]
#28 /usr/bin/python3() [0x619de7]
#29 /usr/bin/python3() [0x615610]
#30 /usr/bin/python3() [0x619d79]
#31 /usr/bin/python3(PyRun_SimpleFileExFlags+0x196) [0x619816]
#32 /usr/bin/python3(Py_RunMain+0x2b3) [0x60d4e3]
#33 /usr/bin/python3(Py_BytesMain+0x29) [0x5ea6e9]
#34 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea) [0x7ffff7c5dd0a]
#35 /usr/bin/python3(_start+0x2a) [0x5ea5ea]
Here's what I'm doing: it is a new host, with fresh samba 4.16 install
(debian build), the command:
samba-tool domain join tls.msk.ru MEMBER -U mjt-adm
and here's the smb.conf's global section:
[global]
dedicated keytab file = /etc/krb5.keytab
disable spoolss = Yes
kerberos method = secrets and keytab
netbios name = WH
realm = TLS.MSK.RU
security = ADS
server role = member server
winbind use default domain = Yes
workgroup = TLS
How to print the python types in gdb?
Thanks,
/mjt
More information about the samba-technical
mailing list