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

425 Commits

Author SHA1 Message Date
Jelmer Vernooij
c0288e0612 lib/util: Remove obsolete sys_getpid() and sys_fork().
The performance of these is minimal (these days) and they can return
invalid results when used as part of applications that do not use
sys_fork().

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Mar 24 21:55:41 CET 2012 on sn-devel-104
2012-03-24 21:55:40 +01:00
Volker Lendecke
1cc7abf8aa s3: Remove the sys_notify dependency from notify_internal
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Mar 23 12:12:51 CET 2012 on sn-devel-104
2012-03-23 12:12:51 +01:00
Volker Lendecke
f3fe53668f s3: Move the notify_ctx to the smbd_server_connection
We only need one notify_ctx per smbd. The notify_array can become quite large.
It's based on absolute paths, so there's no point in having a copy of the
complete array in memory multiple times.

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Wed Mar 21 14:26:07 CET 2012 on sn-devel-104
2012-03-21 14:26:06 +01:00
Volker Lendecke
7dcc2bf7af s3: Remove "conn" param from notify_init() 2012-03-21 12:52:10 +01:00
Volker Lendecke
81ec0cc602 s3: Remove the separate server_id arg to notify_init
The server_id is tied to the messaging_context

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-03-15 11:00:24 +01:00
Andrew Bartlett
2c7d77c77f s3-smbd: vuser and session_info cannot be NULL here
The callers always supply it. (this is a hold-over from the
security=share removal).

Andrew Bartlett
2012-03-04 23:33:05 +01:00
Andrew Bartlett
d7bb961859 s3-auth: Remove security=share (depricated since 3.6).
This patch removes security=share, which Samba implemented by matching
the per-share password provided by the client in the Tree Connect with
a selection of usernames supplied by the client, the smb.conf or
guessed from the environment.

The rationale for the removal is that for the bulk of security=share
users, we just we need a very simple way to run a 'trust the network'
Samba server, where users mark shares as guest ok.  This is still
supported, and the smb.conf options are documented at
https://wiki.samba.org/index.php/Public_Samba_Server

At the same time, this closes the door on one of the most arcane areas
of Samba authentication.

Naturally, full user-name/password authentication remain available in
security=user and above.

This includes documentation updates for username and only user, which
now only do a small amount of what they used to do.

Andrew Bartlett

                       --------------
                      /              \
                     /      REST      \
                    /        IN        \
                   /       PEACE        \
                  /                      \
                  |      SEC_SHARE       |
                  |    security=share    |
                  |                      |
                  |                      |
                  |       5 March        |
                  |                      |
                  |        2012          |
                 *|     *  *  *          | *
        _________)/\\_//(\/(/\)/\//\/\///|_)_______
2012-03-04 23:33:05 +01:00
Jeremy Allison
6081fabe7e Fix problem reported by Tom Lee <tlee2951@gmail.com> - when calculating
the share security mask, take priviliges into account for the connecting
user.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Tue Feb 28 20:21:26 CET 2012 on sn-devel-104
2012-02-28 20:21:26 +01:00
Andrew Bartlett
0fbefbcb54 s3-auth rename vuid_serverinfo to session_info
This matches the name used elsewhere in the code.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Sat Feb 25 05:24:19 CET 2012 on sn-devel-104
2012-02-25 05:24:19 +01:00
Jeremy Allison
95c514a010 Now make_connection_snum() is a static function that takes a
connection_struct as a parameter, fix the interface to allow
it to return an NTSTATUS.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Jan 19 07:25:49 CET 2012 on sn-devel-104
2012-01-19 07:25:49 +01:00
Jeremy Allison
39c627b607 Fix bug 8710 - connections.tdb - major leak with SMB2.
Ensure the cnum used to claim the connection for SMB2 is the
id that will be used for the SMB2 tcon. Based on code from
Ira Cooper <ira@wakeful.net>.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Jan 18 23:14:32 CET 2012 on sn-devel-104
2012-01-18 23:14:32 +01:00
Stefan Metzmacher
704cf10645 s3:smbd: avoid using sconn_server_id()
metze
2011-12-16 13:19:32 +01:00
Stefan Metzmacher
6811b47c99 s3:smbd/service: avoid using server_event_context() for notify_init()
metze
2011-12-12 14:35:43 +01:00
Andreas Schneider
2f65ae25df s3: Include uid_wrapper where it is missing. 2011-10-27 13:32:02 +02:00
Andrew Bartlett
6622821063 s3-auth Remove seperate guest boolean
Instead, we base our guest calculations on the presence or absense of the
authenticated users group in the token, ensuring that we have only
one canonical source of this important piece of authorization data

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:14 +10:00
Andrew Bartlett
9fcc617ff5 s3-auth Use the common auth_session_info
This patch finally has the same structure being used to describe the
authorization data of a user across the whole codebase.

This will allow of our session handling to be accomplished with common code.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:13 +10:00
Andrew Bartlett
128ae06a61 s3-auth use auth_user_info not netr_SamInfo3 in auth3_session_info
This makes auth3_session_info identical to auth_session_info

The logic to convert the info3 to a struct auth_user_info is
essentially moved up the stack from the named pipe proxy in
source3/rpc_server to create_local_token().

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:13 +10:00
Andrew Bartlett
e2049e77e4 s3-auth Use guest boolean in auth_user_info_unix
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:11 +10:00
Andrew Bartlett
9289537993 s3-auth Use struct auth_user_info_unix for unix_name and sanitized_username
This is closer to the layout of struct auth_session_info in auth.idl

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:11 +10:00
Andrew Bartlett
6d741e918f s3-auth Use *unix_token rather than utok in struct auth3_session_info
This brings this structure one step closer to the struct auth_session_info.

A few SMB_ASSERT calls are added in some key places to ensure that
this pointer is initialised, to make tracing any bugs here easier in
future.

NOTE: Many of the users of this structure should be reviewed, as unix
and NT access checks are mixed in a way that should just be done using
the NT ACL.  This patch has not changed this behaviour however.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:10 +10:00
Andrew Bartlett
f16d8f4eb8 s3-auth Use struct auth3_session_info outside the auth subsystem
This seperation between the structure used inside the auth modules and
in the wider codebase allows for a gradual migration from struct
auth_serversupplied_info -> struct auth_session_info (from auth.idl)

The idea here is that we keep a clear seperation between the structure
before and after the local groups, local user lookup and the session
key modifications have been processed, as the lack of this seperation
has caused issues in the past.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20 09:17:10 +10:00
Volker Lendecke
720fa46f94 s3: Calculate&store the maximum share access mask
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-07-05 13:28:08 +02:00
Volker Lendecke
1c022d2e41 s3: Return "granted" from share_access_check
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-07-05 13:28:03 +02:00
Andreas Schneider
73d28912a4 s3-smbd: Replace client_id in smbd service.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-07-04 18:28:26 +10:00
Andrew Bartlett
489f528857 param: Merge param headers into lib/param/loadparm.h
This defines a common table format, so we can in future define a
common table.

Andrew Bartlett
2011-06-29 15:44:09 +10:00
Andrew Bartlett
e5dd03d199 s3-globals Remove smbd_event_context() (use server_event_context())
This has been a wrapper around server_event_context() for some time
now, and removing this from dummmysmbd.c assists with library
dependencies.

Andrew Bartlett
2011-05-31 00:32:07 +02:00
Andrew Bartlett
33e8126c3c s3-param split service.c into param and smbd components
The dependency chain of find_service can't be satisfied sensibly
outside smbd, so don't include this in the main 'param' subsystem.

Also remove the duplicate find_service() and conn_snum_used() from
dummysmbd.c: The WAF build does not need these dummies any more, but
file.

Andrew Bartlett
2011-05-31 00:32:07 +02:00
Günther Deschner
12476223c6 s3-tsocket: only include ../lib/tsocket/tsocket.h where needed.
Guenther
2011-04-29 12:19:04 +02:00
Andrew Bartlett
17d8f0ad30 s3-auth use create_local_token() to transform server_info -> session_info
Before a auth_serversupplied_info struct can be used for
authorization, the local groups and privileges must be calculated.
create_local_token() now copies the server_info, and then sets the
calulated token and unix groups.

Soon, it will also transform the result into an expanded struct
auth_session_info.  Until then, the variable name (server_info vs
session_info provides a clue to the developer about what information
has been entered in the structure).

By moving the calls to create_local_token within the codebase, we
remove duplication, and ensure that the session key (where modified)
is consistently copied into the new structure.

Andrew Bartlett
2011-04-05 06:32:07 +10:00
Günther Deschner
af300a9fcb s3-auth: smbd needs auth.h
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
8c24ebf371 s3: include smbd/smbd.h where needed.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
235f148590 s3-passdb: use passdb headers where needed.
Guenther
2011-03-30 01:13:08 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
David Disseldorp
61bf4699f0 s3-printing: follow force user/group for driver IO
Configuring force user/group settings for the print$ share currently has
unexpected results, this is explained by how the driver upload/add
process takes place. Consider the following example:

[print$]
        path = /print-drv
        write list = $DRIVER_UPLOAD_USER
        force group = ntadmin

- the client connects to the [print$] share and uploads all driver
  files to the /print-drv/W32X86 directory.

- This is permitted, as /print-drv/W32X86 is owned by group ntadmin, and
  the "force group = ntadmin" takes effect for the [print$] session.

- Once all files are uploaded, the client connects to the [ipc$]
  share and issues an AddPrinterDriverEx spoolss request.

- In handling this request move_driver_to_download_area() is called,
  which attempts to create the directory /print-drv/W32X86/3

- The create directory fails, as it is done as the user connected to
  the [ipc$] share which does not have permission to write to the driver
  directory. The [print$] "force group = ntadmin" has no effect.

This is a regression from previous behaviour prior to the commit:
783ab04 Convert move_driver_to_download_area to use create_conn_struct.

https://bugzilla.samba.org/show_bug.cgi?id=7921
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-03-04 15:46:14 +01:00
Günther Deschner
5a0cf0c77e s3-printing: fix pcacp prototypes and includes.
Guenther
2011-02-22 21:52:18 +01:00
Andrew Bartlett
2e69e89456 s3-auth Rename auth_serversupplied_info varaiables: server_info -> session_info
These variables, of type struct auth_serversupplied_info were poorly
named when added into 2001, and in good consistant practice, this has
extended all over the codebase in the years since.

The structure is also not ideal for it's current purpose.  Originally
intended to convey the results of the authentication modules, it
really describes all the essential attributes of a session.  This
rename will reduce the volume of a future patch to replaced these with
a struct auth_session_info, with auth_serversupplied_info confined to
the lower levels of the auth subsystem, and then eliminated.

(The new structure will be the output of create_local_token(), and the
change in struct definition will ensure that this is always run, populating
local groups and privileges).

Andrew Bartlett

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2011-02-22 16:20:10 +11:00
Andrew Bartlett
2b05ba77b4 s3-auth Rename cryptic 'ptok' to security_token
This will allow the auth_serversupplied_info struct to be migrated
to auth_session_info easier.

Adnrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-02-10 06:51:06 +01:00
Jeremy Allison
2b788aa6ce Move the uglyness of #ifdef REALPATH_TAKES_NULL into the vfs_default
module, change the signature of VFS_REALPATH to always return a
malloc'ed string.

Needed to make some privileges work I plan on doing shortly
easier to code.

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Nov 20 02:15:50 CET 2010 on sn-devel-104
2010-11-20 02:15:50 +01:00
Jeremy Allison
f0dcc90f72 Fix bug 7781 - Samba transforms ShareName to lowercase (sharename) when adding new share via MMC
Change the find_service() interface to not depend on fstring, and
create a useable talloc-based interface.

Jeremy.
2010-11-10 01:14:17 +00:00
Jeremy Allison
9997ee813b Remove fstring from map_username. Create a more sane interface than the called-parameter-is-modified.
Jeremy.
2010-11-10 01:14:17 +00:00
Andrew Bartlett
f768b32e37 libcli/security Provide a common, top level libcli/security/security.h
This will reduce the noise from merges of the rest of the
libcli/security code, without this commit changing what code
is actually used.

This includes (along with other security headers) dom_sid.h and
security_token.h

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Oct 12 05:54:10 UTC 2010 on sn-devel-104
2010-10-12 05:54:10 +00:00
Andrew Bartlett
8c15cf54ae s3-auth Rename NT_USER_TOKEN user_sids -> sids
This is closer to the struct security_token from security.idl
2010-08-31 10:20:14 +10:00
Volker Lendecke
70c5bed4b2 s3: Replace calls to check_access by allow_access
We already have both the name and address of the client stored now
2010-08-22 14:28:34 +02:00
Volker Lendecke
8f7bf85c40 s3: Remove an unused variable 2010-08-18 17:13:48 +02:00
Volker Lendecke
6d10684556 s3: Remove unneeded "client_address" from connection_struct 2010-08-18 11:18:23 +02:00
Volker Lendecke
4a27c10903 s3: Remove smbd_server_fd() from make_connection 2010-08-16 22:39:24 +02:00
Volker Lendecke
897d09174d s3: Remove smbd_server_fd() from share_sanity_checks 2010-08-16 22:39:24 +02:00
Volker Lendecke
a98604d7f2 s3: Remove smbd_server_fd() from make_connection_snum 2010-08-16 22:39:24 +02:00
Volker Lendecke
96ae457023 s3: Remove get_client_fd() 2010-08-16 13:13:10 +02:00
Günther Deschner
0f8e032628 s3-netlogon: remove global include of netlogon.h.
This reduces precompiled headers by another 4 MB and also slightly speeds up the
build.

Guenther
2010-08-06 15:46:16 +02:00
Volker Lendecke
0ea7aed746 s3: Remove smbd_messaging_context() from make_connection_snum() 2010-07-05 11:06:30 +02:00
Volker Lendecke
07854cb099 s3: Remove procid_self() from make_connection_snum() 2010-07-05 11:06:25 +02:00
Volker Lendecke
23a31becac s3: Remove unused msg_flags from connections.tdb
This breaks rolling code upgrade!
2010-07-04 21:49:03 +02:00
Volker Lendecke
d724ac3e8c s3: Remove smbd_server_conn from make_connection_snum 2010-06-12 15:42:51 +02:00
Volker Lendecke
312a508e88 s3: Fix some nonempty lines 2010-06-12 11:59:21 +02:00
Simo Sorce
471ed70c49 s3:smbd map_username() doesn't need sconn anymore
Signed-off-by: Andreas Schneider <asn@samba.org>
2010-05-31 18:21:29 +02:00
Simo Sorce
d9cffc01be s3:auth use info3 in auth_serversupplied_info
Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-28 00:55:53 +02:00
Andrew Bartlett
cba7f8b827 s3:dom_sid Global replace of DOM_SID with struct dom_sid
This matches the structure that new code is being written to,
and removes one more of the old-style named structures, and
the need to know that is is just an alias for struct dom_sid.

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
2010-05-21 10:39:59 +02:00
Jeremy Allison
a8a4fe0605 Fix bug #7410 - samba sends "raw" inode number as uniqueid with unix extensions.
Move to a consistent get_FileIndex() function for all inode returns,
that checks if st_dev on the file is identical to the top directory
dev_t of the exported share, and if so uses the raw 64-bit inode
number. If it isn't (we've traversed a mount point) - return what
we used to do for Windows which is the concatination of the bottom
32-bits of the inode with the 32-bit device number. We can get more
creative with this over time (hashing?) if we want as now all inode returns go
through this single function.

Jeremy.
2010-05-20 11:36:47 -07:00
Jeremy Allison
2e00a8a74b Fix bug 7297 - smbd crashes with CUPS printers and no [printers] share defined.
Ensure we don't dereference an array with an index of -1.

Jeremy.
2010-03-25 17:09:23 -07:00
Jeremy Allison
c35c38075c Remove the bool admin_user from conn struct. We no longer look at this to make access decisions.
Jeremy.
2010-03-15 15:39:41 -07:00
Volker Lendecke
752bffc53f s3: Consolidate server_id_self into the equivalent procid_self() 2010-02-23 15:30:00 +01: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
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
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 2fdd8b10c6.

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
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
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
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
Christian Ambach
7050764a3a streamline some log levels for invalid servicenames
I don't think we need to log the fact that a user gave a wrong sharename in Explorer with the highest log level.
The level of this was not very consistent:
service.c:		DEBUG(3,("find_service() failed to find service %s\n", service));
service.c:		DEBUG(0,("%s (%s) couldn't find service %s\n",
smb2_tcon.c:		DEBUG(1,("smbd_smb2_tree_connect: couldn't find service %s\n",

This changes the last two to 3 as the first one.

Signed-off-by: Christian Ambach <christian.ambach@de.ibm.com>
2009-12-06 22:31:35 +01:00
Jeremy Allison
00ce3e143f Fix for CVE-2009-2813.
===========================================================
== Subject:     Misconfigured /etc/passwd file may share folders unexpectedly
==
== CVE ID#:     CVE-2009-2813
==
== Versions:    All versions of Samba later than 3.0.11
==
== Summary:     If a user in /etc/passwd is misconfigured to have
==              an empty home directory then connecting to the home
==              share of this user will use the root of the filesystem
==              as the home directory.
===========================================================
2009-10-01 10:23:29 -07:00
Jeremy Allison
c69f92d16d Second attempt at fix for bug 6529 - Offline files conflict with Vista and Office 2003.
Confirmation from reporter that this fixes the issue in master on ext3/ext4.
Back-ports to follow.
Jeremy.
2009-08-24 20:57:37 -07:00
Jeremy Allison
1fb916babd Log debug message when hires timestamps are available on the
share.
Jeremy.
2009-08-21 21:53:37 -07:00
Jeremy Allison
1af0aa92b3 Fix bug 6529 - Offline files conflict with Vista and Office 2003
On filesystems that can't store less than one second timestamps,
round the incoming timestamp set requests so the client can't discover
that a time set request has been truncated by the filesystem.
Needs backporting to 3.4, 3.3, 3.2 and (even) 3.0.
Jeremy
2009-08-21 21:44:21 -07:00
Stefan Metzmacher
c50a03e4e2 s3:smbd: remove dirptr and dirpath from connection_struct
They're both only used in the context of a function,
so we can make them stack variables.

metze
2009-08-07 14:18:17 +02:00
Stefan Metzmacher
c54e6b19e3 s3:smbd: add a smbd_server_connection pointer to connection_struct
This can be NULL for faked connection structs used in the rpc server
or printing code.

metze
2009-08-07 14:18:14 +02:00
Christian Ambach
8b6ec5b82c do not log chdir with level 0 if reason is access denied
this changes the level of logs caused by users trying to access shares
or subdirectories for which they do not have access to in the ACL

this can fill up the samba log even with log level 0 and is more an
expected kind of logs that IMHO should not be logged with such a high
level.

All other errors while chdir() will still be logged with level 0

Signed-off-by: Christian Ambach <christian.ambach@de.ibm.com>
2009-07-21 10:05:21 -07:00
Jeremy Allison
d57e67f9eb Revert this commit :
s3: Make smbd aware of permission change of usershare. Since usershare are relatively volatile and
non-previledge users must disconnect from smbd and reconnect to it to make share permission in effect.

For now. This is a feature request and I think we need
to design it a little differently so as not to touch
core change_to_user() code.

Jeremy.
2009-07-14 11:25:45 -07:00
Bo Yang
9ef6af73b3 s3: Make smbd aware of permission change of usershare. Since usershare are relatively volatile and non-previledge users must disconnect from smbd and reconnect to it to make share permission in effect. 2009-07-15 17:05:45 +08:00
Tim Prouty
e129384d7c s3: Plumb smb_filename through SMB_VFS_STAT and SMB_VFS_LSTAT
This patch introduces two new temporary helper functions
vfs_stat_smb_fname and vfs_lstat_smb_fname.  They basically allowed me
to call the new smb_filename version of stat, while avoiding plumbing
it through callers that are still too inconvenient.  As the conversion
moves along, I will be able to remove callers of this, with the goal
being to remove all callers.

There was also a bug in create_synthetic_smb_fname_split (also a
temporary utility function) that caused it to incorrectly handle
filenames with ':'s in them when in posix mode.  This is now fixed.
2009-06-24 21:15:25 -07:00
Stefan Metzmacher
a02265cdc4 s3:smbd: make make_connection_snum() non static
metze
2009-06-03 17:54:38 +02:00
Stefan Metzmacher
c862018008 s3:smbd: move tcon specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:38 +02:00
Stefan Metzmacher
75d03970b7 s3:smbd: move more session specific globals to struct smbd_server_connection
metze
2009-06-03 17:54:37 +02:00
Volker Lendecke
49ca690b4b Introduce "struct stat_ex" as a replacement for SMB_STRUCT_STAT
This patch introduces

struct stat_ex {
        dev_t           st_ex_dev;
        ino_t           st_ex_ino;
        mode_t          st_ex_mode;
        nlink_t         st_ex_nlink;
        uid_t           st_ex_uid;
        gid_t           st_ex_gid;
        dev_t           st_ex_rdev;
        off_t           st_ex_size;
        struct timespec st_ex_atime;
        struct timespec st_ex_mtime;
        struct timespec st_ex_ctime;
        struct timespec st_ex_btime; /* birthtime */
        blksize_t       st_ex_blksize;
        blkcnt_t        st_ex_blocks;
};
typedef struct stat_ex SMB_STRUCT_STAT;

It is really large because due to the friendly libc headers playing macro
tricks with fields like st_ino, so I renamed them to st_ex_xxx.

Why this change? To support birthtime, we already have quite a few #ifdef's at
places where it does not really belong. With a stat struct that we control, we
can consolidate the nanosecond timestamps and the birthtime deep in the VFS
stat calls.

At this moment it is triggered by a request to support the birthtime field for
GPFS. GPFS does not extend the system level struct stat, but instead has a
separate call that gets us the additional information beyond posix. Without
being able to do that within the VFS stat calls, that support would have to be
scattered around the main smbd code.

It will very likely break all the onefs modules, but I think the changes will
be reasonably easy to do.
2009-05-26 17:48:23 +02:00
Volker Lendecke
796764d92b Increase debug level of "create_connection_server_info failed" message
I don't think we should unconditionally send every refused connection attempt
to a share to syslog, that's where all debug level 0 messages end up.
2009-05-04 12:41:54 +02:00
Michael Adam
077bcc1125 s3:smbd/service: switch load_registry_service/shares to use loadparm routines
instead of reading the registry directly with tdb and activating the
configure options by hand.

This eliminates the need for repeating checks done in loadparm.
For instance it disables registry shares without path in the server
as is the case with text based shares.

Michael
2009-04-29 02:20:19 +02:00
Stefan Metzmacher
c16c90a1cb s3:smbd: use new simplified snb_signing code in the server
We keep the seqnum/mid mapping in the smb_request structure.

This also moves one global variable into the
smbd_server_connection struct.

metze
2009-03-23 12:21:13 +01:00
Jeremy Allison
35f4ea221e Fix bug #6155 - "force group" is no longer working as expected.
We need to store the "force group" uid separately from the
conn->server_info token as we need to apply it separately also.
Volker PLEASE CHECK !
Jeremy.
2009-03-03 16:08:56 -08:00
Stefan Metzmacher
3dde0cbb76 s3:smbd: move all globals and static variables in globals.[ch]
The goal is to move all this variables into a big context structure.

metze
2009-01-08 12:22:21 +01:00
Michael Adam
5318e73e93 smbd: prevent access to root filesystem when connecting with empty service name
This only applies to a setup with "registry shares = yes"

Michael
(cherry picked from commit 288fa94ac7)
(cherry picked from commit e85526b184)
2009-01-05 11:07:59 +01:00
Volker Lendecke
6f840dd678 Remove unused make_connection_with_chdir() 2008-11-24 11:39:03 +01:00
Volker Lendecke
a781b78417 Remove smb_np_struct 2008-10-13 20:59:33 +02:00
Volker Lendecke
3c516937e8 Fix a debug message
(This used to be commit 8dd94d448b)
2008-06-26 13:32:11 +02:00
Volker Lendecke
40f5eab5eb Wrap the unix token info in a unix_user_token in auth_serversupplied_info
No functional change, this is a preparation for more current_user ref removal
(This used to be commit dcaedf345e)
2008-06-19 18:51:37 +02:00
Jeremy Allison
ae51353107 Re-enable the evil "aio write behind" parameter.
Jeremy.
(This used to be commit 5d22ca00bc)
2008-05-26 21:13:05 -07:00
Volker Lendecke
50ab871813 Remove some references to get_current_username() and current_user_info
(This used to be commit 344d69f95e)
2008-05-25 11:43:57 +02:00
Volker Lendecke
320fadd8fc Remove the reference to current_user_info from share_access.c
This required to pass around the domain a bit
(This used to be commit 17b0db20d2)
2008-05-25 11:43:57 +02:00
Volker Lendecke
5bda9a8af0 Remove "user" from connection_struct
(This used to be commit 368454a27c)
2008-05-10 11:17:01 +02:00
Volker Lendecke
53a623d8a6 Remove the unix token info from connection_struct
(This used to be commit 2834dacc8d)
2008-05-10 11:17:01 +02:00
Volker Lendecke
776caa081b Replace nt_user_token with server_info in connection_struct
(This used to be commit a3738aef59)
2008-05-10 11:17:01 +02:00
Volker Lendecke
322896f8dd find_forced_group can directly change the token in server_info
Now that we have a token that is correctly set up with gids already, this saves
manual translation of the SIDs to GIDs.
(This used to be commit 6136a6d9d7)
2008-05-10 11:17:00 +02:00
Volker Lendecke
d2157f1342 Add an error return in find_forced_group()
(This used to be commit 93ce0705c1)
2008-05-10 11:17:00 +02:00
Volker Lendecke
39bd6a9595 Do not unnecessarily mess with the results in find_forced_group()
(This used to be commit 6d9860d09b)
2008-05-10 11:17:00 +02:00
Volker Lendecke
ddcea20947 Replace find_forced_user by a direct call to make_serverinfo_from_username
(This used to be commit 7991e6764b)
2008-05-10 11:17:00 +02:00
Volker Lendecke
ca25800287 Simplify make_connection_snum: Copy connection_struct info from server_info
(This used to be commit 5aa3cdf355)
2008-05-10 11:17:00 +02:00
Volker Lendecke
90995202c0 Add "server_info" to connection_struct
This will replace all the user identity stuff in connection_struct, for now it
is just a source where the other fields in connection_struct are filled from.
(This used to be commit 0f53f9e7db)
2008-05-10 11:17:00 +02:00
Volker Lendecke
f93e232535 Remove unused "force_group" from connection_struct
(This used to be commit 03944f8d89)
2008-05-10 11:17:00 +02:00
Volker Lendecke
39a318aee4 "status" -> "pstatus" in make_connection_snum
(This used to be commit 3ce395e61e)
2008-05-10 11:17:00 +02:00
Volker Lendecke
270a3f2a6f Add create_connection_server_info() -- not used yet
(This used to be commit 50bf075f75)
2008-05-10 11:17:00 +02:00
Volker Lendecke
4f731150bd Use talloc_tos() for a temporary getpwnam_alloc in make_connection_snum
(This used to be commit 1843ea64ab)
2008-05-07 14:47:29 +02:00
Volker Lendecke
193b63f326 Use talloc_stackframe() in find_forced_group
(This used to be commit 27a9bbc645)
2008-05-07 14:47:29 +02:00
Volker Lendecke
bec1dfab27 Remove "userdom_struct user" from "struct user_struct"
(This used to be commit 420de03523)
2008-05-05 18:28:59 +02:00
Volker Lendecke
71ff1ba2de Remove "guest" from "struct user_struct"
(This used to be commit 570a6b80fe)
2008-05-05 18:28:59 +02:00
Volker Lendecke
c6d209f834 Remove the unix token info from "struct user_struct"
(This used to be commit aa2299d42a)
2008-05-05 18:28:58 +02:00
Volker Lendecke
bb3755968f Remove "nt_user_token" from "struct user_struct"
(This used to be commit 51d5d512f2)
2008-05-05 18:28:58 +02:00
Volker Lendecke
d62563342e Remove connection_struct->mem_ctx, connection_struct is its own parent
(This used to be commit 559180f7d3)
2008-05-05 11:23:13 +02:00
Michael Adam
6476313b6d Add a debug message.
Michael
(This used to be commit a398070448)
2008-03-12 02:12:34 +01:00
Michael Adam
67536eddc3 registry shares: prevent creating regular share called "global".
This is a first quick fix.
Registry shares should be rewritten to use libnet_conf.

Michael
(This used to be commit 71bd0bd0ea)
2008-03-11 11:15:50 +01:00
Volker Lendecke
9a22653222 Add SMB_VFS_FS_CAPABILITIES
It turns out that this is a necessary operation, separate from statvfs. statvfs
can fail during tcon, so conn->fs_capabilities would never see that we support
streams on a particular share.

James, can you check that I got the darwin variant right? Thanks!
(This used to be commit 3ad798d803)
2008-01-21 16:14:27 +01:00
Michael Adam
b92c3e281c Add handling of [homes] and [printers] via registry shares.
Now homes and printers shares can be accessed through the
registry meachanism on demand in pure registry configurations
with "config backend = registry" without the need to
have a special handler for these two.

Michael
(This used to be commit eec3248ef9)
2008-01-16 17:10:02 +01:00
Jeremy Allison
253fbf1a6e Make use of talloc_pool in the main codepaths. Remove the sub-contexts.
Jeremy.
(This used to be commit bc932b8ad4)
2008-01-09 17:11:04 -08:00
Jeremy Allison
afce2b245a Add the capability to set "smb encrypt = required"
on a share (or global) and have the server reply with
ACCESS_DENIED for all non-encrypted traffic (except
that used to query encryption requirements and set
encryption state).
Jeremy.
(This used to be commit d241bfa577)
2007-12-27 23:51:03 -08:00
James Peach
1176e04c76 Cache the underlying filesystem capabilities at connection time.
This change alters the Samba connection code to cache the filesystem
capabilities when a new client connects. This can be used to enable
filesystem specific optimisations is a general manner.
(This used to be commit de3c5b808a)
2007-12-22 14:01:25 -08:00
Volker Lendecke
e518e19bc0 Remove Get_Pwnam and its associated static variable
All callers are replaced by Get_Pwnam_alloc
(This used to be commit 735f593154)
2007-12-19 21:09:10 +01:00
Volker Lendecke
900288a2b8 Replace sid_string_static by sid_string_dbg in DEBUGs
(This used to be commit bb35e794ec)
2007-12-15 22:09:36 +01:00
Jeremy Allison
2b3c44e4fb Always define PATH_MAX. Makes code simpler (removes
a bunch of #defines). Remove pstring from msdfs.c.
Jeremy.
(This used to be commit e203ba2227)
2007-11-10 22:31:34 -08:00
Jeremy Allison
54d65bfb9a Fix the build when realpath doesn't take null
as a last arg.
Jeremy.
(This used to be commit 6312522538)
2007-11-10 15:02:08 -08:00
Jeremy Allison
acc0218f13 Remove pstring from service.c.
Jeremy.
(This used to be commit cdd9e5cc83)
2007-11-10 14:43:39 -08:00
Volker Lendecke
ec1ecd92c9 Make load_registry_service return the share number
(This used to be commit 934964c90f)
2007-11-05 02:45:14 +01:00
Jeremy Allison
5b0b4f23ef Remove most of the remaining globals out of lib/util_sock.c.
I have a plan for dealing with the remaining..... Watch
this space.
Jeremy.
(This used to be commit 963fc76852)
2007-11-03 23:20:10 -07:00
Jeremy Allison
25074433f4 I can't get away without a 'length' arg. :-).
Jeremy.
(This used to be commit 95d01279a5)
2007-11-03 18:41:26 -07:00
Jeremy Allison
6658165d5e Stop get_peer_addr() and client_addr() from using global
statics. Part of my library cleanups.
Jeremy.
(This used to be commit e848506c85)
2007-11-03 18:15:45 -07:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Gerald (Jerry) Carter
e5a951325a [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
(This used to be commit 5c6c8e1fe9)
2007-10-10 15:34:30 -05:00
Jeremy Allison
12f61e09d9 r25117: The mega-patch Jerry was waiting for. Remove all pstrings from
the main server code paths. We should now be able to cope with
paths up to PATH_MAX length now.
Final job will be to add the TALLOC_CTX * parameter to
unix_convert to make it explicit (for Volker).
Jeremy.
(This used to be commit 7f0db75fb0)
2007-10-10 12:30:41 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Volker Lendecke
14e25f10d6 r23168: Move the lp_max_connections() into service.c.
(This used to be commit 4afe37d431)
2007-10-10 12:22:51 -05:00
Volker Lendecke
f3c477c631 r23167: Remove an unused parameter
(This used to be commit 3452a870d5)
2007-10-10 12:22:51 -05:00
Volker Lendecke
b4a7b7a888 r22844: Introduce const DATA_BLOB data_blob_null = { NULL, 0, NULL }; and
replace all data_blob(NULL, 0) calls.
(This used to be commit 3d3d61687e)
2007-10-10 12:22:01 -05:00
Jeremy Allison
b93126ea12 r21953: One format fix, clarify a condition that the IBM
checker was worried about.
Jeremy.
(This used to be commit 70eec7b8ae)
2007-10-10 12:18:52 -05:00
Volker Lendecke
28e2069d1f r21547: Fix from Michael Adam <ma@sernet.de>: Refuse registry shares without path.
Thanks,

Volker
(This used to be commit e795865d58)
2007-10-10 12:18:11 -05:00