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

265 Commits

Author SHA1 Message Date
Jeremy Allison
4800ed3595 s3: VFS: Protect errno if sys_getwd() fails across free() call.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13069

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-10-04 10:06:15 +02:00
Jeremy Allison
fb9ce0685e s3: VFS: Ensure sys_getwd() doesn't leak memory on error on really old systems.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13069

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-10-04 10:06:15 +02:00
Volker Lendecke
ab132ba7e5 configure: Centralize check for posix_fallocate
This checks for posix_fallocate unless we are sitting on an ancient glibc.
With this we don't need HAVE_BROKEN_POSIX_FALLOCATE anymore,
HAVE_POSIX_FALLOCATE will only be defined if we have a valid [g]libc.

./configure tested on Debian, FreeBSD (which does have posix_fallocate) and
OpenBSD (which does not have posix_fallocate). Also tested with changing the
not have an old-enough glibc around. All did the right thing.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-08-24 01:46:08 +02:00
Jeremy Allison
60af864f75 s3:lib: Fix incorrect logic in sys_broken_getgroups()
If setlen == 0 then the second argument must be ignored.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2017-04-18 11:47:17 +02:00
Volker Lendecke
908df8ec13 lib: Extract sys_popen()
This was added by Jeremy with 3cf31a194f, do the (C) accordingly

sys_popen is a pretty isolated functionality, and I'd like to use it
soon without "includes.h", needed by "proto.h"

Except for one malloc->talloc this is supposed to be a 1:1 copy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-23 22:03:16 +01:00
Volker Lendecke
8338fe6ac8 lib: Remove sys_waitpid
We have waitpid in libreplace

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2016-02-23 22:03:16 +01:00
Uri Simchoni
c6ed45fe71 s3-lib: introduce sys_realpath()
Add sys_realpath() function that captures the OS variations
on realpath().

Signed-off-by: Uri Simchoni <uri@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-01-27 00:22:22 +01:00
Richard Sharpe
dffe228283 Convert all uint32/16/8 to _t in source3/lib.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-13 19:11:23 +02:00
Richard Sharpe
2224796fc3 Change all uses of uint32/16/8 in proto.h to uint32_t/16_t/8_t.
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-04-29 23:42:20 +02:00
David Disseldorp
47f15b14ae system: add hole punch support to sys_fallocate()
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>
2015-03-09 21:27:07 +01:00
David Disseldorp
12c0b6bf40 s3/vfs: change fallocate mode flags from enum->uint32_t
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>
2015-03-09 21:27:07 +01:00
David Disseldorp
3787119eb8 lib/system: remove useless HAVE_LINUX_FALLOCATE64 logic
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-09 21:27:07 +01:00
Volker Lendecke
97b2570a5e lib: Split out sys_[read|write] & friends
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-12-07 00:12:07 +01:00
Volker Lendecke
fb9067c789 Remove a few #ifdef EWOULDBLOCk
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-09-18 20:36:11 +02:00
Jeremy Allison
d77a74237e s3: nmbd: Fix bug 10633 - nmbd denial of service
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

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-06-25 01:33:13 +02:00
Abhidnya Joshi
47175f5760 s3: Add DAC_OVERRIDE capability support
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2013-12-16 10:11:03 -07:00
David Disseldorp
c7762042ba debug: remove unused sys_adminlog
printing.c was the last user of this syslog wrapper.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Nov 20 10:19:32 CET 2013 on sn-devel-104
2013-11-20 10:19:32 +01:00
Christian Ambach
ba40d0d9d3 s3:lib/system fix build on AIX 7
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
2013-08-02 09:47:43 +02:00
Jeremy Allison
7a4dd84595 Remove dependency on detection of HAVE_DIRFD for use of fdopendir().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Apr 12 16:21:10 CEST 2013 on sn-devel-104
2013-04-12 16:21:09 +02:00
Michael Adam
2172a1448e s3: in sys_popen(), add a debug message for failed fork
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Tue Sep  4 22:17:30 CEST 2012 on sn-devel-104
2012-09-04 22:17:30 +02:00
Michael Adam
c1b703f95c s3: in sys_popen(), add a debug message for failed extract_args() 2012-09-04 20:39:21 +02:00
Michael Adam
6c7df39fee s3: in sys_popen(), untangle function call from result check 2012-09-04 20:39:20 +02:00
Michael Adam
1d4fe78db9 s3: in sys_popen(), untangle assigment from check and add a debug message in failure case 2012-09-04 20:39:20 +02:00
Michael Adam
d43c411fb1 s3: in sys_popen(), improve call to pipe and report error to debug 2012-09-04 20:39:20 +02:00
Michael Adam
243157ae34 s3: in sys_popen(), validate input before opening the pipe. 2012-09-04 20:39:20 +02:00
Michael Adam
e7d385c366 s3: in sys_popen(), fix a debug message 2012-09-04 20:39:20 +02:00
Michael Adam
c35bdb34da s3: add a debug message for failed execv in sys_popen()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-08-17 20:07:07 +02:00
Volker Lendecke
9dc78c90f3 s3-aio: Remove unused VFS functions and more
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:45:58 -07:00
Volker Lendecke
f9df073a31 s3: Make smbd/aio.c not depend on aio.h anymore
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:40:35 -07:00
Jeremy Allison
821bd95156 Replace all uses of setXX[ug]id() and setgroups with samba_setXX[ug]id() calls.
Will allow thread-specific credentials to be added by modifying
the central definitions. Deliberately left the setXX[ug]id()
call in popt as this is not used in Samba.
2012-06-28 17:15:16 -07:00
Stefan Metzmacher
e89150597a Revert "s3-lib Remove unused sys_fcntl_long()"
This reverts commit 846a697e20.

This is still used in source3/smbd/oplock_irix.c

metze
2012-06-19 17:04:29 +02:00
Andrew Bartlett
d2f6d0ba1e build: Rationalise AIO support in configure, ensure on by default
With this change, the define to check for AIO is HAVE_AIO, consistant
with other subsystems.

It is now also on by default in the autoconf build, as it has been for waf.

Andrew Bartlett
2012-06-06 08:23:10 +02:00
Andrew Bartlett
c290cdb934 lib/replace: xattr wrappers in lib/replace rather than source3/lib/system.c
This also moves all the still-used configure tests etc.  The unused OSF API
is also removed at this time.

Andrew Bartlett
2012-06-02 02:13:49 +02:00
Andrew Bartlett
6aa12fcb30 build: Remove SMB_OFF_T, replace with off_t
Now that we always require a 64 bit off_t, we no longer need SMB_OFF_T.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Fri Apr  6 01:47:43 CEST 2012 on sn-devel-104
2012-04-06 01:47:43 +02:00
Andrew Bartlett
19eee33d82 s3-vfs: Remove unused lremovexattr call from VFS modules, system.c and configure
If this is ever needed again, it would be more appropriate as an options argument
to removexattr.

Andrew Bartlett
2012-04-05 13:39:01 +10:00
Andrew Bartlett
c70ac29c54 s3-vfs: Remove unused lsetxattr call from VFS modules, system.c and configure
If this is ever needed again, it would be more appropriate as an options argument
to listxattr.

Andrew Bartlett
2012-04-05 13:39:00 +10:00
Andrew Bartlett
c5b17c5555 s3-vfs: Remove unused llistxattr call from VFS modules, system.c and configure
If this is ever needed again, it would be more appropriate as an options argument
to listxattr.

Andrew Bartlett
2012-04-05 13:39:00 +10:00
Andrew Bartlett
b2f7cfa848 s3-vfs: Remove unused lgetxattr call from VFS modules, system.c and configure 2012-04-05 13:39:00 +10:00
Andrew Bartlett
f6e0532024 build: Remove SMB_STRUCT_DIR define 2012-04-05 02:39:09 +02:00
Andrew Bartlett
6edd8e95f1 build: Remove sys_rewinddir wrapper 2012-04-05 02:39:09 +02:00
Andrew Bartlett
3e8a6e5760 build: Remove sys_closedir wrapper 2012-04-05 02:39:09 +02:00
Andrew Bartlett
ecc822faf8 build: Remove sys_telldir wrapper 2012-04-05 02:39:09 +02:00
Andrew Bartlett
900473a45b build: Remove sys_seekdir wrapper 2012-04-05 02:39:09 +02:00
Andrew Bartlett
afdb78075c build: Remove sys_readdir wrapper 2012-04-05 02:39:09 +02:00
Andrew Bartlett
fe526bb32b build: Remove sys_opendir wrapper 2012-04-05 02:39:09 +02:00
Andrew Bartlett
b74fe73a6f build: Remove sys_fopen wrapper 2012-04-05 02:39:08 +02:00
Andrew Bartlett
d166b79852 build: Remove sys_open wrapper 2012-04-05 02:39:08 +02:00
Andrew Bartlett
9cc056e567 build: Remove sys_creat wrapper 2012-04-05 02:39:08 +02:00
Andrew Bartlett
ced1f61ec1 build: Remove fallback call to sys_open as HAVE_CREAT is not actually checked for 2012-04-05 02:39:08 +02:00
Andrew Bartlett
7fa1b878c1 build: Remove sys_ftell wrapper 2012-04-05 02:39:08 +02:00