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

121 Commits

Author SHA1 Message Date
Stefan Metzmacher
648665a008 s3:libsmb: make use of smb_[set]len_nbt() in async_smb.c
metze
2011-10-25 01:47:21 +02:00
Stefan Metzmacher
d670d060fc s3:libsmb: use HDR_* defines in cli_pull_raw_error()
metze
2011-10-25 01:47:21 +02:00
Stefan Metzmacher
7ebd4337ac libcli/smb: move source3/libsmb/read_smb.* to the toplevel
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Mon Oct 24 10:18:06 CEST 2011 on sn-devel-104
2011-10-24 10:18:06 +02:00
Stefan Metzmacher
75d146d3ed libcli/smb: move smb_seal.c to the toplevel
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Oct 21 10:22:39 CEST 2011 on sn-devel-104
2011-10-21 10:22:39 +02:00
Stefan Metzmacher
81f71e76fd s3:libsmb/async_smb: in cli_state_notify_pending() we always disconnect
So we should always set state->mid = 0.

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Thu Oct 20 11:34:23 CEST 2011 on sn-devel-104
2011-10-20 11:34:23 +02:00
Volker Lendecke
fbf1748984 s3: Avoid a winbind 100% cpu loop
When a DC goes down hard, winbind can end up in a 100% CPU loop. The next
(small) RPC request to the DC ends up as a trans2 request. If the connection
goes down, we end up trying to discard the request via the loop in
cli_state_notify_pending(). Because this is a trans2 request,
cli_smb_req_unset_pending will not kick in. Thus the pending array will always
remain at length 1.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Oct 19 01:39:35 CEST 2011 on sn-devel-104
2011-10-19 01:39:35 +02:00
Stefan Metzmacher
2bb17dc23e s3:libsmb: return INTERNAL_ERROR if the request is in bad state when the caller ships it
metze
2011-09-18 05:33:10 +02:00
Stefan Metzmacher
bbe78ca5a2 s3:libsmb: return if tevent_req_set_endtime() fails
tevent_req_set_endtime() already calls tevent_req_nomem().

metze
2011-09-18 05:33:10 +02:00
Stefan Metzmacher
28e3d09916 s3:libsmb: s/cli_encryption_on/cli_state_encryption_on()
metze
2011-09-15 16:17:45 +02:00
Stefan Metzmacher
b02d27ae05 s3:libsmb: move cli->smb1.mid to cli->conn.smb1.mid
metze
2011-09-15 12:12:23 +02:00
Stefan Metzmacher
a6e8167e4a s3:libsmb: return NT_STATUS_CONNECTION_DISCONNECTED instead of NT_STATUS_CONNECTION_INVALID
We should return the same in all places.

metze
2011-09-14 18:03:17 +02:00
Stefan Metzmacher
1dc3ac242a s3:libsmb: let cli_pull_raw_error() return NT_STATUS_OK as DOS-Error success
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Mon Sep 12 19:12:21 CEST 2011 on sn-devel-104
2011-09-12 19:12:21 +02:00
Stefan Metzmacher
74adebe8d9 s3:libsmb: move cli_session_request*() to smbsock_connect.c
metze
2011-08-28 17:23:49 +02:00
Stefan Metzmacher
ab0a1cc5c6 s3:libsmb: move cli_smb_oplock_break_waiter*() to clioplock.c
metze
2011-08-28 17:16:51 +02:00
Stefan Metzmacher
1e43bacd5e s3:libsmb: use cli_smb_req_set_mid() in cli_smb_oplock_break_waiter_send()
metze
2011-08-28 17:16:50 +02:00
Stefan Metzmacher
9e0d975512 s3:libsmb: let cli_smb_req_mid() return the mid set by cli_smb_req_set_mid()
metze
2011-08-28 16:32:19 +02:00
Stefan Metzmacher
b41d44eda3 s3:libsmb: keep a cli_smb_state->one_way
This moves the SMB1 specific stuff to cli_smb_req_create(),
instead of having it in the core dispatching code.

metze
2011-08-12 18:06:28 +02:00
Stefan Metzmacher
c485df9530 s3:libsmb: abstract the incoming dispatch function via a function pointer
This will allow handling of SMB2 in future.

metze
2011-08-12 18:06:04 +02:00
Stefan Metzmacher
58003b5a77 s3:libsmb: split out cli_state_dispatch_smb1() from cli_smb_received()
metze
2011-08-12 17:54:04 +02:00
Stefan Metzmacher
9b15963695 s3:libsmb: add missing TALLOC_FREE(frame) to cli_smb_received()
metze
2011-08-12 17:54:04 +02:00
Stefan Metzmacher
0d1a7fda1e s3:libsmb: keep the request order in cli_smb_req_unset_pending()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Fri Aug 12 12:36:03 CEST 2011 on sn-devel-104
2011-08-12 12:36:03 +02:00
Stefan Metzmacher
edeb41aa20 s3:libsmb: use tevent_req_defer_callback() unless there's only one request in cli_smb_received()
Callers of tevent_req_done() (or similar functions) have to return directly.
Otherwise the callback could invalidate the current stack state,
which is likely to trigger segfaults.

If there was only one pending request and we just got the response
for that one, we can use tevent_req_done() directly.

Otherwise there're more pending requests and we need to call
cli_state_receive_next() or we got the response for chained requests.
Both means that we have to use tevent_req_defer_callback().

metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
02cb2052d8 s3:libsmb: make use of cli_state_receive_next() in cli_smb_received()
metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
56d3c91af7 s3:libsmb: notify all request about failures in cli_smb_req_set_pending()
It's up to the caller to notify the current request,
but we have to notify all other pending requests if
we're not able to read the next response from the server.

metze
2011-08-12 11:08:00 +02:00
Stefan Metzmacher
4335a4f1c6 s3:libsmb: split out cli_state_receive_next() from cli_smb_req_set_pending()
metze
2011-08-12 11:08:00 +02:00
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