summaryrefslogtreecommitdiff
path: root/source4/smb_server/smb_server.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r7523: blerghAndrew Tridgell1-1/+6
the error code for an invalid tid depends on the command (This used to be commit 9dab036fbe50d84cb79d7a103c454a1c0c90a48a)
2007-10-10r7510: fixed error code for using a bad tid.Andrew Tridgell1-1/+1
amazingly, I have seen w2k do a session setup followed by an immediate attempted opening of \netlogon, with no tconx to ipc$ first. So this error code can matter. (This used to be commit 79112d81cb9ea3fc7e94be1af282ab4247170532)
2007-10-10r6270: Move the VUID handling to a IDR tree. This should avoid O(n)Andrew Bartlett1-1/+1
behaviour on session setups, and because we no longer need do deal with the linked list as much, the code is much simpiler too. We may be able to compleatly remove the tid and vuid linked lists, but I need to check. This patch also tries to clean up the VUID handling and session setups in general. To avoid security issues, we now have a distinction between VUIDs allocated for the session setup (to tie togeather the multiple round trips) and those used after authentication. Andrew Bartlett (This used to be commit 3e5775146d9ce6f0ac43aecae7e899b5324399ad)
2007-10-10r5294: - added a separate NBT-WINS test for WINS operations (register, ↵Andrew Tridgell1-1/+1
refresh, release and query) - change the iface_n_*() functions to return a "const char *" instead of a "struct ipv4_addr" I think that in general we should move towards "const char *" for all IP addresses, as this makes IPv6 much easier, and is also easier to debug. Andrew, when you get a chance, could you fix some of the auth code to use strings for IPs ? - return a NTSTATUS error on bad name queries and node status instead of using rcode. This makes the calling code simpler. - added low level name release code in libcli/nbt/ - use a real IP in the register and wins nbt torture tests, as w2k3 WINS server silently rejects some operations that don't come from the IP being used (eg. it says "yes" to a release, but does not in fact release the name) (This used to be commit bb1ab11d8e0ea0bd9ae34aebeb565d36fe4b495f)
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-5/+5
gettimeofday() call and just use timeval_current() when its actually needed (This used to be commit 236403cc4dc2924ed6a898acae0bb44cc1688dcc)
2007-10-10r5193: make sure we mark the event dead when we free it on a dead connectionAndrew Tridgell1-0/+1
(This used to be commit 90535bab957ddaa7bfcdf43e199581f3352bdc8a)
2007-10-10r5185: make all the events data structures private to events.c. This willAndrew Tridgell1-2/+2
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-10r5102: This is a major simplification of the logic for controlling top levelAndrew Tridgell1-106/+59
servers in smbd. The old code still contained a fairly bit of legacy from the time when smbd was only handling SMB connection. The new code gets rid of all of the smb_server specific code in smbd/, and creates a much simpler infrastructures for new server code. Major changes include: - simplified the process model code a lot. - got rid of the top level server and service structures completely. The top level context is now the event_context. This got rid of service.h and server.h completely (they were the most confusing parts of the old code) - added service_stream.[ch] for the helper functions that are specific to stream type services (services that handle streams, and use a logically separate process per connection) - got rid of the builtin idle_handler code in the service logic, as none of the servers were using it, and it can easily be handled by a server in future by adding its own timed_event to the event context. - fixed some major memory leaks in the rpc server code. - added registration of servers, rather than hard coding our list of possible servers. This allows for servers as modules in the future. - temporarily disabled the winbind code until I add the helper functions for that type of server - added error checking on service startup. If a configured server fails to startup then smbd doesn't startup. - cleaned up the command line handling in smbd, removing unused options (This used to be commit cf6a46c3cbde7b1eb1b86bd3882b953a2de3a42e)
2007-10-10r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for theAndrew Tridgell1-2/+2
large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0)
2007-10-10r4728: split up server_services into:Stefan Metzmacher1-40/+26
- stream_socket services the smb, ldap and rpc service which sets up a srtam socket end then waits for connections and - task services which this you can create a seperate task that do something (this is also going through the process_model subsystem so with -M standard a new process for this created with -M thread a new thread ... I'll add datagram services later when we whave support for datagram sockets in lib/socket/ see the next commit as an example for service_task's metze (This used to be commit d5fa02746c6569b09b6e05785642da2fad3ba3e0)
2007-10-10r4726: - use the name tcon and tid instead of conn and cnumStefan Metzmacher1-5/+3
- make use of talloc destructors metze (This used to be commit 8308da6ce4a95f8c10e22949ef00e9e64f2dbb85)
2007-10-10r4684: the smbsrv code should not know about rpc stuffStefan Metzmacher1-3/+0
just vfs_ipc metze (This used to be commit f85ebd1e8e19f5ff271dd7d79190fea16d6a98c4)
2007-10-10r4611: - renamed add_socket() to smb_add_socket() as that is less confusingAndrew Tridgell1-10/+6
- removed the spurious call to set_blocking() in the smb server setup. (This used to be commit 76d905d12e6f65a3670e4167ec79d8876b772ca6)
2007-10-10r4591: - converted the other _p talloc functions to not need _pAndrew Tridgell1-1/+2
- added #if TALLOC_DEPRECATED around the _p functions - fixes the code that broke from the above while doing this I fixed quite a number of places that were incorrectly using the non type-safe talloc functions to use the type safe ones. Some were even doing multiplies for array allocation, which is potentially unsafe. (This used to be commit 6e7754abd0c225527fb38363996a6e241b87b37e)
2007-10-10r4232: added server support for multi-part SMBtrans requests, whileAndrew Tridgell1-1/+1
maintaining the async nature of the server. This is done with a SMBtrans request queue for partially completed requests. The smb signing issues with this get a little tricky, but it now seems to work fine (This used to be commit bc0209058b76a947ad27673aeb096d11a168996b)
2007-10-10r4063: - change char * -> uint8_t in struct request_bufferStefan Metzmacher1-2/+2
- 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-10r3539: much nicer async open delay code.Andrew Tridgell1-4/+4
The previous code didn't handle the case where the file got renamed or deleted while waiting for the sharing violation delay. To handle this we need to make the 2nd open a full open call, including the name resolve call etc. Luckily this simplifies the logic. I also expanded the RAW-MUX test to include the case where we do open/open/open/close/close, with the 3rd open async, and that open gets retried after both the first close and the 2nd close, with the first retry failing and the 2nd retry working. The tests the "async reply after a async reply" logic in pvfs_open(). (This used to be commit eded2ad9c91f5ba587ef4f7f5f5a6dceb4b51ff3)
2007-10-10r3518: fixed some includes to be consistent.Andrew Tridgell1-13/+4
- use #include <XXX.h> for operating system includes - use includes relative to include/ for things like system/wait.h also fixed the thread backend to work somewhat. To fix it properly we need to do this: - add a configure test for support for thread local storage (the __thread keyword) - refuse to do pthreads if tls doesn't work - refuse to do pthreads if seteuid() affects process instead of thread - defined THREAD_LOCAL as __thread when WITH_PTHREADS - add THREAD_LOCAL to all the global data structures that should be thread local (there are quite a few) right now the thread backend falls over when you hit it with several connections at once, due to the lack of __thread on some critical structures. (This used to be commit 0dc1deabd0b53bc7a6f6cee2ed99e2cbbe422262)
2007-10-10r3507: - added deferred replies on sharing violation in pvfs open. TheAndrew Tridgell1-5/+4
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-10r3500: cleaned up the AS_USER/AS_GUEST stuff in the core smb packet processingAndrew Tridgell1-96/+36
(This used to be commit 8fa456afc9be113f292a1952119b533e4dc04fc1)
2007-10-10r3481: split out client.h and events.hAndrew Tridgell1-0/+1
(This used to be commit c6f486574470a311e0d336c026103f131451e21e)
2007-10-10r3466: split out request.h, signing.h, and smb_server.hAndrew Tridgell1-0/+1
(This used to be commit 7c4e6ebf05790dd6e29896dd316db0fff613aa4e)
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-10r3443: the next stage in the include files re-organisation.Andrew Tridgell1-4/+4
I have created the include/system/ directory, which will contain the wrappers for the system includes for logical subsystems. So far I have created include/system/kerberos.h and include/system/network.h, which contain all the system includes for kerberos code and networking code. These are the included in subsystems that need kerberos or networking respectively. Note that this method avoids the mess of #ifdef HAVE_XXX_H in every C file, instead each C module includes the include/system/XXX.h file for the logical system support it needs, and the details are kept isolated in include/system/ This patch also creates a "struct ipv4_addr" which replaces "struct in_addr" in our code. That avoids every C file needing to import all the system networking headers. (This used to be commit 2e25c71853f8996f73755277e448e7d670810349)
2007-10-10r3341: - don't zero the async structure (makes valgrind more useful)Andrew Tridgell1-1/+0
- get rid of req->mid, as it isn't a safe value to use to match requests in the server (it is safe in the client code, as we choose the mid, but in the server we can't rely on other clients to choose the mid carefully) (This used to be commit 938fb44351e12a515073ea94cd306988d5ca7340)
2007-10-10r3336: use a struct ntvfs_async_state to be able to do async chaning of ↵Stefan Metzmacher1-4/+3
ntvfs modules the idea is that a passthru module can use ntvfs_async_state_push() before calling ntvfs_next_*() and in the _send function it calls ntvfs_async_state_pop() and then call the upper layer send_fn itself - ntvfs_nbench is now fully async - the ntvfs_map_*() functions and the trans(2) mapping functions are not converted yet metze (This used to be commit fde64c0dc142b53d128c8ba09af048dc58d8ef3a)
2007-10-10r3307: fixed the send side of the smb_server code to be non-blocking. ThisAndrew Tridgell1-5/+37
means the whole of the SMB handling code is now non-blocking. (This used to be commit 30acedb943f0170d30e7b08925280d0dffc7873e)
2007-10-10r3306: the main smb server code now handles non-blocking socket receives. IAndrew Tridgell1-47/+78
haven't marked the socket non-blocking yet as I haven't checked that the send path is OK for non-blocking. (This used to be commit bda978cc2a921a888534054135b9325427425dd2)
2007-10-10r3304: changed the API to lib/socket/ a little.Andrew Tridgell1-6/+15
The main change is to make socket_recv() take a pre-allocated buffer, rather than allocating one itself. This allows non-blocking users of this API to avoid a memcpy(). As a result our messaging code is now about 10% faster, and the ncacn_ip_tcp and ncalrpc code is also faster. The second change was to remove the unused mem_ctx argument from socket_send(). Having it there implied that memory could be allocated, which meant the caller had to worry about freeing that memory (if for example it is sending in a tight loop using the same memory context). Removing that unused argument keeps life simpler for users. (This used to be commit a16e4756cd68ca8aab4ffc59d4d9db0b6e44dbd1)
2007-10-10r3278: - rewrote the client side rpc connection code to use lib/socket/Andrew Tridgell1-11/+3
rather than doing everything itself. This greatly simplifies the code, although I really don't like the socket_recv() interface (it always allocates memory for you, which means an extra memcpy in this code) - fixed several bugs in the socket_ipv4.c code, in particular client side code used a non-blocking connect but didn't handle EINPROGRESS, so it had no chance of working. Also fixed the error codes, using map_nt_error_from_unix() - cleaned up and expanded map_nt_error_from_unix() - changed interpret_addr2() to not take a mem_ctx. It makes absolutely no sense to allocate a fixed size 4 byte structure like this. Dozens of places in the code were also using interpret_addr2() incorrectly (precisely because the allocation made no sense) (This used to be commit 7f2c771b0e0e98c5c9e5cf662592d64d34ff1205)
2007-10-10r3202: return a old DOS error code ERRSRV:ERRbaduid for a bad vuid. This ↵Andrew Tridgell1-1/+1
means we now pass the BASE-VUID test. (This used to be commit 560300c0025940d84c9be41447145f4b441e7105)
2007-10-10r3136: - Allow specifying socket type when adding smbd serviceJelmer Vernooij1-1/+1
- Make sure a epm_tower struct is completely initialized - Some more minor fixes (This used to be commit d560dcbdb85cb2c6915bdb9e2f82f1872b0f5a52)
2007-10-10r2751: this is a new ntvfs design which tries to solve:Stefan Metzmacher1-1/+1
- the stacking of modules - finding the modules private data - hide the ntvfs details from the calling layer - I set NTVFS_INTERFACE_VERSION 0 till we are closer to release (because we need to solve some async problems with the module stacking) metze (This used to be commit 3ff03b5cb21bb79afdd3b1609be9635f6688a539)
2007-10-10r2658: fixed a couple of error codes found with RAW-CONTEXTAndrew Tridgell1-2/+2
(This used to be commit 18632ec56524f294655d881406c10beb659ddee1)
2007-10-10r2646: - use a talloc destructor to ensure that sockets from the new socketAndrew Tridgell1-1/+1
library are closed on abnormal termination - convert the service.h structures to the new talloc methods (This used to be commit 2dc334a3284858eb1c7190f9687c9b6c879ecc9d)
2007-10-10r2627: use the new talloc capabilities in a bunch more places in the rpcAndrew Tridgell1-2/+1
server code. This fixes a number of memory leaks I found when testing with valgrind and smbtorture, as the cascading effect of a talloc_free() ensures that anything derived from the top level object is destroyed on disconnect. (This used to be commit 76d0b8206ce64d6ff4a192979c43dddbec726d6e)
2007-10-10r2542: I really don't like the 'substitute' code, and I particularly don'tAndrew Bartlett1-7/+0
like it in the mainline code (outside the smb.conf magic). We will need to have a more useful 'helper' routine for this, but for now we at least get a reliable IP address. Also remove the unused 'socket' structure in the smb server - it seems to have been replaced by the socket library. Andrew Bartlett (This used to be commit d8fd19a2020da6cce691c0db2b00f42e31d672cc)
2007-10-10r2449: use a blocking fd for smbsrv codeStefan Metzmacher1-0/+4
metze (This used to be commit fba1637710138b0f2fae148e88b91a9cd1665465)
2007-10-10r2447: let the server code use the new lib/socket/ stuffStefan Metzmacher1-15/+25
metze (This used to be commit 2fd577d2417e117a7e8c1a56feb147eae805df34)
2007-10-10r2326: remove definition and usage of struct socket_contextStefan Metzmacher1-3/+3
metze (This used to be commit 1854907da8d577db41de9aa14573d5c8c0092f47)
2007-10-10r2320: add my copyrightStefan Metzmacher1-0/+1
metze (This used to be commit 45b77064bfeae1d4db2fa83c5513bdafa0c237e4)
2007-10-10r2250: removed unnecessary mem_ctxAndrew Tridgell1-3/+0
(This used to be commit c455a3a61d587f5126236d8c11ba84e19d4f038a)
2007-10-10r2249: got rid of some more mem_ctx elements in structuresAndrew Tridgell1-5/+4
(This used to be commit 21ef338cbbe96acc8594ffc550ef60c6a40fb951)
2007-10-10r2247: talloc_destroy -> talloc_freeTim Potter1-2/+2
(This used to be commit 6c1a72c5d667245b1eec94f58e68acd22dd720ce)
2007-10-10r1998: fix compiler warningStefan Metzmacher1-2/+1
metze (This used to be commit bf06f476dbdfbcb38ccbd8606e622097015c2b3d)
2007-10-10r1819: changed "smb ports" to be a LIST parameter type in loadparm (its a ↵Andrew Tridgell1-5/+4
classic case for a list) (This used to be commit e53d32c65ab0751b3e01f4f699f5d0e1892369ae)
2007-10-10r1796: Enable server-side SPNEGO, now that I have fixed the server-side SMBAndrew Bartlett1-0/+2
signing code to be able to cope. Andrew Bartlett (This used to be commit cb74d52b563730a50e33c92d868c45ee96a598e8)
2007-10-10r1578: the first stage of the async client rewrite.Andrew Tridgell1-0/+1
Up to now the client code has had an async API, and operated asynchronously at the packet level, but was not truly async in that it assumed that it could always write to the socket and when a partial packet came in that it could block waiting for the rest of the packet. This change makes the SMB client library full async, by adding a separate outgoing packet queue, using non-blocking socket IO and having a input buffer that can fill asynchonously until the full packet has arrived. The main complexity was in dealing with the events structure when using the CIFS proxy backend. In that case the same events structure needs to be used in both the client library and the main smbd server, so that when the client library is waiting for a reply that the main server keeps processing packets. This required some changes in the events library code. Next step is to make the generated rpc client code use these new capabilities. (This used to be commit 96bf4da3edc4d64b0f58ef520269f3b385b8da02)