summaryrefslogtreecommitdiff
path: root/source3/libsmb/namequery.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r17900: Fix from Michael Adam <ma@sernet.de> - make internal_resolve_nameJeremy Allison1-62/+62
do what it's supposed to. Jeremy. (This used to be commit 4b7387a054bfc1587e0b9b7088f420a5bcf0bad9)
2007-10-10r17881: Another microstep towards better error reporting: Make ↵Volker Lendecke1-12/+26
get_sorted_dc_list return NTSTATUS. If we want to differentiate different name resolution problems we might want to introduce yet another error class for Samba-internal errors. Things like no route to host to the WINS server, a DNS server explicitly said host not found etc might be worth passing up. Because we can not stash everything into the existing NT_STATUS codes, what about a Samba-specific error class like NT_STATUS_DOS and NT_STATUS_LDAP? Volker (This used to be commit 60a166f0347170dff38554bed46193ce1226c8c1)
2007-10-10r17795: Finally track down the "ads_connect: Interrupted system call"Gerald Carter1-14/+34
error. Fix our DNS SRV lookup code to deal with multi-homed hosts. We were noly remembering one IP address per host from the Additional records section in the SRV response which could have been an unreachable address. (This used to be commit 899179d2b9fba13cc6f4dab6efc3c22e44e062bc)
2007-10-10r17760: The DNS SRV lookup already sorts by priority and weight so don'tGerald Carter1-3/+9
use the generic IP list sort in get_sorted_dc_list(). (This used to be commit 03a767539d5b09ebd6564c0c9157de2a6e0e6b89)
2007-10-10r17124: fixed a bug which caused resolve_ads() to spin forever if one of theAndrew Tridgell1-11/+9
DCs isn't resolvable in DNS. The fix is to leave that DC out of the returned list of DCs. I think the original code intended that anyway, just didn't quite get it right ('i' wasn't incremented in that code path, so the loop didn't terminate) (This used to be commit d7ec9f3cc0439e9e0f4c98988b14ae2155d931b9)
2007-10-10r15611: Remove used but uninitialised variable "count".James Peach1-2/+2
(This used to be commit 71fd0d3de4a02b9a7b67914f6412f18ec0bb5e7a)
2007-10-10r15543: New implementation of 'net ads join' to be more like Windows XP.Gerald Carter1-53/+44
The motivating factor is to not require more privileges for the user account than Windows does when joining a domain. The points of interest are * net_ads_join() uses same rpc mechanisms as net_rpc_join() * Enable CLDAP queries for filling in the majority of the ADS_STRUCT->config information * Remove ldap_initialized() from sam/idmap_ad.c and libads/ldap.c * Remove some unnecessary fields from ADS_STRUCT * Manually set the dNSHostName and servicePrincipalName attribute using the machine account after the join Thanks to Guenther and Simo for the review. Still to do: * Fix the userAccountControl for DES only systems * Set the userPrincipalName in order to support things like 'kinit -k' (although we might be able to just use the sAMAccountName instead) * Re-add support for pre-creating the machine account in a specific OU (This used to be commit 4c4ea7b20f44cd200cef8c7b389d51b72eccc39b)
2007-10-10r15462: replace the use of OpenLDAP's ldap_domain2hostlist() forGerald Carter1-22/+29
locating AD DC's with out own DNS SRV queries. Testing on Linux and Solaris. (This used to be commit cf71f88a3cdcabf99c0798ef4cf8c978397a57eb)
2007-10-10r13987: Fix Coverity bug # 74. This tool is good...Volker Lendecke1-0/+1
Thanks, Volker (This used to be commit 86f62484dd7db43e036d9edf29e459b8bd0e5fbe)
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-14/+8
realloc can return NULL in one of two cases - (1) the realloc failed, (2) realloc succeeded but the new size requested was zero, in which case this is identical to a free() call. The error paths dealing with these two cases should be different, but mostly weren't. Secondly the standard idiom for dealing with realloc when you know the new size is non-zero is the following : tmp = realloc(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } However, there were *many* *many* places in Samba where we were using the old (broken) idiom of : p = realloc(p, size) if (!p) { return error; } which will leak the memory pointed to by p on realloc fail. This commit (hopefully) fixes all these cases by moving to a standard idiom of : p = SMB_REALLOC(p, size) if (!p) { return error; } Where if the realloc returns null due to the realloc failing or size == 0 we *guarentee* that the storage pointed to by p has been freed. This allows me to remove a lot of code that was dealing with the standard (more verbose) method that required a tmp pointer. This is almost always what you want. When a realloc fails you never usually want the old memory, you want to free it and get into your error processing asap. For the 11 remaining cases where we really do need to keep the old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR, which can be used as follows : tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size); if (!tmp) { SAFE_FREE(p); return error; } else { p = tmp; } SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the pointer p, even on size == 0 or realloc fail. All this is done by a hidden extra argument to Realloc(), BOOL free_old_on_error which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR macros (and their array counterparts). It remains to be seen what this will do to our Coverity bug count :-). Jeremy. (This used to be commit 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
2007-10-10r13893: Fix for Coverity issue CID #164. The first one that I don'tJeremy Allison1-0/+2
think is a direct bug, but some code that needs clarification :-). Jeremy. (This used to be commit 61901a3f10de64a72b655d9aa884424a4fc88a44)
2007-10-10r13889: Fix resource leak on error path. Coverity bug CID #73.Jeremy Allison1-0/+1
Jeremy. (This used to be commit 46e10980927f1dfa4a1995e778df880cf823cbdb)
2007-10-10r13322: Fix warning time_t != int.Jeremy Allison1-2/+2
Jeremy. (This used to be commit 6196446a03abeb4100bac1721977488ae5843f42)
2007-10-10r13310: first round of server affinity patches for winbindd & net ads joinGerald Carter1-113/+210
(This used to be commit 6c3480f9aecc061660ad5c06347b8f1d3e11a330)
2007-10-10r7882: Looks like a large patch - but what it actually does is make SambaJeremy Allison1-6/+6
safe for using our headers and linking with C++ modules. Stops us from using C++ reserved keywords in our code. Jeremy (This used to be commit 9506b8e145982b1160a2f0aee5c9b7a54980940a)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-11/+10
allocation functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
2007-10-10r3843: If a connection to a DC is requested, open connections ↵Volker Lendecke1-3/+3
simultaeneously to all DCs found. The first one to reply wins. Volker (This used to be commit 84ac54aef2bd56b5c889d3b05b8828aceb8ae00e)
2007-10-10r3264: fix lmhosts lookup so that we don't say we found something when we ↵Gerald Carter1-24/+29
really didn't (This used to be commit c7036f824627dc555185a52ed95d3e0132babcd8)
2007-10-10r3143: Allow for multiple DC's to be named as #1c names in lmhosts.Volker Lendecke1-13/+26
Volker (This used to be commit 2af98ec054508055a63552cfdb48cfaf43f76b62)
2007-10-10r2770: oops; internal_resolve_name() should stay static in 3.0Gerald Carter1-1/+1
(This used to be commit 316302ca4a79cfc201311e12df71fdbb974c09c4)
2007-10-10r2768: BUG 1519: save the hostname used in the open_printer_ex() for later ↵Gerald Carter1-1/+1
reuse when filling in the spolss replies (also gets rid of get_called_name() (This used to be commit 57db8ca91f52329c7f8985c04463b6b69015b0c4)
2007-10-10r1326: Modification to get_dc_list to check negative cache. From "Joe ↵Jeremy Allison1-188/+203
Meadows" <jameadows@webopolis.com>. Jeremy. (This used to be commit 4cc38b8aea51b55cc449cd2144f18de7d4819637)
2007-10-10r248: Add support for printing out the MAC address on nmblookup.Richard Sharpe1-4/+11
(This used to be commit bf9f02be5fc1d09c8c08c78c3f2df23b2099ba4f)
2004-03-13Modified fix for bugid #784. Based on a patch from moriyama@miraclelinux.com ↵Jeremy Allison1-2/+2
(MORIYAMA Masayuki). Don't use nstrings to hold workgroup and netbios names. The problem with them is that MB netbios and workgroup names in unix charset (particularly utf8) may be up to 3x bigger than the name when represented in dos charset (ie. cp932). So go back to using fstrings for these but translate into nstrings (ie. 16 byte length values) for transport on the wire. Jeremy. (This used to be commit b4ea493599ab414f7828b83f40a5a8b43479ff64)
2004-03-13First part of patch from moriyama@miraclelinux.com (MORIYAMA Masayuki) toJeremy Allison1-1/+1
fix up netbios names with mb strings. Includes reformat of libsmb/nmblib.c so it's readable. Jeremy. (This used to be commit 966e49a48c352563cdd7f75fe2768f2d6612ec7e)
2004-02-08Make get_dc_list static - we only ask for a sorted list externally.Andrew Bartlett1-23/+24
Andrew Bartlett (This used to be commit e10e176c83da9eda0746e0bd108c72a01a0505e8)
2004-01-13* allow dns lookups to be disabled for DOMAIN#1c (and #1b)Gerald Carter1-7/+26
names * fix some a mispelled variable name (This used to be commit bca702c97620ad8f66015d6e4b41abd4adf22076)
2004-01-09Romve debugging assertions (oops...)Andrew Bartlett1-6/+0
Andrew Bartlett (This used to be commit 7e75a6d681fc63cacc7e5caa7a04568c6019367f)
2004-01-09Add a new type of name lookup 'ads'. This seperates this from normalAndrew Bartlett1-33/+59
hostname lookups, and ensures that we don't lookup 'short' (ie NetBIOS) domain names in DNS. Andrew Bartlett (This used to be commit 35f6347a73ce7423adb78c7e95492bb6d98f4c40)
2003-12-09Make intent to return only one address clear.Jeremy Allison1-2/+2
Jeremy. (This used to be commit d3d0353baeba580d8a7a4688f847463b1b2e750c)
2003-09-05More tuning from cachegrind. Change most trim_string() calls to trim_char(0,Jeremy Allison1-1/+1
as that's what they do. Fix string_replace() to fast-path ascii. Jeremy. (This used to be commit f35e9a8b909d3c74be47083ccc4a4e91a14938db)
2003-07-03fix bug #190; WINS server was getting marked as dead when it was not.Gerald Carter1-2/+14
(This used to be commit fa354f3ceefe53bdfd4f543559041d337b75613f)
2003-06-25large change:Gerald Carter1-371/+327
*) 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 d7f7fcda425bef380441509734eca33da943c091)
2003-06-23* s/get_dc_name/rpc_dc_name/g (revert a previous change)Gerald Carter1-2/+9
* move back to qsort() for sorting IP address in get_dc_list() * remove dc_name_cache in cm_get_dc_name() since it slowed things down more than it helped. I've made a note of where to add in the negative connection cache in the ads code. Will come back to that. * fix rpcclient to use PRINTER_ALL_ACCESS for set printer (instead of MAX_ALLOWED) * only enumerate domain local groups in our domain * simplify ldap search for seqnum in winbindd's rpc backend (This used to be commit f8cab8635b02b205b4031279cedd804c1fb22c5b)
2003-06-13Forward port the app-head changes for dc name cache into 3.0.Jeremy Allison1-14/+25
Jeremy. (This used to be commit 8bcc3116a22ce11b55a35f3363230f54bc5735fc)
2003-05-08Revert a patch that somehow slipped in...Volker Lendecke1-2/+2
Volker (This used to be commit 6cde3d4d655bbe1d81e68ec2ec7a23669ac82120)
2003-05-08This puts real netlogon connection caching to winbind. This becomesVolker Lendecke1-2/+2
important once we start doing schannel, as there would be a lot more roundtrips for the second PIPE open and bind. With this patch logging in to a member server is a matter of two (three if you count the ack...) packets between us and the DC. Volker (This used to be commit 5b3cb7725a974629d0bd8b707bc2940c36b8745e)
2003-03-05Writable string const fixes.Jeremy Allison1-1/+1
Jeremy. (This used to be commit c832e95c2f4daf175954a60f3c56420cf2f35b45)
2003-02-17Correctly check for inet_addr fail. Patch from gregor.7@osu.edu.Jeremy Allison1-2/+5
Jeremy. (This used to be commit 01f6b2694532749807aff1c2e6f338dade2d9b09)
2003-01-04Merge from HEAD - mimir's new gencache based namecache code.Andrew Bartlett1-6/+4
Andrew Bartlett (This used to be commit f79324f730c400342f445c931b0d75ff756d7cc7)
2002-12-04[merge] remove assert(count ==1) for multi-homed PDCs; CR 1277Gerald Carter1-3/+22
(This used to be commit 18799c115b05d6662350509f6662dbfceb4b71f5)
2002-12-04Doing janitorial duty for tpot - memory leak fix.Jeremy Allison1-0/+2
Jeremy. (This used to be commit 7acf9594210f024e8d0c34259fcc990c6c76c838)
2002-12-01Fixup of ordered cleanup of get_dc_list - bug found by Dominik 'Aeneas' ↵Jeremy Allison1-27/+10
Schnitzer <dominik@schnitzer.at> Jeremy. (This used to be commit 15185ac437a6a0f53711bef035879173dbb492c6)
2002-11-23[merge from APP_HEAD]Gerald Carter1-22/+104
90% fix for CR 1076. The password server parameter will no take things like password server = DC1 * which means to contact DC1 first and the go to auto lookup if it fails. jerry (This used to be commit 016ef8b36b30846311a5321803298f8e28719244)
2002-11-12Removed global_myworkgroup, global_myname, global_myscope. Added liberalJeremy Allison1-8/+9
dashes of const. This is a rather large check-in, some things may break. It does compile though :-). Jeremy. (This used to be commit f755711df8f74f9b8e8c1a2b0d07d02a931eeb89)
2002-11-06Merge of get_dc_list() api change from HEAD.Tim Potter1-13/+46
(This used to be commit 6ba7847ce2756fde94e530fd0bf2a055f3e27373)
2002-08-17sync 3.0 branch with headJelmer Vernooij1-9/+58
(This used to be commit 3928578b52cfc949be5e0ef444fce1558d75f290)
2002-07-15updated the 3.0 branch from the head branch - ready for alpha18Andrew Tridgell1-391/+271
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
2002-04-04small change in name_resolve_bcast()Jean-François Micouleau1-1/+1
spotted by alexander bokovoy. it shouldn't break anything. if it's wrong, feel free to revert but explain why. J.F. (This used to be commit 638c692525c050ecdf414d461ef6b4aed3ce51db)
2002-03-19Don't try to sort a list of zero length in internal_resolve_name()Tim Potter1-1/+1
(This used to be commit 5387e4046f67a1c6ef9e98268268b06a729d5ca4)