summaryrefslogtreecommitdiff
path: root/source4/libcli/raw/clitransport.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r8407: fixed a bug left over from our old socket code.Andrew Tridgell1-23/+33
Thanks to lha for giving me a login on a netbsd machine to see this (This used to be commit 4e66f682e4f1c31bbe9441a13af2c245db31433d)
2007-10-10r8111: fixed the client library to work against w2k3 with nt status codesAndrew Tridgell1-1/+1
disabled. The main change is to turn off spnego, which cannot work at all without nt status codes (w2k3 gives a ERRHRD:ERRgeneral error when you try) I also modified NT_STATUS_EQUAL() to allow for nt->dos code equality, but only when nt status codes are disabled in smb.conf. That keeps all the existing torture code working, while still allowing us to correctly catch the cases where forced dos error codes are needed The dos->ntstatus mapping table has been removed completely, as it doesn't really make sense, is impossible to get right, and with the new dos status handling isn't needed. When matching a nt status code to a dos status code it makes far more sense to map from the nt code to the dos code and compare, rather than the reverse, as the nt->dos mapping is what windows has to do internally, so there really is a valid mapping table. (This used to be commit f21274e07b361ef40fdc0fe23e96f1c9c63a091c)
2007-10-10r8104: - added support for our client library to not negotiate nt status ↵Andrew Tridgell1-7/+14
codes, controlled with 'nt status support' option. - make nt_errstr() display nice strings for dos status codes encoded using NT_STATUS_DOS() - no longer map between dos and nt status codes in the client library, instead return using NT_STATUS_DOS() - fixed the RAW-CONTEXT test to look for NT_STATUS_DOS(ERRSRV, ERRbaduid) instead of NT_STATUS_INVALID_HANDLE (This used to be commit ff5549e87ffae9f062394f30d8fd1ae95b614735)
2007-10-10r7654: - add a timeout to all smb requests (default 60 seconds)Andrew Tridgell1-0/+46
- add a request destructor, to make it safe to destroy a pending request with talloc_free() (This used to be commit 72c6988767249caa585f37fec4c0afbf41557ec2)
2007-10-10r5322: removed a whole bunch of #include lines that minimal_includes.plAndrew Tridgell1-1/+0
thinks are not needed. Now to see how this fares on the build farm :) (This used to be commit 80ffcc650c9c86141507edd8338b97814a85f868)
2007-10-10r5304: removed lib/socket/socket.h from includes.hAndrew Tridgell1-0/+1
(This used to be commit b902ea546d2d1327b23f40ddaeeaa8e7e3662454)
2007-10-10r5197: moved events code to lib/events/ (suggestion from metze)Andrew Tridgell1-1/+1
(This used to be commit 7f54c8a339f36aa43c9340be70ab7f0067593ef2)
2007-10-10r5195: most events don't need the time of the event, so save a ↵Andrew Tridgell1-1/+0
gettimeofday() call and just use timeval_current() when its actually needed (This used to be commit 236403cc4dc2924ed6a898acae0bb44cc1688dcc)
2007-10-10r5185: make all the events data structures private to events.c. This willAndrew Tridgell1-17/+28
make it possible to add optimisations to the events code such as keeping the next timed event in a sorted list, and using epoll for file descriptor events. I also removed the loop events code, as it wasn't being used anywhere, and changed timed events to always be one-shot (as adding a new timed event in the event handler is so easy to do if needed) (This used to be commit d7b4b6de51342a65bf46fce772d313f92f8d73d3)
2007-10-10r4954: we don't need the separate event_remove_*() calls any more, as you nowAndrew Tridgell1-1/+1
remove an event by calling talloc_free(). (This used to be commit 8f19b6886cc58a56d52aecfc83a175197061e533)
2007-10-10r4951: some of the code dealing with libcli was getting too complex trying toAndrew Tridgell1-5/+8
handle the inverted memory hierarchy that a normal session establishment gave. The inverted hierarchy came from that fact that you first establish a socket, then a transport, then a session and finally a tree. That leads to the socket being at the top of the memory hierarchy and the tree at the bottom, which makes no sense from the users point of view, as they want to be able to free the tree and have everything disappear. The core problem was that the libcli interface didn't distinguish between establishing a primary context and a secondary context. If you establish a 2nd session on a transport then you want the transport to be referenced by the session, whereas if you establish a primary session then you want the transport to be a child of the session. To fix this I have added "parent_ctx" and "primary" arguments to the libcli intialisation functions. This makes using the library much easier, and gives us a memory hierarchy that makes much more sense. I was prompted to do this by a bug in the cifs backend, which was caused by the socket not being properly torn down on a disconnect due to the inverted memory hierarchy. (This used to be commit 5e8fd5f70178992e249805c2e1ddafaf6840739b)
2007-10-10r4944: every event_add_*() caller was having to call talloc_steal() to takeAndrew Tridgell1-2/+2
control of the event, so instead build that into the function. If you pass NULL as mem_ctx then it leaves it as a child of the events structure. (This used to be commit 7f981b9ed96f39027cbfd500f41e0c2be64cbb50)
2007-10-10r4943: Smplified the events handling code a lot. The first source ofAndrew Tridgell1-1/+1
complexity was that events didn't automatically cleanup themselves. This was because the events code was written before we had talloc destructors, so you needed to call event_remove_XX() to clean the event out of the event lists from every piece of code that used events. I have now added automatic event destructors, which in turn allowed me to simplify a lot of the calling code. The 2nd source of complexity was caused by the ref_count, which was needed to cope with event handlers destroying events while handling them, which meant the linked lists became invalid, so the ref_count ws used to mark events for later destruction. The new system is much simpler. I now have a ev->destruction_count, which is incremented in all event destructors. The event dispatch code checks for changes to this and handles it. (This used to be commit a3c7417cfeab429ffb22d5546b205818f531a7b4)
2007-10-10r4891: - added a generic resolve_name() async interface in libcli/resolve/,Andrew Tridgell1-18/+29
which will eventually try all resolution methods setup in smb.conf - only resolution backend at the moment is bcast, which does a parallel broadcast to all configured network interfaces, and takes the first reply that comes in (this nicely demonstrates how to do parallel requests using the async APIs) - converted all the existing code to use the new resolve_name() api - removed all the old nmb code (yay!) (This used to be commit 239c310f255e43dd2d1c2433f666c9faaacbdce3)
2007-10-10r4886: fixed two places where we process the send side of a socket after theAndrew Tridgell1-0/+1
recv side in the same event. That's a bad idea, as the first callback could decide to destroy the socket. (This used to be commit bf74ea34fc0e3c31e220c8f5a9217c95f3ca1d52)
2007-10-10r4811: now that the event context is at the socket level, the event cleanupAndrew Tridgell1-1/+0
should be there too (This used to be commit 058ae5527e3daeb50eeea9e0ecee858c84e7e17d)
2007-10-10r4777: added a smb_composite_sesssetup() async composite function. ThisAndrew Tridgell1-1/+2
encapsulates all the different session setup methods, including the multi-pass spnego code. I have hooked this into all the places that previously used the RAW_SESSSETUP_GENERIC method, and have removed the old RAW_SESSSETUP_GENERIC code from clisession.c and clitree.c. A nice side effect is that these two modules are now very simple again, back to being "raw" session setup handling, which was what was originally intended. I have also used this to replace the session setup code in the smb_composite_connect() code, and used that to build a very simple replacement for smbcli_tree_full_connection(). As a result, smbclient, smbtorture and all our other SMB connection code now goes via these composite async functions. That should give them a good workout! (This used to be commit 080d0518bc7d6fd4bc3ef783e7d4d2e3275d0799)
2007-10-10r4767: handle the different NBT session request refusals, and map them toAndrew Tridgell1-10/+41
reasonable NT_STATUS values (This used to be commit b193a9cb0c851a4ec55ad9956a815be93eea35e4)
2007-10-10r4758: - added async support to the session request codeAndrew Tridgell1-17/+44
- added async support to the negprot client code - removed two unused parameters from smbcli_full_connection() code - converted smbclient to use smbcli_full_connection() rather than reinventing everything itself (This used to be commit 71cbe2873473e039b4511511302cb63f1c50bce8)
2007-10-10r4757: added the ability of the clisocket level of libcli to handle asyncAndrew Tridgell1-21/+12
socket connections. This was complicated by a few factors: - it meant moving the event context from clitransport to clisocket, so lots of structures changed - we need to asynchronously handle connection to lists of port numbers, not just one port number. The code internally tries each port in the list in turn, without ever blocking - the man page on how connect() is supposed to work asynchronously doesn't work in practice (now why doesn't this surprise me?). The getsockopt() for SOL_ERROR is supposed to retrieve the error, but in fact the next (unrelated) connect() call on the same socket also gets an error, though not the right error. To work around this I need to tear down the whole socket between each attempted port. I hate posix. Note that clisocket.c still does a blocking name resolution call in smbcli_sock_connect_byname(). That will be fixed when we add the async NBT resolution code. Also note that I arranged things so that every SMB connection is now async internally, so using plain smbclient or smbtorture tests all the async features of this new code. (This used to be commit 468f8ebbfdbdf37c757fdc4863626aa9946a8870)
2007-10-10r4549: got rid of a lot more uses of plain talloc(), instead usingAndrew Tridgell1-2/+2
talloc_size() or talloc_array_p() where appropriate. also fixed a memory leak in pvfs_copy_file() (failed to free a memory context) (This used to be commit 89b74b53546e1570b11b3702f40bee58aed8c503)
2007-10-10r4228: make sure the caller knows the packet is in error when a signing ↵Andrew Tridgell1-0/+1
error occurs (This used to be commit 5e13571e6b9f5eb35f710c2c8bd85b5569665613)
2007-10-10r4063: - change char * -> uint8_t in struct request_bufferStefan Metzmacher1-5/+5
- change smbcli_read/write to take void * for the buffers to match read(2)/write(2) all this fixes a lot of gcc-4 warnings metze (This used to be commit b94f92bc6637f748d6f7049f4f9a30b0b8d18a7a)
2007-10-10r3507: - added deferred replies on sharing violation in pvfs open. TheAndrew Tridgell1-8/+8
deferred reply is short-circuited immediately when the file is closed by another user, allowing it to be opened by the waiting user. - added a sane set of timeval manipulation routines - converted all the events code and code that uses it to use struct timeval instead of time_t, which allows for microsecond resolution instead of 1 second resolution. This was needed for doing the pvfs deferred open code, and is why the patch is so big. (This used to be commit 0d51511d408d91eb5f68a35e980e0875299b1831)
2007-10-10r3481: split out client.h and events.hAndrew Tridgell1-0/+1
(This used to be commit c6f486574470a311e0d336c026103f131451e21e)
2007-10-10r3463: separated out some more headers (asn_1.h, messages.h, dlinklist.h and ↵Andrew Tridgell1-0/+1
ioctl.h) (This used to be commit b97e395c814762024336c1cf4d7c25be8da5813a)
2007-10-10r3447: more include/system/XXX.h include filesAndrew Tridgell1-0/+1
(This used to be commit 264ce9181089922547e8f6f67116f2d7277a5105)
2007-10-10r3419: moved the libcli/raw structures into libcli/raw/libcliraw.hAndrew Tridgell1-0/+1
and made them private (This used to be commit 386ac565c452ede1d74e06acb401ca9db99d3ff3)
2007-10-10r3385: when discarding a unmatched reply print the command type to help ↵Andrew Tridgell1-1/+2
debugging (This used to be commit 91139ed8d41a1d4b99379142b3e09c6d0a8ff159)
2007-10-10r3354: honor "max xmit" and "max mux" from smb.conf in our client code. ThisAndrew Tridgell1-1/+4
is important as it allows the test suite to exercise the multiple reply logic in smbd for trans2 search replies. (This used to be commit 865159016ab1e806465a55697444228fb3fa286e)
2007-10-10r3319: fixed a bug in the client library found by the new non-block testing codeAndrew Tridgell1-10/+0
(This used to be commit 1e62aa262aac1c8e3676caac7b65086d21b7a01e)
2007-10-10r3315: converted the libcli/raw/ code to use the generic socket library. ThisAndrew Tridgell1-3/+3
allows me to test with the socket:testnonblock option. It passes. (This used to be commit 7cb4bf8662825d507d8246647ffb10aa08bad794)
2007-10-10r3017: nicer memory handling for event_context_merge()Andrew Tridgell1-1/+0
(This used to be commit 1cef44505e5de9b8ae5206522b624082ad2343b2)
2007-10-10r3016: - converted the events code to tallocAndrew Tridgell1-1/+1
- added the new messaging system, based on unix domain sockets. It gets over 10k messages/second on my laptop without any socket cacheing, which is better than I expected. - added a LOCAL-MESSAGING torture test (This used to be commit 3af06478da7ab34a272226d8d9ac87e0a4940cfb)
2007-10-10r2680: switched the libcli/raw/ code over to use talloc_reference(), which ↵Andrew Tridgell1-2/+1
simplifies things quite a bit (This used to be commit c82a9cf750829c4f6982ca3133295c8599023c4e)
2007-10-10r2660: - converted the libcli/raw/ library to use talloc_increase_ref_count()Andrew Tridgell1-17/+17
rather than manual reference counts - properly support SMBexit in the cifs and posix backends - added a logoff method to all backends With these changes the RAW-CONTEXT test now passes against the posix backend (This used to be commit c315d6ac1cc40546fde1474702a6d66d07ee13c8)
2007-10-10r2655: fixed an error in the shutdown of the sock->transport->session->treeAndrew Tridgell1-2/+1
smbcli raw context handling (This used to be commit d5fd6388751944f11c34e5124d403d57c8670e3b)
2007-10-10r2654: fixed some more server memory leaks. We are now down to a single leakAndrew Tridgell1-1/+1
of 16 bytes, caused by the 16 byte data_blob in the smb_signing code. (This used to be commit 2f1b788e09686e065d22f621f5c0c585192c6740)
2007-10-10r2624: - save some system calls by only trying read/write operations that ↵Andrew Tridgell1-1/+11
select has indicated are possible - when a socket is dead, don't try to do anything more on it (This used to be commit e95e5c591fcf9c3b7fde7fbdcc1837e22195e0a8)
2007-10-10r2247: talloc_destroy -> talloc_freeTim Potter1-1/+1
(This used to be commit 6c1a72c5d667245b1eec94f58e68acd22dd720ce)
2007-10-10r1985: take advantage of the new talloc in a few more placesAndrew Tridgell1-9/+6
(This used to be commit 6ffdfd779936ce8c5ca49c5f444e8da2bbeee0a8)
2007-10-10r1984: this change is what you should read to understand the new talloc()Andrew Tridgell1-2/+2
It simplifies our structure handling a lot, making the code shorter and easier to understand. Look at the diff carefully and see if you can understand it. If you're still confused then please ask. (This used to be commit 03c341aca7f09cb1f0d33ec65e074e6a00caa30f)
2007-10-10r1983: a completely new implementation of tallocAndrew Tridgell1-4/+4
This version does the following: 1) talloc_free(), talloc_realloc() and talloc_steal() lose their (redundent) first arguments 2) you can use _any_ talloc pointer as a talloc context to allocate more memory. This allows you to create complex data structures where the top level structure is the logical parent of the next level down, and those are the parents of the level below that. Then destroy either the lot with a single talloc_free() or destroy any sub-part with a talloc_free() of that part 3) you can name any pointer. Use talloc_named() which is just like talloc() but takes the printf style name argument as well as the parent context and the size. The whole thing ends up being a very simple piece of code, although some of the pointer walking gets hairy. So far, I'm just using the new talloc() like the old one. The next step is to actually take advantage of the new interface properly. Expect some new commits soon that simplify some common coding styles in samba4 by using the new talloc(). (This used to be commit e35bb094c52e550b3105dd1638d8d90de71d854f)
2007-10-10r1896: stricter check on packet parsing for NBT session repliesAndrew Tridgell1-1/+1
(This used to be commit 30ab38559e8c52ecdaf7ca9b124875ade82c5c66)
2007-10-10r1824: nicer handling of NBT session replies, and handling of bad packetsAndrew Tridgell1-0/+6
with the async SMB code (This used to be commit cef94978f43a8326b6cf1888c15ca8c568ebe9f8)
2007-10-10r1712: this should fix a bug with a spinning client when a server diesAndrew Tridgell1-0/+4
unexpectedly. bug found by abartlett. (This used to be commit 566b7a9ce986cdfeabb69f17c472782fc7494d43)
2007-10-10r1654: rename cli_ -> smbcli_Stefan Metzmacher1-62/+62
rename CLI_ -> SMBCLI_ metze (This used to be commit 8441750fd9427dd6fe477f27e603821b4026f038)
2007-10-10r1635: when a transport dies, setup errors for all pending sends and recvs, ↵Andrew Tridgell1-0/+29
plus disalllow any more sends (This used to be commit 326fdc8c9d2848c6c08a49e34c72430fe0116d23)
2007-10-10r1634: to get signing right for async requests we must send requests inAndrew Tridgell1-1/+1
order. Fixed the linked list add to always add to the end for outgoing requests. (This used to be commit 81c450b434bb28b0fa8620c309f39203e8950497)
2007-10-10r1633: fixed a couple of async oplock handling errorsAndrew Tridgell1-5/+9
(This used to be commit d7e2f39b90122088e94d4a8e8c7ffa7c91d7d664)