summaryrefslogtreecommitdiffstats
path: root/source3/lib
Commit message (Collapse)AuthorAgeFilesLines
* system: add hole punch support to sys_fallocate()David Disseldorp2015-03-091-2/+9
| | | | | | | | If Samba is configured with FALLOC_FL_PUNCH_HOLE support, then allow sys_fallocate() to propogate the flag to syscall invocation. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3/vfs: change fallocate mode flags from enum->uint32_tDavid Disseldorp2015-03-091-10/+11
| | | | | | | | | | | | | | | | | | | | The Linux fallocate syscall offers a mode parameter which can take the following flags: FALLOC_FL_KEEP_SIZE FALLOC_FL_PUNCH_HOLE (since 2.6.38) FALLOC_FL_COLLAPSE_RANGE (since 3.15) FALLOC_FL_ZERO_RANGE (since 3.14) The flags are not exclusive, e.g. FALLOC_FL_PUNCH_HOLE must be specified alongside FALLOC_FL_KEEP_SIZE. Samba currently takes a vfs_fallocate_mode enum parameter for the VFS fallocate hook, taking either an EXTEND_SIZE or KEEP_SIZE value. This commit changes the fallocate hook such that it accepts a uint32_t flags parameter, in preparation for PUNCH_HOLE and ZERO_RANGE support. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/system: remove useless HAVE_LINUX_FALLOCATE64 logicDavid Disseldorp2015-03-091-3/+1
| | | | | Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Fix CID 1273292 Uninitialized pointer readVolker Lendecke2015-03-041-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* lib: Fix CID 1273056 Negative array index readVolker Lendecke2015-03-041-1/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* lib: Fix CID 1128561 Pointer to local outside scopeVolker Lendecke2015-03-041-2/+3
| | | | | | | | This is not strictly a bug, but it is confusing enough to justify a small patch I guess. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* Fix whitespaceVolker Lendecke2015-03-041-4/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* lib: Fix CID 1128552 Buffer not null terminatedVolker Lendecke2015-03-041-6/+8
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: David Disseldorp <ddiss@samba.org>
* Fix the O3 developer buildVolker Lendecke2015-03-033-5/+5
| | | | | | | | | | Different gcc versions complain at different places Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Mar 3 13:14:53 CET 2015 on sn-devel-104
* lib: Fix talloc hierarchy in init_lsa_ref_domain_listVolker Lendecke2015-02-271-1/+5
| | | | | | | The sid is copied, so the name should also be copied. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Move "iov_buf.[ch]" to lib/utilVolker Lendecke2015-02-247-125/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Use talloc_report_strVolker Lendecke2015-02-131-76/+8
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging4: Use messages_dgmVolker Lendecke2015-02-131-1/+1
| | | | | | | | | | | | | This replaces the transport mechanism in source4 with calls to the messages_dgm code. It is supposed to enable "smbcontrol samba pool-usage" as an example without having to rewrite smbcontrol using the source4 based messaging subsystem. This moves the source3 based names.tdb (which is unused so far) to the lock directory, source4 does not have a cache directory. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging3: Use message_hdr_[put|get]Volker Lendecke2015-02-131-32/+16
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging: Define a binary format for message headersVolker Lendecke2015-02-132-0/+74
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messaging3: Use messaging_dgm_refVolker Lendecke2015-02-131-11/+15
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib: Add messages_dgm_ref.[ch]Volker Lendecke2015-02-132-0/+158
| | | | | | | | | | | | | | | We only have one messaging_dgm context per process. But we will use this from two completely independent messaging subsystems which are independently initialized. We need to coordinate creation and destruction, do this via talloc. I know this looks like a step back, but when in the future we have really just one messaging subsystem, this can go again. My immediate goal is to make source3 and source4 transport-compatible, and this looks like a quick way towards that goal. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messages_dgm: Add a few #includesVolker Lendecke2015-02-131-0/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* unix_msg: remove cookie from unix_msg_initVolker Lendecke2015-02-136-16/+9
| | | | | | | | | | | | "pid" and "sock" are sufficient I guess as randomizers to distinguish messages. In theory, a pid could be recycled very quickly, which might mix up in-flight messages. But once a few messages have passed, "cookie" would be incremented as another indicator of a fresh message. Why? Remove messages_dgm dependency on samba-util Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messages_dgm: Move directory handling upVolker Lendecke2015-02-133-104/+98
| | | | | | | | | | | | | When we want to use messages_dgm in source4, we need to find better places for the lock and socket directories. Source4 does not have the concept of a cache directory. So I chose "private dir"/sock and "lock dir"/msg as subdirectories. This moves directory creation from messages_dgm.c to messages.c, source4/lib/messaging will have its own way of doing this. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* messages_dgm: Only pass "unique" to messaging_dgm_initVolker Lendecke2015-02-133-8/+8
| | | | | | | | We have only one context per pid, so messaging_dgm_init can do getpid() itself. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* lib: Fix a typoVolker Lendecke2015-02-101-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Update mailing list references to point at lists.samba.orgAndrew Bartlett2015-02-101-1/+1
| | | | | | | | | | | | The mailing lists are on lists.samba.org, but there are many references that use the shorthand of samba.org Some references to samba@ have been changed to samba-technical@ where this make more sense. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Feb 10 07:08:28 CET 2015 on sn-devel-104
* gencache: don't fail gencache_stabilize if there were records to delete.Michael Adam2015-02-091-1/+1
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3-util: Fix authentication with long hostnames.Andreas Schneider2015-01-121-1/+3
| | | | | | | | | | | | | If the hostname is longer than MAX_NETBIOSNAME_LEN we fail to correctly check the hostname. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11008 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Jan 12 23:10:30 CET 2015 on sn-devel-104
* smbd: Make talloc_report of smb_filename more readableVolker Lendecke2015-01-111-0/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Simplify iov_bufVolker Lendecke2015-01-091-2/+2
| | | | | | | | | | | | | | According to https://www.securecoding.cert.org/confluence/display/seccode/INT30-C.+Ensure+that+unsigned+integer+operations+do+not+wrap we only need to check against one operand. 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): Fri Jan 9 23:42:49 CET 2015 on sn-devel-104
* unix_msg: Fix 80-line formattingVolker Lendecke2015-01-091-2/+4
| | | | | | | | This is pretty fresh code, so hope this change does not fall under the "no reformatting" rule yet Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* fixup: check for NULL pointersRalph Boehme2015-01-071-2/+2
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Use msghdr_prep_recv_fds in unix_msgVolker Lendecke2015-01-061-7/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Add msghdr_prep_recv_fdsVolker Lendecke2015-01-062-0/+22
| | | | | | | | This will prepare a msghdr for receiving fd's. Same pattern as before: First get the buffer size, then fill in msghdr. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Use msghdr_extract_fds in unix_msgVolker Lendecke2015-01-061-56/+19
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Add msghdr_extract_fdsVolker Lendecke2015-01-062-0/+30
| | | | | | | | | This is a copy of the extract_fd_array_from_msghdr routine in unix_msg.c, with a similar use pattern: First call it without an output array to get the length and then call it a second time to actually fill in the array. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Use msghdr in unix_msgVolker Lendecke2015-01-062-121/+60
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Add msghdr.[ch]Volker Lendecke2015-01-062-0/+165
| | | | | | | | | | | | | | | | | | | | This is a little set of routines to deal with the ugly fd-passing macros. This patch is the first step assisting the creation of msghrds for sending fds. Receiving fd helpers will follow later. The basic idea behind these routines is that they fill a variable-sized buffer. They are supposed to be called twice per msghdr preparation. First with a 0-sized NULL output buffer to calculate the required bufsize, and then a second time filling in the buffer as such. This does not take care of the old msg_accrights way of passing file descriptors. CMSG/SCM_RIGHTS is standardized for quite a while now, and I believe this intreface can be made to also take care of msg_accrights if needed. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: unix_dgram_msg does not need "num_fds"Volker Lendecke2015-01-061-2/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Fix a commentVolker Lendecke2014-12-301-3/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Use iov_advance in write_data_iovVolker Lendecke2014-12-301-16/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add iov_advanceVolker Lendecke2014-12-302-0/+35
| | | | | | | This chops off n bytes from an iovec array. Used for short writev's Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: iov_buf does not need talloc.h anymoreVolker Lendecke2014-12-301-1/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Use talloc_memdup in messaging_rec_dupVolker Lendecke2014-12-281-2/+1
| | | | | | | | 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): Sun Dec 28 04:20:48 CET 2014 on sn-devel-104
* Fix a comment to indicate that TALLOC_FREE must be used to free an allocated ↵Richard Sharpe2014-12-261-1/+1
| | | | | | | | | | array of strings. Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri Dec 26 22:54:51 CET 2014 on sn-devel-104
* s3:lib: fix allocation check in messages_ctdbd.cStefan Metzmacher2014-12-171-1/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* lib: Add ctdbd_messaging_send to ctdb_dummy.cVolker Lendecke2014-12-161-0/+7
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging3: Add messaging_handler_send/recvVolker Lendecke2014-12-161-0/+81
| | | | | | | | | This repeatedly listens on msg_type. It's similar to messaging_register with talloc based autocleanup. The handler is free to talloc_move a way the record for later use. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging3: Add messaging_send_iov_fromVolker Lendecke2014-12-161-10/+20
| | | | | | | In the notifyd code it will be very helpful to fake source server_ids Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* messaging3: Add messaging_names_dbVolker Lendecke2014-12-161-0/+19
| | | | | | | | This will enable messaging3 users to more easily register themselves under a name Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* netapi: Move DC check to NetJoinDomain() where it is needed.Andrew Bartlett2014-12-111-0/+4
| | | | | | | | | | This partially reverts 15f6e27bd5a9065c8b781fa21f5989ce2c355776. BUG: https://bugzilla.samba.org/show_bug.cgi?id=10891 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
* lib: Use iov_buf in unix_msgVolker Lendecke2014-12-092-24/+3
| | | | | | | Now that iov_buf does not pull in talloc we can use it Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Simplify iov_buf[len]Volker Lendecke2014-12-093-31/+30
| | | | | | | This makes iov_buf independent of talloc Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>