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

30 Commits

Author SHA1 Message Date
Jelmer Vernooij
5f4842cf65 r26376: Add context for libcli_resolve.
(This used to be commit 459e1466a4)
2007-12-21 05:49:12 +01:00
Jelmer Vernooij
01d2acfdb4 r26335: Specify name_resolve_order to socket code.
(This used to be commit b03e5d0011)
2007-12-21 05:48:46 +01:00
Jelmer Vernooij
6bc52259aa r25545: Use inet_ntop for ipv4 code as well - should make it easier to share code between IPv4 and IPv6 later on.
(This used to be commit e3df90927b)
2007-10-10 15:07:51 -05:00
Jelmer Vernooij
61ffa08f4c r24712: No longer expose the 'BOOL' data type in any interfaces.
(This used to be commit 1ce32673d9)
2007-10-10 15:02:54 -05:00
Andrew Tridgell
0479a2f1cb r23792: convert Samba4 to GPLv3
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 fcf38a38ac)
2007-10-10 14:59:12 -05:00
Andrew Tridgell
59d1a2b30e r22960: added a SOCKET_FLAG_NOCLOSE to allow us to tell the socket layer that
we will handle the close of the socket
(This used to be commit d57aaf5ba6)
2007-10-10 14:52:31 -05:00
Andrew Bartlett
ba07fa43d0 r17197: This patch moves the encryption of bulk data on SASL negotiated security
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 5d7c9c12cb)
2007-10-10 14:10:18 -05:00
Andrew Bartlett
a1a842eb44 r17168: Now that TLS (and soon SASL) is below the socket layer, we need to
make the testnonblock skip some things.  The socket *under* the tls
socket is still tested.

Andrew Bartlett
(This used to be commit 9c33c6a20a)
2007-10-10 14:10:15 -05:00
Andrew Bartlett
742c110cd6 r15400: Move the TLS code behind the socket interface.
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 09b2f30dfa)
2007-10-10 14:05:32 -05:00
Andrew Bartlett
c2cc10c786 r15356: Remove unused 'flags' argument from socket_send() and friends.
This is in preperation for making TLS a socket library.

Andrew Bartlett
(This used to be commit a312812b92)
2007-10-10 14:05:25 -05:00
Jelmer Vernooij
f4e403440a r15349: Integrate set_socket_options() into the socket library
(This used to be commit 598ea173cd)
2007-10-10 14:05:24 -05:00
Jelmer Vernooij
35349a58df r14542: Remove librpc, libndr and libnbt from includes.h
(This used to be commit 51b4270513)
2007-10-10 13:58:42 -05:00
Andrew Bartlett
f55ea8bb3d r12804: This patch reworks the Samba4 sockets layer to use a socket_address
structure that is more generic than just 'IP/port'.

It now passes make test, and has been reviewed and updated by
metze. (Thankyou *very* much).

This passes 'make test' as well as kerberos use (not currently in the
testsuite).

The original purpose of this patch was to have Samba able to pass a
socket address stucture from the BSD layer into the kerberos routines
and back again.   It also removes nbt_peer_addr, which was being used
for a similar purpose.

It is a large change, but worthwhile I feel.

Andrew Bartlett
(This used to be commit 88198c4881)
2007-10-10 13:49:57 -05:00
Andrew Bartlett
37bc6b5f81 r12728: Revive testparm.
It needs work to not dump defaults from loadparm.c, but otherwise it works.

Andrew Bartlett
(This used to be commit 1260fcf465)
2007-10-10 13:49:46 -05:00
Volker Lendecke
134b2488c8 r11369: Implement socket_connect_multi: Connect to multiple ipv4 tcp ports in
sequence, with a 2-millisecond timeout between firing the syn packets. Build
smbcli_sock_connect_send upon that.

Volker
(This used to be commit 5718df44d9)
2007-10-10 13:45:27 -05:00
Volker Lendecke
d6e070b74a r11274: Start a connection attempt to the DC's port 389. To do this properly, make
socket_connect and ldap_connect properly async.

Volker
(This used to be commit bcc71fc1de)
2007-10-10 13:45:12 -05:00
Andrew Tridgell
75c29073ce r9704: r9684@blu: tridge | 2005-08-27 19:38:31 +1000
don't try to call the name resolver on non-ipv4 names!
(This used to be commit 4bb3d36fe6)
2007-10-10 13:34:52 -05:00
Andrew Tridgell
bab977dad7 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
(This used to be commit 2e3c660b2f)
2007-10-10 13:18:14 -05:00
Andrew Tridgell
1692bbf2e2 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.
(This used to be commit f6993db31d)
2007-10-10 13:17:28 -05:00
Jelmer Vernooij
5b18cf2268 r6795: Make some functions static and remove some unused ones.
(This used to be commit 46509eb899)
2007-10-10 13:16:44 -05:00
Andrew Tridgell
bed7c9ec32 r5304: removed lib/socket/socket.h from includes.h
(This used to be commit b902ea546d)
2007-10-10 13:09:39 -05:00
Andrew Tridgell
8783aa8ea5 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
(This used to be commit 9f12a45a05)
2007-10-10 13:08:59 -05:00
Andrew Tridgell
21aafc3536 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)
(This used to be commit b787dd166f)
2007-10-10 13:08:50 -05:00
Andrew Tridgell
452ddd94ba 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
(This used to be commit ced1a0fcdc)
2007-10-10 13:05:13 -05:00
Andrew Tridgell
990d76f7cb 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.
(This used to be commit 406d356e69)
2007-10-10 13:04:53 -05:00
Andrew Tridgell
c6888da148 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.
(This used to be commit a16e4756cd)
2007-10-10 13:04:52 -05:00
Andrew Tridgell
fe45888e22 r2581: added "hosts allow" and "hosts deny" checking in smbd. I needed this
as my box keeps getting hit by viruses spreading on my companies
internal network, which screws up my debug log badly (sigh).

metze, I'm not sure if you think access.c should go in the socket
library or not. It is closely tied to the socket functions, but you
may prefer it separate.

The access.c code is a port from Samba3, but with some cleanups to
make it (slighly) less ugly.
(This used to be commit 058b2fd99e)
2007-10-10 12:59:07 -05:00
Stefan Metzmacher
be61c9d877 r2439: - function that return just an int don't need a TALLOC_CTX
- fix some return and state bugs

metze
(This used to be commit 2757c593ab)
2007-10-10 12:58:53 -05:00
Stefan Metzmacher
498ea8485f r2343: - make socket_get_*_addr() return char * not const char *
- add some error mappings
- use some flags SOCKET_FLAG_PEEK ans SOCKET_FLAG_BLOCK

metze
(This used to be commit a375c6b0b1)
2007-10-10 12:58:45 -05:00
Stefan Metzmacher
ce694e7051 r2328: add the start of a new system and protocol
independent socket library.

this is not used, but compiled currently

there're maybe some api changes later...

metze
(This used to be commit de4447d7a5)
2007-10-10 12:58:44 -05:00