[Samba] Missing deprecations from CHANGELOG 4.14

Matthias Kühne | Ellerhold AG matthias.kuehne at ellerhold.de
Wed Aug 4 07:12:05 UTC 2021


Hallo Rowland,

Am 03.08.21 um 16:07 schrieb Rowland Penny via samba:
> On Tue, 2021-08-03 at 15:16 +0200, Matthias Kühne | Ellerhold AG via
> samba wrote:
>> Hello Rowland,
>>
>> Im still tracking down this bug and I've set up a brand new VM.
>>
>> Using the standard debian samba package (4.9.5) my script can
>> successfully send files to a Mac OS SMB-Server without any smb.conf
>> at all.
>>
>> After the upgrade to Louis' 4.13 (2:4.13.10+dfsg-0.1buster1) this
>> script
>> fails.
> Any chance of seeing your script ?


Install dependencies php-cli php-smbclient (which installs libsmbclient).

Run this script:

```

<?php

// Setup
if (is_file(__DIR__ . '/_credentials.php')) {
     $credentials = require __DIR__ . '/_credentials.php';
     $username  = $credentials['username'];
     $workgroup = $credentials['workgroup'];
     $password  = $credentials['password'];
     $shareUri  = $credentials['shareUri'];
} else {
     $username  = 'user';
     $workgroup = 'WORKGROUP';
     $password  = 'secret!';
     $shareUri  = 'smb://my.server.lan/My Share/';
}

// Execution

$state = smbclient_state_new();
smbclient_option_set($state, SMBCLIENT_OPT_AUTO_ANONYMOUS_LOGIN, false);

if (function_exists('smbclient_client_protocols')) {
     smbclient_client_protocols($state, 'NT1', null);
     echo 'Set min protocol' . PHP_EOL;
}

echo 'Init with ' . $username . ' on ' . $shareUri . PHP_EOL;

$result = smbclient_state_init($state, $workgroup, $username, $password);
if (($result === null) || ($result === false)) {
     throw new RuntimeException('smbclient_state_init() failed: ' . 
smbclient_state_errno($state));
}

// stat()
var_dump(smbclient_getxattr($state, $shareUri, 'system.dos_attr.*'));
```

It should print the attributes of the share, but fails with 
"smb_signing_good: BAD SIG: seq 1" and "permission denied"

>> Ive changed my smb.conf to
>>
>> [global]
>>       ntlm auth = ntlmv1-permitted
>>       client min protocol = NT1
>>
>> and tried it again: It works again (as expected)!
>>
>> Upgrading to 4.14 (2:4.14.6+dfsg-0.1buster1) and my script fails
>> again!
>> Using `smbclient` instead of `libsmbclient` via the php-module works
>> though...
>>
>> So something must've changed between 4.13.10 and 4.14.6 in
>> libsmbclient ...
> smbclient doesn't require the smb.conf and deprecated doesn't mean
> 'removed'. It takes quite some time before Samba removes deprecated
> parameters, 'years' comes to mind.
>
>
> Additionally I tried to use PHPs 'smbclient_client_protocols()' to
> allow
> SMB1 connections. Turns out this function is not available. Looking
> at
> https://github.com/eduardok/libsmbclient-php/blob/b019c41a9ceb3695d97e0ef2fe1ad424097455b3/config.m4
> (line 75+) it seems like the libsmbclient is missing the
> 'smbc_setOptionProtocols', so the PHP Module doesnt publish the
> 'smbclient_client_protocols()' function.
> That has been part of Samba since Sep 2018, could the libsmbclient that
> libsmbclient-php uses require updating ?

I think the php module doesnt have its own libsmbclient but uses the 
system one. And thats the one getting updated between 4.13 and 4.14. 
Everything php-related stayed the same.


> Im using Ondrej Sury PHP Repository for debian and opened a bug
> there:
> https://github.com/oerdnj/deb.sury.org/issues/1624
>
> Turns out neither the standard debian 4.9, nor Louis 4.13 nor Louis
> 4.14
> version of libsmbclient has this function compiled in. Im 90% sure,
> that
> this is a separate thing because 4.9 and 4.13 worked while lacking
> this
> function.
> It should be compiled in, because it is part of Samba. I think what
> wasn't updated was the libsmbclient manpage, it appears that there is
> an option not listed in the manpage 'min_proto'. Have a look here:
> https://git.samba.org/?p=samba.git;a=commitdiff;h=0dae4e2f5c65167fdb2405e232436921a0bb17e6
>
> Rowland

So there is a test in the config.m4 of the php module (see 
https://github.com/eduardok/libsmbclient-php/blob/b019c41a9ceb3695d97e0ef2fe1ad424097455b3/config.m4 
line 73+). Ondrej Sury said that this is a compile time option. So I 
thought that its a compile time option for libsmbclient, but now I think 
its rather a compile time option for the php module!

During the compilation of the php module this C-function was not 
available, which disabled the php function for all installs. Im using 
the deb.surg.org repo for PHP, that compiles against debians samba 
(4.9), which doesnt have this C-function (?). So even updating 
libsmbclient to a version with this C-function doesnt unlock the php 
function.

So its an entirely separate issue that has nothing to do with my bug. 
And its fixed on bullseye because debian upgraded to 4.13.

Thank you very much for helping me!

-- 
Matthias Kühne
Senior Webentwickler
Datenschutzbeauftragter

Ellerhold Aktiengesellschaft
Friedrich-List-Str. 4
01445 Radebeul

Telefon: +49 (0) 351 83933-61
Telefax: +49 (0) 351 83933-99

Web     www.ellerhold.de
Twitter www.twitter.com/Ellerhold_AG
Youtube www.youtube.com/user/ellerholdgruppe

Amtsgericht Dresden / HRB 23769
Vorstand: Stephan Ellerhold, Maximilian Ellerhold
Vorsitzender des Aufsichtsrates: Frank Ellerhold



---Diese E-Mail und Ihre Anlagen enthalten vertrauliche Mitteilungen. Sollten Sie nicht der beabsichtigte Adressat sein, so bitten wir Sie um Mitteilung und um sofortiges löschen dieser E-Mail und der Anlagen.

Unsere Hinweise zum Datenschutz finden Sie hier: http://www.ellerhold.de/datenschutz/

This e-mail and its attachments are privileged and confidential. If you are not the intended recipient, please notify us and immediately delete this e-mail and its attachments.

You can find our privacy policy here: http://www.ellerhold.de/datenschutz/




More information about the samba mailing list