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

96 Commits

Author SHA1 Message Date
Stefan Metzmacher
ca567117b0 s3:libsmb: use talloc_stackframe() in cli_smb_received()
metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
bae9324e50 s3:libsmb: call cli_smb_req_unset_pending() before tevent_req_done() also for chained requests
metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
d41d2e93f4 s3:libsmb: reset the destructor in cli_smb_req_unset_pending()
metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
c01b8326e0 s3:libsmb: add cli_state_notify_pending() and use it
If we got a problem on the connection we need to notify every
pending request. But we need to make use of tevent_req_defer_callback()
before tevent_req_nterror(), otherwise the callback, triggered
by tevent_req_nterror(), could invalidate the state of current caller,
which will likely cause segfaults.

metze
2011-08-12 11:08:00 +02:00
Volker Lendecke
1335059ff5 s3: Fix async smb handling
In cli_echo with more than one response we ended up with more than one read_smb
request. One from the call to cli_smb_req_set_pending called from
cli_smb_received. The other one from cli_smb_received itself. I don't really
see another way to deal with this than to hold the read_smb request in the
cli_state.

Metze, please check!

Volker
2011-07-27 00:47:45 +02:00
Stefan Metzmacher
13dbd5021b s3:libsmb: move cli_state->fd to cli_state->conn.fd
metze
2011-07-22 17:06:07 +02:00
Stefan Metzmacher
6d1757f189 s3:libsmb: make use of cli_state_disconnect()
metze
2011-07-22 17:06:07 +02:00
Stefan Metzmacher
103413da8b s3:libsmb: make use of cli_state_is_connected()
metze
2011-07-22 17:06:07 +02:00
Stefan Metzmacher
a11cc880ef s3:libsmb: move cli_state->outgoing to cli_state->conn.outgoing
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Jul 22 09:53:59 CEST 2011 on sn-devel-104
2011-07-22 09:53:59 +02:00
Stefan Metzmacher
9f2b3b0be6 s3:libsmb: move cli_state->pending to cli_state->conn.pending
metze
2011-07-22 08:44:08 +02:00
Stefan Metzmacher
8f41e54d53 s3:libsmb: move cli->cnum to cli->smb1.tid and hide it behind cli_state_[g|s]et_tid()
metze
2011-07-20 15:56:27 +02:00
Stefan Metzmacher
6c31b610e4 s3:libsmb: move cli->mid to cli->smb1.mid
metze
2011-07-20 15:48:59 +02:00
Stefan Metzmacher
a1c1f8c83b s3:libsmb: remove unused cli_smb_inbuf()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Wed Jul 13 01:19:51 CEST 2011 on sn-devel-104
2011-07-13 01:19:51 +02:00
Stefan Metzmacher
235aedae50 s3:libsmb: don't use the cli->inbuf to store the last error
We keep the raw error in cli->raw_status now, until we fixed all
caller to get the NTSTATUS from the function calls.

metze
2011-07-08 14:09:09 +02:00
Volker Lendecke
f0ff6f390a Use tevent_req_oom
This fixes a few Coverity errors
2011-06-20 12:33:24 +02:00
Stefan Metzmacher
3dd1ebd21e s3:libsmb/async_smb: add helpers to get and set the seqnum for signing
This will be used for correct signing in [nt]trans[2][s] requests.

metze
2011-06-10 19:27:05 +02:00
Stefan Metzmacher
a25936f1b1 s3:libsmb/async_smb: don't remove pending requests if the mid is set
If the mid was set explicitly, it means the request expects more than
one reply, so leave it in the pending array.

metze
2011-06-10 19:27:05 +02:00
Stefan Metzmacher
173fc258e4 s3:libsmb/async_smb: call cli_smb_req_unset_pending() instead of destructor directly
metze
2011-06-10 19:27:05 +02:00
Stefan Metzmacher
49cdf171a5 s3:libsmb/async_smb: let cli_smb_recv() initialize output values for one way requests
metze
2011-06-10 19:27:05 +02:00
Volker Lendecke
976a43c5aa s3: Remove a pointless if-statement
We are here only if we have more than one num_pending

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jun  6 18:21:17 CEST 2011 on sn-devel-104
2011-06-06 18:21:17 +02:00
Rusty Russell
56e72337b0 lib/util/time.c: timeval_current_ofs_msec
Several places want "milliseconds from current time", and several were
simply doing "msec * 1000" which can (and does in one place) result in
a usec value over 1 a million.

Using a helper to do this is safer and more readable.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-01 10:38:47 +02:00
Volker Lendecke
1a393b7cd6 s3: Directly call common_encrypt_buffer in cli_smb_req_iov_send 2011-05-23 11:06:08 +02:00
Volker Lendecke
0645deb1b4 s3: Do central cli_set_error 2011-05-19 17:31:30 +02:00
Volker Lendecke
e7e43ba6a1 s3: Make read_smb_send/recv public 2011-05-19 13:46:47 +02:00
Rusty Russell
87e3542174 async_smb.c: convert cli->timeout properly
I have a test failure on my 32-bit Ubuntu system, in that
samba3.smbtorture_s3.plain(s3dc).LOCK9 immediately times out (rather than
waiting 5 seconds for the child).

Debugging revealed this code: timeout is in ms and is set to > 1000 in
various places.  The code dates from 2002, and other perturbations didn't
reveal why it breaks now, but fix it anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date: Tue May 10 12:09:07 CEST 2011 on sn-devel-104
2011-05-10 12:09:07 +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
e131c94ac1 More const fixes for compiler warnings from the waf build. 2011-05-05 23:56:07 +02:00
Günther Deschner
50883cfeb4 s3-tevent: only include ../lib/util/tevent wrappers where needed.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Fri Apr 29 14:00:30 CEST 2011 on sn-devel-104
2011-04-29 14:00:30 +02:00
Günther Deschner
2473c2fb1b s3-libsmb: put namequery headers to nmblib.h
We might find a better name for it and merge other namequery related things as
well here...

Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
6c8d802391 s3-libsmb: move smb encryption structs into own header.
Guenther
2011-03-16 10:11:16 +01:00
Volker Lendecke
02a74fd36d s3: Add async cli_session_request
This does not do the redirects, but I think that might be obsolete anyway
2010-12-22 16:39:15 +01:00
Volker Lendecke
e25ee6af8f s3: Make winbind recover from a signing error
When winbind sees a signing error on the smb connection to a DC (for whatever
reason, our bug, network glitch, etc) it should recover properly. The "old"
code in clientgen.c just closed the socket in this case. This is the right
thing to do, this connection is spoiled anyway. The new, async code did not do
this so far, which led to the code in winbindd_cm.c not detect that we need to
reconnect.
2010-11-18 14:48:18 +00:00
Günther Deschner
c7fe04abc7 s3-build: only include async headers where needed.
Guenther
2010-09-20 13:54:42 -07:00
Jim McDonough
0ec0095d1a s3-libsmbclient Convert dos error codes to NTstatus in async libsmbclient.
DOS error codes were being lost with the conversion to async
libsmbclient.  If we're passing around NTSTATUS internally,
let's just convert it when we get it.

DOS ACCESS_DENIED on nautilus was not prompting for other credentials,
because it was not being mapped.
2010-08-19 15:49:31 -04:00
Jeremy Allison
d447184ca8 If the timeout has been set to zero, don't register an end time.
The caller doesn't want a timeout.

Jeremy.
2010-03-30 13:45:53 -07:00
Volker Lendecke
9ad1b4cda0 s3: Fix the CHAIN1 torture test
I've tried to solve this just within cli_smb_recv(), but I could not find a way
to sanely determine when we are receiving the last entry in the chain just from
looking at the blob. This solves it in an a bit more brutal way...
2010-02-28 18:49:59 +01:00
Volker Lendecke
299d9c409d s3: Explicitly handle inbuf in cli_smb_oplock_break_waiter_done 2010-02-22 23:23:18 +01:00
Volker Lendecke
d122bfc064 s3: Add a talloc_move for the inbuf to cli_smb_recv 2010-02-22 23:23:18 +01:00
Volker Lendecke
65914ed819 s3: Avoid calling cli_alloc_mid twice in cli_smb_req_iov_send
I hate macros....
2010-02-21 20:42:39 +01:00
Björn Jacke
38be40f63c s3:async_smb: remove unused variable 2010-01-26 00:19:10 +01:00
Volker Lendecke
3f25fb5677 s3: NT_STATUS_MORE_PROCESSING_REQUIRED is a valid sesssetup return value 2010-01-03 11:38:22 +01:00
Volker Lendecke
47bee67c05 s3: Restore correct timeouts for SMB requests 2009-12-22 16:07:58 +01:00
Volker Lendecke
528c150d55 s3: Remove a pointless else branch 2009-12-22 14:08:08 +01:00
Volker Lendecke
b6f446ca35 s3: Move smb_splice_chain to smbd/process.c, its only user 2009-12-22 13:54:43 +01:00
Volker Lendecke
a8e02b591b Add "err_on_readability" to writev_send
A socket where the other side has closed only becomes readable. To catch
errors early when sitting in a pure writev, we need to also test for
readability.
2009-05-24 13:47:29 +02:00
Volker Lendecke
f140bf2e65 Fix broken pipe handling
Metze is right: If we have *any* error at the socket level, we just can
not continue.

Also, apply some defensive programming: With this async stuff someone else
might already have closed the socket.
2009-05-18 07:13:04 +02:00
Bo Yang
aa70e44cd0 s3: tevent_req_poll() loops forever when pipe is broken
Signed-off-by: Bo Yang <boyang@samba.org>
2009-05-19 01:13:36 +08:00
Stefan Metzmacher
b9f3a78169 s3:libsmb: move read_smb_send/recv() static in async_smb.c
metze
2009-05-13 18:27:50 +02:00
Stefan Metzmacher
ca6ec5ecd7 s3:libsmb: let cli_smb_chain_send() also return NTSTATUS
metze
2009-05-13 18:27:50 +02:00
Bo Yang
6ff09b323e s3:libsmb: return NT_STATUS_CONNECTION_INVALID if the fd is -1
This way we can destinguish between requests which failed
because the connection broke after they were triggered
and the requests which are started on an already broken
connection.

This also moves the check to cli_smb_req_iov_send()
where it really belongs.

metze
2009-05-13 18:27:41 +02:00