1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-11 00:23:51 +03:00
Commit Graph

56 Commits

Author SHA1 Message Date
Stefan Metzmacher
fdbf822f1c r8044: give a better error code
metze
2007-10-10 13:19:02 -05:00
Andrew Tridgell
3f77b879a0 r7668: - setup HAVE_ILDAP to enable the ildap backend in ldb
- fixed a bug in socket_connect_ev()
2007-10-10 13:18:20 -05:00
Andrew Tridgell
4013c2ddea r7660: improved error handling in socket_connect_ev() (it matters when name
resolution fails)
2007-10-10 13:18:18 -05:00
Andrew Tridgell
2e3c660b2f r7626: a new ldap client library. Main features are:
- hooked into events system, so requests can be truly async and won't
   interfere with other processing happening at the same time

 - uses NTSTATUS codes for errors (previously errors were mostly
   ignored). In a similar fashion to the DOS error handling, I have
   reserved a range of the NTSTATUS code 32 bit space for LDAP error
   codes, so a function can return a LDAP error code in a NTSTATUS

 - much cleaner packet handling
2007-10-10 13:18:14 -05:00
Andrew Tridgell
f5102b886c r7476: ensure dgram sockets are created non-blocking. As they usually skip
the connect() stage, we were missing this
2007-10-10 13:17:57 -05:00
Andrew Tridgell
f6993db31d r7227: added a socket_pending() call to abstract away the FIONREAD ioctl. It
will be interesting to see if this causes any portability problems, as
it is a less commonly used call.
2007-10-10 13:17:28 -05:00
Andrew Tridgell
35ef6e3b15 r7205: added support for sendto() on unix domain sockets 2007-10-10 13:17:26 -05:00
Jelmer Vernooij
46509eb899 r6795: Make some functions static and remove some unused ones. 2007-10-10 13:16:44 -05:00
Andrew Tridgell
23b2046dcb r6562: added support for datagram unix domain sockets in the socket library 2007-10-10 13:16:25 -05:00
Jelmer Vernooij
7fe77cd659 r6070: Fix typo's and fallback to "" as default user name if no
other username could be guessed.
2007-10-10 13:11:17 -05:00
Andrew Bartlett
7e1d82a200 r5903: While I can't test IPv6, metze asked me to commit a matching change
for unknown hosts that I just did for IPv4.

Andrew Bartlett
2007-10-10 13:11:08 -05:00
Andrew Bartlett
6b8b40f73b r5898: Handle errors in the 'sync' name and IP address handling code.
Andrew Bartlett
2007-10-10 13:11:07 -05:00
Andrew Tridgell
b902ea546d r5304: removed lib/socket/socket.h from includes.h 2007-10-10 13:09:39 -05:00
Andrew Tridgell
9db6c79e90 r5298: - got rid of pstring.h from includes.h. This at least makes it a bit
less likely that anyone will use pstring for new code

 - got rid of winbind_client.h from includes.h. This one triggered a
   huge change, as winbind_client.h was including system/filesys.h and
   defining the old uint32 and uint16 types, as well as its own
   pstring and fstring.
2007-10-10 13:09:38 -05:00
Andrew Tridgell
2fedca6adf r5108: the beginnings of a nbtd server for Samba4. Currently just displays
the packets it receives, but it at least shows how the server
structure will work.

To implement it I extended the libcli/nbt/ library to allow for an
incoming packet handler to be registered. That allows the nbt client
library to be used for low level processing of the nbtd server packets.

Other changes:

 - made the socket library always set SO_REUSEADDR when binding to an
   interface, to ensure that restarts of a server don't have to wait
   for a couple of minutes.

 - made the nbt port configurable. Defaults to 137, but other ports
   will be useful for testing.
2007-10-10 13:09:23 -05:00
Andrew Tridgell
ec32b22ed5 r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the
large commit. I thought this was worthwhile to get done for
consistency.
2007-10-10 13:09:15 -05:00
Andrew Tridgell
9f12a45a05 r4831: added udp support to our generic sockets library.
I decided to incorporate the udp support into the socket_ipv4.c
backend (and later in socket_ipv6.c) rather than doing a separate
backend, as so much of the code is shareable. Basically this adds a
socket_sendto() and a socket_recvfrom() call and not much all.

For udp servers, I decided to keep the call as socket_listen(), even
though dgram servers don't actually call listen(). This keeps the API
consistent.

I also added a simple local sockets testsuite in smbtorture,
LOCAL-SOCKET
2007-10-10 13:08:59 -05:00
Andrew Tridgell
b787dd166f r4753: added the ability for the generic socket library to handle async
connect(). This required a small API change (the addition of
a socket_connect_complete() method)
2007-10-10 13:08:50 -05:00
Stefan Metzmacher
894f402b01 r4686: cerate a function to create a socket by specifying an socket_ops struct
metze
2007-10-10 13:08:43 -05:00
Jelmer Vernooij
8e7e98ae5f r3753: Have some modules default to "NOT" and enable them again when
their dependencies are found
2007-10-10 13:05:51 -05:00
Jelmer Vernooij
64826da834 r3733: More build system fixes/features:
- Use .mk files directly (no need for a SMB_*_MK() macro when adding a new SUBSYSTEM, MODULE or BINARY). This allows addition of new modules and subsystems without running configure
 - Add support for generating .dot files with the Samba4 dependency tree (as used by the graphviz and springgraph utilities)
2007-10-10 13:05:47 -05:00
Jelmer Vernooij
7a8244761b r3586: Fix some of the issues with the module init functions.
Both subsystems and modules can now have init functions, which can be
specified in .mk files (INIT_FUNCTION = ...)

The build system will define :
 - SUBSYSTEM_init_static_modules that calls the init functions of all statically compiled modules. Failing to load will generate an error which is not fatal
 - BINARY_init_subsystems that calls the init functions (if defined) for the subsystems the binary depends on

This removes the hack with the "static bool Initialised = " and the
"lazy_init" functions
2007-10-10 13:05:36 -05:00
Andrew Tridgell
8ec3cf8b2b r3482: fixed a warning and an error from the IRIX 6.4 build 2007-10-10 13:05:20 -05:00
Andrew Tridgell
7842b23d01 r3457: s_addr is a macro on solaris, so we can't use it in structure names. arrgh. 2007-10-10 13:05:15 -05:00
Andrew Tridgell
ced1a0fcdc r3450: portability fixes
- fix rep_inet_ntoa() for IRIX
 - lib/signal.c needs system/wait.h
 - some systems define a macro "accept", which breaks the lib/socket/ structures.
   use fn_ as a prefix for the structure elements to avoid the problem
2007-10-10 13:05:13 -05:00
Andrew Tridgell
6b1f86aea8 r3449: more include file reduction
the ldb part isn't ideal, I will have to think of a better solution
2007-10-10 13:05:13 -05:00
Andrew Tridgell
2e25c71853 r3443: the next stage in the include files re-organisation.
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.
2007-10-10 13:05:11 -05:00
Andrew Tridgell
f2a9bbc317 r3356: in the standard process model we need to make sure we close all
listening sockets after the fork to prevent the child still listening
on incoming requests.

I have also added an optimisation where we use dup()/close() to lower
the file descriptor number of the new socket to the lowest possible
after closing our listening sockets. This keeps the max fd num passed
to select() low, which makes a difference to the speed of select().
2007-10-10 13:05:00 -05:00
Andrew Tridgell
76c4ba6d29 r3335: better configure support for ipv6 - thanks to a quick tutorial from metze 2007-10-10 13:04:56 -05:00
Jelmer Vernooij
9c13f42c1f r3334: Allow disabling IPv6 support using socket:noipv6 2007-10-10 13:04:56 -05:00
Andrew Tridgell
9794570c6d r3333: added configure tests for ipv6 support 2007-10-10 13:04:56 -05:00
Jelmer Vernooij
d829890124 r3329: Add support for IPv6 2007-10-10 13:04:56 -05:00
Andrew Tridgell
718175a265 r3318: generate random STATUS_MORE_ENTRIES errors (1 in 10 packets) as well
as randomly short recv/send when socket:testnonblock is enabled
2007-10-10 13:04:53 -05:00
Andrew Tridgell
406d356e69 r3314: added a option "socket:testnonblock" to the generic socket code. If
you set this option (either on the command line using --option or in
smb.conf) then every socket recv or send will return short by random
amounts. This allows you to test that the non-blocking socket logic in
your code works correctly.

I also removed the flags argument to socket_accept(), and instead made
the new socket inherit the flags of the old socket, which makes more
sense to me.
2007-10-10 13:04:53 -05:00
Andrew Tridgell
a2d92aa431 r3313: in socket_accept() make the new socket non-blocking unless SOCKET_FLAG_BLOCK is set. 2007-10-10 13:04:53 -05:00
Andrew Tridgell
a16e4756cd r3304: changed the API to lib/socket/ a little.
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.
2007-10-10 13:04:52 -05:00
Andrew Tridgell
80a109de84 r3300: initialise *sendlen on failure, to allow for callers to check only for
NT_STATUS_IS_ERR()
2007-10-10 13:04:51 -05:00
Andrew Tridgell
b8a2afae67 r3279: Removed MSG_DONTWAIT flags as many platform don't have it.
If a socket is non-blocking then adding MSG_DONTWAIT is pointless (it
does nothing), so all we lose is the ability to set non-blocking on a
packet-by-packet basis, which is not a very useful thing to have
anyway

if the socket is blocking then the code already adds MSG_WAITALL, so
MSG_DONTWAIT is also not needed in that case.
2007-10-10 13:04:49 -05:00
Andrew Tridgell
7f2c771b0e r3278: - rewrote the client side rpc connection code to use lib/socket/
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)
2007-10-10 13:04:49 -05:00
Andrew Tridgell
238febb008 r3184: don't setup socket options on unix domain sockets (our smb.conf socket options are really meant for tcp) 2007-10-10 13:04:38 -05:00
Andrew Tridgell
ab222b236a r3183: moved the unlink of the messaging unixdom socket to the messaging destructor 2007-10-10 13:04:37 -05:00
Jelmer Vernooij
fa0760dd5f r3169: unlink() is called on the listening unix socket every time a child process
exits. Commenting it out until we have a clean way of doing this.
2007-10-10 13:02:29 -05:00
Andrew Tridgell
64514ff5b7 r3020: better error handling in socket_unix 2007-10-10 12:59:58 -05:00
Andrew Tridgell
3af06478da r3016: - converted the events code to talloc
- 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
2007-10-10 12:59:57 -05:00
Andrew Tridgell
b367209a9f r3015: fixed typo noticed by abartlett 2007-10-10 12:59:57 -05:00
Andrew Tridgell
6f4926d846 r3013: added support for unix domain sockets in the generic socket library. I
will shortly be using this for a rewrite of the intra-smbd messaging
library, which is needed to get lock timeouts working properly (and
share modes, oplocks etc)
2007-10-10 12:59:57 -05:00
Andrew Tridgell
8dc23821c9 r2671: we're getting too many errors caused by the talloc_realloc() API not
taking a context (so when you pass a NULL pointer you end up with
memory in a top level context). Fixed it by changing the API to take a
context. The context is only used if the pointer you are reallocing is
NULL.
2007-10-10 12:59:20 -05:00
Andrew Tridgell
2dc334a328 r2646: - use a talloc destructor to ensure that sockets from the new socket
library are closed on abnormal termination

- convert the service.h structures to the new talloc methods
2007-10-10 12:59:16 -05:00
Andrew Tridgell
26da45a801 r2628: got rid of some warnings and converted a few more places to use hierarchical memory allocation 2007-10-10 12:59:14 -05:00
Andrew Tridgell
4cb11fb77a r2622: to implement the SOCKET_FLAG_BLOCK option in the socket library we
need to add MSG_WAITALL to the recv() flags. This is needed by the
current server code or sometimes it will fail with a receive error.
2007-10-10 12:59:13 -05:00