1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

55447 Commits

Author SHA1 Message Date
Jeremy Allison
860510b196 s3: libsmb: Move all calls to convert_ss2service() to one place now all methods return a sockaddr_storage.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>

Autobuild-User(master): Isaac Boukris <iboukris@samba.org>
Autobuild-Date(master): Tue Aug  4 10:13:53 UTC 2020 on sn-devel-184
2020-08-04 10:13:53 +00:00
Jeremy Allison
03112db121 s3: libsmb: Now all resolution functions return a ss_list on success, we only need one local variable for this.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:43 +00:00
Jeremy Allison
ecaa424448 s3: libsmb: Change resolve_ads() to return a talloc'ed ss_list, matching the other name resolution methods.
Now we can move all the convert_ss2service() calls to one place.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:43 +00:00
Jeremy Allison
d53ade5beb s3: libsmb: Rewrite resolve_ads() to use the previously added dns_lookup_list() function.
Clean up internals - a LOT.

This one needs careful review. Ditch the (unused) port returns from
the SRV replies.

Internally uses talloc'ed arrays of struct sockaddr_storage
which it then convert to MALLOC'ed struct ip_service.

Still returns struct ip_service but this will be
fixed in the next commit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:43 +00:00
Jeremy Allison
d0fa32bdcd s3: libsmb: Add in (currently unused) function dns_lookup_list().
This function takes a list of names returned from a DNS SRV
query which didn't have returned IP addresses and returns an
array of struct sockaddr_storage.

Currently synchronous, but this is the function that will
be changed to be asynchronous later.

Compiles but commented out for now so we don't get "unused
function" warnings.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
97781fe0ae s3: libsmb: Pass in TALLOC_CTX * parameter to resolve_ads() instead of creating one internally.
Pass in talloc_tos() to make it match the other resolve_XXX() functions.

No memory leaks as this is used for transient data and is cleaned up
when the calling frame in internal_resolve_name() is destroyed.

Preparing to have it return a talloc'ed struct sockaddr_storage array
rather than a malloc'ed struct ip_service array.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
2297c883b5 s3: libsmb: Cleanup - ensure ss_list variables are initialized with NULL.
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
eaea3c0a62 s3: libsmb: Cleanup - put talloc parameter first in name_resolve_bcast().
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
cef158a75c s3: libsmb: Cleanup - put talloc parameter first in resolve_wins().
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
7ad92b3702 s3/s4: Cleanup. Move TALLOC_CTX * parameter to be first in resolve_lmhosts_file_as_sockaddr() to match modern conventions.
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
f12cee2361 s3: libsmb: Cleanup - put talloc parameter first in resolve_hosts().
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
53474b57e1 s3: libsmb: Cleanup - reformatting name_resolve_bcast() parameters inside internal_resolve_name().
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
1cb67bd31c s3: libsmb: Cleanup - reformatting resolve_wins() parameters inside internal_resolve_name().
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
e8db4b0909 s3: libsmb: Cleanup - reformatting resolve_lmhosts_file_as_sockaddr() parameters inside internal_resolve_name().
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
d42ba0b1b6 s3: libsmb: Cleanup - reformatting 2nd use of resolve_ads() parameters inside internal_resolve_name().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
cd3cc111a4 s3: libsmb: Cleanup - reformatting resolve_ads() parameters inside internal_resolve_name().
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
dd165b2c96 s3: libsmb: Cleanup - reformatting resolve_hosts() parameters inside internal_resolve_name().
No logic changes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
2ad4889919 s3: libsmb: Cleanup - Remove incorrect comment in resolve_ads(). The DNS code copes fine with IPv6 addresses.
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:42 +00:00
Jeremy Allison
e07fa95349 s3: libsmb: Cleanup - modernize DEBUG -> DBG_ in internal_resolve_name()
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
14433e2afa s3: libsmb: Cleanup - split allocation and NULL check in internal_resolve_name().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
1499fd8a2e s3: libsmb: Cleanup - use helper 'ok' bool for internal_resolve_name().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
4abcb3001e s3: libsmb: Cleanup - use helper 'ok' bool for name_resolve_bcast().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
d48d60595a s3: libsmb: Cleanup - use helper 'ok' bool for resolve_wins().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
8e20de549f s3: libsmb: Cleanup - use helper 'ok' bool for resolve_lmhosts_file_as_sockaddr().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
d4e430635e s3: libsmb: Cleanup - use helper 'ok' bool for resolve_hosts().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
75469fcfbf s3: libsmb: Cleanup - change to early continue in internal_resolve_name() for name_resolve_bcast().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
ba656a7950 s3: libsmb: Cleanup - change to early continue in internal_resolve_name() for resolve_wins().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
02f72478e2 s3: libsmb: Cleanup - change to early continue in internal_resolve_name() for 0x1D name in resolve_wins().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
114fe82343 s3: libsmb: Cleanup - change to early continue in internal_resolve_name() for resolve_lmhosts_file_as_sockaddr().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
139d7a73c0 s3: libsmb: Cleanup - change to early continue in internal_resolve_name() for resolve_ads().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
e74b323a4e s3: libsmb: Cleanup - change to early continue in internal_resolve_name() for KDC resolve_ads().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
bfe1b6eee9 s3: libsmb: Cleanup - change to early continue in internal_resolve_name() for resolve_hosts().
No logic change.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
a4c85116e5 s3: libsmb: Cleanup - ensure we don't try and continue resolving names on failure of convert_ss2service().
Logic change, but correct error cleanup - jump to new 'fail:' label.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Isaac Boukris <iboukris@samba.org>
2020-08-04 08:51:41 +00:00
Jeremy Allison
12c526f151 s3: scripts: Selfttest. samba3.blackbox.smbclient_iconv.*
Fix missing 'include' in temporary client smb.conf file.

The current temporary generated smb.conf file for the client, "client_cp850_smbconf"
doesn't include the normal client smb.conf file "client.conf".

This means it's missing the:

interfaces = XXXX,YYYY

line we needed to find the server via socketwrapper. Currently this test is finding the server by accident :-).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Aug  4 06:30:25 UTC 2020 on sn-devel-184
2020-08-04 06:30:25 +00:00
Ralph Boehme
2327471756 lib: relicense smb_strtoul(l) under LGPLv3
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Aug  3 22:21:04 UTC 2020 on sn-devel-184
2020-08-03 22:21:02 +00:00
Ralph Boehme
698d20d39d smbd: remove get_current_vuid()
The last user was removed by 3d09993725.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Jul 29 13:44:47 UTC 2020 on sn-devel-184
2020-07-29 13:44:47 +00:00
Ralph Boehme
da1103dbdc smbd: build smb_fname per file to delete in unlink_internals()
Make sure to pass fresh smb_fname's to do_unlink(). Needed for path-ref fsps in
the future.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Jul 18 07:21:11 UTC 2020 on sn-devel-184
2020-07-18 07:21:10 +00:00
Ralph Boehme
f31108cd7d smbd: consolidate fsp allocation for open_directory() and open_file_ntcreate()
...at one place in the caller create_file_unixpath().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
09cfac6565 smbd: factor out fsp_bind_smb()
Needed for path-ref fsps in the future.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
9c187e2900 smbd: don't mess with smb_dname->base_name in call_trans2findfirst()
Create a fresh name instead. Needed to proper support for path-ref fsps in the
future.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
567f7987e3 s3/lib: fsp_str_dbg() doesn't show a possible stream name
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
8c2c749157 smbd: use helper variable for fd in fd_open()
No change in behaviour. Fwiw, no need to set fsp->fh->fd to -1 in the error case,
as that is initialized to -1 in fsp_new().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
92d8b5f5ed smbd: remove errno saving from fd_open()
This is not needed anymore since 97d061237b.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
1508d661cb smbd: remove a nested block in non_widelink_open()
No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
b6e40dbf9b smbd: use (global) POSIX pathname state in non_widelink_open()
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
afdeba8819 smbd: check for conn->cwd_fsp in fd_close()
This avoids doing the check in all callers.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
a929644b28 smbd: check for conn->cwd_fsp in file_free()
This avoids doing the check in all callers.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:41 +00:00
Ralph Boehme
6ab75d2c62 smbd: use a helper variable in open_file()
No change in behaviour, this just prepares for changes to come.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:40 +00:00
Ralph Boehme
916ebade76 smbd: remove unused NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE
The previous commit removed the only consumer of the flags.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:40 +00:00
Ralph Boehme
4523a0b47d smbd: ensure we do a base open for internal stream deletes
Otherwise we're not opening the basefile so fsp->base_fsp remains NULL for fsp
handles on streams. As there are some places that use the check (fsp->base_fsp
!= NULL) to check for stream handles, eg streams_xattr_fstat(), we must ensure
it is set otherwise we open a pretty big window for undefined behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-18 05:58:40 +00:00