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

807 Commits

Author SHA1 Message Date
Volker Lendecke
7b0b1d6d48 smbd: Fix a typo
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>

Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Wed Jan 30 18:21:19 CET 2013 on sn-devel-104
2013-01-30 18:21:19 +01:00
Volker Lendecke
3d5c534f0c smbd: Fix bug 9549 -- Memleak in the async echo handler
Reviewed by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan  8 23:30:41 CET 2013 on sn-devel-104
2013-01-08 23:30:41 +01:00
Volker Lendecke
0fa3129686 s3: Fix clear_if_first for the async echo handler
A worker smbd is as not long-lived as the main smbd, but as the async
echo handler exits when the worker smbd does, passing "true" here is the
right thing to do and fixes our clear_if_first handling when the async
echo handler is active.

Reviewed-by: Christian Ambach <ambi@samba.org>

Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Fri Dec  7 11:29:36 CET 2012 on sn-devel-104
2012-12-07 11:29:36 +01:00
Volker Lendecke
d5693d99b8 Fix Bug 9422 - large read requests cause server to issue malformed reply
Reviewed by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Nov 30 03:27:07 CET 2012 on sn-devel-104
2012-11-30 03:27:07 +01:00
Stefan Metzmacher
9f1dfd8fac s3:smbd: don't disconnect the client when a share has "smb encrypt = required"
It's not the client fault, if he doesn't know that encryption is required.
We should just return ACCESS_DENIED and let the client work on other
shares and open files on the current SMB connection.

metze
2012-08-17 14:51:57 +02:00
Stefan Metzmacher
e5d4e8df6b s3:smbd: lp_smb_encrypt() returns SMB_SIGNING_* values
metze
2012-08-17 14:51:57 +02:00
Stefan Metzmacher
35c0f164bc s3:smbd: do a clean shutdown during release_ip() after CTDB_SRVID_RELEASE_IP
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul 31 11:33:27 CEST 2012 on sn-devel-104
2012-07-31 11:33:27 +02:00
Stefan Metzmacher
d73b7938bb s3:smbd: use print_sockaddr() instead of client_socket_addr()
We already have a server address in sockaddr_storage format.

Also the name "client_socket" was very miss leading,
as it returns the local address of the socket.

metze
2012-07-31 09:34:21 +02:00
Stefan Metzmacher
13de233fc6 s3:smbd: move smbd_register_ips() next to release_ip()
metze
2012-07-31 09:34:21 +02:00
Rusty Russell
fe72740e82 loadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *.
They use talloc_tos() internally: hoist that up to the callers, some
of whom don't want to us talloc_tos().

A simple patch, but hits a lot of files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-07-18 15:07:23 +09:30
Andrew Bartlett
15fedb3c68 s3-auth Remove unused global_machine_account_needs_changing
This boolean was only set if the old machine account store (with an
MD4 hash in it) was returned.  We have not set that password type for
years.  If this call ever worked, it would store a plaintext password,
so we could only ever be here if we had set a password using a version
of Samba so old as not to store plaintext, and then never honered the
flag anyway.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jul 13 07:52:40 CEST 2012 on sn-devel-104
2012-07-13 07:52:40 +02:00
Jeremy Allison
6617c2c1f5 Make schedule_deferred_open_message_smb() return an indication of success. 2012-06-30 02:23:39 +02:00
Stefan Metzmacher
7d1395536b s3:smbd: make use of smbXsrv_open for smb1/2/3
This makes sure we generate unique persistent file ids,
which are stored in smbXsrv_open_global.tdb.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jun 29 21:01:11 CEST 2012 on sn-devel-104
2012-06-29 21:01:11 +02:00
Stefan Metzmacher
e77000259c s3:smbd/sesssetup: implement dynamic re-authentication and expire session if client supports it
metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
a129e271b5 s3:smbd: make use of smbXsrv_session for smb1
Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
faa8edccef s3:smbd: make use of smbXsrv_tcon for smb1
Pair-Programmed-With: Michael Adam <obnox@samba.org>

metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
02d206ee64 s3:smb2_sesssetup: make use of the smbXsrv_session infrastructure
We still have smbd_smb2_session as primary structure,
but that will went away once we got rid of smbd_smb2_tcon.

metze
2012-06-25 20:55:06 +02:00
Stefan Metzmacher
b40fa94360 s3:smbd: fix warning in smbd_tevent_trace_callback() without profile support
metze
2012-06-22 12:56:47 +02:00
Stefan Metzmacher
cd260391fa s3:smbd: fix the build with the --with-profiling-data option
metze
2012-06-20 12:58:58 +02:00
Stefan Metzmacher
d8b3687fcb s3:smbd: remember the request_time on an incoming request
metze
2012-06-15 07:18:00 +02:00
Stefan Metzmacher
fc96488c64 s3:smbd: readd START_PROFILE(smbd_idle)/END_PROFILE(smbd_idle)
metze
2012-06-09 12:09:17 +02:00
Stefan Metzmacher
02d9ba6ee1 s3:smbd: change user_struct->vuid to uint64_t
Only sconn->smb1.sessions.next_vuid remains as uint16_t,
so that we do not generate larger values yet.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Jun  6 12:07:33 CEST 2012 on sn-devel-104
2012-06-06 12:07:33 +02:00
Stefan Metzmacher
f52e5738a2 s3:smbd: use 'struct user_struct' instead of typedef'ed 'user_struct'
metze
2012-06-06 10:18:39 +02:00
Andrew Bartlett
9f4b6fa0cc s3-param: Use same function name for "max xmit" as lib/param
Again, this helps with merging the FN_ list.

Andrew Bartlett
2012-05-30 04:15:12 +02:00
Stefan Metzmacher
b5e9ece1f3 s3:smbd: remove global 'smbd_server_conn' !!!
For now we still use a global 'global_smbXsrv_connection'
in order to pass the connection state to exit_server*().

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu May 24 20:07:20 CEST 2012 on sn-devel-104
2012-05-24 20:07:20 +02:00
Stefan Metzmacher
288a75d8dc s3:smbd: only call file_init_global() in the parent smbd
metze
2012-05-24 18:16:37 +02:00
Stefan Metzmacher
48e62f2d46 s3:smbd: remove unused var in smbXsrv_connection_init_tables()
metze
2012-05-24 18:16:37 +02:00
Stefan Metzmacher
b3235d483d s3:smbd: introduce struct smbXsrv_connection
This will represent a transport connection for SMB 1 or 2
in the server. smbd_server_connection will slowly be moved
to the SMB_VFS layer to satisfy the existing modules,
but it will hopefully be protocol independend in future.

metze
2012-05-12 01:01:34 +02:00
Andrew Bartlett
1ac7f071ce build: Remove SMB_F* locking defines 2012-04-05 02:39:09 +02:00
Andrew Bartlett
c363815809 s3-smbd: Inline init_modules() into only caller 2012-04-03 14:25:12 +10:00
Jeremy Allison
5df1c11539 Start to add truncate checks on all uses of strlcpy(). Reading lwn
has it's uses :-).

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Mar 29 20:48:15 CEST 2012 on sn-devel-104
2012-03-29 20:48:15 +02:00
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
Jeremy Allison
86a80cf4fd Fix bug 8823 - source3/smbd/process.c:smb_dump seems to have a memory leak.
Based on code from Richard Sharpe. Move to talloc from malloc.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Mar 22 00:20:41 CET 2012 on sn-devel-104
2012-03-22 00:20:40 +01:00
Volker Lendecke
8f93068cf8 s3: Add smb_request_done
This is used to enable async chained command sequences. A synchronous
reply_xxx command does not need to take are anymore about and_x
chaining. The async commands (pipe r/w at this moment) must do so
however. When finished, they must inform the main chain engine that
they are finished with a smb_request_done call.

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Sat Mar 10 17:14:05 CET 2012 on sn-devel-104
2012-03-10 17:14:05 +01:00
Volker Lendecke
2c1caf5fcb s3: Remove unused smb_request->done 2012-03-10 15:34:12 +01:00
Volker Lendecke
3a7bc3abb8 s3: Remove unused smb_request->chain_outbuf 2012-03-10 15:34:12 +01:00
Volker Lendecke
572bc64b59 s3: Remove "req_wct_ofs()"
This is fixed up in construct_reply_chain
2012-03-10 15:34:12 +01:00
Volker Lendecke
12068d4aac s3: Fix the read&x offset within a chain 2012-03-10 15:34:12 +01:00
Volker Lendecke
11d087aa04 s3: Remove chain_reply
<insert your favourite tombstone ascii art here>
2012-03-10 15:34:12 +01:00
Volker Lendecke
3b2c9bebc0 s3: Replace chain_reply
This is a new implementation of our andx handling code. The old
code was quite involved in that it was called from within the reply_
handlers. This leads to pretty complex faking of smb_request
structures to give them the same environment, independent of whether
they are called directly or from within chain_reply.

chain_reply needs to go because it blocks really async handling of
chained requests.
2012-03-10 15:34:11 +01:00
Volker Lendecke
c9870a62f5 s3: Add a new set of andx chain handling routines
This is in preparation of getting rid of chain_reply.
2012-03-10 15:34:11 +01:00
Stefan Metzmacher
6ce72a01ab s3:smbd: keep 'num_users' and 'users' directly under smbd_server_connection
The plan is to have users_struct as some kind of low level
abstraction for a smb1/smb2 session, that can be used by SMB_VFS modules.

metze
2012-03-06 21:26:05 +01:00
Volker Lendecke
1f62df52aa s3: Move a talloc_strdup out of the main code path
This is only used for AS_GUEST requests

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Tue Mar  6 14:29:50 CET 2012 on sn-devel-104
2012-03-06 14:29:50 +01:00
Volker Lendecke
216769f2ce s3: Move the drain_socket on error to reply_write_and_X
That's the only case where this can happen, so we should not clutter the main
code path.
2012-03-05 15:59:36 +01:00
Volker Lendecke
07386bb533 s3: Remove "size" param from switch_message
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Mon Mar  5 15:13:49 CET 2012 on sn-devel-104
2012-03-05 15:13:49 +01:00
Volker Lendecke
c99d245548 s3: Remove "size" param from smb_dump 2012-03-05 13:35: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
89c55485c3 Add the implementation of check_reduced_name_with_privilege(). Now to plumb into
SMB1 requests.
2012-02-29 17:04:08 -08:00
Volker Lendecke
adac885881 s3: Fix a const warning 2012-02-29 01:32:54 +01:00
Andrew Bartlett
c318c94170 s3-param: Align lp_{max,min}protocol with lib/param names
This adds an alisas to ensure that both our loadparm systems know all
the names.

I would like to move to the 'server ..' name as canonical, and this
will be raised on the list.

Andrew Bartlett
2012-02-27 07:36:05 +01:00
Volker Lendecke
61953ab35a s3: Simplify smb_splice_chain
No code change, just remove a {} block left over as the else branch
from the previous commit

Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Fri Feb 24 18:07:48 CET 2012 on sn-devel-104
2012-02-24 18:07:48 +01:00
Volker Lendecke
b07ae1ab7b s3: Simplify smb_splice_chain
first_request won't be true anymore, we always splice fully existing
records in smbd
2012-02-24 16:34:42 +01:00
Volker Lendecke
4708b97ce5 s3: Simplify smb_splice_chain
With the last commit, bytes_padding is not set anymore
2012-02-24 16:34:40 +01:00
Volker Lendecke
5b7609db56 s3: Simplify smb_splice_chain
bytes_alignment used to be used in libsmb, which uses different code
now
2012-02-24 16:34:35 +01:00
Volker Lendecke
da322e4f3f s3: Simplify smb_splice_chain
We use it in smbd/process.c only now. This only splices in finished
buffers, both callers used the same arguments. Pull that into the
routine itself.
2012-02-24 16:34:34 +01:00
Volker Lendecke
947a8bc44a s3: Turn some SMB_ASSERTS into proper return
We deal with the error properly further up
2012-02-24 16:34:34 +01:00
Volker Lendecke
28901acd27 s3: Fix a DEBUG msg 2012-02-24 16:34:34 +01:00
Volker Lendecke
f1dc8b28b7 s3: smb_request->vwv can be const
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Thu Feb 23 12:37:23 CET 2012 on sn-devel-104
2012-02-23 12:37:22 +01:00
Jeremy Allison
21528da9cd Fix a bunch of "unused variable" warnings.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Feb 18 06:22:40 CET 2012 on sn-devel-104
2012-02-18 06:22:40 +01:00
Jeremy Allison
ed85e9fe6a Replace smbd_server_connection_loop_once() with tevent_loop_once() directly.
We no longer need to call poll() directly inside smbd !

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Feb 17 02:49:13 CET 2012 on sn-devel-104
2012-02-17 02:49:13 +01:00
Andrew Bartlett
367c567c5f lib/util: Remove sys_poll as it is no longer needed
sys_poll() is only needed if the signal pipe is set up and used, but as
no signal handler ever writes to the pipe, this can all be removed.

signal based events are now handled via tevent.

Andrew Bartlett

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-02-16 15:49:21 -08:00
Volker Lendecke
fed2fba0a9 s3: Move basic SMB checking to a much earlier point 2012-01-05 13:09:35 +01:00
Volker Lendecke
f7439f81be s3: Add a suicide mode to smbd
To test our cleanup code paths properly, we need a way to make smbd exit hard
without cleaning up
2012-01-05 13:09:35 +01:00
Volker Lendecke
69a67a1b73 s3: Check for the packet size before accessing it
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Jan  4 15:16:20 CET 2012 on sn-devel-104
2012-01-04 15:16:20 +01:00
Stefan Metzmacher
03455519e7 s3:smbd: pass smbd_server_connection and a snumused function pointer to reload_services()
metze
2011-12-15 11:11:24 +01:00
Stefan Metzmacher
e412b8bfcc s3:smbd: split smb_conf_updated into parent and child versions
metze
2011-12-15 11:03:00 +01:00
Stefan Metzmacher
715933a3d3 s3:smbd: split ID_CACHE_* message handling into parent and child parts
metze
2011-12-15 08:16:31 +01:00
Stefan Metzmacher
290ce331b6 s3:smbd: pass smbd_server_connection to smbd_setup_sig_hup_handler()
metze
2011-12-13 20:31:09 +01:00
Stefan Metzmacher
8a83464216 s3:smbd: pass smbd_server_connection to smbd_setup_sig_term_handler()
metze
2011-12-13 20:31:09 +01:00
Stefan Metzmacher
21de673575 s3:smbd/oplock: pass smbd_server_connection to init_oplocks()
metze
2011-12-13 20:31:09 +01:00
Stefan Metzmacher
e09c675596 s3:smbd/open: pass smbd_server_connection as private_data to msg_file_was_renamed()
metze
2011-12-13 12:36:35 +01:00
Stefan Metzmacher
173ea71686 s3:smbd: register MSG_SMB_FILE_RENAME after the fork
The parent smbd doesn't need to handle this, as it doesn't
have any file handles open.

metze
2011-12-13 12:36:35 +01:00
Stefan Metzmacher
d492a437be s3:smbd/conn_msg: pass smbd_server_connection as private_data to msg_force_tdis()
metze
2011-12-13 12:36:35 +01:00
Volker Lendecke
0f9d14820e s3: Remove a bunch of calls to procid_self()
All callers to messaging_[re]init only used procid_self()
2011-12-12 21:50:25 +01:00
Stefan Metzmacher
4d44f879e1 s3:smbd/clode: pass smbd_server_connection as private_data to msg_close_file()
metze
2011-12-12 20:14:41 +01:00
Stefan Metzmacher
bf8cce18c6 s3:smbd/process: avoid using server_event_context() for the forked echo handler
metze
2011-12-12 14:35:43 +01:00
Stefan Metzmacher
16cfc7243b s3:smbd/process: avoid using server_event_context() for smbd_deferred_open_timer events
metze
2011-12-12 14:35:43 +01:00
Stefan Metzmacher
0b8eeb1edc s3:smbd: pass down smbd_server_connection via smbd_echo_state
metze
2011-12-12 14:35:42 +01:00
Stefan Metzmacher
bf35606bbf s3:smbd: remove references to the global smbd_server_conn
metze
2011-12-12 14:35:42 +01:00
Stefan Metzmacher
6d84b24d76 s3:smbd: make struct pending_message_list private
metze
2011-12-12 14:35:42 +01:00
Stefan Metzmacher
8b2b7d1c87 s3:smbd: remember the smbd_server_connection on pending_message_list
metze
2011-12-12 14:35:42 +01:00
Stefan Metzmacher
3d7521c8ab s3:smbd: call sub_set_socket_ids() in smbd_process() again
This got lost in commit b2511a280a.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Mon Dec 12 10:23:44 CET 2011 on sn-devel-104
2011-12-12 10:23:43 +01:00
Volker Lendecke
5e0258fc93 s3: Avoid a race with the async echo handler
We can not read from the echo handler socket when we have the main socket
locked. This leads to the echo responder to lock up sitting in the fcntl lock
while the parent wants to read the remainder of a large packet.
2011-11-10 17:18:53 +01:00
Christian Ambach
b99becd4fa s3:smbd increase a debug level
logging disconnected clients with level 1 swamps the logs
2011-11-04 17:39:43 +01:00
Stefan Metzmacher
f205e4cada s3:smbd: echo FLAGS2_SMB_SECURITY_SIGNATURES* and the signature field in the reply
This matches what windows is doing.

metze
2011-09-14 08:09:15 +02:00
Volker Lendecke
d911bd5c69 s3: Remove a reference to smbd_server_conn 2011-09-13 11:00:13 +02:00
Volker Lendecke
7e70f85350 s3: Pass smbd_server_connection to srv_encrypt_buffer 2011-08-25 21:36:19 +02:00
Volker Lendecke
d4c4705e55 s3: Pass smbd_server_connection to srv_decrypt_buffer 2011-08-25 21:36:19 +02:00
Volker Lendecke
08262fe964 s3: Pass smbd_server_connection to srv_free_enc_buffer 2011-08-25 21:36:19 +02:00
Volker Lendecke
f9ef138ec7 s3: Pass smbd_server_connection to is_encrypted_packet 2011-08-25 21:36:19 +02:00
Volker Lendecke
b4b9918cc8 s3: Pass sconn to valid_smb_header 2011-08-25 21:36:19 +02:00
Volker Lendecke
1022c28e15 s3: Fix bug 8360
OS/2 sends an unexpected write&x/read&x chain

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Aug 14 08:48:58 CEST 2011 on sn-devel-104
2011-08-14 08:48:58 +02:00
Simo Sorce
0de09289ae s3-printing: Force pcap reload when all ready
This way we are sure the cache is primed properly and messages can be sent to
processes if necessary as all messaging has been set up.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:05 +02:00
Simo Sorce
05455b459a lib-util: Make useful function a common utility.
Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-10 18:14:02 +02:00
Andreas Schneider
dd3a927959 s3-smbd: Pass tevent context to smbd_server_connection_loop_once().
Signed-off-by: Simo Sorce <idra@samba.org>
2011-08-09 10:41:47 +02:00
Volker Lendecke
d20e968cff s3: Move deferred_open_queue to smbd_server_connection 2011-08-02 19:18:09 +02:00
Volker Lendecke
cb69d105f5 s3: Pass sconn explicitly to get_deferred_open_message_smb 2011-08-02 19:18:08 +02:00
Volker Lendecke
f9d183f931 s3: Pass sconn explicitly to open_was_deferred 2011-08-02 19:18:08 +02:00
Volker Lendecke
502fdae7f1 s3: Pass sconn explicitly to schedule_deferred_open_message_smb 2011-08-02 19:18:08 +02:00
Volker Lendecke
04253dfd9f s3: Explicitly pass sconn to remove_deferred_open_message_smb 2011-08-02 19:18:08 +02:00
Simo Sorce
2e8a85ec72 s3:smbd - Move printing queue stuff
This way we can properly deal with pcap updates in the background queue process
if it is enabled (on by default) and not perform these actions in the main
smbd process.

Signed-off-by: Günther Deschner <gd@samba.org>
2011-08-02 15:28:03 +02:00
Volker Lendecke
5812645f49 s3: Priorize the async echo responder over the client
Without this, an active client connection can starve the echo responder. This
leads to apparently "lost" SMBs.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Jul 28 18:53:38 CEST 2011 on sn-devel-104
2011-07-28 18:53:38 +02:00
Volker Lendecke
4dd0a3b5e2 s3: Remove unused smbd_echo_reader() 2011-07-28 17:42:23 +02:00
Volker Lendecke
710e5d9256 s3: Use smbd_echo_read_send in the async echo handler 2011-07-28 17:42:23 +02:00
Volker Lendecke
27afb8910f s3: Add smbd_echo_read_send/recv
Read a SMB packet in the echo responder, giving the parent one second to step
in
2011-07-28 17:42:23 +02: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
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
Stefan Metzmacher
0633c0f600 s3:smbd: s/SMBkeepalive/NBSSkeepalive
metze
2011-07-12 09:44:04 +02:00
Stefan Metzmacher
aca920b27c s3:smbd: use PROTOCOL_SMB2_02 instead PROTOCOL_SMB2
metze
2011-07-12 08:18:00 +02:00
Jeremy Allison
8dc7029561 Fix bug #8293 - SMB2 doesn't rotate the log files often enough.
Move the num_requests field out of the smb1 struct into the generic
struct smbd_server_connection struct. Use it to count SMB2 requests
as well as SMB1 and ensure that check_log_size() is called every 50
SMB2 requests.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Fri Jul  8 01:14:53 CEST 2011 on sn-devel-104
2011-07-08 01:14:53 +02:00
Andrew Bartlett
c599d075cb s3-lib Move event_add_idle() to source3/lib/events.c
This allows libauth not to depend on smbd_base.

Andrew Bartlett
2011-07-04 18:53:59 +10:00
Andreas Schneider
ad0f765a09 s3-smbd: Exit cleanly if we can't create an address string.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-07-04 18:28:21 +10:00
Andreas Schneider
a513086c2a s3-smbd: Replace client_id in smbd process.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2011-07-04 18:28:16 +10:00
Andrew Bartlett
8d4a8389bb s3-talloc Change TALLOC_MEMDUP() to talloc_memdup()
Using the standard macro makes it easier to move code into common, as
TALLOC_MEMDUP isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
ad0a07c531 s3-talloc Change TALLOC_ZERO_P() to talloc_zero()
Using the standard macro makes it easier to move code into common, as
TALLOC_ZERO_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
d5e6a47f06 s3-talloc Change TALLOC_P() to talloc()
Using the standard macro makes it easier to move code into common, as
TALLOC_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
3d15137653 s3-talloc Change TALLOC_ARRAY() to talloc_array()
Using the standard macro makes it easier to move code into common, as
TALLOC_ARRAY isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
73b377432c s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc()
Using the standard macro makes it easier to move code into common, as
TALLOC_REALLOC_ARRAY isn't standard talloc.

Andrew Bartlett
2011-06-09 12:40:08 +02:00
Jeremy Allison
06fb258500 release_ip() is only used with CLUSTER_SUPPORT. 2011-06-01 23:53:07 +02: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
Christian Ambach
df650fa8cf s3:smbd remove unused code
in the early CTDB days, the RELEASE_IP message was defined
and some code was added to react on such a message to make
smbd exit if the IP address it was using for the server socket
is removed by CTDB.
Later, it was discovered that we need to stop smbd immediately
and logic was added to ctdb_conn to call release_ip() without
going through the messaging system.

So this code is not used and can be removed

Autobuild-User: Christian Ambach <ambi@samba.org>
Autobuild-Date: Fri May 20 16:18:24 CEST 2011 on sn-devel-104
2011-05-20 16:18:24 +02:00
Volker Lendecke
8a2eff871f s3: Fork the echo handler only after SMB1 negprot is done
This enables activating the echo responder also if SMB2 is enabled, albeit it
will only be used for SMB1 at this moment.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri May 20 15:06:03 CEST 2011 on sn-devel-104
2011-05-20 15:06:03 +02:00
Christian Ambach
642c6ba2b9 Fix Bug 8152 - smbd crash in release_ip()
release_ip() needs the private_data, but it was never saved away
to feed it into release_ip() later

Autobuild-User: Christian Ambach <ambi@samba.org>
Autobuild-Date: Thu May 19 21:21:14 CEST 2011 on sn-devel-104
2011-05-19 21:21:14 +02:00
Volker Lendecke
fc79169ca4 s3: conn->sconn in smbd_server_connection_read/write_handler
"struct smbd_server_connection" is called sconn elsewhere, avoid confusion

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue May 17 19:00:20 CEST 2011 on sn-devel-104
2011-05-17 19:00:20 +02:00
Günther Deschner
27022587e3 s3-libsmb: move protos to libsmb/proto.h
Guenther
2011-05-06 16:37:18 +02:00
Jeremy Allison
4f41be356a Fix many const compiler warnings. 2011-05-05 10:41:59 -07:00
Volker Lendecke
0232604875 s3: Handle EINTR from sys_poll correctly
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue May  3 18:06:48 CEST 2011 on sn-devel-104
2011-05-03 18:06:48 +02:00
Günther Deschner
c233c21425 s3-proto: move remaining spoolss protos to own header file.
Guenther
2011-05-02 15:03:43 +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
Volker Lendecke
8b5d163d89 s3: Fix smbd with the async echo responder
We need to read from the echo socket, pass the socket to read
from down to the read routines

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Apr 14 15:34:36 CEST 2011 on sn-devel-104
2011-04-14 15:34:36 +02:00
Volker Lendecke
15d6c70707 s3: Fix a typo
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Apr 14 11:55:56 CEST 2011 on sn-devel-104
2011-04-14 11:55:56 +02:00
Günther Deschner
165521e20d s3: only include smb profiling where needed.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Thu Apr 14 01:31:39 CEST 2011 on sn-devel-104
2011-04-14 01:31:39 +02:00
Günther Deschner
ab36d597e7 s3-messages: make ndr_messaging.h part of messages.h.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
b2af281e50 s3-messages: only include messages.h where needed.
Guenther
2011-03-30 01:13:09 +02: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
Volker Lendecke
0f082de561 s3: Eliminate sys_select from fd_is_readable 2011-02-28 16:40:19 +01:00
Volker Lendecke
9758afd47e s3: Use poll in smbd 2011-02-28 16:40:19 +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
Volker Lendecke
16229e4cef s3: Avoid a select call per smb
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Feb 11 12:13:54 CET 2011 on sn-devel-104
2011-02-11 12:13:54 +01:00
Volker Lendecke
8af7400d55 s3: Fix some nonempty blank lines 2011-02-06 16:44:56 +01:00
Stefan Metzmacher
0bbe7334d6 s3:smbd: let smbd_server_connection_loop_once() check for select errors
metze
2011-01-31 16:16:09 +01:00
Stefan Metzmacher
6953e2fa66 Revert "s3: Fix starving the echo responder"
This reverts commit d5cf6482ed.

I'll add a more generic fix for this problem.

metze
2011-01-31 16:16:09 +01:00
Stefan Metzmacher
19d3779274 Revert "s3:events: Call all ready fd event handlers on each iteration of the main loop"
This reverts commit 455fccf86b.

I'll add a more generic fix for this problem.

metze
2011-01-31 16:16:09 +01:00
Jeremy Allison
67e578ab5a Allow "security = share" with SMB2. We already handle this in smb2/smb2_server.c
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Jan 26 20:37:29 CET 2011 on sn-devel-104
2011-01-26 20:37:29 +01:00
Volker Lendecke
109cbe37a2 s3: Fix bug 7917: Yet another bug in chain_reply
Found by Michael Hanscho <samba@micha.priv.at> with a WinCE client.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Jan 14 17:42:05 CET 2011 on sn-devel-104
2011-01-14 17:42:05 +01:00
David Disseldorp
0b188e7784 s3-printing: Initiate pcap reload from parent smbd
Since commit 7022554, smbds share a printcap cache (printer_list.tdb),
therefore ordering of events between smbd processes is important when
updating printcap cache information. Consider the following two process
example:
1) smbd1 receives HUP or printcap cache time expiry
2) smbd1 checks whether pcap needs refresh, it does
3) smbd1 marks pcap as refreshed
4) smbd1 forks child1 to obtain cups printer info
5) smbd2 receives HUP or printcap cache time expiry
6) smbd2 checks whether pcap needs refresh, it does not (due to step 3)
7) smbd2 reloads printer shares prior to child1 completion (stale pcap)
8) child1 completion, pcap cache (printer_list.tdb) is updated by smbd1
9) smbd1 reloads printer shares based on new pcap information

In this case both smbd1 and smbd2 are reliant on the pcap update
performed on child1 completion.
The prior commit "reload shares after pcap cache fill" ensures that
smbd1 only reloads printer shares following pcap update, however smbd2
continues to present shares based on stale pcap data.

This commit addresses the above problem by driving pcap cache and
printer share updates from the parent smbd process.
1) smbd0 (parent) receives a HUP or printcap cache time expiry
2) smbd0 forks child0 to obtain cups printer info
3) child0 completion, pcap cache (printer_list.tdb) is updated by smbd0
4) smbd0 reloads printer shares
5) smbd0 notifies child smbds of pcap update via message_send_all()
6) child smbds read fresh pcap data and reload printer shares

This architecture has the additional advantage that only a single
process (the parent smbd) requests printer information from the printcap
backend.

Use time_mono in housekeeping functions As suggested by Björn Jacke.
2011-01-07 15:37:39 -08:00
David Disseldorp
04248c2cfa s3-printing: reload shares after pcap cache fill
Since commit eada8f8a, updates to the cups pcap cache are performed
asynchronously - cups_cache_reload() forks a child process to request
cups printer information and notify the parent smbd on completion.

Currently printer shares are reloaded immediately following the call to
cups_cache_reload(), this occurs prior to smbd receiving new cups pcap
information from the child process. Such behaviour can result in stale
print shares as outlined in bug 7836.

This fix ensures print shares are only reloaded after new pcap data has
been received.

Pair-Programmed-With: Lars Müller <lars@samba.org>
2011-01-07 15:37:39 -08:00
Jeremy Allison
30d29e64cb All calls to event_add_to_select_args() call GetTimeOfDay() and
pass this in as the &now parameter. Push this call inside of
event_add_to_select_args() to the correct point so it doesn't
get called unless needed.

Jeremy.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Dec 23 01:08:11 CET 2010 on sn-devel-104
2010-12-23 01:08:11 +01:00
Volker Lendecke
efb22bf782 s3: Add some DEBUG
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Oct 20 11:58:20 UTC 2010 on sn-devel-104
2010-10-20 11:58:20 +00:00
Volker Lendecke
da00021a7c s3: Cope with EINTR in smbd_[un]lock_socket 2010-10-20 13:14:57 +02:00
Jeremy Allison
e7d0f478ee Add deadtime detection for SMB2. Correctly update lastused timestamp across all active tcons. Should fix dfree cache not updating bug. 2010-10-19 15:13:17 -07:00
Volker Lendecke
c2533f94b5 s3: Remove smbd_server_conn from construct_reply
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Oct 14 12:35:07 UTC 2010 on sn-devel-104
2010-10-14 12:35:07 +00:00
Volker Lendecke
63e08ef885 s3: Lift smbd_server_conn from receive_smb_talloc 2010-10-14 13:53:07 +02:00
Volker Lendecke
a2db154caa s3: Lift smbd_server_conn from receive_smb_raw_talloc 2010-10-14 13:53:07 +02:00
Volker Lendecke
fa0de39551 s3: Lift smbd_server_conn from receive_smb_raw_talloc_partial_read 2010-10-14 13:53:07 +02:00
Volker Lendecke
cac60a7041 s3: Remove some explicit smbd_server_conn refs in process_smb() 2010-10-14 13:53:06 +02:00
Volker Lendecke
81bdb5910c s3: Rename "conn" to the more used "sconn" in process_smb() 2010-10-14 13:53:06 +02:00
Volker Lendecke
fd9effce2b s3: Fix the async echo responder for netbios keepalives
This fixes a crash in the echo responder when the client started to send the
NetBIOS-Level 0x85-style keepalive packets. We did not correctly check the
packet length, so the code writing the signing seqnum overwrote memory after
the malloc'ed area for the 4 byte keepalive packet.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Oct  7 19:47:35 UTC 2010 on sn-devel-104
2010-10-07 19:47:35 +00:00
Volker Lendecke
342c79e265 s3: Make the write end of the echo responder pipe non-blocking
Without this, we can get a writable pipe end, but the writev call on the pipe
will block.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Oct  6 13:57:30 UTC 2010 on sn-devel-104
2010-10-06 13:57:30 +00:00
Steven Danneman
455fccf86b s3:events: Call all ready fd event handlers on each iteration of the main loop
Previously, only one fd handler was being called per main message loop
in all smbd child processes.

In the case where multiple fds are available for reading the fd
corresponding to the event closest to the beginning of the event list
would be run.  Obviously this is arbitrary and could cause unfairness.

Usually, the first event fd is the network socket, meaning heavy load
of client requests can starve out other fd events such as oplock
or notify upcalls from the kernel.

In this patch, I have changed the behavior of run_events() to unset
any fd that it has already called a handler function, as well
as decrement the number of fds that were returned from select().
This allows the caller of run_events() to iterate it, until all
available fds have been handled.

I then changed the main loop in smbd child processes to iterate
run_events().  This way, all available fds are handled on each wake
of select, while still checking for timed or signalled events between
each handler function call.  I also added an explicit check for
EINTR from select(), which previously was masked by the fact that
run_events() would handle any signal event before the return code
was checked.

This required a signature change to run_events() but all other callers
should have no change in their behavior.  I also fixed a bug in
run_events() where it could be called with a selrtn value of -1,
doing unecessary looping through the fd_event list when no fds were
available.

Also, remove the temporary echo handler hack, as all fds should be
treated fairly now.
2010-10-01 13:31:33 -07:00
Günther Deschner
b38d0542e1 samba: share select wrappers.
Guenther
2010-10-01 22:30:22 +02:00
Volker Lendecke
a3e211ca3f s3: Attempt to fix bug 7518
If select returns -1, we can't rely on the fd sets. The current code might loop
endlessly because when putting an invalid fd (the closed socket?) on the read
set, a select implementation might choose not to touch it but directly return
with EINVAL. Thus run_events will see the socket readable, which leads to a
"return true", and thus a NT_STATUS_RETRY -> same game again.

We should never get into this situation, but to me the logfiles given in bug
7518 do not reveal enough information to understand how this can happen.
2010-09-28 19:22:50 +02:00
Volker Lendecke
51bc104c5c s3: Increase the debuglevel for connection termination msgs 2010-09-28 10:40:17 +02:00
Volker Lendecke
790ad3d1a4 s3: Remove two calls to procid_self() 2010-09-28 07:36:18 +02:00
Volker Lendecke
f83e7d8f8c s3: Remove "server_fd" global variable 2010-09-28 07:36:15 +02:00
Jeremy Allison
03841f9e44 Fix bug #7698 - Assert causes smbd to panic on invalid NetBIOS session request.
Found by the CodeNomicon test suites at the SNIA plugfest.

http://www.codenomicon.com/

If an invalid NetBIOS session request is received the code in name_len() in
libsmb/nmblib.c can hit an assert.

Re-write name_len() and name_extract() to use "buf/len" pairs and
always limit reads.

Jeremy.
2010-09-26 03:01:03 -07:00
Günther Deschner
8e16d6dbdf s3-build: only include ctdbd_conn.h where needed.
Guenther
2010-09-20 13:54:50 -07:00
Günther Deschner
c7fe04abc7 s3-build: only include async headers where needed.
Guenther
2010-09-20 13:54:42 -07:00
Volker Lendecke
df19469295 s3: On Solaris, iov_len is an int
We can't use &iov.iov_len passing it to a size_t *
2010-09-05 16:41:28 +02:00
Volker Lendecke
5648c3f67e s3: messaging_ctdbd_connection() was only called with procid_self()
Eventually we'll get this right...
2010-08-31 17:07:41 +02:00
Volker Lendecke
fbf3d03550 s3: Fix an uninitialized variable 2010-08-29 23:14:49 +02:00
Volker Lendecke
f687d43454 s3: Fix the build without cluster 2010-08-29 23:14:49 +02:00
Volker Lendecke
e784e160ec s3: Remove two uses of smbd_server_fd()
Actually, this is a bit cheating. But those two files depend on
smbd_server_conn anyway, it does not make things worse.
2010-08-29 21:55:25 +02:00
Volker Lendecke
744cc26451 s3: Remove smbd_server_fd() from smbd_register_ips 2010-08-29 21:55:24 +02:00
Volker Lendecke
5bbc4df168 s3: Lift smbd_server_fd() from msg_release_ip() 2010-08-29 21:55:24 +02:00
Volker Lendecke
467208e9f4 s3: Lift smbd_server_fd() from release_ip() 2010-08-29 21:55:24 +02:00
Volker Lendecke
70df6fcb2a s3: Pass sconn to check_reload
This removes a use of smbd_server_fd()
2010-08-29 21:55:24 +02:00
Volker Lendecke
babfe23717 s3: Pass sconn instead of msg_ctx to housekeeping_fn 2010-08-29 21:55:24 +02:00
Stefan Metzmacher
db6d1c6276 s3:smbd: s/sa_len/sa_socklen , because sa_len is a macro on IRIX
metze
2010-08-28 08:28:01 +02:00
Volker Lendecke
2d81721a3f s3: Move "trans_num" to smbd_server_connection 2010-08-24 21:06:41 +02:00
Volker Lendecke
1808dd0a85 s3: Make srv_send_smb take an sconn instead of a sock fd 2010-08-24 21:06:41 +02: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
ac7b63384d s3: Lift smbd_server_fd from reload_services() 2010-08-18 11:18:21 +02:00
Volker Lendecke
a58cea0026 s3: Lift smbd_server_fd() from receive_smb_raw_talloc 2010-08-17 22:44:03 +02:00
Volker Lendecke
1f0afe1aed s3: Lift smbd_server_fd() from read_smb_length_return_keepalive 2010-08-17 22:44:03 +02:00
Volker Lendecke
9671547d17 s3: Lift smbd_server_fd() from read_fd_with_timeout() 2010-08-17 22:44:03 +02:00
Volker Lendecke
40ae8b74b6 s3: Remove smbd_server_fd() from write_data()
This completely removes the DEBUG(0, ..) error message from write_data(). I've
gone through all callers of write_data() and made sure that they have their own
equivalent error message printing.
2010-08-17 12:46:53 +02:00
Volker Lendecke
68e86969fa s3: Remove smbd_server_fd() from smbd_process 2010-08-16 22:39:25 +02:00
Volker Lendecke
0bd39c73be s3: Remove smbd_server_fd() from smbd_echo_loop 2010-08-16 22:39:25 +02:00
Volker Lendecke
2cd643865d s3: Remove smbd_server_fd() from smbd_echo_reader 2010-08-16 22:39:25 +02:00
Volker Lendecke
a23483310d s3: Remove smbd_server_fd() from smbd_echo_reply 2010-08-16 22:39:25 +02:00
Volker Lendecke
bb867df269 s3: Remove smbd_server_fd() from keepalive_fn 2010-08-16 22:39:25 +02:00
Volker Lendecke
a2bf46e9ec s3: Remove smbd_server_fd() from smbd_server_connection_handler 2010-08-16 22:39:25 +02:00
Volker Lendecke
8e7a92bc24 s3: Remove smbd_server_fd() from smbd_server_connection_read_handler 2010-08-16 22:39:25 +02:00
Volker Lendecke
6737c3dd32 s3: Remove smbd_server_fd() from chain_reply 2010-08-16 22:39:25 +02:00
Volker Lendecke
b9d052c728 s3: Remove smbd_server_fd() from construct_reply 2010-08-16 22:39:24 +02:00