summaryrefslogtreecommitdiff
path: root/source3/lib
AgeCommit message (Collapse)AuthorFilesLines
2014-12-08s3-lib: Do not require a password with --use-ccache.Andreas Schneider1-1/+2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10279 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> (cherry picked from commit 1e148a91fd20053f823b57e19d757665fa30c53d)
2014-11-24samba: pass down size_t instead of int to add_string_to_array().Günther Deschner1-1/+1
Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Mon Nov 17 19:53:22 CET 2014 on sn-devel-104 The last 3 patches address BUG: https://bugzilla.samba.org/show_bug.cgi?id=10942 cleanup add_string_to_array and usage
2014-11-09s3: nmbd: Ensure NetBIOS names are only 15 characters stored.Jeremy Allison1-1/+9
This screws up if the name is greater than MAX_NETBIOSNAME_LEN-1 in the unix charset, but less than or equal to MAX_NETBIOSNAME_LEN-1 in the DOS charset, but this is so old we have to live with that. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10920 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit 7467f6e72cba214eeca75c34e9d9fba354c7ef31) Signed-off-by: Andreas Schneider <asn@samba.org>
2014-10-19pthreadpool: Slightly serialize jobsJeremy Allison1-3/+3
Using the new msg_source program with 1.500 instances against a single msg_sink I found the msg_source process to spawn two worker threads for synchronously sending the data towards the receiving socket. This should not happen: Per destination node we only create one queue. We strictly only add pthreadpool jobs one after the other, so a single helper thread should be perfectly sufficient. It turned out that under heavy overload the main sending thread was scheduled before the thread that just had finished its send() job. So the helper thread was not able to increment the pool->num_idle variable indicating that we don't have to create a new thread when the new job is added. This patch moves the signalling write under the mutex. This means that indicating readiness via the pipe and the pool->num_idle variable happen both under the same mutex lock and thus are atomic. No superfluous threads anymore. Back port of commit 1c4284c7395f23cefa61a407db74cf5067aee2aa that went into master. https://bugzilla.samba.org/show_bug.cgi?id=10779 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2014-10-19s3: lib: Signal handling - ensure smbrun and change password code save and ↵Jeremy Allison1-8/+10
restore existing SIGCHLD handlers. Bug #10831 - SIGCLD Signal handler not correctly reinstalled on old library code use - smbrun etc. https://bugzilla.samba.org/show_bug.cgi?id=10831 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-10-09s3: Move init_lsa_ref_domain_list to libChristof Schmitt1-0/+67
This will be used in the next patch in winbind. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit 16594e7fc0a46249a48d0d0635de0c1050ecd340)
2014-08-07lib/util: move memcache.[ch] to the toplevel 'samba-util' libraryStefan Metzmacher5-425/+4
This is generic enough that it could be used in all code. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Jul 18 15:43:33 CEST 2014 on sn-devel-104 (cherry picked from commit 45807028d478c082fef6f3a3d5a142d96d63fb50)
2014-08-07s3:lib/memcache: only include the required header filesStefan Metzmacher1-1/+6
We don't need the full "includes.h". Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit b560fac7f78b761ee279d8e87a749125665eb5d1)
2014-08-07s3:lib/memcache: make use of talloc for memcache_elementsStefan Metzmacher1-6/+5
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit 91105d1057c29c5878f50678baeb1bd1a6f1abe3)
2014-08-07s3:lib/memcache: use uint8_t instead of uint8Stefan Metzmacher1-2/+2
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit d7cbc63dc7537fc9562da985b77f6d62dc41fd84)
2014-07-15msg_channel: Fix a 100% CPU loopVolker Lendecke1-0/+12
In a ctdb setup, msg_read_got_ctdb did not set channel->pending_req to NULL. In smbXsrv_session_close_loop in any error condition this leads to a 100% loop. smbXsrv_session_close_loop continously retries, but because close_channel->pending_req is != NULL, msg_read_send will always return EBUSY, making smbXsrv_session_close_loop retry infinitely. This patch makes sure that msg_read_got_ctdb correctly NULLs out pending_req. msg_channel.c does not exist in master anymore, so this patch is 4.1 only. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Bug: https://bugzilla.samba.org/show_bug.cgi?id=10663 100% smbd cpu loop in ctdb setups
2014-06-22s3: smbd - fix processing of packets with invalid DOS charset conversions.Jeremy Allison1-9/+17
Bug 10654 - Segmentation fault in smbd_marshall_dir_entry()'s SMB_FIND_FILE_UNIX handler https://bugzilla.samba.org/show_bug.cgi?id=10654 Signed-off-by: Jeremy Allison <jra@samba.org> CVE-2014-3493
2014-06-22s3: nmbd: Fix bug 10633 - nmbd denial of serviceJeremy Allison1-5/+2
The Linux kernel has a bug in that it can give spurious wakeups on a non-blocking UDP socket for a non-deliverable packet. When nmbd was changed to use non-blocking sockets it became vulnerable to a spurious wakeup from poll/epoll. Fix sys_recvfile() to return on EWOULDBLOCK/EAGAIN. CVE-2014-0244 Signed-off-by: Jeremy Allison <jra@samba.org>
2014-05-20lib-util: rename memdup to smb_memdup and fix all callers (bug #10556)Björn Baumbach2-3/+3
Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit fae7e5d771d1c69bded1189b23335647023fa0f7) Conflicts: ctdb/lib/util/util.h Also renamed memdup() in source3/locking/brlock.c
2014-04-29s3-lib/util: fix logic inside set_namearray loops.Jeremy Allison1-10/+16
Additional fix for bug #10544 - s3-lib/util: set_namearray reads across end of namelist string. Not strictly needed as the initial fix addresses the problem, but corrects the internal logic inside the loops. https://bugzilla.samba.org/show_bug.cgi?id=10544 Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Michael Adam <obnox@samba.org> (cherry picked from commit 4f59580331b934b183c3344da57f2002d88d4512)
2014-04-29s3-lib/util: fix read across end of namelist stringBjörn Baumbach1-2/+5
If the namelist is not terminated with a '/', we try to read the next character after the string termination '\0'. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Apr 8 21:44:16 CEST 2014 on sn-devel-104 (cherry picked from commit 8f46b130c5c796d66d26982f5cd99c52f7c8ece1) Fix bug #10544 - s3-lib/util: set_namearray reads across end of namelist string.
2014-04-04s3: messages: Implement cleanup of dead records.Jeremy Allison2-0/+55
When a smbd process dies, pending messages.tdb records for this process might not get cleaned up. Implement a cleanup for dead records that is triggered after a smbd dies uncleanly; the records for that PID are deleted. Based on a patchset from Christof Schmitt <cs@samba.org>. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> (cherry picked from commit 837671f47670b16726aa96ba7a0902974a1037eb) Bug: https://bugzilla.samba.org/show_bug.cgi?id=10534 Cleanup messages.tdb record after unclean smbd shutdown Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-1-test): Fri Apr 4 23:07:07 CEST 2014 on sn-devel-104
2014-04-01s3: lib: Back-port tevent_queue_wait_send/recv -> ↵Jeremy Allison2-0/+115
smbd_tevent_queue_wait_send/recv Required for bugfix: [Bug 10344] SessionLogoff on a signed connection with an outstanding notify request crashes smbd. https://bugzilla.samba.org/show_bug.cgi?id=10344 Signed-off-by: Jeremy Allison <jra@samba.org>
2014-03-10s3:lib/ctdbd_conn: let release_ip_handler return boolStefan Metzmacher1-6/+30
If it returns true the passed ip address matched and we let a nested ctdb operation fail with NT_STATUS_ADDRESS_CLOSED. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit 9677fae6aab26d2bf0884dc31516d2dcd8840c03)
2013-12-14s3-lib: Fix %G substitution for domain users in smbdAndreas Schneider1-1/+11
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10286 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Christian Ambach <ambi@samba.org> Autobuild-User(master): Christian Ambach <ambi@samba.org> Autobuild-Date(master): Tue Dec 10 16:39:43 CET 2013 on sn-devel-104 (cherry picked from commit 8eef4ab79ec5fb7e96ad2f2ad6c9bf30db13a50d) Signed-off-by: Andreas Schneider <asn@samba.org> Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-1-test): Sat Dec 14 23:47:20 CET 2013 on sn-devel-104
2013-12-09Merge tag 'samba-4.1.3' into v4-1-testKarolin Seeger5-1/+187
samba: tag release samba-4.1.3
2013-12-05CVE-2013-4408:s3:Ensure LookupRids() replies arrays are range checked.Jeremy Allison2-0/+32
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10185 Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-12-05CVE-2013-4408:s3:Ensure LookupNames replies arrays are range checked.Jeremy Allison3-1/+145
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10185 Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org>
2013-12-05CVE-2013-4408:s3:ctdb_conn: add some length verification to ctdb_packet_more()Stefan Metzmacher1-0/+5
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10185 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-12-05CVE-2013-4408:s3:util_tsock: add some overflow detection to ↵Stefan Metzmacher1-0/+5
tstream_read_packet_done() Bug: https://bugzilla.samba.org/show_bug.cgi?id=10185 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2013-11-28smbd: Fix bug 10284Volker Lendecke1-69/+31
If we msg_read_send on a nonempty channel, we create one tevent_immediate. If we directly receive another message and from within the msg_read_send's tevent_req callback we immediately do another msg_read_send, we end up with two tevent_immediate events for msg_channel_trigger with just one incoming message. Test to follow. This patch simplifies msg_channel.c by removing the explicit immediate events. Instead, it relies on the implicit immediate event available via tevent_req_defer_callback. For messages received from tdb with a msg_read_send req pending, we directly finish that request without putting the message on the queue. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10284 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit 6b6920b02905661ae661a894e3bd8d2c744d7003) Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-1-test): Thu Nov 28 13:13:48 CET 2013 on sn-devel-104
2013-11-26s3-lib: Add grpname to talloc_sub_specified().Andreas Schneider1-6/+25
BUG: https://bugzilla.samba.org/show_bug.cgi?id=2191 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 6366ebb79bb72d9dcb12f8fe8d6e35611fcff150)
2013-11-22s3-lib: smbclient shows no error if deleting a directory with del failedJeremy Allison1-0/+42
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10260 Move dir_check_ftype() to util.c Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit fc611dd6e849537aa4817504275cdbf48f6f1e79)
2013-11-22smbd: Fix a talloc hierarchy problem in msg_channelVolker Lendecke1-1/+1
When tearing down a watch_send with an open tevent_immediate, we talloc_free the msg_channel while the tevent_immediate still references it. Don't make the tevent_immediate outlive the msg_channel. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10250 Signed-off-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 Nov 20 00:13:51 CET 2013 on sn-devel-104 (cherry picked from commit 2d91577f984bc83c2c87141cfdda87d068060b32)
2013-09-12dbwrap_ctdb: Treat empty records as non-existingVolker Lendecke2-0/+18
This is a patch implementing the workaround Christian mentioned in https://bugzilla.samba.org/show_bug.cgi?id=10008#c5 Bug: https://bugzilla.samba.org/show_bug.cgi?id=10008 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christian Ambach <ambi@samba.org> (cherry picked from commit 1cae59ce112ccb51b45357a52b902f80fce1eef1)
2013-08-30s3:lib: Factor read_ea_list_entry() and read_nttrans_ea_list() out so they ↵Jeremy Allison2-0/+162
can be used by the SMB2 client code. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit c80349e0fad7c182b0bddefed99a78d95323faca)
2013-08-30s3:lib/netapi: make use of lp_cli_maxprotocol()Stefan Metzmacher1-1/+1
https://bugzilla.samba.org/show_bug.cgi?id=9514 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 7e455e9ed2b298df6b735a89abdd75564375ef34)
2013-08-30s3:lib: remove unused interpret_protocol()Stefan Metzmacher1-25/+0
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 9188ee4ab195a18b1bd697bced8613f98a6a91d9)
2013-08-27Fix bug #10063 - source3/lib/util.c:1493 leaking memory w/ pam_winbind.so / ↵Jeremy Allison1-2/+4
winbind Don't use talloc_tos() in something that can be linked to in pam_winbindd.so Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Simo Sorce <idra@samba.org> Autobuild-User(master): Simo Sorce <idra@samba.org> Autobuild-Date(master): Sat Aug 24 02:28:28 CEST 2013 on sn-devel-104 (cherry picked from commit 9423d5afb71e272298f4858d82f436e19ee2b07f) Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-1-test): Tue Aug 27 11:36:39 CEST 2013 on sn-devel-104
2013-08-20s3:lib/system fix build on AIX 7Christian Ambach1-3/+12
AIX uses struct stat64 with struct timespec64, so direct assignment does not work any more. Pair-Programmed-With: Volker Lendecke <vl@samba.org> Signed-off-by: Christian Ambach <ambi@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Aug 2 09:47:43 CEST 2013 on sn-devel-104 (cherry picked from commit ba40d0d9d320e500621a6a8107a2ef0a34aeb6ba)
2013-08-07Add ea_list_has_invalid_name() function.Jeremy Allison1-0/+34
Invalid character list probed from Windows Server 2012. Bug 9992: Windows error 0x800700FE when copying files with xattr names containing ":" Signed-off-by: Jeremy Allison <jra@samba.org>
2013-07-15s3-lib: hide incomplete smbXsrv_tcon_global recordsStefan Metzmacher1-0/+13
Part of fix for bug #10003 Pair-programmed-with: Björn Baumbach <bb@sernet.de> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit c52e61f7ba215da28cbb7b8e328aea110ad79b11)
2013-07-15s3-lib: fix segf while reading incomplete session info (bug #10003)Björn Baumbach2-7/+17
Pair-programmed-with: Stefan Metzmacher <metze@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 53aa069b97070c73b782e2868b9b9686abe353cc)
2013-06-25s3:lib add mapping for ETXTBSYChristian Ambach1-0/+3
add ETXTBSY to the errno->STATUS conversion table. It will be mapped to STATUS_SHARING_VIOLATION Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2013-06-21s3:lib/util_sid_passdb make use of pdb_is_responsible_for_* functionsChristian Ambach1-15/+34
ask passdb to determine if sid/object should be handled by passdb or not Pair-Programmed-With: Michael Adam <obnox@samba.org> Signed-off-by: Christian Ambach <ambi@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
2013-06-18Re-add umask(0) code removed by commit 3a7c2777ee0de37d758fe81d67d6836a8354825eJeremy Allison1-2/+7
Without the umask code the pipe permissions are affected by the umask of the calling process. As only smbd currently sets its umask to zero (nmbd and winbindd should do the same) this causes the winbindd pipe to be unavailable to the nss library code unless winbindd is run from an init process that explicitly sets umask to zero. When testing from the command line this can be hard to track down :-). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ira Cooper <ira@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Jun 18 04:31:27 CEST 2013 on sn-devel-104
2013-06-18Fix xx_path() - return check from mkdir() is incorrect.Jeremy Allison1-3/+8
This is very old code, but mkdir() fails with -1, not 0. Only print the error message is mkdir failed with anything other than EEXIST. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
2013-06-14gencache: Simplify gencache_init a bitVolker Lendecke1-13/+16
Use the implicit cleanup facility CLEAR_IF_FIRST provides Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-06-11lib: Remove an unused variableVolker Lendecke1-1/+0
Signed-off-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 Jun 11 21:52:09 CEST 2013 on sn-devel-104
2013-06-03s3:lib/ctdb_packet use sys_send in packet_fd_writeChristian Ambach1-1/+1
use the signal safe variant here to prevent spurious errors when running with CTDB and a signal comes in Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Christian Ambach <ambi@samba.org> Autobuild-Date(master): Mon Jun 3 20:01:22 CEST 2013 on sn-devel-104
2013-05-28Remove lib/netapi autoconf build system, this is now build with wafAndrew Bartlett2-421/+0
Reviewed-by: Jelmer Vernooij <jelmer@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-05-18swat: Remove swat.Kai Blin1-10/+0
Signed-off-by: Kai Blin <kai@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Kai Blin <kai@samba.org> Autobuild-Date(master): Sat May 18 16:32:38 CEST 2013 on sn-devel-104
2013-05-17s3:lib/ctdb_conn make sure we are root before connecting to CTDBChristian Ambach1-1/+14
CTDB socket is only reachable for root, make sure we are root when trying to connect to it Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Christian Ambach <ambi@samba.org> Autobuild-Date(master): Fri May 17 13:16:37 CEST 2013 on sn-devel-104
2013-05-17lib: Add before/after hooks to async_connectVolker Lendecke2-3/+3
This will facilitiate [un]become_root for smbd to connect safely to ctdbd. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christian Ambach <ambi@samba.org>
2013-05-16s3:lib/dbwrap add missing curly bracesChristian Ambach1-2/+4
violation of README.Coding Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>