<feed xmlns='http://www.w3.org/2005/Atom'>
<title>samba.git/nsswitch/libwbclient/wscript, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/'/>
<entry>
<title>nsswitch: leverage TLS if available in favour over global locking</title>
<updated>2023-01-05T11:33:37+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2022-11-06T15:57:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=642a4452ce5b3333c50e41e54bc6ca779686ecc3'/>
<id>642a4452ce5b3333c50e41e54bc6ca779686ecc3</id>
<content type='text'>
The global locking can lead to deadlocks when using nscd: when processing the
first request in winbind, when we know we call into code that will recurse into
winbind we call winbind_off() which sets an environment variable which is later
checked here in the nsswitch module.

But with nscd in the stack, we don't see the env variable in nsswitch, so when
we try to acquire the global lock again, it is already locked and we deadlock.

By using a thread specific winbindd_context, plus a few other thread local global
variables, we don't need a global lock anymore.

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The global locking can lead to deadlocks when using nscd: when processing the
first request in winbind, when we know we call into code that will recurse into
winbind we call winbind_off() which sets an environment variable which is later
checked here in the nsswitch module.

But with nscd in the stack, we don't see the env variable in nsswitch, so when
we try to acquire the global lock again, it is already locked and we deadlock.

By using a thread specific winbindd_context, plus a few other thread local global
variables, we don't need a global lock anymore.

Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libwbclient: add wbc[Ctx]ChangeTrustCredentialsAt()</title>
<updated>2022-12-21T19:10:35+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2022-11-22T11:00:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=682216aa29eda70885c7756927ebfbe88d655aa4'/>
<id>682216aa29eda70885c7756927ebfbe88d655aa4</id>
<content type='text'>
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nsswitch: reduce dependecies to private libraries and link static/builtin if possible</title>
<updated>2021-11-30T15:53:34+00:00</updated>
<author>
<name>Stefan Metzmacher</name>
<email>metze@samba.org</email>
</author>
<published>2021-07-01T10:08:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=66e90b7391bd404580f3919c4f2b8625c9c89c0e'/>
<id>66e90b7391bd404580f3919c4f2b8625c9c89c0e</id>
<content type='text'>
Over the last month I got more and more reports,
that it's not possible to use a custom Samba version
on systems with sssd being installed, which depends on some
specific samba libraries installed in the system.

One major problem is that the custom libnss_winbind.so.2
depends on the libreplace-samba4.so of the custom build
and also injects an RPATH into the running process.
When sssd uses any nss library call it will get this,
when it then tries to load some of its plugins via dlopen(),
e.g.

ldd /usr/lib64/sssd/libsss_ad.so| grep samba

   libsamba-util.so.0 =&gt; /lib64/libsamba-util.so.0
   libreplace-samba4.so =&gt; /usr/lib64/samba/libreplace-samba4.so
   libsamba-security-samba4.so =&gt; /usr/lib64/samba/libsamba-security-samba4.so
   libsamba-errors.so.1 =&gt; /lib64/libsamba-errors.so.1
   libsamba-debug-samba4.so =&gt; /usr/lib64/samba/libsamba-debug-samba4.so
   libgenrand-samba4.so =&gt; /usr/lib64/samba/libgenrand-samba4.so
   libsocket-blocking-samba4.so =&gt; /usr/lib64/samba/libsocket-blocking-samba4.so
   libtime-basic-samba4.so =&gt; /usr/lib64/samba/libtime-basic-samba4.so
   libsys-rw-samba4.so =&gt; /usr/lib64/samba/libsys-rw-samba4.so
   libiov-buf-samba4.so =&gt; /usr/lib64/samba/libiov-buf-samba4.so

When that loads dlopen() will fail as a soname libreplace-samba4.so is
already loaded, but the symbol version within the other one don't match, as the
contain the exact version, e.g. replace_dummy@@SAMBA_4.13.3.

This is just an example and similar things can happen in all situations
where we provide libraries, which are potentially injected into every
process of the running system. These should only depend on libc.so and
related basic system libraries in order to avoid the problem.

We have the following libraries, which are in the that category:

- libnss_winbind.so.2
- libnss_wins.so.2
- pam_winbind.so
- winbind_krb5_locator.so
- async_dns_krb5_locator.so

The rules of library loading are really complex and symbol versioning
is not enough to solve it, only the combination of unique soname and
unique symbol version suffix seem to solve the problem, but injecting
an RPATH is still a problem.

In order to solve the problem I experimented with adding SAMBA_SUBSYSTEM()
definitions with 'hide_symbols=True' in order to do some static linking
of selected components, e.g.

   bld.SAMBA_SUBSYSTEM('replace-hidden',
                       source=REPLACE_SOURCE,
                       group='base_libraries',
                       hide_symbols=True,
                       deps='dl attr' + extra_libs)

It's relatively simple to get to the point where the following are
completely static:

- libnss_winbind.so.2
- libnss_wins.so.2
- pam_winbind.so
- winbind_krb5_locator.so

But 'async_dns_krb5_locator.so' links in almost everything!
It seems we install the krb5 plugins into our own $MODULESDIR/krb5/,
so it may not be so critical, as long it's the admin who created
the desired symlinks into the location the kerberos libraries search
for plugins. Note the at least the locator plugins are always loaded
without any configuration, every .so in a special path are loaded with dlopen().
This is done by every application using kerberos, so we load a lot of samba libraries
into them.

Packagers should not put async_dns_krb5_locator.so (nor a symlink) into
the path that's reachable by libkrb5.so.

As a longterm solution we may want to change async_dns_krb5_locator.so
to use a helper process with posix_spawn() instead of doing everything
within the process.

Note I added hiden_symbols=True to the nss modules for Linux and
FreeBSD only, because these are the only platforms I'm able to test
on. We most likely should do the same on other platforms, but some
with access to the platform should provide a tested patch.

In order to avoid manual definitions of SAMBA_SUBSYSTEMS() with
'-hidden', I added the 'provide_builtin_linking=True' option,
as the logic is very similar to what we already have with the
'--builtin-libraries=BUILTIN_LIBRARIES' configure option.

SAMBA_PLUGIN() is used in order to use SAMBA_LIBRARY() in order
to make it more strict that these plugins can't be used as
normal depedency by other subsystems and libraries.

While being there it was easy enough to make libwbclient.so
also standalone without dependecies to other samba libraries.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14780

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Andrew Bartlett &lt;abartlet@samba.org&gt;
Reviewed-by: Andreas Schneider &lt;asn@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Over the last month I got more and more reports,
that it's not possible to use a custom Samba version
on systems with sssd being installed, which depends on some
specific samba libraries installed in the system.

One major problem is that the custom libnss_winbind.so.2
depends on the libreplace-samba4.so of the custom build
and also injects an RPATH into the running process.
When sssd uses any nss library call it will get this,
when it then tries to load some of its plugins via dlopen(),
e.g.

ldd /usr/lib64/sssd/libsss_ad.so| grep samba

   libsamba-util.so.0 =&gt; /lib64/libsamba-util.so.0
   libreplace-samba4.so =&gt; /usr/lib64/samba/libreplace-samba4.so
   libsamba-security-samba4.so =&gt; /usr/lib64/samba/libsamba-security-samba4.so
   libsamba-errors.so.1 =&gt; /lib64/libsamba-errors.so.1
   libsamba-debug-samba4.so =&gt; /usr/lib64/samba/libsamba-debug-samba4.so
   libgenrand-samba4.so =&gt; /usr/lib64/samba/libgenrand-samba4.so
   libsocket-blocking-samba4.so =&gt; /usr/lib64/samba/libsocket-blocking-samba4.so
   libtime-basic-samba4.so =&gt; /usr/lib64/samba/libtime-basic-samba4.so
   libsys-rw-samba4.so =&gt; /usr/lib64/samba/libsys-rw-samba4.so
   libiov-buf-samba4.so =&gt; /usr/lib64/samba/libiov-buf-samba4.so

When that loads dlopen() will fail as a soname libreplace-samba4.so is
already loaded, but the symbol version within the other one don't match, as the
contain the exact version, e.g. replace_dummy@@SAMBA_4.13.3.

This is just an example and similar things can happen in all situations
where we provide libraries, which are potentially injected into every
process of the running system. These should only depend on libc.so and
related basic system libraries in order to avoid the problem.

We have the following libraries, which are in the that category:

- libnss_winbind.so.2
- libnss_wins.so.2
- pam_winbind.so
- winbind_krb5_locator.so
- async_dns_krb5_locator.so

The rules of library loading are really complex and symbol versioning
is not enough to solve it, only the combination of unique soname and
unique symbol version suffix seem to solve the problem, but injecting
an RPATH is still a problem.

In order to solve the problem I experimented with adding SAMBA_SUBSYSTEM()
definitions with 'hide_symbols=True' in order to do some static linking
of selected components, e.g.

   bld.SAMBA_SUBSYSTEM('replace-hidden',
                       source=REPLACE_SOURCE,
                       group='base_libraries',
                       hide_symbols=True,
                       deps='dl attr' + extra_libs)

It's relatively simple to get to the point where the following are
completely static:

- libnss_winbind.so.2
- libnss_wins.so.2
- pam_winbind.so
- winbind_krb5_locator.so

But 'async_dns_krb5_locator.so' links in almost everything!
It seems we install the krb5 plugins into our own $MODULESDIR/krb5/,
so it may not be so critical, as long it's the admin who created
the desired symlinks into the location the kerberos libraries search
for plugins. Note the at least the locator plugins are always loaded
without any configuration, every .so in a special path are loaded with dlopen().
This is done by every application using kerberos, so we load a lot of samba libraries
into them.

Packagers should not put async_dns_krb5_locator.so (nor a symlink) into
the path that's reachable by libkrb5.so.

As a longterm solution we may want to change async_dns_krb5_locator.so
to use a helper process with posix_spawn() instead of doing everything
within the process.

Note I added hiden_symbols=True to the nss modules for Linux and
FreeBSD only, because these are the only platforms I'm able to test
on. We most likely should do the same on other platforms, but some
with access to the platform should provide a tested patch.

In order to avoid manual definitions of SAMBA_SUBSYSTEMS() with
'-hidden', I added the 'provide_builtin_linking=True' option,
as the logic is very similar to what we already have with the
'--builtin-libraries=BUILTIN_LIBRARIES' configure option.

SAMBA_PLUGIN() is used in order to use SAMBA_LIBRARY() in order
to make it more strict that these plugins can't be used as
normal depedency by other subsystems and libraries.

While being there it was easy enough to make libwbclient.so
also standalone without dependecies to other samba libraries.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14780

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Andrew Bartlett &lt;abartlet@samba.org&gt;
Reviewed-by: Andreas Schneider &lt;asn@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nsswitch/libwbclient: explicitly mark all wbc* symbols as _PUBLIC_</title>
<updated>2021-11-30T15:53:34+00:00</updated>
<author>
<name>Stefan Metzmacher</name>
<email>metze@samba.org</email>
</author>
<published>2021-10-12T12:30:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=62d05a81087029d93ba0cf81c11e5b244d788aef'/>
<id>62d05a81087029d93ba0cf81c11e5b244d788aef</id>
<content type='text'>
Some private functions from wbclient_internal.h already
leaked into the ABI. With hide_symbols=True we make sure
this doesn't happen again.

Having wbcRequestResponse[Priv]() as part of the ABI helps us
in order to hide winbindd_[priv_]request_response() soon.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14780

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Andrew Bartlett &lt;abartlet@samba.org&gt;
Reviewed-by: Andreas Schneider &lt;asn@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some private functions from wbclient_internal.h already
leaked into the ABI. With hide_symbols=True we make sure
this doesn't happen again.

Having wbcRequestResponse[Priv]() as part of the ABI helps us
in order to hide winbindd_[priv_]request_response() soon.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14780

Signed-off-by: Stefan Metzmacher &lt;metze@samba.org&gt;
Reviewed-by: Andrew Bartlett &lt;abartlet@samba.org&gt;
Reviewed-by: Andreas Schneider &lt;asn@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lib: relicense smb_strtoul(l) under LGPLv3</title>
<updated>2020-08-03T22:21:02+00:00</updated>
<author>
<name>Ralph Boehme</name>
<email>slow@samba.org</email>
</author>
<published>2020-07-03T06:11:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=23274717563b19684c52f8a909f528f608dafd7c'/>
<id>23274717563b19684c52f8a909f528f608dafd7c</id>
<content type='text'>
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Swen Schillig &lt;swen@linux.ibm.com&gt;
Reviewed-by: Volker Lendecke &lt;vl@samba.org&gt;

Autobuild-User(master): Jeremy Allison &lt;jra@samba.org&gt;
Autobuild-Date(master): Mon Aug  3 22:21:04 UTC 2020 on sn-devel-184
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Ralph Boehme &lt;slow@samba.org&gt;
Reviewed-by: Swen Schillig &lt;swen@linux.ibm.com&gt;
Reviewed-by: Volker Lendecke &lt;vl@samba.org&gt;

Autobuild-User(master): Jeremy Allison &lt;jra@samba.org&gt;
Autobuild-Date(master): Mon Aug  3 22:21:04 UTC 2020 on sn-devel-184
</pre>
</div>
</content>
</entry>
<entry>
<title>libwbclient: Use wrapper for string to integer conversion</title>
<updated>2019-03-01T00:32:11+00:00</updated>
<author>
<name>Swen Schillig</name>
<email>swen@linux.ibm.com</email>
</author>
<published>2019-01-29T13:21:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=ea7231dcc0b50c535f913f0542d600d0b2119a21'/>
<id>ea7231dcc0b50c535f913f0542d600d0b2119a21</id>
<content type='text'>
In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig &lt;swen@linux.ibm.com&gt;
Reviewed-by: Ralph Böhme &lt;slow@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig &lt;swen@linux.ibm.com&gt;
Reviewed-by: Ralph Böhme &lt;slow@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>wbclient: Add wbcSetClientProcessName()</title>
<updated>2018-11-12T08:50:25+00:00</updated>
<author>
<name>Andreas Schneider</name>
<email>asn@samba.org</email>
</author>
<published>2018-11-02T17:57:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=1834513ebe394f4e5111665a21df652e59b3b0b6'/>
<id>1834513ebe394f4e5111665a21df652e59b3b0b6</id>
<content type='text'>
Signed-off-by: Andreas Schneider &lt;asn@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Andreas Schneider &lt;asn@samba.org&gt;
Reviewed-by: Jeremy Allison &lt;jra@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>nsswitch/libwbclient/wscript: import from waflib</title>
<updated>2018-09-05T04:37:25+00:00</updated>
<author>
<name>Alexander Bokovoy</name>
<email>ab@samba.org</email>
</author>
<published>2018-06-15T13:20:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=d00ba4003125898d0c4928ac6ad205bad79ee3c2'/>
<id>d00ba4003125898d0c4928ac6ad205bad79ee3c2</id>
<content type='text'>
Signed-off-by: Alexander Bokovoy &lt;ab@samba.org&gt;
Reviewed-by: Andrew Bartlett &lt;abartlet@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Alexander Bokovoy &lt;ab@samba.org&gt;
Reviewed-by: Andrew Bartlett &lt;abartlet@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libwbclient: Add "authoritative" to wbcAuthErrorInfo</title>
<updated>2017-03-07T08:15:17+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2017-01-29T16:51:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=a6f4e603063b540f37a1b8774dd9253dd595a913'/>
<id>a6f4e603063b540f37a1b8774dd9253dd595a913</id>
<content type='text'>
smbd needs to react to "authoritative"

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
smbd needs to react to "authoritative"

Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Stefan Metzmacher &lt;metze@samba.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libwbclient: Implement wbc[Ctx]UnixIdsToSids</title>
<updated>2016-02-22T19:29:15+00:00</updated>
<author>
<name>Volker Lendecke</name>
<email>vl@samba.org</email>
</author>
<published>2015-08-14T09:55:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/samba.git/commit/?id=171931cf7de4fcccf6d2e1e7b6520a44b21d21ee'/>
<id>171931cf7de4fcccf6d2e1e7b6520a44b21d21ee</id>
<content type='text'>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Ralph Boehme &lt;slow@samba.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Volker Lendecke &lt;vl@samba.org&gt;
Reviewed-by: Ralph Boehme &lt;slow@samba.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
