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

123455 Commits

Author SHA1 Message Date
Jeremy Allison
f36a0be9a7 s3: libsmb: Comment out wrapper function internal_resolve_name(). Rename _internal_resolve_name() -> internal_resolve_name().
We can now remove the wrapper.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
57349b65cc s3: libsmb: Remove now unused dup_ip_service_array().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
68e12688f2 s3: libsmb: Finally change _internal_resolve_name() to return a talloc'ed ip_service array.
The wrapper internal_resolve_name() is now functionaly identical to _internal_resolve_name()
so we can remove it and rename _internal_resolve_name() back to internal_resolve_name().

dup_ip_service_array() is now no longer used, so comment it
out as it's a staic function.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
863ab1af62 s3: libsmb: Make _internal_resolve_name() return a size_t pointer for count.
Getting closer to being a idential to the wrapper function
internal_resolve_name() which we can then remove.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
31674946b7 s3: libsmb: _internal_resolve_name() code cleanup.
Only set *return_iplist just before success return.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
5e819231b3 s3: libsmb: _internal_resolve_name() code cleanup.
Only set *return_count just before success return.
Preparing to move all counts to size_t.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Noel Power
e68e0402cc s3/libsmb: Cleanup coding in convert_ss2service()
Don't update out params when unsuccessful

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
6b0b726105 s3: libsmb: Cleanup coding in convert_ss2service().
Will make it easier to return a talloc'ed array.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
9e4b5349f2 s3: libsmb: Change convert_ss2service() and it's one caller to take and return unsigned counts.
Getting closer to making _internal_resolve_name() return a pointer to size_t
for a count.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
cb01b5e433 s3: libsmb: Make namecache_store() take an unsigned count.
Counts can never be negative.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
f39ff1367a s3: libsmb: _internal_resolve_name(). Remove unused free(s).
*return_iplist is guaranteeded to be always NULL here.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:43 +00:00
Jeremy Allison
4d4bf8eedb s3: libsmb: Convert namecache_fetch() and it's only caller to return a talloc'ed array of struct samba_sockaddr.
Eventually everything will be talloced arrays of samba_sockaddr.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
9ffb18856b s3: libsmb: Cleanup the code to do one address return given an IP address to _internal_resolve_name().
Will make easier to move to talloc later.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
aa20df217c s3: libsmb: Change remove_duplicate_addrs2() to take and return size_t, not int.
Will make converting _internal_resolve_name() to return a size_t easier.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
e065fc8e28 s3: libsmb: Move talloc_stackframe() initialization to the front of _internal_resolve_name().
Ensure we free correctly on all exit paths.
This will allow us to move the internal calls to
talloc more easily.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
f5bb322e66 s3: libsmb: Rename internal_resolve_name_talloc() -> internal_resolve_name().
No more non-talloc callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
a68d329b40 s3: libsmb: Remove internal_resolve_name() externally. All callers now use internal_resolve_name_talloc().
Make the wrapped internal_resolve_name() function static as _internal_resolve_name().

Now we can rename the callers back from internal_resolve_name_talloc() -> internal_resolve_name()
as all external callers are talloc-based.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Noel Power
e5fd57d6e5 s3/libsmb: Cleanup, don't modify out params except on success
All callers don't use out params on failure.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
a16d023c15 s3: libsmb: Make discover_dc_netbios() use internal_resolve_name_talloc().
No more external users of internal_resolve_name().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
fed4b6341c s3: libsmb: Make get_dc_list() use internal_resolve_name_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
37eaee03e0 s3: libsmb: Make get_pdc_ip() use internal_resolve_name_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
55b589e9b0 s3: libsmb: Make find_master_ip() use internal_resolve_name_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Noel Power
12e346d9d8 s3/libsmb: resolve_name_list don't update out params except for success
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
505272a893 s3: libsmb: Make resolve_name_list() use internal_resolve_name_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:42 +00:00
Jeremy Allison
e18eb94f42 s3: libsmb: namequery - Make resolve_name() use internal_resolve_name_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
c6fc75a73b s3: libsmb: namequery - Add internal_resolve_name_talloc().
This is a wrapper function for internal_resolve_name()
that converts the replies from malloc() -> talloc().

Now to move the callers, and I can move the talloc
code down one level again.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
c0ccdd7038 s3: libsmb: Make get_dc_list() internal to namequery.c return talloc'ed ip_service array.
Moving closer to the target of making internal_resolve_name()
use talloc.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
973ca8a5c0 s3: libsmb: Cleanup - use early return in get_dc_list().
No logic change. Makes later code changes clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
46f7ab8f37 s3: libsmb: Change get_dc_list() to return a size_t count parameter.
Remove paranoia checks and casts from callers, move internally.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
b9bc1e59bd s3: libsmb: Change to an early return in get_dc_list().
No logic change. Will make later code changes clearer.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
3b3f92a2fa s3: libsmb: Cleanup - rename ctx -> frame for a talloc_stackframe to match modern coding standards.
We will be passing in a real TALLOC_CTX soon.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
23fb64f35a s3: libsmb: Rename get_sorted_dc_list_talloc() -> get_sorted_dc_list()
There are no non-talloc callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
a0984e5064 s3: libsmb: Remove get_sorted_dc_list().
No more callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
e8b7162415 s3: winbindd: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
1d6c3c2dea s3: net lookup: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
b4164093cf s3: libsmb: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
fbc2031800 s3: libads: Move callers of get_sorted_dc_list() -> get_sorted_dc_list_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:41 +00:00
Jeremy Allison
f305a140d1 s3: libsmb: Add get_sorted_dc_list_talloc().
Talloc version of get_sorted_dc_list_talloc().
Makes use of dup_ip_service_array().
Now to move the callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:40 +00:00
Jeremy Allison
6deb23c618 s3: libads: Rename get_kdc_list_talloc() -> get_kdc_list().
It's the only version now.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:40 +00:00
Jeremy Allison
b7182c4417 s3: libsmb: Remove now unused get_kdc_list() (non-talloc version).
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:40 +00:00
Jeremy Allison
11226af33e s3: utils: net_lookup. Convert to use get_kdc_list_talloc().
No more users of get_kdc_list().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:40 +00:00
Noel Power
5307b0e319 s3/libads: Cleanup() get_kdc_ip_string, free kdc_str on error
kdc_str will be cleaned up when the passed ctx is freed,
it just seems odd that we now return NULL without cleaning up allocated mem.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-09-07 13:23:40 +00:00
Noel Power
9d62c3e981 s3/libads: Only set result to kdc_str on success
Prior to this change result was set even when any or all errors
occured in the function.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-09-07 13:23:40 +00:00
Jeremy Allison
8e1b6602f5 s3: libads: Make get_kdc_ip_string() use get_kdc_list_talloc().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:40 +00:00
Jeremy Allison
e8a491691d s3: libsmb: Add get_kdc_list_talloc().
Talloc version of get_kdc_list(). Makes use of dup_ip_service_array().
Now to move the callers.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:40 +00:00
Jeremy Allison
02016acb2d s3: libsmb: Add utility funtion dup_ip_service_array().
Preparing to return ip_service arrays as talloc, not
malloc. Commented out as not yet used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:40 +00:00
Jeremy Allison
6bee431be3 s3: libsmb: Cleanup - Use helper variable for return from namecache_fetch() in internal_resolve_name().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:40 +00:00
Noel Power
a4073ae55c s3: libsmb: Cleanup in resolve_name_list().
Don't modify out params (unless successful result).

Signed-off-by: Noel Power <npower@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-09-07 13:23:40 +00:00
Jeremy Allison
6c28d71511 s3: libsmb: Cleanup - correctly error on sockaddr_storage_to_samba_sockaddr() fail.
Instead of jumping out and leaking the memory onto ctx,
skip bad conversions and error out if there are no addresses
to return (and cleanup the memory there).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:40 +00:00
Noel Power
b95eea6b29 s3: libsmb: Cleanup - ensure we initialize all stack variables to 'safe' values when calling resolve_name_list()
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2020-09-07 13:23:39 +00:00