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

46 Commits

Author SHA1 Message Date
Jeremy Allison
170051d61e s3: libsmb: Now we only have namecache_store_sa(), rename it back to namecache_store().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:44 +00:00
Jeremy Allison
2989d736c4 s3: libsmb: Remove use of struct ip_service from the namecache code.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:44 +00:00
Jeremy Allison
0e59fee291 s3: libsmb: Add namecache_store_sa(). Doesn't store ports and takes a samba_sockaddr array.
Now uses ipstr_list_make_sa(). Now convert
the callers, remove namecache_store() and
then rename namecache_store_sa() back to namecache_store().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2020-09-07 13:23:44 +00:00
Jeremy Allison
7835e2cb48 s3: libsmb: Add internal ipstr_list_make_sa().
Duplicates ipstr_list_make() with samba_sockaddr, but doesn't store
ports. The duplication is temporary as the ipstr_list_make() function
will go away once namecache_store is converted to samba_sockaddr.

Compiles but 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:44 +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
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
57badc4638 s3: libsmb: Namecache. Fix bug missed by me in previous cleanup.
In ipstr_list_make() we need to look at the correct array entry
to determine the ss_family for the sockaddr_storage.

Otherwise we are always storing the type of the first entry.

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

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jul 17 05:54:31 UTC 2020 on sn-devel-184
2020-07-17 05:54:29 +00:00
Jeremy Allison
8ea51f4135 s3: libsmb: Cleanup - Make ipstr_list_make() talloc rather than malloc.
Remove the excessive and unneeded ipstr_list_add() function,
fold it into ipstr_list_make() to make it much clearer what
we're doing.

The only use of MALLOC now is in ipstr_list_parse() returned
by namecache_fetch(). We need to fix the caller before
we can move that to talloc. As that is used inside internal_resolve_name()
which is designed to return a MALLOC'ed ip list from all
name resolution mechanisms leave that fix for another day.

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

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jul 16 08:16:31 UTC 2020 on sn-devel-184
2020-07-16 08:16:31 +00:00
Jeremy Allison
1d712add99 s3: libsmb: Cleanup - Move DEBUG -> DBG_XXX() macros.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:37 +00:00
Jeremy Allison
bd205f2a6c s3: libsmb: Cleanup - make namecache_status_record_key() use talloc.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:37 +00:00
Jeremy Allison
56d5cbe8bf s3: libsmb: Cleanup - make namecache_key() use talloc.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:36 +00:00
Jeremy Allison
df0e54bea3 s3: libsmb: Cleanup - namecache_store() - use common out.
Prepare for moving malloc values to talloc.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:36 +00:00
Jeremy Allison
06f0a7e911 s3: libsmb: Cleanup - namecache_store() initialize stack variables.
Preparing for common out: exit.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:36 +00:00
Jeremy Allison
67ea64d27e s3: libsmb: Cleanup - move talloc frame out of inner scope.
Make it available thoughout the function. Prepare to use
talloc for namecache_key().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:36 +00:00
Jeremy Allison
be41035127 s3: libsmb: Cleanup modern coding standards. 'True/False' -> 'true/false'.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:36 +00:00
Jeremy Allison
c7e8c3d427 s3: lib: Cleanup - make ipstr_list_make() and ipstr_list_parse() private to the only user.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:36 +00:00
Jeremy Allison
2371c45f11 s3: lib: Cleanup - nothing uses ipstr_list_free(). Remove it.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:36 +00:00
Jeremy Allison
527d7df08e s3: lib: Cleanup - all the ipstr_XXX() functions are only used in namecache.c.
Move them there. Will remove from the global namespace next.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2020-07-16 06:52:36 +00:00
Volker Lendecke
5b2c3f2f42 lib: Remove gencache.h from proto.h
It's a pain to recompile the world if gencache.h changes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Oct 19 18:52:50 CEST 2018 on sn-devel-144
2018-10-19 18:52:50 +02:00
David Disseldorp
0cd4561ab1 namecache: fix uninitialised pointer returns
asprintf_strupper_m() doesn't set *strp on error.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Sep 13 03:21:39 CEST 2014 on sn-devel-104
2014-09-13 03:21:39 +02:00
Volker Lendecke
d3c689fc5c lib: Use "mem_ctx" arg in gencache_get
Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep  5 20:09:21 CEST 2013 on sn-devel-104
2013-09-05 20:09:21 +02:00
Volker Lendecke
8a7246ac2c lib: Add a "mem_ctx" arg to gencache_get (unused so far)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-09-05 09:16:23 -07:00
Volker Lendecke
35f08a2958 s3: Remove a pointless else
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Jan 12 11:12:56 CET 2011 on sn-devel-104
2011-01-12 11:12:56 +01:00
Andrew Bartlett
4ef847a3b7 s3:libsmb/namecache Remove namecache_enable()
No caller honours the return value, and this call only prints a
DEBUG().  Removing this reduces the number of initialisation
boilerplate calls s3compat has to make.

Andrew Bartlett
2010-05-13 10:12:26 +10:00
Volker Lendecke
3edcd55bf1 Remove gencache_init/shutdown
gencache_get/set/del/iterate call gencache_init() internally anyway. And we've
been very lazy calling gencache_shutdown, so this seems not really required.
2009-07-15 10:55:20 +02:00
Stefan Metzmacher
7d93d3d4b8 s3:namecache: remove unused namecache_shutdown() function
metze
2009-01-27 15:28:06 +01:00
Volker Lendecke
d3def9a18c Revert "Pass NULL to gencache_get when we are not interested in the timeout value"
This reverts commit 16062dfc3d.
(This used to be commit 114ca85775)
2008-07-11 17:53:25 +02:00
Volker Lendecke
962beb2872 Pass NULL to gencache_get when we are not interested in the timeout value
(This used to be commit 16062dfc3d)
2008-07-03 15:17:58 +02:00
Volker Lendecke
78c6ee0090 Remove some globals
(This used to be commit 31d0a846db)
2007-12-05 14:39:07 +01:00
Jeremy Allison
f88b7a076b This is a large patch (sorry). Migrate from struct in_addr
to struct sockaddr_storage in most places that matter (ie.
not the nmbd and NetBIOS lookups). This passes make test
on an IPv4 box, but I'll have to do more work/testing on
IPv6 enabled boxes. This should now give us a framework
for testing and finishing the IPv6 migration. It's at
the state where someone with a working IPv6 setup should
(theorecically) be able to type :
smbclient //ipv6-address/share
and have it work.
Jeremy.
(This used to be commit 98e154c312)
2007-10-24 14:16:54 -07:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Jeremy Allison
37be6913fe r19249: Attempt to fix a site lookup bug found by Guenther.
- "The problem is, with a fresh system, we don't know our sitename,
therefor we do a stupid DNS query for all DCs. The reply we get is a
round-robin list of all 21 DCs, we just pick the first, contact that
and safe that INET.COM#1C query in the name cache for later use...
What we need to do if we don't yet know our sitename, is to contact to
any DC, get the CLDAP reply to tell us in which site we are, then flush
the namecache and requery DNS including the sitename"

Implement the flushing of the #1C entries for a given NetBIOS name/realm
when looking up the site value.

Jeremy.
(This used to be commit b2d1e44f59)
2007-10-10 12:15:25 -05:00
Volker Lendecke
eab60e2bb1 r18312: Change gencache_get slightly: Delete expired keys, and only strdup the value
if a valid entry was found. The newer calls got the latter one wrong, change
the older calls.

Volker
(This used to be commit 554e68887b)
2007-10-10 11:51:19 -05:00
Jeremy Allison
0f1bc28744 r18006: Actually a smaller change than it looks. Leverage
the get_dc_list code to get the _kerberos. names
for site support. This way we don't depend on one
KDC to do ticket refresh. Even though we know it's
up when we add it, it may go down when we're trying
to refresh.
Jeremy.
(This used to be commit 77fe2a3d74)
2007-10-10 11:39:47 -05:00
Jeremy Allison
41d1f322f8 r17874: Fix possible null deref found by Stanford checker.
Jeremy.
(This used to be commit 2894310cc8)
2007-10-10 11:38:56 -05:00
Gerald Carter
f51d769dd3 large change:
*)  consolidates the dc location routines again (dns
    and netbios)  get_dc_list() or get_sorted_dc_list()
    is the authoritative means of locating DC's again.

    (also inludes a flag to get_dc_list() to define
     if this should be a DNS only lookup or not)

    (however, if you set "name resolve order = hosts wins"
     you could still get DNS queries for domain name IFF
     ldap_domain2hostlist() fails.  The answer?  Fix your DNS
     setup)

*)  enabled DOMAIN<0x1c> lookups to be funneled through
    resolve_hosts resulting in a call to ldap_domain2hostlist()
    if lp_security() == SEC_ADS

*)  enables name cache for winbind ADS backend

*)  enable the negative connection cache for winbind
    ADS backend

*)  removes some old dead code

*)  consolidates some duplicate code

*)  moves the internal_name_resolve() to use an IP/port pair
    to deal with SRV RR dns replies.  The namecache code
    also supports the IP:port syntax now as well.

*)  removes 'ads server' and moves the functionality back
    into 'password server' (which can support "hostname:port"
    syntax now but works fine with defaults depending on
    the value of lp_security())
(This used to be commit d7f7fcda42)
2003-06-25 17:41:05 +00:00
Jeremy Allison
292a51eda1 Forward port the app-head changes for dc name cache into 3.0.
Jeremy.
(This used to be commit 8bcc3116a2)
2003-06-13 21:03:15 +00:00
Andrew Bartlett
79f3265893 (merge from HEAD) Valgrind found some memory leaks!
(This used to be commit 8315b9c311)
2003-03-22 23:32:50 +00:00
Andrew Bartlett
863e9ca2c6 Merge from HEAD - mimir's new gencache based namecache code.
Andrew Bartlett
(This used to be commit f79324f730)
2003-01-04 08:48:15 +00:00
Jeremy Allison
edc4c1f643 Ensure data is not used uninitialised.
Jeremy.
(This used to be commit 3c2d396aa8)
2002-11-26 17:40:25 +00:00
Jeremy Allison
44c8c16546 Fix bug in tdb_fetch tidyup.
Jeremy.
(This used to be commit 88d081e064)
2002-11-26 17:03:16 +00:00
Jeremy Allison
de474974ea Lots of fixes for error paths where tdb_fetch() data need freeing.
Found via a post from Arcady Chernyak <Arcady.Chernyak@efi.com>.
Jeremy.
(This used to be commit 5d5762d178)
2002-11-23 02:52:36 +00:00
Gerald Carter
a834a73e34 sync'ing up for 3.0alpha20 release
(This used to be commit 65e7b5273b)
2002-09-25 15:19:00 +00:00
Tim Potter
88d321becd Merge of netbios namecache code from APPLIANCE_HEAD.
Tridge suggested a generic caching mechanism for Samba to avoid the
proliferation of little cache files hanging around limpet like in the
locks directory.  Someone should probably implement this at some
stage.
(This used to be commit dad31483b3)
2002-08-16 00:25:48 +00:00