summaryrefslogtreecommitdiff
path: root/nsswitch
Commit message (Collapse)AuthorAgeFilesLines
...
* nsswitch: linux: Remove use of strcpy().Jeremy Allison2016-03-221-16/+28
| | | | | | | | | The previous use was safe, but having *any* use of strcpy inside our code sets off security flags. Replace with an explicit length calculation and memcpy. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* Added MSV1_0_ALLOW_MSVCHAPV2 flag to ntlm_authHerwin Weststrate2016-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | An implementation of https://lists.samba.org/archive/samba/2012-March/166497.html (which has been discussed in 2012, but was never implemented). It has been tested on a Debian Jessie system with this patch added to the Debian package (which is currently 4.1.17). Even though this is Samba 4, the ntlm_auth installed is the one from Samba 3 (yes, it surprised me too). The backend was a machine with Windows 2012R2. It was first tested with the local security policy 'Network Security: LAN Manager authentication level' setting changed to 'Send NTLMv2 Response Only' (allow ntlm v1). This way we are able to authenticate with and without the MSV1_0_ALLOW_MSVCHAPV2 flag (as expected). After the basic step has been verified, the local security policy 'Network Security: LAN Manager authentication level' setting was changed to 'Send NTLMv2 Response Only. Refuse LM & NTLM' (only allow ntlm v2). The behaviour now changed according to the MSV1_0_ALLOW_MSVCHAPV2 flag (again: as expected). $ ntlm_auth --request-nt-key --username=XXXXXXXXXXXXX --challenge=XXXXXXXXXXXXXXXXX --nt-response=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --domain= Logon failure (0xc000006d) $ ntlm_auth --request-nt-key --username=XXXXXXXXXXXXX --challenge=XXXXXXXXXXXXXXXXX --nt-response=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --domain= --allow-mschapv2 NT_KEY: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The changes in `wbclient.h` are intended for programs that use libwinbind directly instead of authenticating via `ntlm_auth`. I intend to use that within FreeRADIUS (see https://bugzilla.samba.org/show_bug.cgi?id=11149). BUG: https://bugzilla.samba.org/show_bug.cgi?id=11694 Signed-off-by: Herwin Weststrate <herwin@quarantainenet.nl> Reviewed-by: Kai Blin <kai@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* winbind: Remove unused WINBINDD_UID_TO_SIDVolker Lendecke2016-02-221-1/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Mon Feb 22 23:39:13 CET 2016 on sn-devel-144
* nss_aix: Hack away WINBINDD_UID_TO_SIDVolker Lendecke2016-02-221-0/+11
| | | | | | | | | To do a proper xids2sids conversion I need a build environment. Everyone who needs this and can build AIX please speak up! Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* winbind: Remove unused WINBINDD_GID_TO_SIDVolker Lendecke2016-02-221-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* libwbclient: Use wbcCtxUnixIdsToSids in wbcCtxGidToSidVolker Lendecke2016-02-221-19/+16
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* libwbclient: Use wbcCtxUnixIdsToSids in wbcCtxUidToSidVolker Lendecke2016-02-221-19/+16
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* winbind: Remove unused WINBINDD_SID_TO_GIDVolker Lendecke2016-02-221-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* winbind: Remove unused WINBINDD_SID_TO_UIDVolker Lendecke2016-02-221-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* libwbclient: Use wbcCtxSidsToUnixIds in wbcCtxSidToGidVolker Lendecke2016-02-221-19/+12
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* libwbclient: Use wbcCtxSidsToUnixIds in wbcCtxSidToUidVolker Lendecke2016-02-221-19/+12
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* wbinfo: Add --unix-ids-to-sidsVolker Lendecke2016-02-221-0/+77
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* libwbclient: Implement wbc[Ctx]UnixIdsToSidsVolker Lendecke2016-02-224-2/+226
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* winbind: Expose WINBINDD_XIDS_TO_SIDS externallyVolker Lendecke2016-02-221-1/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* nss_netbsd: Remove unimplemented prototypesVolker Lendecke2016-02-111-13/+0
| | | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Feb 11 04:43:53 CET 2016 on sn-devel-144
* nss_linux: Remove non-nss functionsVolker Lendecke2016-02-111-371/+0
| | | | | | | | | These functions were meant as a standard interface before libwbclient was developed. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* libwbclient: Fix a few resource leak CIDsVolker Lendecke2016-02-041-6/+9
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* libwbclient: Add "goto fail" test macrosVolker Lendecke2016-02-041-0/+21
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* pam_winbind: check != PAM_SUCCESS and != NULL explicitlyMichael Adam2016-01-131-14/+14
| | | | | | | | ...instead of using "if (ret)" or similar. This is just a code cleanup, no changes in behaviour. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* torture: add torture comment output of name/ip to WinsBy{Ip,Name} testsMichael Adam2016-01-111-0/+6
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* torture: Fix winbind.wbclient.ResolveWinsByIp testMichael Adam2016-01-111-1/+13
| | | | | | | | | | | | The test gets handed a name, so we first need to resolve the name to an IP before we can pass that on to ResolveWinsByIp. Bug uncovered by the new nss_wrapper code (1.1.2). Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Fix various spelling errorsMathieu Parent2015-11-061-1/+1
| | | | | | | | Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Fri Nov 6 13:43:45 CET 2015 on sn-devel-104
* nss_wins: Use libwbclient to query wins serverAndreas Schneider2015-10-262-160/+86
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11563 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* nss_wins: Use lp_global_no_reinit()Andreas Schneider2015-10-261-1/+1
| | | | | | | | | | This avoids that we run into use after free issues when we access memory allocated on the globals and the global being reinitialized. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11563 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* wbinfo: make --verbose --pam-logon print sidsVolker Lendecke2015-10-121-0/+10
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Günther Deschner <gd@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Oct 12 14:01:50 CEST 2015 on sn-devel-104
* build: Move __attribute__ ((destructor)) and ((constructor)) tests to wafsambaAndrew Bartlett2015-10-091-1/+1
| | | | | | | | This allows us to use them in talloc as well. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>
* nss_winbind: fix hang on Solaris on big groupsBjörn Jacke2015-09-111-0/+6
| | | | | | | | | | | | | | The problem with large groups on Solaris in the the NSS winbind module is Solaris wants the return value to be NSS_UNAVAIL if the buffer given is too small for getgrnam_r. The current code return NSS_TRYAGAIN which causes Solaris/Illumos to loop without trying to resize the buffer. Thanks to Nathan Huff <nhuff@acm.org> for finding this out. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10365 Signed-off-by: Bjoern Jacke <bj@sernet.de> Reviewed-by: Ralph Böhme <rb@sernet.de>
* nss_wins: add module for FreeBSDBjörn Jacke2015-09-112-1/+87
| | | | | | | | | Thanks to Timur Bakeyev <timur@FreeBSD.org> for the patch. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11493 Signed-off-by: Bjoern Jacke <bj@sernet.de> Reviewed-by: Ralph Böhme <rb@sernet.de>
* pam_winbind: Fix a segfault if initialization failsAndreas Schneider2015-09-081-11/+8
| | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11502 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Tue Sep 8 21:39:21 CEST 2015 on sn-devel-104
* winbind client: avoid vicious cycle created by client retryUri Simchoni2015-07-151-17/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch cancels the retry policy of the winbind client. When winbindd fails to respond to a request within 30 seconds, the winbind client closes the connection and retries up to 10 times. In some cases, delayed response is a result of multiple requests from multiple clients piling up on the winbind domain child process. Retrying just piles more and more requests, creating a vicious cycle. Even in the case of a single request taking long to complete, there's no point in retrying because the retry request would just wait for the current request to complete. Better to wait patiently. There's one possible benefit in the retry, namely that winbindd typically caches the results, and therefore a retry might take a cached result, so the net effect of the retry may be to increase the timeout to 300 seconds. But a more straightforward way to have a 300 second timeout is to modify the timeout. Therefore the timeout is modified from 30 seconds to 300 seconds (IMHO 300 seconds is too much, but we have "winbind rquest timeout" with a default of 60 to make sure the request completes or fails within 60 seconds) BUG: https://bugzilla.samba.org/show_bug.cgi?id=11397 Signed-off-by: Uri Simchoni <urisimchoni@gmail.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* wbinfo: Dump user info for pam-logon -vVolker Lendecke2015-06-111-3/+42
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* nsswitch: Simplify winbind_named_pipe_sock()Volker Lendecke2015-06-081-10/+8
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Mon Jun 8 19:48:18 CEST 2015 on sn-devel-104
* nsswitch: Extend idmap_rfc2307 testcase for reverse lookupChristof Schmitt2015-06-051-9/+63
| | | | | | | | | | | | | | Also test the codepaths to map UID and GID back to SID and names. Use different user and group to avoid returning results cached from the previous lookups. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11313 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Jun 5 01:24:32 CEST 2015 on sn-devel-104
* selftest: Add tests for expected output of wbinfo -i and wbinfo --uid-infoAndrew Bartlett2015-05-061-3/+46
| | | | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* nsswitch/wins: use lp_load_global() wrapper of lp_load().Michael Adam2015-04-221-1/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* nsswitch: improve error messages in wbinfo callsStefan Metzmacher2015-03-271-10/+17
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
* lib: load_case_tables() -> smb_init_locale()Volker Lendecke2015-03-241-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Remove load_case_tables_library()Volker Lendecke2015-03-241-1/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Ensure we always initialise the winbind contextMatthew Newton2015-03-181-1/+1
| | | | | | | | | | | | Stops segfault when a context is passed. Internal Samba code will currently always call this with NULL so won't trigger the bug. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Mar 18 01:41:32 CET 2015 on sn-devel-104
* Update libwbclient version to 0.12Matthew Newton2015-03-103-2/+133
| | | | | | | | | | | | | | Increment the minor version of the libwbclient library after new context functions added. (Major version increase not required as the only two functions with changed parameters are private to the library.) Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Mar 10 03:24:45 CET 2015 on sn-devel-104
* Move wbc global variables into global context insteadMatthew Newton2015-03-103-45/+73
| | | | | | | | | | There are some global variables in use in the libwbclient library. Now that we have a context, move these into it so that they are thread-safe when the wbcCtx* functions are used. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Add context versions of wbclient functionsMatthew Newton2015-03-106-176/+1161
| | | | | | | | | | | To make the libwbclient library thread-safe, all functions that call through to wb_common winbindd_request_response need to have context that they can use. This commit adds all the necessary functions. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Add wbcContext to wbcRequestResponseMatthew Newton2015-03-102-7/+21
| | | | | | | | | To enable libwbclient to pass winbindd context through to the winbind client library in wb_common. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Add wbcContext struct, create and free functionsMatthew Newton2015-03-103-0/+78
| | | | | | | | | The basic context structure and functions for libwbclient so that libwbclient can be made thread-safe. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Use global context for winbindd_request_responseMatthew Newton2015-03-106-39/+66
| | | | | | | | | Updating API call in libwbclient, wbinfo, ntlm_auth and winbind_nss_* as per previous commit to wb_common.c. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Make winbind client library thread-safe by adding contextMatthew Newton2015-03-102-61/+143
| | | | | | | | | | Rather than keep state in global variables, store the current context such as the winbind file descriptor in a struct that is passed in. This makes the winbind client library thread-safe. Signed-off-by: Matthew Newton <matthew-git@newtoncomputing.co.uk> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* pam: Fix CID 1034871 Resource leakVolker Lendecke2015-03-031-0/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Tue Mar 3 20:03:25 CET 2015 on sn-devel-104
* pam: Fix CID 1034870 Resource leakVolker Lendecke2015-03-031-1/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* nss-wins: Do not lookup invalid netbios namesAndreas Schneider2015-02-231-1/+13
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Make sure response->extra_data.data is always cleared outMatthew Newton2015-01-091-6/+7
| | | | | | | | | | Otherwise a bad read can sometimes cause the function to return -1 with an invalid pointer in extra_data.data, which is attempted to be freed by the caller (e.g. libwbclient/wbc_pam.c wbcAuthenticateUserEx()) by calling winbindd_free_response(). Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>