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

42 Commits

Author SHA1 Message Date
Samuel Cabrero
d0dc0171ad s3:libads: Allocate ADS_STRUCT under a talloc context
The ads_destroy() function is now static and only called from the
ADS_STRUCT destructor.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-27 15:50:30 +00:00
Noel Power
eb3ba3eeaa s3/libads: clang: Fix 'Value stored during initialization is never read'
Fixes:

source3/libads/ldap_utils.c:52:13: warning: Value stored to 'status' during its initialization is never read <--[clang]
        ADS_STATUS status = ADS_SUCCESS;
                   ^~~~~~   ~~~~~~~~~~~
1 warning generated.

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-09-26 18:41:27 +00:00
Jeremy Allison
e7425bd524 s3: ldap: Ensure the ADS_STRUCT pointer doesn't get freed on error, we don't own it here.
Thanks to Isaac Boukris <iboukris@gmail.com> for finding the
issue and testing this fix.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13244

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

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 26 02:25:20 CET 2018 on sn-devel-144
2018-01-26 02:25:20 +01:00
Justin Maggard
cf05ba5b32 s3-libads: Use the configured LDAP page size.
We already allow the user to configure LDAP page size, and use it in pdb_ldap.
But then we hard-code the initial LDAP page size value to 1000 in ads_init, so
it doesn't take effect there.  So let's use the configured LDAP page size value
in ads_init also, which defaults to 1000.

Signed-off-by: Justin Maggard <jmaggard@netgear.com>
Reviewed-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 Jan 15 03:59:16 CET 2016 on sn-devel-144
2016-01-15 03:59:16 +01:00
Volker Lendecke
7ceded5ed7 lib: Make sid_binstring_hex use TALLOC
talloc_tos() is better than plain malloc...

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-13 01:44:20 +02:00
Richard Sharpe
5074cf825d Convert all uses of uint8/16/32 to uint8/16/32_t in the libads code.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 22 06:22:29 CEST 2015 on sn-devel-104
2015-04-22 06:22:29 +02:00
Andrew Bartlett
f3562424b6 lib/param: Move all enum declarations to lib/param
This is in preperation for the parameter table being made common.

Andrew Bartlett

Pair-Programmed-With: Andrew Tridgell <tridge@samba.org>
2012-07-24 11:01:17 +02:00
Andrew Bartlett
0da10c842e s3-libads: Use a reducing page size to try and cope with a slow LDAP server
If we cannot get 1000 users downloaded in 15seconds, try with 500, 250
and then 125 users at a time.

Andrew Bartlett

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-05-26 02:03:08 +02:00
Andrew Bartlett
3d15137653 s3-talloc Change TALLOC_ARRAY() to talloc_array()
Using the standard macro makes it easier to move code into common, as
TALLOC_ARRAY isn't standard talloc.
2011-06-09 12:40:08 +02:00
Volker Lendecke
491fdb24e4 s3: Make ads_ranged_search_internal static 2010-11-20 14:42:44 +01:00
Volker Lendecke
365116ea92 s3: Fix some nonempty blank lines 2010-11-20 14:42:44 +01:00
Volker Lendecke
b3091e0e22 s3: Remove unused ads_search_retry_extended_dn 2010-11-20 14:42:44 +01:00
Volker Lendecke
cdf52d56d5 s3: Make ads_do_search_retry_args() static 2010-11-20 14:42:44 +01:00
Björn Jacke
5b016dbab8 s3/libads: use monotonic clock for ldap connection timeouts 2010-09-07 20:37:53 +02:00
Günther Deschner
e7a6a3ec0d s3: avoid global include of ads.h.
Guenther
2010-08-05 00:32:02 +02:00
Andrew Bartlett
cba7f8b827 s3:dom_sid Global replace of DOM_SID with struct dom_sid
This matches the structure that new code is being written to,
and removes one more of the old-style named structures, and
the need to know that is is just an alias for struct dom_sid.

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-21 10:39:59 +02: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
Gerald (Jerry) Carter
e5a951325a [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
(This used to be commit 5c6c8e1fe9)
2007-10-10 15:34:30 -05:00
Stefan Metzmacher
809c9d4d31 r23888: move elements belonging to the current ldap connection to a
substructure.

metze
(This used to be commit 00909194a6)
2007-10-10 12:28:38 -05:00
Stefan Metzmacher
2fc53c947b r23886: add ads_disconnect() function
metze
(This used to be commit ba70737b70)
2007-10-10 12:28:38 -05: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
Günther Deschner
9c170fce26 r22797: We are only interested in the DACL of the security descriptor, so search with
the SD_FLAGS control.

Guenther
(This used to be commit 648df57e53)
2007-10-10 12:21:57 -05:00
Günther Deschner
56f6336fd4 r22460: Adding a generic ads_ranged_search() function.
Guenther
(This used to be commit b8828ea251)
2007-10-10 12:19:35 -05:00
Günther Deschner
69cee2a3ec r21240: Fix longstanding Bug #4009.
For the winbind cached ADS LDAP connection handling
(ads_cached_connection()) we were (incorrectly) assuming that the
service ticket lifetime equaled the tgt lifetime. For setups where the
service ticket just lives 10 minutes, we were leaving hundreds of LDAP
connections in CLOSE_WAIT state, until we fail to service entirely with
"Too many open files".

Also sequence_number() in winbindd_ads.c needs to delete the cached LDAP
connection after the ads_do_search_retry() has failed to submit the
search request (although the bind succeeded (returning an expired
service ticket that we cannot delete from the memory cred cache - this
will get fixed later)).

Guenther
(This used to be commit 7e1a84b722)
2007-10-10 12:17:50 -05:00
Günther Deschner
4b147350b8 r21003: Display LDAP base in debug statement.
Guenther
(This used to be commit fb5830f87a)
2007-10-10 12:17:25 -05:00
Günther Deschner
245aa33f0d r18620: Fallback to non-paging LDAP searches in ads_do_search_retry_internal()
for anonymous bound connections.

When doing anonymous bind you can never use paged LDAP control for
RootDSE searches on AD.

Guenther
(This used to be commit dc1d92faab)
2007-10-10 11:52:01 -05:00
Günther Deschner
5a87bbd48a r18172: Just a little more verbosity in this debug statement.
Guenther
(This used to be commit e852bc4646)
2007-10-10 11:43:30 -05:00
Volker Lendecke
ee0e397d6f 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
(This used to be commit b2ff9680eb)
2007-10-10 11:39:49 -05:00
Günther Deschner
1e3147cf12 r15704: Prefer LDAP error codes in ads_search_retry_sid().
Guenther
(This used to be commit 6cfc65ea20)
2007-10-10 11:17:08 -05:00
Günther Deschner
c60e96c392 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
(This used to be commit 7d766b5505)
2007-10-10 11:17:08 -05:00
Andrew Bartlett
60493551d1 r15492: Without this patch, the LDAP client libs will call abort() in
ldap_get_values_len, because they were handed a NULL msgs pointer, for
example in ads_pull_sid().

This occurs when the AD server fails at the connect stage.  (The
toubled AD server is actually Samba4 in my example).

Andrew Bartlett
(This used to be commit 221a6de7d0)
2007-10-10 11:16:54 -05:00
Günther Deschner
34e810076d r15305: Let winbind search by sid directly (or in windows terms: "bind to a
sid"); works in all AD versions I tested. Also add "net ads sid" search
tool.

Guenther
(This used to be commit 5557ada694)
2007-10-10 11:16:33 -05:00
Jeremy Allison
c9effb004c r11451: Fix -O1 "might be using uninitialized" errors.
Jeremy.
(This used to be commit cab76c3c33)
2007-10-10 11:05:16 -05:00
Jeremy Allison
acf9d61421 r4088: Get medieval on our ass about malloc.... :-). Take control of all our 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 620f2e608f)
2007-10-10 10:53:32 -05:00
Andrew Bartlett
3c2371dcfc There is some memory corruption hidden somewhere in our winbind code. If I
could reproduce it, I would fix it, but for now just make sure we always
SAFE_FREE() and set our starting pointers to NULL.

Andrew Bartlett
(This used to be commit c279e178bc)
2004-01-05 02:12:38 +00:00
Gerald Carter
48958b0105 don't call ads_destroy() twice; fixes segfault in winbindd when DC goes down; bug 437
(This used to be commit 1cfbd92404)
2003-10-03 21:43:09 +00:00
Tim Potter
45b9fd9fb9 Don't print out error in ads_do_search_retry() when it suceeds.
(This used to be commit 617feab422)
2003-08-15 21:23:25 +00:00
Jelmer Vernooij
f7792732e6 Change variable name to get this working on gcc 3.2 (Merge from HEAD)
(This used to be commit d49113caef)
2003-04-15 17:06:51 +00:00
Andrew Bartlett
8b197158c9 Add the beginings of sam_ads to the tree.
This module, primarilly the work of "Stefan (metze) Metzmacher"
<metze@metzemix.de>, uses the Active Directory schema to store the
user/group/other information.  I've been testing it against a real AD server,
and it is intended to work with OpenLDAP as well.

I've moved a few functions around in our other libads code, which has made it
easier to tap into that existing code.

Also, I've made some changes to the SAM interface, I hope there are not too
many objections...   To ensure we don't get silly bugs in the skel module, it
is now in the default compile.  This way you should not forget to update it :-)

Andrew Bartlett
(This used to be commit 24fb0cde2f)
2002-09-28 12:27:04 +00:00
Andrew Bartlett
bc828246db This needs to be #ifdef HAVE_LDAP.
(This used to be commit 2b54a2fc2c)
2002-09-28 00:47:06 +00:00
Andrew Bartlett
7e4afe5381 Move a number of ADS related functions out into utility libs, so that things
like metze's sam_ads can also use them.

Also add error checking etc to a few more functions.

Andrew Bartlett
(This used to be commit c864edf4fb)
2002-09-27 12:23:47 +00:00