1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-15 23:24:37 +03:00

5040 Commits

Author SHA1 Message Date
Jeremy Allison
a4e8210ba7 Fix bug #7155 - valgrind Conditional jump or move depends on uninitialised value(s) error when "mangling method = hash"
The charset array allocated in init_chartest() is allocated
by MALLOC, but only some elements of it being set after allocation. Fix is to
memset to zero after allocation.

Jeremy.
2010-02-18 12:21:10 -08:00
Jeremy Allison
df13b1303a Fix bug #7154 - mangling method = hash can crash storing a name not containing a '.'
Fix use of uninitialized variable. This can lead to crashes if
mangling = hash processes names with no '.'.

Jeremy.
2010-02-18 11:22:44 -08:00
Jeremy Allison
5564e7147f Fix bug #6557 - Do not work VFS full_audit
Re-arrange the operations order so SMB_VFS_CONNECT is done
first as root (to allow modules to correctly initialize themselves).

Reviewed modules to check if they needed CONNECT invoked as
a user (which we previously did) and it turns out any of them
that cared needed root permissions anyway.

Jeremy.
2010-02-17 11:13:35 -08:00
Volker Lendecke
8aef63d243 s3: Fix bug 7139
To provide the user with the same SID when doing Kerberos logins, attempt to do
a make_server_info_sam instead of a make_server_info_pw.
2010-02-17 11:32:30 +01:00
Andrew Tridgell
3f0898a9f5 s3-smbd: convert lanman and notify code to TYPESAFE_QSORT() 2010-02-14 18:44:21 +11:00
Volker Lendecke
ece99c763a s3: Fix a C++ warning 2010-02-13 13:24:59 +01:00
Jeremy Allison
9252df53d9 Use sec_initial_uid() in the places where being root doesn't matter,
and 0 in the places where it does.

Jeremy
2010-02-12 23:18:53 -08:00
Jeremy Allison
d46d7717c7 Simplify the logic in make_connection_snum(), and make it match Windows behavior.
Cause all exit paths to go through one place, where all cleanup is
done. change_to_root_user() for pathname operations that should succeed if
the path exists, even if the connecting user has no access.

For example, a share can now be defined with a path of /root/only/access
(where /root/only/access is a directory path with all components only
accessible to root e.g. root owned, permissions 700 on every component).
Non-root users will now correctly connect, but get ACCESS_DENIED on
all activities (which matches Windows behavior). Previously, non-root
users would get NT_STATUS_BAD_NETWORK_NAME on doing a TConX to this
share, even though it's a perfectly valid share path (just not accessible
to them).

This change was inspired by the research I did for bug #7126, which
was reported by bepi@adria.it.

As this is a change in a core function, I'm proposing to leave
this only in master for 3.6.0, not back-port to any existing releases.
This should give us enough time to decide if this is the way we want this to
behave (as Windows) or if we prefer the previous behavior.

Jeremy.
2010-02-12 22:45:37 -08:00
Steven Danneman
cb0ea27369 s3/smbd: change locking behavior when "lock spin time = 0".
The "lock spin time" parameter mimics the following Windows
setting which by default is 250ms in Windows and 200ms in Samba.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\LockViolationDelay

When a client sends repeated, non-blocking, contending BRL requests
to a Windows server, after the first Windows starts treating these
requests as timed blocking locks with the above timeout.

As an efficiency, I've changed the behavior when this setting is 0,
to skip this logic and treat all requests as non-blocking locks.

This gives the smbd server behavior similar to the 3.0 release with
the do_spin_lock() implementation.

I've also changed the blocking lock parameter in the call from
push_blocking_lock_request() to true as all requests made in this
path are blocking by definition.
2010-02-12 21:29:00 -08:00
Jeremy Allison
465ffbadb8 Remove #if SOFTLINK_OPTIMIZATION code.
This hasn't been turned on or been capable of doing so for
many years now. Makes this jumbo function smaller...
Jeremy.
2010-02-12 18:50:54 -08:00
Jeremy Allison
1f89ffd035 Revert "Fix bug #7126 - [SMBD] With access denied error smbd return wrong NT_STATUS_OBJECT_PATH_INVALID error"
This reverts commit 2fdd8b10c6abadd27c579e772c0482214d2363a5.

This fix is incorrect. The original code works as desired,
I made a mistake here.

Jeremy.
2010-02-12 18:17:32 -08:00
Jeremy Allison
2fdd8b10c6 Fix bug #7126 - [SMBD] With access denied error smbd return wrong NT_STATUS_OBJECT_PATH_INVALID error
As tridge's comment says, we should be ignoring ACCESS_DENIED
on the share path in a TconX call, instead allowing the mount
and having individual SMB calls fail (as Windows does). The
original code erroneously caught SMB_VFS_STAT != 0 and errored
out on that.

Jeremy.
2010-02-12 15:45:20 -08:00
Volker Lendecke
44f75eded1 s3: notify_onelevel does not use seqnums, so don't open asking for it 2010-02-12 12:08:22 +01:00
Jeremy Allison
9fc76f86fa Remove the code replaced by widelinks warning.
Jeremy.
2010-02-11 15:59:41 -08:00
Jeremy Allison
a6f402ad87 Remove lp_safe_widelinks() -> convert to just lp_widelinks. Suggestion from Volker.
Create widelinks_warning(int snum) to cover the message needed in make_connection.

Jeremy.
2010-02-11 15:16:23 -08:00
Jeremy Allison
02a5078f1f Final part of jumbo patch for bug #7104 - "wide links" and "unix extensions" are incompatible.
Volker pointed out that the preexec scripts get passed the conn->connectpath
as a parameter, so call canonicalize_connect_path() both *before* and after
the preexec scripts. Ignore errors on the call before the preexec scripts,
as the path may not exist until created by the preexec scripts.

Jeremy.
2010-02-11 14:45:53 -08:00
Simo Sorce
5d92d969dd Introduce lp_safe_widelinks()
This way we avoid any chance that a configuration reload may turn
back on wide links when unix extensions are enabled.
2010-02-11 16:27:17 -05:00
Jeremy Allison
94865e4dbd Fine changes to previous fix for bug #7104 - "wide links" and "unix extensions" are incompatible.
Make sure we match the previous allow widelinks behavior, in that
non-root preexec scripts can create share directories for a share
definition.

Jeremy
2010-02-11 11:00:45 -08:00
Jeremy Allison
cd18695fc2 Suplementary patch for bug #7104 - "wide links" and "unix extensions" are incompatible.
Bug reported by Ralf Zimmermann <r.zimmermann@siegnetz.de>. Reproduced by jra.

If the target directory of a share doesn't exist, but is designed to
be created by a "root preexec" script call, then the widelinks check
is done too early - thus preventing the user from connecting to the
share.

Fix is to re-arrange the order of checks in make_connection_snum()
to always do the following order of operations:

(1). Turn off wide links if unix extensions = yes.
(2). Call any root preexec scripts.
(3). Canonicalize the share path to remove any symlinks (ie. end
up with the realpath in the connection_struct).

Jeremy.
2010-02-11 10:19:33 -08:00
Andrew Tridgell
13ac4ad521 s3-smbd: update to use new DLIST macros
(cherry picked from commit 365b408c458c848a818637d9b36a0423aeb1ba54)
2010-02-10 15:43:49 -08:00
Jeremy Allison
8ddc977c14 Fix bug #7122 - Reading a large browselist fails (server returns invalid values in subsequent SMBtrans replies)
There are two problems:

1). The server is off-by-one in the end of buffer space test.
2). The server returns 0 in the totaldata (smb_vwv1) and totalparams (smb_vwv0)
fields in the second and subsequent SMBtrans replies.

This patch fixes both.

Jeremy.
2010-02-09 15:14:38 -08:00
Stefan Metzmacher
bc8242a08e s3:smbd: use StrCaseCmp() instead of strcasecmp
metze
2010-02-09 18:59:16 +01:00
Stefan Metzmacher
1686a5e7e7 s3:smbd: Fix really ugly bool vs. int bug!!!
A comparison function for qsort needs to return an 'int'!
Otherwise you'll get random results depending on the compiler
and the architecture...

metze
2010-02-09 18:59:15 +01:00
Stefan Metzmacher
30eec0656c s3:smbd: implement api_RNetServerEnum3
This is needed to support large browse lists.

metze
2010-02-08 18:47:41 +01:00
Stefan Metzmacher
495ac46166 s3:smbd: add/improve some DEBUG messages in api_RNetServerEnum2()
metze
2010-02-08 18:46:57 +01:00
Stefan Metzmacher
dc58672c65 s3:smbd: rename api_RNetServerEnum => api_RNetServerEnum2
metze
2010-02-08 18:35:12 +01:00
Jeremy Allison
b93f07ef41 Fix trailing whitespace errors I added (sorry).
Jeremy.
2010-02-05 22:51:11 -08:00
Andrew Tridgell
dd498d2eec s3-smbd: add a rate limited cleanup of brl, connections and locking db
On unclean shutdown we can end up with stale entries in the brlock,
connections and locking db. Previously we would do the cleanup on
every unclean exit, but that can cause smbd to be completely
unavailable for several minutes when a large number of child smbd
processes exit.

This adds a rate limited cleanup of the databases, with the default
that cleanup happens at most every 20s
2010-02-05 22:17:32 -08:00
Andrew Tridgell
74267d6524 s3-brlock: we don't need these MSG_SMB_UNLOCK calls now
These have been replaced with the min timeout in blocking.c
2010-02-05 22:17:26 -08:00
Andrew Tridgell
5b398edbee s3-brlock: add a minimim retry time for pending blocking locks
When we are waiting on a pending byte range lock, another smbd might
exit uncleanly, and therefore not notify us of the removal of the
lock, and thus not trigger the lock to be retried.

We coped with this up to now by adding a message_send_all() in the
SIGCHLD and cluster reconfigure handlers to send a MSG_SMB_UNLOCK to
all smbd processes. That would generate O(N^2) work when a large
number of clients disconnected at once (such as on a network outage),
which could leave the whole system unusable for a very long time (many
minutes, or even longer).

By adding a minimum re-check time for pending byte range locks we
avoid this problem by ensuring that pending locks are retried at a
more regular interval.
2010-02-05 22:17:17 -08:00
Jeremy Allison
fac6d5212b Remove now unused variable.
Jeremy.
2010-02-05 16:20:34 -08:00
Jeremy Allison
bd269443e3 Fix bug 7104 - "wide links" and "unix extensions" are incompatible.
Change parameter "wide links" to default to "no".
Ensure "wide links = no" if "unix extensions = yes" on a share.
Fix man pages to refect this.

Remove "within share" checks for a UNIX symlink set - even if
widelinks = no. The server will not follow that link anyway.

Correct DEBUG message in check_reduced_name() to add missing "\n"
so it's really clear when a path is being denied as it's outside
the enclosing share path.

Jeremy.
2010-02-05 15:20:18 -08:00
Jeremy Allison
86bf5eac67 Add debug to make it clear when EA dosmode set is invoked.
Jeremy.
2010-02-01 19:21:35 -08:00
Jeremy Allison
f3ee1516e6 Fix bug #7084 - Create time on directories not stored properly in an EA in new create time code.
Remove erroneous optimisation that caused no EA to be set
if calculated btime matched st_ex btime, and calculated DOS
attribute matched existing file attribute.

Jeremy.
2010-02-01 18:50:43 -08:00
Jeremy Allison
4e08d0d0d6 Arg. Got the sense of the test reversed to fix bug #7080 - Quota only shown when logged as root.. Doh !
Jeremy.
2010-02-01 15:57:16 -08:00
Jeremy Allison
b3009819c5 Fix bug #7080 - Quota only shown when logged as root.
conn->server_info->utok.uid == 0

isn't the correct check to see if we're root anymore. As rpc_samr_nt.c does,
the correct check is :

geteuid() == sec_initial_uid()

Jeremy.
2010-02-01 15:55:55 -08:00
Steven Danneman
f42971c520 s3/smbd: Fix string buffer overflow causing heap corruption
The destname malloc size was not taking into account the 1 extra byte
needed if a string without a leading '/' was passed in and that slash
was added.

This would cause the '\0' byte to be written past the end of the
malloced destname string and corrupt whatever heap memory was there.

This problem would be hit if a share name was given in smb.conf without
a leading '/' and if it was the exact size of the allocated STRDUP memory
which in some implementations of malloc is a power of 2.
2010-01-30 13:38:31 -08:00
Jeremy Allison
899bd0005f Fix bug #7067 - Linux asynchronous IO (aio) can cause smbd to fail to respond to a read or write.
Only works on Linux kernels 2.6.26 and above. Grants CAP_KILL capability
to allow Linux threads under different euids to send signals to each other.

Jeremy.
2010-01-26 16:51:57 -08:00
Jeremy Allison
1e2e92f54d Correct fix for unused variable return from ndr_decode. Use it :-).
Jeremy.
2010-01-25 17:38:55 -08:00
Jeremy Allison
2fff1e13f1 Revert "s3: remove unused Variable"
This reverts commit 9536d94d5478b63fc05047964b40d8786a7246c4.

Bjorn, your change removed the ndr_decoding of the dos attribute.
Not a good idea :-).

Jeremy.
2010-01-25 17:06:54 -08:00
Björn Jacke
9536d94d54 s3: remove unused Variable
Jeremy, please check!
2010-01-26 00:19:10 +01:00
Volker Lendecke
8905b599b4 s3: Fix some nonempty blank lines 2010-01-23 14:35:37 +01:00
Volker Lendecke
9b4b9d26f1 s3: Initialize the seqnum in "init_smb_request"
This makes it a bit more obvious for me that the signing sequence number is
tied to the SMB request.
2010-01-21 14:08:27 +01:00
Volker Lendecke
33e397f9fd s3: Make "init_smb_request" static to process.c 2010-01-21 14:08:27 +01:00
Volker Lendecke
41a350f17e s3: Fix a typo 2010-01-19 16:53:11 +01:00
Volker Lendecke
7d04c0fcfd s3: Remove a comment from ancient times that no longer applies 2010-01-19 14:20:07 +01:00
Volker Lendecke
aa362e8e68 s3: Protect against an invalid bcc in SMBsendtxt 2010-01-17 17:26:39 +01:00
Jeremy Allison
33ee8b5a4e Make file access control decisions a lot easier to debug (at level 10).
Jeremy.
2010-01-12 21:06:09 -08:00
Jeremy Allison
105f876eb4 Fix bug #7033 - SMBrmdir call always returns true, even on failure to delete a directory.
Argh. Missed the second (and essential) part of the fix for the above :-(.

Jeremy
2010-01-12 16:55:31 -08:00
Jeremy Allison
ce8dcbe91b Fix bug #7033 - SMBrmdir call always returns true, even on failure to delete a directory.
There is a codepath missing to propagate back error returns from the rmdir
POSIX call inside close_directory when delete on close is set. This means doing
an rmdir on a Windows command line will always report success, even when the
directory was not deleted. This fix adds that codepath back into Samba.

Jeremy.
2010-01-12 16:50:40 -08:00