1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
Commit Graph

58837 Commits

Author SHA1 Message Date
Volker Lendecke
38e5b39eac smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06 19:22:28 +00:00
Volker Lendecke
a395f752f0 smbd: Fix CID 1504457 Resource leak
Highly likely that's a false positive because Coverity does not
understand that srv_encrypt_buffer() only allocates when
NT_STATUS_OK(status), but it does not hurt to make it happy this way.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06 19:22:28 +00:00
Volker Lendecke
f236c42fb7 smbd: Remove NTCREATEX_FLAG_DELETE_ON_CLOSE
This is only used for print files. Storing it in the fd_handle seems
overkill to me, this can easily be stored directly in the fsp itself,
we have a flag for this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06 19:22:28 +00:00
Volker Lendecke
777597d0c6 smbd: Move message_push_string() to smb1_utils.c
Only used in SMB1 code

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06 19:22:28 +00:00
Volker Lendecke
9ec99ab57c smbd: Remove unused smb_bufrem() macro
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06 19:22:28 +00:00
Christian Ambach
7ba732bac1 s3:smbd implement volume serial number parameter
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14765
RN: add new smb.conf parameter "volume serial number" to allow overriding
the generated default value

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed=by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jun  6 17:42:37 UTC 2022 on sn-devel-184
2022-06-06 17:42:37 +00:00
Christian Ambach
5f1f3b0f06 docs-xml: add new parameter volume serial number
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14765
RN: add new smb.conf parameter "volume serial number" to allow overriding
the generated default value

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06 16:46:35 +00:00
Christian Ambach
470d4a3b61 s3:smbd factor out volume serial number generation
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14765
RN: add new smb.conf parameter "volume serial number" to allow overriding the
generated default value

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06 16:46:35 +00:00
Christian Ambach
5e79652364 s3:smbd add missing VolumeCreationTime to FileFsVolumeInformation
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06 16:46:35 +00:00
Christian Ambach
5f0b65654c s3:include fix typo
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-06 16:46:35 +00:00
Ralph Boehme
8ae672f955 vfs_gpfs: use handle based gpfswrap_get_winattrs()
Fixes detecting offline flag for files in snapshot – no idea if this is
actually expected.

Replaces path based gpfswrap_get_winattrs_path() with handle based version
gpfswrap_get_winattrs(). When dealing with files in snapshots fsp->fsp_name
points to the active dataset, which will cause ENOENT failures if files are
deleted there any only present in the snapshot.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-06-03 20:56:35 +00:00
Ralph Boehme
a0dc4c9026 vfs_gpfs: finally: use gpfswrap_fgetacl() instead of gpfswrap_getacl()
Replaces path based gpfswrap_getacl() with handle based version
gpfswrap_fgetacl(). When dealing with files in snapshots fsp->fsp_name points to
the active dataset, which will cause ENOENT failures if files are deleted there
any only present in the snapshot:

[2022/05/06 11:32:55.233435,  4, pid=12962, effective(1460548, 273710), real(1460548, 0)]
   calling open_file with flags=0x0 flags2=0x800 mode=0644, access_mask = 0x80, open_access_mask = 0x80
[2022/05/06 11:32:55.233460, 10, pid=12962, effective(1460548, 273710), real(1460548, 0), class=vfs]
   gpfs_get_nfs4_acl invoked for dir/subdir/file.txt
[2022/05/06 11:32:55.233495,  5, pid=12962, effective(1460548, 273710), real(1460548, 0), class=vfs]
   smbd_gpfs_getacl failed with No such file or directory
[2022/05/06 11:32:55.233521,  9, pid=12962, effective(1460548, 273710), real(1460548, 0), class=vfs]
   gpfs_getacl failed for dir/subdir/file.txt with No such file or directory
[2022/05/06 11:32:55.233546, 10, pid=12962, effective(1460548, 273710), real(1460548, 0)]
   smbd_check_access_rights_fsp: Could not get acl on dir/subdir/file.txt {@GMT-2022.05.04-11.58.53}: NT_STATUS_OBJECT_NAME_NOT_FOUND

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-06-03 20:56:35 +00:00
Ralph Boehme
1b2c70f4d1 vfs_gpfs: pass fsp to gpfs_getacl_with_capability()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-06-03 20:56:35 +00:00
Ralph Boehme
ac458648aa vfs_gpfs: pass fsp to vfs_gpfs_getacl()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-06-03 20:56:35 +00:00
Ralph Boehme
3764be7031 vfs_gpfs: use fsp in gpfsacl_get_posix_acl()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-06-03 20:56:35 +00:00
Ralph Boehme
c26efe0c23 vfs_gpfs: pass fsp to gpfsacl_get_posix_acl()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-06-03 20:56:35 +00:00
Ralph Boehme
5f4625a285 vfs_gpfs: pass fsp to gpfs_get_nfs4_acl()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-06-03 20:56:35 +00:00
Ralph Boehme
ad06d80683 vfs_gpfs: pass fsp to gpfsacl_emu_chmod()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15069

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-06-03 20:56:35 +00:00
Ralph Boehme
a0f7ced610 vfs_gpfs: indentation and README.Coding fixes
Best viewed with git show -w.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2022-06-03 20:56:35 +00:00
Andreas Schneider
ac16351ff5 s3:printing: Start samba-bgqd as soon as possible
We need some time to fill the printcap cache.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue May 31 21:51:07 UTC 2022 on sn-devel-184
2022-05-31 21:51:07 +00:00
Andreas Schneider
3b5b80e996 s3:printing: Initialize the printcap cache as soon as the bgqd starts
As soon as the background daemon starts, we need to initialize the
printcap cache so that rpcd-spoolssd can serve printers.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-31 20:53:35 +00:00
Volker Lendecke
5aa6b85cd9 winbind: Create local krb5.conf for idmap backend ad
Without this, it can happen that tldap will look at a possibly wrong
/etc/krb5.conf. I have not reliably reproduced this, because a
set_domain_online_request() in the idmap child might interfere with
this, so I could not write a comprehensive test for this. Manual
testing however fixes the issue that wbinfo --sid-to-uid can take ages
asking a potentially nonexisting KDC.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2022-05-31 19:17:34 +00:00
Michael Tokarev
976326fa2b s3/util/py_net.c: fix samba-tool domain join&leave segfault
We process python args using PyArg_ParseTupleAndKeywords(), and use "p"
type modifier there.  According to documentation, this type modifier,
while works for a boolean type, expects an argument of type int. But in
py_net_join_member() and  py_net_leave() we use argument of type uint8_t
(no_dns_update, keep_account, r->in.debug). So when PyArg_ParseTupleAndKeywords()
tries to assign a value to &no_dns_update, it updates subsequent, unrelated bytes
too, - which ones depends on the stack and structure layout used by the compiler.

Fix this by using int type for all relevant variables, and by introducing proxy
variable "debug" (of the same type) for r->in.debug.

While at it, also ensure all variables have sensible default values.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed May 25 06:19:32 UTC 2022 on sn-devel-184
2022-05-25 06:19:32 +00:00
Noel Power
56e1798171 s3/client: Restore '-E' handling
Sometimes we really do need to redirect output to stderr
e.g. when using the tar command to output the archive to stdout
we don't want debug or cmdline status messages straying into stdout.

was removed with commit: e4474ac0a5

remove known fail for the test

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15075
Signed-off-by: Noel Power <noel.power@suse.com>

Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue May 24 10:29:27 UTC 2022 on sn-devel-184
2022-05-24 10:29:27 +00:00
Noel Power
5b6493043f s3/script/tests: Test smbclient -E redirects output to stderr
Add new test to ensure smbclient is writing to stderr (with '-E')
Add knownfail for this test (will be removed when issue is fixed in
later commit)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15075
Signed-off-by: Noel Power <noel.power@suse.com>
2022-05-24 09:33:31 +00:00
Samuel Cabrero
a26f535ded s3:libads: Clear previous CLDAP ping flags when reusing the ADS_STRUCT
Before commit 1d066f37b9, when the LDAP
connection wasn't established yet (ads->ldap.ld == NULL), the
ads_current_time() function always allocated and initialized a new
ADS_STRUCT even when ads->ldap.ss had a good address after having called
ads_find_dc().

After that commit, when the ADS_STRUCT is reused and passed to the
ads_connect() call, ads_try_connect() may fail depending on the
contacted DC because ads->config.flags field can contain the flags
returned by the previous CLDAP call. For example, when having 5 DCs:

* 192.168.101.31 has PDC FSMO role
* 192.168.101.32
* 192.168.101.33
* 192.168.101.34
* 192.168.101.35

$> net ads info -S 192.168.101.35

net_ads_info()
  ads_startup_nobind()
    ads_startup_int()
      ads_init()
      ads_connect()
        ads_try_connect(192.168.101.35)
          check_cldap_reply_required_flags(returned=0xF1FC, required=0x0)
  ads_current_time()
    ads_connect()
      ads_try_connect(192.168.101.35)
        check_cldap_reply_required_flags(returned=0xF1FC, required=0xF1FC)

The check_cldap_reply_required_flags() call fails because
ads->config.flags contain the flags returned by the previous CLDAP call,
even when the returned and required values match because they have
different semantics:

  if (req_flags & DS_PDC_REQUIRED)
        RETURN_ON_FALSE(ret_flags & NBT_SERVER_PDC);

  translates to:

  if (0xF1FC & 0x80)
        RETURN_ON_FALSE(0xF1FC & 0x01);

  which returns false because 192.168.101.35 has no PDC FSMO role.

The easiest fix for now is to reset ads->config.flags in
ads_current_time() when reusing an ADS_STRUCT before calling
ads_connect(), but we should consider storing the required and returned
flags in different fields or at least use the same bitmap for them
because check_cldap_reply_required_flags() is checking a
netr_DsRGetDCName_flags value using the nbt_server_type bitmap.

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

Signed-off-by: Samuel Cabrero <scabrero@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon May 23 19:18:38 UTC 2022 on sn-devel-184
2022-05-23 19:18:38 +00:00
Samuel Cabrero
4dde5e747d s3:libnet: Fix talloc frame not freed in order
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-23 18:25:28 +00:00
Samuel Cabrero
11e0eb6f93 s3:libads: Print 'gc' and 'no_fallback' fields in ndr_print_ads_struct()
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-23 18:25:28 +00:00
Pavel Filipenský
3bb6b05781 s3:lib: Fix use_after_free: Using freed pointer "p"
Found by covscan.

Signed-off-by: Pavel Filipenský <pfilipen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-23 18:25:28 +00:00
Volker Lendecke
be944dce00 srvsvcd: Silence a integer type warning
Okay because lp_csc_policy() is an enum with 4 choices

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May 20 19:59:07 UTC 2022 on sn-devel-184
2022-05-20 19:59:07 +00:00
Volker Lendecke
5f82f01a3b srvsvcd: Avoid an "else" due to the early return
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-20 19:02:37 +00:00
Volker Lendecke
d4a6e72d5c srvsvcd: Directly initialize variables in count_for_all_fn()
Easier to read for me

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-20 19:02:37 +00:00
Volker Lendecke
48168614d4 srvsvcd: Align integer types
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-20 19:02:37 +00:00
Volker Lendecke
c90aff07ab srvsvcd: Fix shareinfo2 max_connections calculation
lp_max_connections() being an int could be >UINT32_MAX

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-20 19:02:37 +00:00
Volker Lendecke
8ea8526d13 srvsvcd: Use UINT32_MAX where appropriate
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-20 19:02:37 +00:00
Volker Lendecke
78ebd8af88 registry3: Align some integer types
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-20 19:02:37 +00:00
Volker Lendecke
a771f1d314 smbd: Simplify copy_file()
Pass in new_create_disposition directly. We can also remove the
if-case (ofun & OPENX_FILE_EXISTS_OPEN) in copy_file, the two callers
don't use it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-20 19:02:37 +00:00
Volker Lendecke
e7a60eb7c9 smbd: Simplify copy_file()
The only two callers did not use "count" and "target_is_directory".

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-20 19:02:37 +00:00
Samuel Cabrero
9bacf7529d s3:winbind: Remove struct winbindd_child_dispatch_table
All parent-child communication is based in NDR and dispatched as a local
RPC call.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu May 19 18:50:24 UTC 2022 on sn-devel-184
2022-05-19 18:50:24 +00:00
Samuel Cabrero
e9286b06cf s3:winbind: Convert InitConnection from struct based to NDR based
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-19 17:51:33 +00:00
Samuel Cabrero
39005d4437 s3:winbind: Create a binding handle for each child
Next commits will convert InitConnection from struct based to NDR based
and this call will be directly issued to a domain child so create a 'wbint'
binding handle for domain childs too.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-19 17:51:33 +00:00
Samuel Cabrero
5827a4f9ae s3:winbind: Fix code format and use newer debug macros
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-19 17:51:33 +00:00
Samuel Cabrero
574c3ed926 s3:winbind: Move winbindd_dual_init_connection() function
It will be converted later to a local RPC call handler so it must be in
the file including ndr_winbind_scompat.c

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-19 17:51:33 +00:00
Samuel Cabrero
cc0ef447cd s3:winbind: Convert winbindd_dual_pam_chauthtok() from struct based to NDR based
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-19 17:51:33 +00:00
Samuel Cabrero
ba40aad05b s3:winbind: Split getting and filling the password policy info
Next commits will convert from struct based to NDR based. The
samr_DomInfo1 struct will be returned by the child to the parent inside
the 'r' struct and the parent will just fill the winbindd_respone.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-19 17:51:33 +00:00
Samuel Cabrero
0f3b1d5c1d s3:winbind: Convert winbindd_dual_pam_chng_pswd_auth_crap() from struct based to NDR based
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-19 17:51:33 +00:00
Samuel Cabrero
ce0be638b4 s3:winbind: Convert PamLogOff from struct based to ndr based
Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-19 17:51:33 +00:00
Volker Lendecke
04e0e02c69 srvsvc: Announce [username] in NetShareEnum
This patch has two flaws: First, it does not cover api_RNetShareEnum()
for SMB1, and the second one is: To make this elegant, we would have
to restructure our share handling. It is really only listing shares
for which we have to pull in everything from smb.conf, registry,
usershares and potentially printers. What we should do is modify our
loadparm handling to only load share definitions on demand and for
listing shares handle all the potential sources specially. Add code
that walks the registry shares without adding them to our services
list and so on.

This patch is the quick&dirty way to fix the bug, the alternative
would be weeks or more. And hopefully nobody notices the SMB1
problem...

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15062

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed May 18 17:42:20 UTC 2022 on sn-devel-184
2022-05-18 17:42:20 +00:00
Volker Lendecke
20cbade5b1 srvsvc: Add a central return point to init_srv_share_info_ctr()
Soon there will be cleanup work to do.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15062

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-18 16:50:34 +00:00
Volker Lendecke
3145131809 selftest: Test for bug 15062 -- list "username" in netshareenum
Bug: https://bugzilla.samba.org/show_bug.cgi?id=15062

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-18 16:50:34 +00:00