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

1744 Commits

Author SHA1 Message Date
Sumit Bose
2e78022066 s3-ipasam: Disable old trustdom_pw calls
Signed-off-by: Günther Deschner <gd@samba.org>
2011-02-16 11:34:44 +01:00
Sumit Bose
4fa210d76a s3-passdb: Add minimal stub for IPA passdb backend
Signed-off-by: Günther Deschner <gd@samba.org>
2011-02-16 11:34:31 +01:00
Volker Lendecke
ab85362cff s3: Support "codePage" in pdb_ads
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Feb 15 22:00:27 CET 2011 on sn-devel-104
2011-02-15 22:00:27 +01:00
Volker Lendecke
ead7ffa1a7 s3: Add "code_page" to struct samu 2011-02-15 21:12:22 +01:00
Volker Lendecke
8bbf0ad2a0 s3: Support "country_code" in pdb_ads 2011-02-15 21:12:22 +01:00
Volker Lendecke
d9d0fef862 s3: Add "country_code" to struct samu 2011-02-15 21:12:22 +01:00
Volker Lendecke
7a2cbdafa8 s3: Add userWorkstations and userParameters to pdb_ads 2011-02-15 21:12:22 +01:00
Günther Deschner
a32f0ff2f0 s3-waf: TLDAP is only needed by pdb_ads (and smbtorture).
Guenther
2011-02-15 12:09:22 +01:00
Volker Lendecke
5d63c503f7 s3: Add "comment" and "description" to pdb_ads
This is pending a change to samldb_description_check, we might have to modify
the description with a TLDAP_MOD_REPLACE operation.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Feb 13 17:56:58 CET 2011 on sn-devel-104
2011-02-13 17:56:58 +01:00
Volker Lendecke
60df3c0679 s3: Make "net sam list [users|workstations]" list only the right things
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Feb 13 12:59:14 CET 2011 on sn-devel-104
2011-02-13 12:59:14 +01:00
Volker Lendecke
f49ad6d073 s3: Remove an unneeded proto 2011-02-13 12:11:53 +01:00
Volker Lendecke
9331bc378d s3: Fix some nonempty blank lines 2011-02-13 12:11:53 +01:00
Volker Lendecke
fe551d6815 s3: Convert tldap_entry_values args to "array, count" 2011-02-13 12:11:53 +01:00
Volker Lendecke
84abb428f6 s3: Add an explicit counter to tldap_add_mod_[blobs|str] 2011-02-13 12:11:53 +01:00
Volker Lendecke
158c1e315b s3: Convert tldap_make_mod_fmt args to "array, count" 2011-02-13 12:11:52 +01:00
Volker Lendecke
6b492a1741 s3: Convert tldap_add_mod_blobs args to "array, count" 2011-02-13 12:11:52 +01:00
Volker Lendecke
30e72e0d0a s3: Align the args of pdb_ads_update_sam_account to tldap_modify 2011-02-13 12:11:52 +01:00
Volker Lendecke
d38ab83bab s3: Make "smbpasswd <user>" work with pdb_ads
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sat Feb 12 15:17:39 CET 2011 on sn-devel-104
2011-02-12 15:17:39 +01:00
Günther Deschner
8015514c5b s3-waf: use bld.env.HAVE_LDAP in some more places, hopefully fixes the builds w/o ldap.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Fri Feb 11 13:08:38 CET 2011 on sn-devel-104
2011-02-11 13:08:38 +01:00
Volker Lendecke
efa460e291 s3: Align the args in tldap_modify
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Feb 10 23:20:05 CET 2011 on sn-devel-104
2011-02-10 23:20:05 +01:00
Volker Lendecke
b524e58f9a s3: Align tldap_add and tldap_add_send 2011-02-10 22:34:01 +01:00
Volker Lendecke
0539ca51ab s3: Add primary group in pdb_ads_enum_group_memberships
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Feb  6 18:41:08 CET 2011 on sn-devel-104
2011-02-06 18:41:08 +01:00
Volker Lendecke
d515c6cd5c s3: Fix auth_netlogond to cope with netlogon_creds_CredentialState
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Feb  6 17:30:48 CET 2011 on sn-devel-104
2011-02-06 17:30:48 +01:00
Volker Lendecke
47d07df37f s3: Fix a potential memleak in secrets_fetch_trusted_domain_password 2011-02-06 16:44:56 +01:00
Volker Lendecke
8c367162f0 s3: In pdb_ads, cope with artificial samu structs 2011-02-06 16:44:56 +01:00
Volker Lendecke
08f2a8562f s3: Use strlcpy in pdb_ads_connect 2011-02-06 16:44:56 +01:00
Andreas Schneider
ad65605643 s3-auth: Fixed account lockout check. 2011-01-17 16:50:50 +01:00
Bjoern Baumbach
6acbcd1b0c Make sure that user exists after running add user script before adding sam account.
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Tue Dec  7 17:37:52 CET 2010 on sn-devel-104
2010-12-07 17:37:52 +01:00
Günther Deschner
133a2ffd00 s3-waf: avoid module name uppercasing.
This finally allows mixed case module names like the classic build
(./configure --shared_modules=charset_CP850)

Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Dec  1 18:39:14 CET 2010 on sn-devel-104
2010-12-01 18:39:14 +01:00
Jeremy Allison
e1cfca1e2e Make getpwnam_alloc() static to lib/username.c, and ensure all username lookups go
through Get_Pwnam_alloc(), which is the correct wrapper function. We were using
it *some* of the time anyway, so this just makes us properly consistent.

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Oct 20 16:02:12 UTC 2010 on sn-devel-104
2010-10-20 16:02:12 +00:00
Günther Deschner
10f95a4f1a s3-waf: fix pdb modules build.
Guenther
2010-10-18 15:57:03 +02:00
Andrew Bartlett
f768b32e37 libcli/security Provide a common, top level libcli/security/security.h
This will reduce the noise from merges of the rest of the
libcli/security code, without this commit changing what code
is actually used.

This includes (along with other security headers) dom_sid.h and
security_token.h

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Oct 12 05:54:10 UTC 2010 on sn-devel-104
2010-10-12 05:54:10 +00:00
Volker Lendecke
41b54a8931 s3: Remove talloc_autofree_context from pdb_interface
None of the pdb backends have special destructors that need to be run at
program exit.
2010-10-03 10:45:56 +02:00
Günther Deschner
b894847ca0 s3-waf: rework CLDAP and LIBCLI_LDAP subsystems.
Guenther
2010-09-27 00:39:38 +02:00
Günther Deschner
d7d33317c7 s3-waf: move pdb subsystem to pdb/wscript_build.
Guenther
2010-09-27 00:39:37 +02:00
Volker Lendecke
d4bfb5c488 s3: Remove talloc_autofree_context() from guest_user_info()
pwd is freed a few lines down
2010-09-26 17:36:40 +02:00
Volker Lendecke
2b601d72d5 s3: Remove talloc_autofree_context() from lookup_unix_user_name()
pwd is freed in this routine immediately
2010-09-26 03:29:28 +02:00
Volker Lendecke
9b2d3142c1 s3: Remove talloc_autofree_context() from pdb_init_ads() 2010-09-26 03:29:28 +02:00
Andrew Bartlett
d7bc452a89 s3: Replace sid_binstring and sid_guidstring with PIDL-based alternatives
This reduces the manual marshalling of these structures by removing
the duplication here.

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2010-09-20 16:15:03 -07:00
Günther Deschner
4dbd743e46 s3-util_sid: use shared dom_sid_compare_auth and dom_sid_equal_X functions.
Guenther
2010-09-20 14:04:37 -07:00
Andrew Bartlett
4bf783d4d6 s3-auth Change type of num_sids to uint32_t
size_t is overkill here, and in struct security_token in the num_sids
is uint32_t.

This includes a change to the prototype of add_sid_to_array()
and add_sid_to_array_unique(), which has had a number of
consequnetial changes as I try to sort out all the callers using
a pointer to the number of sids.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2010-09-11 18:46:05 +10:00
Andreas Schneider
c5cfad142c s3-passdb: Try to unlock the account if it is locked out.
Signed-off-by: Simo Sorce <idra@samba.org>
2010-08-30 10:43:41 -04:00
Andreas Schneider
2ab0b63bd8 s3-passdb: Added a pdb_try_account_unlock function.
The function checks if the account has been autolocked. If we have a
lockout_duration and a bad password time it checks if we can unlock the
account.

Signed-off-by: Simo Sorce <idra@samba.org>
2010-08-30 10:43:34 -04:00
Günther Deschner
7a05ca2c9c s3-build: use dbwrap.h only where needed.
Guenther
2010-08-26 00:25:55 +02:00
Günther Deschner
2b41f421fd s3-idmap: only include idmap headers where needed.
Guenther
2010-08-26 00:20:29 +02:00
Günther Deschner
7ff7eb0b52 s3-build: only include nsswitch header where needed.
Guenther
2010-08-26 00:20:28 +02:00
Günther Deschner
aba1bf4b5e s3-build: only include memcache.h where needed.
Guenther
2010-08-26 00:20:28 +02:00
Michael Adam
c45eca5751 s3:pdb_ldap: move some code in ldapsam_create_dom_group()
to make the flow more similar to ldapsam_create_user().
This prepares for calling winbind_sid_to_gid() instead of
winbind_allocate_gid(): we need the group_sid for this...

Michael
2010-08-14 02:10:30 +02:00
Günther Deschner
ae36783c7b s3-passdb: include samr.h where needed.
Guenther
2010-08-06 15:43:37 +02:00
Günther Deschner
c136b84f0d s3-secrets: only include secrets.h when needed.
Guenther
2010-08-05 10:12:25 +02:00
Volker Lendecke
c186f92437 s3: [ug]id_to_unix_... can not fail
Remove some silly failure checks
2010-07-11 17:33:34 +02:00
Björn Jacke
a679319192 s3:pdb_ldap: change LDAP password before samba password hashes
this way we can catch up with password change refuses from ldap password policy
overlays and abort the password change early.

Thanks to Andy Hanton <andyhanton@gmail.com> for the initial patch.
2010-07-06 18:50:01 +02:00
Volker Lendecke
a56c688366 s3: Fix another aspect of bug 7262 and make paged results work again 2010-07-06 17:36:18 +02:00
Volker Lendecke
3278554b3e s3: Make talloc_attrs() static 2010-07-05 12:37:13 +02:00
Günther Deschner
dff7be8ccb s3-libads: only include libds flags where needed.
Guenther
2010-07-01 23:20:40 +02:00
Andreas Schneider
ac5600fc7e s3-passdb: Make sure dn is initialized and don't free it.
dn is just a pointer to a memory which hasn't been duplicated.

Found by clang-analyzer.
2010-06-28 12:56:13 +02:00
Andreas Schneider
6d89116afe s3-passdb: Make sure we don't call free on a garbage pointer.
Found by clang-analyzer.
2010-06-28 12:56:13 +02:00
Andreas Schneider
a81b97ff34 s3-passdb: Make sure that we don't assign garbage. 2010-06-28 10:18:12 +02:00
Volker Lendecke
f66cc82709 s3: Fix EnumDomainAliases when no aliases are in LDAP
We used to return NT_STATUS_ACCESS_DENIED, now we just return 0 entries, just
like W2k8 does.

usrmgr.exe was pretty unhappy with the NT_STATUS_ACCESS_DENIED
2010-06-10 15:28:26 +02:00
Michael Adam
ba809ecb8a s3:pdb_ldap: fix bug 7505 - init_sam_from_ldap stores group in sid2uid cache 2010-06-10 12:02:05 +02:00
Karolin Seeger
8ca88e2f81 s3-passdb: Fix typo in comment.
Karolin
2010-06-10 10:34:58 +02:00
Volker Lendecke
1fd15dcb7c s3: Fix bug 7253
acct_ctrl is 32 bit in LOGIN_CACHE, but "w" as a format specifier for
tdb_unpack only writes 16 bits. Okay on x86, not okay on Solaris.

Thanks to Vladimir.Marek@Sun.COM!

Volker
2010-06-09 10:27:17 +02:00
Simo Sorce
0a7ff14617 s3:passdb Export function to calculate the proper primary group sid
Don't keep it buried in passdb, this function need to be available
for use in places where we do not want to construct an artificial
samu struct just to play tricks.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-06-07 22:53:08 +10:00
Matthieu Patou
57ab910b6f s3: Allow previous password to be stored and use it to check tickets
This patch is to fix bug 7099. It stores the current password in the
 previous password key when the password is changed. It also check the
 user ticket against previous password.

Signed-off-by: Günther Deschner <gd@samba.org>
2010-06-02 14:32:23 +02:00
Günther Deschner
f9f8007361 s3-build: only use ndr_security.h where needed.
Guenther
2010-05-31 11:32:37 +02:00
Simo Sorce
d85d85b851 s3:passdb Fix memory leak
We were allocating this passwd structure on sampass, but never freeing
it nor assigning it to unix_pw where it could be reused.
2010-05-29 10:54:08 -04: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
Andrew Bartlett
a92b653af9 s3:passdb Remove use of uint8 uint16 and uint32 in favour of C99 types
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-21 10:24:55 +02:00
Günther Deschner
f6f3bb1813 s3-passdb: move get_logon_hours_from_pdb() into samr server.
Guenther
2010-05-18 21:43:05 +02:00
Andrew Bartlett
7a8e34fe86 s3:split secrets.c to put machine account secrets in a new file
This helps the s3compat effort by allowing these functions to be
replaced by functions that query the cli_credentials and secrets.ldb
APIs.

Also, this changes a couple of DOM_SID to struct dom_sid along the
way.

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-18 21:39:42 +02:00
Jelmer Vernooij
b8268cf7b0 s3: Remove use of iconv_convenience. 2010-05-18 11:45:31 +02:00
Günther Deschner
d7d313851a s3-tldap: only include tldap when actually needed.
Guenther
2010-05-18 00:44:27 +02:00
Günther Deschner
ca73e03eb7 security: merge builtin rid tables.
Guenther
2010-05-18 00:44:26 +02:00
Günther Deschner
3b529d50be s3-rpc_misc: clean out include/rpc_misc.h.
Well known rids don't really belong into an rpc header, just use the ones
defined in security.idl.

Guenther
2010-05-18 00:44:26 +02:00
Günther Deschner
b83ab96b16 s3-passdb: moving account_pol.c into passdb.
Guenther
2010-05-08 01:45:27 +02:00
Günther Deschner
f5ac746091 s3-pdb_ldap: fix memleak.
Guenther
2010-04-29 12:05:42 +02:00
Volker Lendecke
5197d76faa s3: Make a debug msg more readable 2010-04-28 10:55:50 +02:00
Stefan Metzmacher
9fbbaa560a s3:passdb: avoid sid_to_gid() if the sid is "domain users"
If the call fails we would use the "domain users" sid anyway.

metze
2010-03-25 21:25:27 +01:00
Volker Lendecke
ea8e0d5d54 Fix some nonempty blank lines 2010-03-25 10:24:45 +01:00
Karolin Seeger
fad0629e78 s3-builtin: Add missing builtin groups.
Karolin
2010-03-23 15:24:52 +01:00
Karolin Seeger
ef83c970ca s3-builtin: Add some builtin groups.
Karolin
2010-03-23 11:39:05 +01:00
Volker Lendecke
2b4ce9a73f s3: Make login_cache_write take a pointer 2010-03-16 22:35:41 +01:00
Volker Lendecke
276b1aa189 s3: Make login_cache_read take a pointer, avoid a malloc 2010-03-16 22:35:41 +01:00
Volker Lendecke
13a278c1b9 s3: Remove a typedef 2010-03-16 22:35:41 +01:00
Volker Lendecke
02d7cdc671 s3: Fix some nonempty blank lines 2010-03-16 22:35:41 +01:00
Karolin Seeger
7fdbbddf42 s3-passdb: Fix typo in debug message.
Karolin
2010-03-10 12:08:27 +01:00
Simo Sorce
3b12c38ac0 s3:schannel streamline interface
Make calling schannel much easier by removing the need to explicitly open the
database. Let the abstraction do it instead.
2010-02-23 12:46:50 -05:00
Andreas Schneider
b9cf55cfea s3-passdb: Remove obsolete signal type cast. 2010-02-23 12:23:42 +01:00
Volker Lendecke
2ea2d2a81e s3: Fix bug 5198 -- parse chfn(1)-change gecos field 2010-02-13 17:23:43 +01:00
Björn Jacke
9b75650f1a s3: change ldap filter to what really was intended 2010-02-10 13:48:11 +01:00
Stefan Metzmacher
4dc2be2264 s3:passdb: only use gid_to_sid() result if the result is a group of our local sam
Otherwise retry with pdb_gid_to_sid().

metze
2010-02-09 12:57:01 +01:00
Stefan Metzmacher
6753fb1cf6 s3:pdb_ldap: don't search for the users primary group, if we already know it
metze
2010-02-08 11:23:25 +01:00
Stefan Metzmacher
49ace81e19 s3:pdb_ldap: optimize ldapsam_alias_memberships() and cache ldap searches.
ldapsam_alias_memberships() does the same LDAP search twice, triggered
via add_aliases() from create_local_nt_token().

This happens when no domain aliases are used.

metze
2010-02-08 11:23:24 +01:00
Stefan Metzmacher
25038fa85f s3:pdb_ldap: try to build the full unix_pw structure with ldapsam:trusted support
And also store the gid_to_sid mappings in the idmap_cache.

metze
2010-02-08 11:23:24 +01:00
Stefan Metzmacher
e10d086956 s3:passdb: speed up pdb_get_group_sid()
Use the cached version gid_to_sid() instead
of pdb_gid_to_sid().

And also avoid the expensive lookup_sid() call
for wellkown domain groups.

metze
2010-02-08 11:23:23 +01:00
Volker Lendecke
b99046fed1 s3: Make pdb_copy_sam_account also copy the group sid
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2010-02-08 11:23:23 +01:00
Stefan Metzmacher
779821df8e s3: shortcut gid_to_sid when "ldapsam:trusted = yes"
The normal gid_to_sid behaviour is to call sys_getgrgid()
to get the name for the given gid and then call the
getsamgrnam passdb method for the resulting name.

In the ldapsam:trusted case we can reduce the gid_to_sid
operation to one simple search for the gidNumber attribute
and only get the sambaSID attribute from the correspoinding
LDAP object. This reduces the number of ldap roundtrips
for this operation.

metze
2010-02-08 11:23:17 +01:00
Volker Lendecke
abbd0f9195 s3: Make use of ZERO_STRUCTP 2010-02-05 21:11:17 +01:00
Volker Lendecke
3ea602a7c3 s3: Remove a pointless if-statement 2010-02-05 21:11:17 +01:00
Volker Lendecke
dcc850e3b3 s3: Make guest_user_info() static 2010-02-05 21:11:17 +01:00
Volker Lendecke
004e3e400d s3: Hide some uses of pdb_get_init_flags (which I would love to remove...) 2010-02-05 21:11:17 +01:00
Volker Lendecke
1cd7223b8e s3: Fix some nonempty blank lines 2010-02-05 21:11:17 +01:00
Stefan Metzmacher
0c93aa3cd5 s3:passdb: fix a type Domain Users has RID -513
metze
2010-02-04 15:19:50 +01:00
Jeremy Allison
69fd8461b8 Second part of fix for bug #7072 - Accounts can't be unlocked from ldap.
Missed read of entry_timestamp (was entry->entry_timestamp).

Jeremy.
2010-01-27 16:52:40 -08:00
Jeremy Allison
627fb85092 Fix bug #7072 - Accounts can't be unlocked from ldap.
Fix suggested by Andy Hanton <andyhanton@gmail.com>. The LOGIN_CACHE
struct contains two time_t entries, but was being written to and
read from via tdb_pack/tdb_unpack functions using explicit 32-bit int specifiers.
This would break on machines with a 64-bit time_t. Use correct int
sizes for tdb_pack/tdb_unpack.

We have to fix this properly before 2037 :-).

Jeremy.
2010-01-27 16:42:06 -08:00
Volker Lendecke
9fcbe3a65c s3: Remove some pointless uses of string_sid_talloc 2010-01-23 14:35:37 +01:00
Volker Lendecke
253465456a s3:pdb_ldap: Fix large paged search.
Fix bug #6981 (Paged Search with DirX LDAP server broken).
(cherry picked from commit 0a3b576c0a)
2010-01-21 15:33:42 +01:00
Stefan Metzmacher
ac224452b9 s3:pdb_ldap: restore Samba 3.0.x behavior and use the first "uid" value.
See bug #6157 for more details.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 25806f43dd)
2010-01-14 02:27:34 +01:00
Volker Lendecke
373dcf45cf s3: Remove a pointless if-statement 2010-01-12 13:55:07 +01:00
Volker Lendecke
48251c3370 s3: Use sid_check_is_in_our_domain instead of a direct sid_peek_check_rid 2010-01-10 20:56:16 +01:00
Volker Lendecke
3ea64e0ad8 s3: Replace most calls to sid_append_rid() by sid_compose() 2010-01-10 20:56:16 +01:00
Michael Adam
017ccd0bda s3:passdb: store the plain nt passwords hashes in history, not salted md5
This is in order to be able to do challenge response with the history,
so that this can be checked when an invalid password was entered:
If the given password is wrong but in the history, then the bad password
count should not be updated...

The "lucky" bit here is that the md5 has and the nt hash (md4) both are
16 bytes long.

This is part of the fix for bug #4347 .

Michael
2010-01-07 16:51:17 +01:00
Volker Lendecke
5e2fc28b63 s3: Simplify pdb_set_plaintext_passwd: pwhistory==NULL can not happen anymore 2010-01-07 11:07:54 +01:00
Volker Lendecke
2a11f3b3d7 s3: Simplify pdb_set_plaintext_passwd: pwHistLen==0 was checked above 2010-01-07 11:07:54 +01:00
Volker Lendecke
ec0998ada5 s3: Add a paranoia check to pdb_set_plaintext_passwd() 2010-01-07 11:07:54 +01:00
Volker Lendecke
a3f522202d s3: Simplify pdb_set_plaintext_passwd() by removing a redundant condition
if (current_history_len != pwHistLen) {
     if (current_history_len < pwHistLen) {
     }
}

The second "if" is a bit pointless here
2010-01-07 11:07:54 +01:00
Volker Lendecke
7633837026 s3: Simplify pdb_set_plaintext_passwd: memcpy deals fine with 0 bytes 2010-01-07 11:07:53 +01:00
Volker Lendecke
864ed92954 s3: Simplify pdb_set_plaintext_passwd by using talloc_zero_array 2010-01-07 11:07:53 +01:00
Volker Lendecke
e7290255f5 s3: Make use of talloc_array in pdb_set_plaintext_passwd() 2010-01-07 11:07:53 +01:00
Volker Lendecke
7ba006430f s3: Simplify pdb_set_plaintext_passwd() a bit
Remove an indentation by the early return in

+       if (pwHistLen == 0) {
+               /* Set the history length to zero. */
+               pdb_set_pw_history(sampass, NULL, 0, PDB_CHANGED);
+               return true;
+       }
2010-01-07 11:07:52 +01:00
Volker Lendecke
ca6c1cdd5f s3: Simplify pdb_set_plaintext_passwd() slightly
No functional change, this just removes an indentation level by the early
"return True;" in

+       if ((pdb_get_acct_ctrl(sampass) & ACB_NORMAL) == 0) {
+               /*
+                * No password history for non-user accounts
+                */
+               return true;
+       }

Volker
2010-01-07 11:07:52 +01:00
Michael Adam
2fad148b27 s3:pdb_set_pw_history: free the old history before setting the new.
This is not strictly necessary, since this only leaks into the
struct samu, and this is not so long-lived in the code path that
changes the password, but it definitely correct and does not harm.

Michael
2010-01-07 11:07:51 +01:00
Michael Adam
71e3de6c9f s3:pdb_ldap:init_sam_from_ldap: untangle an assignment from the check
to enhance readability and denbuggability.

Michael
2010-01-07 11:07:51 +01:00
Volker Lendecke
129e976c47 s3: "startsmbfilepwent" only looks at the inode -- is that enough? 2009-11-29 11:22:04 +01:00
Volker Lendecke
44ce5603dd s3: Pass the "fake dir create times" parameter to sys_*stat
Step 0 to restore it as a per-share paramter
2009-11-29 11:22:01 +01:00
Michael Adam
557535302c s3:pdb_ldap: fix a comment typo
Michael
2009-11-19 17:55:47 +01:00
Michael Adam
457055871a s3: shortcut uid_to_sid when "ldapsam:trusted = yes"
The normal uid_to_sid behaviour is to call sys_getpwuid()
to get the name for the given uid and then call the
getsampwnam passdb method for the resulting name.

In the ldapsam:trusted case we can reduce the uid_to_sid
operation to one simple search for the uidNumber attribute
and only get the sambaSID attribute from the correspoinding
LDAP object. This reduces the number of ldap roundtrips
for this operation.

Michael
2009-11-19 17:55:47 +01:00
Michael Adam
30ab3a762e s3:passdb: remove the uid_to_rid method - we only need uid_to_sid
Michael
2009-11-14 01:28:50 +01:00
Michael Adam
3b7448de14 s3:pdb_default_uid_to_sid: fix some debug statements.
Michael
2009-11-14 01:27:45 +01:00
Michael Adam
1e3c4b381a s3:smbd: also fill the memcache with sid<->id mappings in ldapsam_sid_to_id()
not only the persistent idmap cache.

Michael
2009-11-13 16:19:32 +01:00
Michael Adam
d2673253e3 s3:smbd: make idmap cache persistent for "ldapsam:trusted".
This stores the mappings found in the idmap cache (which lives
inside gencache). This cache is already read in sid_to_Xid()
and Xid_to_sid() for ldapsam:trusted, this fills the opposite
direction, massively reducing the number of ldap roundtrips
across smbd restarts.

Michael
2009-11-13 16:19:31 +01:00
Volker Lendecke
1220534716 Fix large paged search
Signed-off-by: Michael Adam <obnox@samba.org>
2009-11-13 11:36:06 +01:00
Volker Lendecke
b067a5e4e8 s3: Remove debug_ctx()
smbd just crashed on me: In a debug message I called a routine preparing a
string that itself used debug_ctx. The outer routine also used it after the
inner routine had returned. It was still referencing the talloc context
that the outer debug_ctx() had given us, which the inner DEBUG had already
freed.
2009-11-03 11:30:00 +01:00
Björn Jacke
7006352206 s3:ldap: don't search when no values where found 2009-11-02 01:55:27 +01:00
Björn Jacke
72cec4a031 ѕ3:ldap: search for account policies in objectclass sambaDomain, not * 2009-10-31 00:48:20 +01:00
Günther Deschner
184afaa04c s3-secrets: use autogenerated code for TRUSTED_DOM_PASS struct parsing from a tdb.
Guenther
2009-10-29 10:49:39 +01:00
Günther Deschner
4df8426768 s3-passdb: move open_schannel_session_store() to passdb/secrets_schannel.c.
Guenther
2009-10-28 12:37:39 +01:00
Günther Deschner
bda047afbc s3-passdb: add secrets_delete_generic().
Guenther
2009-10-28 12:37:38 +01:00
Günther Deschner
d168d7fe3c s3-pdb_ldap: fix crash bug in ldapsam_set_trusteddom_pw().
Thanks Volker for the hint.

Guenther
2009-10-20 21:44:02 +02:00
Günther Deschner
c7023c5a3d s3-lsa: Allow to lookup 'NT AUTHORITY\Anonymous Logon' as well.
This is to finally pass RPC-LSA-LOOKUPNAMES test.

Guenther
2009-10-20 15:28:31 +02:00
Günther Deschner
1f4d26c487 s3-lsa: allow to lookup BUILTIN\ in lsa_LookupNames.
Found by RPC-LSA-LOOKUPNAMES torture test.

Guenther
2009-10-20 15:28:31 +02:00
Jeremy Allison
5cc895983d Fix valgrind memory leak in bug #6814 - Fixes for problems reported by valgrind
Jeremy.
2009-10-15 16:55:40 -07:00
Volker Lendecke
1341d4509c s3: Fix some nonempty blank lines 2009-10-13 20:34:24 +02:00
Günther Deschner
ebe0e64ba9 s3: use enum netr_SchannelType all over the place.
Guenther
2009-10-13 10:21:46 +02:00
Stefan Metzmacher
9801ec5f1a s3:secrets_schannel: revert to using version 1
It doesn't really matter if the entries
have invalid context in it. Older versions of samba
refuse to open the file if the version doesn't match.

If we can't parse individual records, we'll fail schannel binds,
but the clients are supposed to reestablish the netlogon secure channel
by doing ServerReqChallenge/ServerAuthenticate* again. This
will just overwrite the old record.

metze
2009-09-21 06:33:25 +02:00
Günther Deschner
f092d689c5 s3-pdb_ldap: Fix bug #4296: Clean up group membership while deleting a user.
Note that this only is tried with editposix=yes.

Guenther
2009-09-02 12:40:47 +02:00
Günther Deschner
360868b6e8 s3-schannel: remove remaining code that was using "struct dcinfo".
Guenther
2009-08-27 15:55:20 +02:00
Günther Deschner
b089506136 s3-schannel: upgrade old format schannel_store.tdb.
Guenther
2009-08-27 15:55:20 +02:00
Günther Deschner
a09b627ecc s3-schannel: add simple wrappers to fetch and store schannel auth info.
Guenther
2009-08-27 15:55:19 +02:00
Günther Deschner
7c972d83d2 s3-schannel: make open_schannel_session_store() public.
Guenther
2009-08-27 15:55:19 +02:00
Günther Deschner
20225d83dd s3-pdb_ldap: Make ldapsam_alias_memberships behave like the tdbsam equivalent.
This lets samr_GetAliasMembership return with NT_STATUS_OK when called with 0
sids (just what w2k3 does).

Guenther
2009-08-03 16:32:15 +02:00
Volker Lendecke
a488334bf1 Rename LOOKUP_NAME_EXPLICIT to LOOKUP_NAME_NO_NSS
It took me a bit to understand what this flag does. I hope this is
a bit clearer, at least it is to me.
2009-07-31 23:19:05 +02:00
Michael Adam
d498532389 s3:passdb: use transaction_wrapped write in tdbsam_new_rid()
Now all tdb writes in passdb use transactions.

Michael
2009-07-29 16:26:30 +02:00
Michael Adam
8da2f93716 s3:secrets: use transaction wrapped store in get rand seed.
Now secrets.tdb is only writen with transactions.

Michael
2009-07-29 16:26:29 +02:00
Michael Adam
ded0ce8345 s3:dbwrap: change dbwrap_change_uint32_atomic() to return NTSTATUS not uint32_t.
Michael
2009-07-29 16:26:21 +02:00
Jeremy Allison
0259a303f4 Fix Coverity CIDs 887, 888. Don't pass NULL's to functions
that deref them.
Jeremy.
2009-07-17 21:50:33 -07:00
Günther Deschner
4b6401ab2c s3-passdb: fix wbc build warning.
Guenther
2009-07-14 23:37:36 +02:00
Volker Lendecke
d050541330 Fix bug 5886
Ok, that's a very long-standing one. I finally got around to install a recent
OpenLDAP and test the different variants of setting a NULL password etc.

Thanks all for your patience!

Volker
2009-07-14 23:16:28 +02:00
Günther Deschner
9f15ef11bd s3-account_policy: add pdb_policy_type enum.
Guenther
2009-07-14 12:12:18 +02:00
Günther Deschner
e4fca7466d s3-pdb_ads: set correct pdb field with the value from 'accountExpires' attribute.
Guenther
2009-07-13 21:56:31 +02:00
Günther Deschner
05fbe0c7f7 libds: merge the UF<->ACB flag mapping functions.
Guenther
2009-07-13 15:36:07 +02:00
Volker Lendecke
afc6f607d5 Return 0 domains from enum_trusteddoms 2009-07-10 22:01:56 +02:00
Volker Lendecke
d8556bbf13 Quieten events and tldap debug messages 2009-07-10 22:01:56 +02:00
Volker Lendecke
c624a704be Make escape_ldap_string take a talloc context 2009-07-09 22:25:29 +02:00
Volker Lendecke
a5cd278f6f pdb_ads: For cached samu entries, priv is NULL
We have to recreate the priv entry on demand. This needs fixing in
passdb... :-)
2009-07-04 12:54:23 +02:00
Volker Lendecke
bfd82e4979 Add pdb_ads_get_domain_info 2009-07-04 12:54:23 +02:00
Volker Lendecke
f6ce7e0625 pdb_ads: Use tldap_fetch_rootdse in pdb_ads_connect 2009-07-04 12:54:22 +02:00
Volker Lendecke
98fb2a18f9 pdb_ads: Fetch the domain GUID 2009-07-04 12:54:22 +02:00
Volker Lendecke
b8322ec2b2 Add pdb_get_domain_info 2009-07-04 12:54:22 +02:00
Volker Lendecke
1c778aa19a Make pdb_ads return an additional flag 2009-07-04 12:54:22 +02:00
Volker Lendecke
91a8cb851e Fix bug #6431 - local groups from 3.0 setups no longer found.
Search for groups without group suffix, group suffix is only used for new entries.
2009-06-30 11:42:15 -07:00
Günther Deschner
28ef5c3ece s3-pdb_tdb: give 'unknown_str' the proper name 'comment' and set comment in passdb.
pdb_{get,set}_comment were already existing in the API but were never used.

Guenther
2009-06-29 22:36:12 +02:00
Stefan Metzmacher
ce8159b30e s3:pdb_ads: we need to make the fd for tldap/tsocket non-blocking
metze
2009-06-29 22:18:14 +02:00
Volker Lendecke
711544d494 Turn the pdb_rid_algorithm into a capabilities call that returns flags 2009-06-28 22:13:50 +02:00
Volker Lendecke
325a58a653 Make pdb_ads survive a restart of Samba4
The search function retries once, the modifying call that hits a dead smbd
returns an error. The next try will reconnect. This was simple to implement and
provides a good compromise against Samba4 idling our connection. Most of the
modifying calls are quickly after a search (like OpenUser) anyway.
2009-06-28 15:51:02 +02:00
Michael Adam
a4bc5bfa95 s3:passdb: fix bug #6509: use gid (not uid) cache in fetch_gid_from_cache().
With the previous code, the cache can never have been hit at all.

Michael
2009-06-26 14:15:44 +02:00
Volker Lendecke
e3fb71dac8 Only set the password if there is one 2009-06-24 16:30:55 +02:00
Volker Lendecke
63a70ba0ad Prepare control support
We will have arrays of controls passed to tldap.c. Follow a mantra from the
classic book "Thinking Forth" by Leo Brodie: Favor counts over terminators :-)

This makes the parameter lists to tldap pretty long, but everyone will have
wrapper routines anyway, see for example tldap_search_fmt. And the OpenLDAP
manpages call the non-_ext routines deprecated, probably for a reason.
2009-06-20 18:54:06 +02:00
Volker Lendecke
62eb817c06 Fix setting passwords in pdb_ads
The samba4 password_hash module does not allow changing the password fields via
the "delete oldval" -> "add newval" set of modify operations, it requires a
single "replace with newval" operation.

Andrew, Samba3 by default uses that delete/add pair to detect if between
fetching the old value and storing the new one the old value has changed. This
is lost by using the "replace" operation.

Would it make sense to add this to the password_hash module?

Volker
2009-06-20 12:15:21 +02:00
Volker Lendecke
eb8c081771 talloc_tos() aborts if it can not get a stackframe 2009-06-20 12:15:21 +02:00
Volker Lendecke
6e4c57ced5 Activate tldap tracing in pdb_ads 2009-06-12 15:04:21 +02:00
Tim Prouty
ef55c2bd91 s3 passdb ads: add missing character 2009-06-11 11:01:51 -07:00
Volker Lendecke
117c19efa4 Implement pdb_enum_alias_memberships 2009-06-11 18:04:35 +02:00
Volker Lendecke
6372bd695d Implement pdb_ads_set_aliasinfo 2009-06-10 23:57:49 +02:00
Volker Lendecke
baa47dd278 pdb_default_aliasinfo is just fine for pdb_ads right now 2009-06-10 23:57:49 +02:00
Volker Lendecke
96df53fdc7 Implement pdb_ads_lookup_rids 2009-06-10 23:08:09 +02:00
Volker Lendecke
6e9e0334ff Fix a segfault in pdb_ads_delete_user()
If a user comes from the passdb cache, priv is NULL
2009-06-10 23:08:09 +02:00
Volker Lendecke
b660e51dec If there are no mods, don't bother the ldap server 2009-06-09 22:40:36 +02:00
Volker Lendecke
078443bc67 Some more fields in pdb_ads_init_ads_from_sam() 2009-06-09 22:40:36 +02:00
Volker Lendecke
9af9a43464 Do not pull samAccountName twice 2009-06-09 21:46:30 +02:00
Volker Lendecke
0302bbda35 No need to free twice -- thanks gd :-) 2009-06-09 15:28:21 +02:00
Volker Lendecke
fa074c9916 Implement pdb_ads_[add|del]_groupmem 2009-06-09 15:25:15 +02:00
Volker Lendecke
63e6bb947a Implement pdb_ads_delete_dom_group 2009-06-09 14:49:34 +02:00
Volker Lendecke
89bd09e7f3 Implement pdb_ads_enum_group_members 2009-06-08 23:59:12 +02:00
Volker Lendecke
46b5cce1e9 Fix some nonempty blank lines 2009-06-08 23:11:14 +02:00
Volker Lendecke
094f47e7cf Fix two 64-bit warnings 2009-06-08 21:14:11 +02:00
Volker Lendecke
275ca400db Implement pdb_[add|del]aliasmem 2009-06-08 21:14:10 +02:00
Volker Lendecke
af82489b41 Do not use a variable format string 2009-06-08 21:14:10 +02:00
Volker Lendecke
7ab4d3fa43 Implement pdb_ads_enum_aliasmem 2009-06-08 21:14:10 +02:00
Volker Lendecke
a51e6ce43c Pass a talloc_ctx to pdb_enum_aliasmem 2009-06-08 21:14:10 +02:00