summaryrefslogtreecommitdiff
path: root/source4/lib/stream/packet.c
AgeCommit message (Collapse)AuthorFilesLines
2011-10-19s4:lib/stream: make use of smb_len_tcp()Stefan Metzmacher1-1/+7
metze
2011-08-13s4:lib: use tevent_ fns names instead of legcay event_ onesSimo Sorce1-8/+8
2010-09-07s4-packet: make packet_recv_disable() a lot more efficientAndrew Tridgell1-2/+6
this avoids doing an epoll system call when we want to prevent receipt of packets on a socket, unless there actually is a packet to receive.
2009-10-18s4: spelling errorAndrew Tridgell1-1/+1
2009-02-18Worked around a problem with select/poll/epoll and gnutls Andrew Tridgell1-1/+37
Our packet layer relies on the event system reliably telling us when a packet is available. When we are using a socket layer like TLS then things get a bit trickier, as there may be bytes in the encryption buffer which could be read even if there are no bytes at the socket level. The GNUTLS library is supposed to prevent this happening by always leaving some data at the socket level when there is data to be processed in its buffers, but it seems that this is not always reliable. To work around this I have added a new packet option packet_set_unreliable_select() which tells the packet layer to not assume that the socket layer has a reliable select, and to instead keep trying to read from the socket until it gets back no data. This option is set for the ldap client and server when TLS is negotiated. This seems to fix the problems with the ldaps tests.
2009-02-02s4:lib/stream: s/private/private_dataStefan Metzmacher1-16/+16
metze
2008-12-29s4:lib/tevent: rename structsStefan Metzmacher1-5/+5
list="" list="$list event_context:tevent_context" list="$list fd_event:tevent_fd" list="$list timed_event:tevent_timer" for s in $list; do o=`echo $s | cut -d ':' -f1` n=`echo $s | cut -d ':' -f2` r=`git grep "struct $o" |cut -d ':' -f1 |sort -u` files=`echo "$r" | grep -v source3 | grep -v nsswitch | grep -v packaging4` for f in $files; do cat $f | sed -e "s/struct $o/struct $n/g" > $f.tmp mv $f.tmp $f done done metze
2008-10-11Fix include paths to new location of libutil.Jelmer Vernooij1-1/+1
2008-07-07packet: make it possible to free the packet_context from the send_callbackStefan Metzmacher1-0/+6
metze (cherry picked from commit 20795c4a0d5f75561561470231de1a2fad2906ff) (This used to be commit 5d5b4e4ab23e1c630dfde2b9f296681e3979c4e0)
2007-10-10r25522: Convert to standard bool types.Jelmer Vernooij1-12/+12
(This used to be commit 5e814287ba475e12f8cc934fdd09b199dcdfdb86)
2007-10-10r24780: More work allowing libutil to be used by external users.Jelmer Vernooij1-9/+6
(This used to be commit 31993cf67b816a184a4a4e92ef8ca2532c797190)
2007-10-10r23792: convert Samba4 to GPLv3Andrew Tridgell1-3/+2
There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa)
2007-10-10r17930: Merge noinclude branch:Jelmer Vernooij1-2/+2
* Move dlinklist.h, smb.h to subsystem-specific directories * Clean up ads.h and move what is left of it to dsdb/ (only place where it's used) (This used to be commit f7afa1cb77f3cfa7020b57de12e6003db7cfcc42)
2007-10-10r17222: Change the function prototypes for the GENSEc and TLS socket creationAndrew Bartlett1-0/+25
routines to return an NTSTATUS. This should help track down errors. Use a bit of talloc_steal and talloc_unlink to get the real socket to be a child of the GENSEC or TLS socket. Always return a new socket, even for the 'pass-though' case. Andrew Bartlett (This used to be commit 003e2ab93c87267ba28cd67bd85975bad62a8ea2)
2007-10-10r17197: This patch moves the encryption of bulk data on SASL negotiated securityAndrew Bartlett1-4/+29
contexts from the application layer into the socket layer. This improves a number of correctness aspects, as we now allow LDAP packets to cross multiple SASL packets. It should also make it much easier to write async LDAP tests from windows clients, as they use SASL by default. It is also vital to allowing OpenLDAP clients to use GSSAPI against Samba4, as it negotiates a rather small SASL buffer size. This patch mirrors the earlier work done to move TLS into the socket layer. Unusual in this pstch is the extra read callback argument I take. As SASL is a layer on top of a socket, it is entirely possible for the SASL layer to drain a socket dry, but for the caller not to have read all the decrypted data. This would leave the system without an event to restart the read (as the socket is dry). As such, I re-invoke the read handler from a timed callback, which should trigger on the next running of the event loop. I believe that the TLS code does require a similar callback. In trying to understand why this is required, imagine a SASL-encrypted LDAP packet in the following formation: +-----------------+---------------------+ | SASL Packet #1 | SASL Packet #2 | ----------------------------------------+ | LDAP Packet #1 | LDAP Packet #2 | ----------------------------------------+ In the old code, this was illegal, but it is perfectly standard SASL-encrypted LDAP. Without the callback, we would read and process the first LDAP packet, and the SASL code would have read the second SASL packet (to decrypt enough data for the LDAP packet), and no data would remain on the socket. Without data on the socket, read events stop. That is why I add timed events, until the SASL buffer is drained. Another approach would be to add a hack to the event system, to have it pretend there remained data to read off the network (but that is ugly). In improving the code, to handle more real-world cases, I've been able to remove almost all the special-cases in the testnonblock code. The only special case is that we must use a deterministic partial packet when calling send, rather than a random length. (1 + n/2). This is needed because of the way the SASL and TLS code works, and the 'resend on failure' requirements. Andrew Bartlett (This used to be commit 5d7c9c12cb2b39673172a357092b80cd814850b0)
2007-10-10r15854: more talloc_set_destructor() typesafe fixesAndrew Tridgell1-3/+1
(This used to be commit 61c6100617589ac6df4f527877241464cacbf8b3)
2007-10-10r15400: Move the TLS code behind the socket interface.Andrew Bartlett1-27/+7
This reduces caller complexity, because the TLS code is now called just like any other socket. (A new socket context is returned by the tls_init_server and tls_init_client routines). When TLS is not available, the original socket is returned. Andrew Bartlett (This used to be commit 09b2f30dfa7a640f5187b4933204e9680be61497)
2007-10-10r15356: Remove unused 'flags' argument from socket_send() and friends.Andrew Bartlett1-2/+2
This is in preperation for making TLS a socket library. Andrew Bartlett (This used to be commit a312812b92f5ac7e6bd2c4af725dbbbc900d4452)
2007-10-10r13962: make functions publicStefan Metzmacher1-19/+19
metze (This used to be commit fd84583ab4a3afc484f220d1475b1e61b3f2fbc6)
2007-10-10r12694: Move some headers to the directory of the subsystem they belong to.Jelmer Vernooij1-0/+1
(This used to be commit c722f665c90103f3ed57621c460e32ad33e7a8a3)
2007-10-10r11967: Fix more 64-bit warnings.Tim Potter1-2/+2
(This used to be commit 9c4436a124f874ae240feaf590141d48c33a635f)
2007-10-10r11870: fixed the problem volker reported with the RPX-XPLOGIN test. TheAndrew Tridgell1-1/+37
problem was caused by a callback destroying the packet processing context while that context was being used in packet_recv() This is the first time we have used the ability of talloc destructors to 'refuse' a free request. It works well in this case as it makes the composite API simpler to use for other code, and isolates the complexity of having callbacks destroying the packet context to the packet.c code. (This used to be commit b1b2d86541a376f1ef33fae897f750005c386ebe)
2007-10-10r11713: separate out the setting of the fde in the packet context from theAndrew Tridgell1-4/+12
enabling of packet serialisation (This used to be commit 6a47cd65a8b588f9ddd375c57caaba08281e7cbb)
2007-10-10r11712: avoid changing the fde flags unless really neededAndrew Tridgell1-6/+9
(This used to be commit 48e6424b0cce38f7d8f212d1e891ff8bbd5fec34)
2007-10-10r11642: add some error checksStefan Metzmacher1-2/+8
metze (This used to be commit 9d6406d8daeff0a9bde72ce7749d18fa61324e8a)
2007-10-10r11636: a bit neater solution to the nt_cancel problemAndrew Tridgell1-1/+17
(This used to be commit ba7864b07eebecd4d4eb2ce515412a49964ae179)
2007-10-10r11630: another fix for over-reading in the packet code. This time get theAndrew Tridgell1-4/+12
sign of the comparison right :-) (This used to be commit 7e40077aa793e29b5770aae2e07e964239e8249b)
2007-10-10r11629: fixed a bug found with the socket:testnonblock code. With randomisedAndrew Tridgell1-0/+1
under-reads we could end up supplying a buffer to the client that has an incorrect length (This used to be commit 9c95015b9cccc10a5ba1facd4b48c0fff34e9588)
2007-10-10r11627: give the caller much more control over the stream to packet process,Andrew Tridgell1-2/+43
allowing it to specify the initial read size (thus preventing over-reading) and to stop the recv process when needed. This is used by the dcerpc socket code, which relies on not getting packets when it isn't ready for them (This used to be commit f869fd674ec4b148dc9a264e94d19ce79d35131d)
2007-10-10r11618: added a generic '32 bit length prefix' full packet helper to the ↵Andrew Tridgell1-3/+18
packet code (This used to be commit b4dbe55105cc2807a17d7e5bf8db9756cc526a3b)
2007-10-10r11605: added handling of the send queue to the generic packet handling codeAndrew Tridgell1-0/+63
(This used to be commit f98d499b2ef93cf2d060acafbc424754add322a8)
2007-10-10r11602: added packet_set_serialise() to allow the generic packet layer toAndrew Tridgell1-0/+28
handle optional request serialisation (this is something that is commonly needed on stream connections) (This used to be commit d860eb795693d8c292eec2a639ece4793d28dc38)
2007-10-10r11595: added a helper layer to parse streams into individual packets. This isAndrew Tridgell1-0/+312
something that Andrew Bartlett has been asking for for a while, and when I started having to re-invent this packet parsing code yet again for SMB2 I decided it was time to do it generically you use it by providing a "is this a full packet yet?" helper function to the packet_*() functions, which then handle all the logic of partial packet buffering. This also goes to great lengths to operate efficiently, minimising the number of recv system calls. (This used to be commit e6c47b954a6f09c53ea419800ce873295fcd0be9)