1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-04 08:23:50 +03:00
Commit Graph

235 Commits

Author SHA1 Message Date
Jeremy Allison
f47bffa21e r18446: Add the ldap 'leave domain' code - call this as
a non-fatal error path if the 'disable machine
account' code succeeded.
Jeremy.
2007-10-10 11:51:42 -05:00
Günther Deschner
6f301b2dc3 r18165: Fix memleaks.
Guenther
2007-10-10 11:43:29 -05:00
Jeremy Allison
9d954d2deb r18063: When we get a successful connection using ADS,
cache the SAF name under both the domain name
and the realm name, as we could be looking up
under both. Jerry please check.
Jeremy.
2007-10-10 11:43:24 -05:00
Volker Lendecke
b2ff9680eb r18019: Fix a C++ warnings: Don't use void * in libads/ for LDAPMessage anymore.
Compiled it on systems with and without LDAP, I hope it does not break the
build farm too badly. If it does, I'll fix it tomorrow.

Volker
2007-10-10 11:39:49 -05:00
Jeremy Allison
2d28f3e94a r18015: Try and detect network failures immediately in
set_dc_type_and_flags().
Fix problem when DC is down in ads_connect, where
we fall back to NetBIOS and try exactly the same
IP addresses we just put in the negative connection
cache.... We can never succeed, so don't try lookups
a second time.
Jeremy.
2007-10-10 11:39:48 -05:00
Jeremy Allison
7acbcf9a6c r17994: Add debugs that showed me why my site code wasn't
working right. Don't update the server site when we
have a client one...
Jeremy.
2007-10-10 11:39:45 -05:00
Jeremy Allison
638d53e2ad r17946: Fix couple of typos...
Jeremy.
2007-10-10 11:39:01 -05:00
Jeremy Allison
9be4ecf24b r17945: Store the server and client sitenames in the ADS
struct so we can see when they match - only create
the ugly krb5 hack when they do.
Jeremy.
2007-10-10 11:39:01 -05:00
Jeremy Allison
d500e1f96d r17943: The horror, the horror. Add KDC site support by
writing out a custom krb5.conf file containing
the KDC I need. This may suck.... Needs some
testing :-).
Jeremy.
2007-10-10 11:39:01 -05:00
Jeremy Allison
a983394171 r17937: Move the saf_ cache into the tcp ad connection code.
Cause winbindd to set site support before doing the
generic AD server lookup.
Jeremy.
2007-10-10 11:39:00 -05:00
Jeremy Allison
ab3f0c5b1e r17928: Implement the basic store for CLDAP sitename
support when looking up DC's. On every CLDAP
call store the returned client sitename (if
present, delete store if not) in gencache with
infinate timeout. On AD DNS DC lookup, try looking
for sitename DC's first, only try generic if
sitename DNS lookup failed.
I still haven't figured out yet how to ensure
we fetch the sitename with a CLDAP query before
doing the generic DC list lookup. This code is
difficult to understand. I'll do some experiments
and backtraces tomorrow to try and work out where
to force a CLDAP site query first.
Jeremy.
2007-10-10 11:38:59 -05:00
Jeremy Allison
4e99606ec1 r17901: Stanford checker fix. cookie here can't be null or we'd
deref null. Make interface explicit.
Jeremy.
2007-10-10 11:38:58 -05:00
Volker Lendecke
60a166f034 r17881: Another microstep towards better error reporting: Make 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
2007-10-10 11:38:57 -05:00
Gerald Carter
36f04674ae r17798: Beginnings of a standalone libaddns library released under
the LGPL.   Original code by Krishna Ganugapati <krishnag@centeris.com>.
Additional work by me.

It's still got some warts, but non-secure updates do
currently work.  There are at least four things left to
really clean up.

1. Change the memory management to use talloc() rather than
   malloc() and cleanup the leaks.
2. Fix the error code reporting (see initial changes to
   dnserr.h)
3. Fix the secure updates
4. Define a public interface in addns.h
5. Move the code in libads/dns.c into the libaddns/ directory
   (and under the LGPL).

A few notes:

* Enable the new code by compiling with --with-dnsupdate
* Also adds the command 'net ads dns register'
* Requires -luuid (included in the e2fsprogs-devel package).
* Has only been tested on Linux platforms so there may be portability
  issues.
2007-10-10 11:38:48 -05:00
Volker Lendecke
d44599de3a r17551: Move some DEBUG to d_printf in interactive functions and return
NO_LOGON_SERVERS if no domain controller was found.

Thanks to Michael Adam <ma@sernet.de>.

Volker
2007-10-10 11:38:38 -05:00
Volker Lendecke
cf7c83d462 r17536: Add a debug message citing the reason why an LDAP connection failed, inspired
by Christian M Ambach <CAMBACH1@de.ibm.com>.

Volker
2007-10-10 11:38:37 -05:00
Volker Lendecke
0f483cf66c r17535: Reformatting, this had many tabs instead of ^$ 2007-10-10 11:38:37 -05:00
Volker Lendecke
b87c495221 r17089: Fix a possible null dereference and some memleaks.
Jerry, please check.

Thanks,

Volker
2007-10-10 11:38:11 -05:00
Gerald Carter
6261dd3c67 r16952: New derive DES salt code and Krb5 keytab generation
Major points of interest:

* Figure the DES salt based on the domain functional level
  and UPN (if present and applicable)
* Only deal with the DES-CBC-MD5, DES-CBC-CRC, and RC4-HMAC
  keys
* Remove all the case permutations in the keytab entry
  generation (to be partially re-added only if necessary).
* Generate keytab entries based on the existing SPN values
  in AD

The resulting keytab looks like:

ktutil:  list -e
slot KVNO Principal
---- ---- ---------------------------------------------------------------------
   1    6 host/suse10.plainjoe.org@COLOR.PLAINJOE.ORG (DES cbc mode with CRC-32)
   2    6 host/suse10.plainjoe.org@COLOR.PLAINJOE.ORG (DES cbc mode with RSA-MD5)
   3    6 host/suse10.plainjoe.org@COLOR.PLAINJOE.ORG (ArcFour with HMAC/md5)
   4    6           host/suse10@COLOR.PLAINJOE.ORG (DES cbc mode with CRC-32)
   5    6           host/suse10@COLOR.PLAINJOE.ORG (DES cbc mode with RSA-MD5)
   6    6           host/suse10@COLOR.PLAINJOE.ORG (ArcFour with HMAC/md5)
   7    6               suse10$@COLOR.PLAINJOE.ORG (DES cbc mode with CRC-32)
   8    6               suse10$@COLOR.PLAINJOE.ORG (DES cbc mode with RSA-MD5)
   9    6               suse10$@COLOR.PLAINJOE.ORG (ArcFour with HMAC/md5)

The list entries are the two basic SPN values (host/NetBIOSName & host/dNSHostName)
and the sAMAccountName value.  The UPN will be added as well if the machine has
one. This fixes 'kinit -k'.

Tested keytab using mod_auth_krb and MIT's telnet.  ads_verify_ticket()
continues to work with RC4-HMAC and DES keys.
2007-10-10 11:19:15 -05:00
Jeremy Allison
9dafb7f48c r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
2007-10-10 11:19:14 -05:00
Günther Deschner
6257f9af93 r16862: Reverting accidential changes in ads_try_connect() from previous commit.
Guenther
2007-10-10 11:19:12 -05:00
Günther Deschner
863aeb621a r16861: Fixing crash bug when passing no domain/realm name to the CLDAP request.
Guenther
2007-10-10 11:19:11 -05:00
Günther Deschner
08958411ee r16836: When receiving a CLDAP reply make sure that we always store the correct
netbios domain name in server affinity cache.

Guenther
2007-10-10 11:19:11 -05:00
Jeremy Allison
d48655d9c0 r16685: Fix bug #3901 reported by jason@ncac.gwu.edu.
Jeremy.
2007-10-10 11:19:07 -05:00
Volker Lendecke
5b1eba76b3 r16339: Fix Klocwork ID
277 278     (cmd_*)

485 487 488 (ldap.c)

Volker
2007-10-10 11:17:36 -05:00
Jeremy Allison
2b69d436da r16324: Klocwork #499. Allways check results from alloc.
Jeremy.
2007-10-10 11:17:33 -05:00
Jeremy Allison
dd31f3fc0e r16322: Klocwork #481., Don't deref null on malloc fail.
Jeremy.
2007-10-10 11:17:33 -05:00
Günther Deschner
dfebcc8e19 r16190: Fix more memleaks.
Guenther
2007-10-10 11:17:23 -05:00
Günther Deschner
f6516a799a r16117: Make winbindd work again in security=ads.
We still used the old HOST/* UPN to get e.g. users, now we need
samaccountname$@REA.LM.

Guenther
2007-10-10 11:17:21 -05:00
Lars Müller
7c375fd540 r15822: Add suggestion made by Ralf Haferkamp. 2007-10-10 11:17:10 -05:00
Gerald Carter
ad1f947625 r15701: change 'net ads leave' to disable the machine account in the domain (since removal implies greater permissions that Windows clients require) 2007-10-10 11:17:08 -05:00
Günther Deschner
7d766b5505 r15698: An attempt to make the winbind lookup_usergroups() call in security=ads
more scalable:

The most efficient way is to use the "tokenGroups" attribute which gives
the nested group membership. As this attribute can not always be
retrieved when binding with the machine account (the only garanteed way
to get the tokenGroups I could find is when the machine account is a
member of the "Pre Win2k Access" builtin group).

Our current fallback when "tokenGroups" failed is looking for all groups
where the userdn was in the "member" attribute. This behaves not very
well in very large AD domains.

The patch first tries the "memberOf" attribute on the user's dn in that
case and directly retrieves the group's sids by using the LDAP Extended
DN control from the user's object.

The way to pass down the control to the ldap search call is rather
painfull and probably will be rearranged later on.

Successfully tested on win2k sp0, win2k sp4, wink3 sp1 and win2k3 r2.

Guenther
2007-10-10 11:17:08 -05:00
Günther Deschner
52423e01dc r15697: I take no comments as no objections :)
Expand the "winbind nss info" to also take "rfc2307" to support the
plain posix attributes LDAP schema from win2k3-r2.

This work is based on patches from Howard Wilkinson and Bob Gautier
(and closes bug #3345).

Guenther
2007-10-10 11:17:08 -05:00
Günther Deschner
ec26c355b3 r15696: Free LDAP search result.
Guenther
2007-10-10 11:17:07 -05:00
Volker Lendecke
53f7104b4f r15635: Fix a bogus gcc uninit variable message 2007-10-10 11:17:04 -05:00
Gerald Carter
b69ac0e304 r15560: Since the hotel doesn't have Sci-Fi and no "Doctor Who"....
Re-add the capability to specify an OU in which to create
the machine account.  Done via LDAP prior to the RPC join.
2007-10-10 11:17:01 -05:00
Gerald Carter
4c4ea7b20f r15543: New implementation of 'net ads join' to be more like Windows XP.
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
2007-10-10 11:16:57 -05:00
Günther Deschner
f4af888282 r15461: Free LDAP result in ads_get_attrname_by_oid().
Guenther
2007-10-10 11:16:49 -05:00
Günther Deschner
2922c7f570 r15250: dump some more sids.
Guenther
2007-10-10 11:16:30 -05:00
Jim McDonough
1953f63903 r14931: Fix #1374: can't join an OU with name that contains '#'
I had to eliminate "\" as an OU path separator, because it is the escape
char in LDAP.  We still accept "/", but using the escape char is just
not a good choice.
2007-10-10 11:15:54 -05:00
Jim McDonough
37b6e2c8de r14252: Fix Coverity #72: free alloc'ed storage before return. Also found one
more that coverity didn't find from asprintf.
2007-10-10 11:15:21 -05:00
Jeremy Allison
78ac3f9cbd r14118: Fix coverity bug #24. Missing return statement meant
a possible NULL ptr deref.
Jeremy.
2007-10-10 11:11:13 -05:00
Günther Deschner
e4c12ab167 r13965: Make sure we always reset the userAccountControl bits when re-joining
with an existing account.

Guenther
2007-10-10 11:11:01 -05:00
Volker Lendecke
bbfb205693 r13951: Fix Coverity Bug #163.
This code was not used anyway :-)

Volker
2007-10-10 11:11:01 -05:00
Günther Deschner
ffce0461de r13657: Let winbindd try to obtain the gecos field from the msSFU30Gecos
attribute when "winbind nss info = sfu" is set. Fixes #3539.

Guenther
2007-10-10 11:10:21 -05:00
Günther Deschner
9b19a68456 r13410: Dump a netbootGUID as a GUID.
Guenther
2007-10-10 11:09:59 -05:00
Gerald Carter
17e63ac4ed r13316: Let the carnage begin....
Sync with trunk as off r13315
2007-10-10 11:06:23 -05:00
Gerald Carter
6c3480f9ae r13310: first round of server affinity patches for winbindd & net ads join 2007-10-10 11:06:23 -05:00
James Peach
95b231f028 r12878: Don't use non-static array initialisers. 2007-10-10 11:06:05 -05:00
Gerald Carter
e96000c16c r12196: patch from Krishna Ganugapati <krishnag@centeris.com>
Use the subtree delete ldap control when running 'net ads leave'
to ensure that the machine account is actually deleted.
2007-10-10 11:05:49 -05:00