1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

613 Commits

Author SHA1 Message Date
Andrew Tridgell
72048e3717 r5155: define ipv4address as a based IDL type, mapped to a "const char *" in
the header, and defined on the wire as a 4 byte network byte order
IP. This means the calling code doesn't have to worry about network
byte order conversions.
2007-10-10 13:09:28 -05:00
Stefan Metzmacher
abacbc9192 r5145: define struct ipv4_addr in misc.idl,
so we can use it in nbt.idl and
get a nicer debug output

metze
2007-10-10 13:09:27 -05:00
Stefan Metzmacher
add1c57937 r5137: fix types
metze
2007-10-10 13:09:26 -05:00
Stefan Metzmacher
344367cc4c r5136: fix types
metze
2007-10-10 13:09:26 -05:00
Andrew Tridgell
cf11d05e35 r5126: the composite code is no longer client specific or smb specific, so
rename the core structure to composite_context and the wait routine to
composite_wait() (suggestion from metze)
2007-10-10 13:09:25 -05:00
Andrew Tridgell
69e6a1cd4b r5121: added periodic name refresh requests for all our registered names, reporting any
name conflicts
2007-10-10 13:09:24 -05:00
Andrew Tridgell
6726f15cf4 r5120: encode outgoing nbt packets when queueing them rather than in the send
event code, as elements of the callers packet structure could go away
while the queue is pending (if for example a name was de-registered
while a packet referencing that name is queued)
2007-10-10 13:09:24 -05:00
Andrew Tridgell
d656fba6f1 r5117: used a composite function to add 4 stage name registration. We send 3
broadcast name registration demands per name per interface at 1 second
intervals, then send a name overwrite request and demand. Any name
conflict replies are reported.
2007-10-10 13:09:24 -05:00
Andrew Tridgell
506e1e823c r5116: fixed build of the nbtlist code 2007-10-10 13:09:24 -05:00
Andrew Tridgell
d7d31fdc66 r5114: the nbtd task can now act as a basic B-node server. It registers its
names on the network and answers name queries. Lots of details are
still missing, but at least this now means you don't need a Samba3
nmbd to use Samba4.

missing pieces include:

 - name registrations should be "shout 3 times, then demand"

 - no WINS server yet

 - no master browser code
2007-10-10 13:09:23 -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
39d1ced21b r5107: moved the horrible ldap socket code, and the even worse
asn1-tied-to-blocking-sockets code into the ldap client and torture
suite, and out of the generic libs, so nobody else is tempted to use
it for any new code.
2007-10-10 13:09:23 -05:00
Andrew Bartlett
ffad9b22be r5092: Add a bit more const - moving it further into the LDB layer.
Andrew Bartlett
2007-10-10 13:09:22 -05:00
Andrew Tridgell
3351c636af r5053: - fix up the library dependencies so that tools that need nbt don't
need to pull in the whole dcerpc subsystem

- moved smbencrypt.c code into libcli/auth/
2007-10-10 13:09:18 -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
f86521677d r5034: - added a type mapping function in pidl, so the type names in our IDL
files don't need to match the type names in the generated headers

- with this type mapping we no longer need definitions for the
  deprecated "int32", "uint8" etc form of types. We can now force
  everyone to use the standard types int32_t, uint8_t etc.

- fixed all the code that used the deprecated types

- converted the IDL types "int64" and "uint64" to "dlong" and
  "udlong". These are the 4 byte aligned 64 bit integers that
  Microsoft internally define as two 32 bit integers in a
  structure. After discussions with Ronnie Sahlberg we decided that
  calling these "int64" was confusing, as it implied a true 8 byte
  aligned type

- fixed all the cases where we incorrectly used things like
  "NTTIME_hyper" in our C code. The generated API now uses a NTTIME for
  those. The fact that it is hyper-aligned on the wire is not relevant
  to the API, and should remain just a IDL property
2007-10-10 13:09:15 -05:00
Stefan Metzmacher
522af7ecc0 r4958: fix compiler warnings
metze
2007-10-10 13:09:10 -05:00
Andrew Tridgell
3e13e1d526 r4957: the fetchfile _recv() function was neglecting to steal the data and
free the connection context. This left a whole lot of state hanging
around and didn't give the memory to the caller properly
2007-10-10 13:09:10 -05:00
Andrew Tridgell
8f19b6886c r4954: we don't need the separate event_remove_*() calls any more, as you now
remove an event by calling talloc_free().
2007-10-10 13:09:09 -05:00
Andrew Tridgell
f8a950b57d r4952: removed a bogus talloc_steal() that was trying to cope with the
inverted memory hierarchy. Now the memory hierarchy is logical its not
needed (and can cause a double free in RPC-SCHANNEL)
2007-10-10 13:09:09 -05:00
Andrew Tridgell
5e8fd5f701 r4951: some of the code dealing with libcli was getting too complex trying to
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.
2007-10-10 13:09:09 -05:00
Andrew Tridgell
4a351901aa r4950: removed some excessive debugging messages 2007-10-10 13:09:09 -05:00
Volker Lendecke
fa435bf7c8 r4949: First version of a fetchfile composite function which connects to a server and
loads a file. Needs a smb url parsing wrapper.

Volker
2007-10-10 13:09:08 -05:00
Andrew Tridgell
7f981b9ed9 r4944: every event_add_*() caller was having to call talloc_steal() to take
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.
2007-10-10 13:09:08 -05:00
Andrew Tridgell
a3c7417cfe r4943: Smplified the events handling code a lot. The first source of
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.
2007-10-10 13:09:08 -05:00
Andrew Tridgell
442308970c r4938: allow the caller to supply an existing event_context if they want to
in smb_composite_connect_send(). This makes doing parallel calls much
easier.
2007-10-10 13:09:07 -05:00
Andrew Tridgell
347dfa4724 r4937: simplify the connect code in the same way 2007-10-10 13:09:07 -05:00
Andrew Tridgell
420b53091e r4936: moved to a convention where the completion function is only called in
one place. This makes the code more robust, and simpler (it would have
prevented the error that volker found).
2007-10-10 13:09:07 -05:00
Andrew Tridgell
c4faceadc7 r4935: fixed a bug where "c->status = xxx_handler(x);" could write to c after
it is freed. The problem is that the handler might complete the
request, and called the c->async.fn() async handler. That handler
might free the request handle.
2007-10-10 13:09:07 -05:00
Andrew Tridgell
b06b8dd2f4 r4927: parse the NBT session request in the smb server. This gets rid of that
annoying "not parsing session request" message on each SMB connection
2007-10-10 13:09:06 -05:00
Andrew Tridgell
39da684ea8 r4924: continue the effort to simplify and generalise the composite
interface. This patch removes the "stage" variable, which is really
better suited to the backend state structures
2007-10-10 13:09:06 -05:00
Andrew Tridgell
dd5b43ed37 r4922: fixed an infinite loop in the name resolve code when handling a method
in smb.conf that isn't implemented in the library
2007-10-10 13:09:06 -05:00
Andrew Tridgell
3268d523cc r4919: if a caller doesn't provide an event context to the resolver library,
then create one. This fixes a crash in the RAW-NEGNOWAIT test for
'host' resolution.
2007-10-10 13:09:06 -05:00
Andrew Tridgell
3d40b47990 r4916: added "host" name resolution using fork() per gethostbyname()
comments welcome, but please think about the alternatives first :-)
2007-10-10 13:09:05 -05:00
Andrew Tridgell
b20c0561b8 r4915: free temp context _before_ the async callback, as the async callback might destroy our top level context
leaving the tmp context freed (so a double free)
2007-10-10 13:09:05 -05:00
Andrew Tridgell
8b653f12f2 r4911: make sure we fill in the transport called name on port 445 as well
(thanks to abartlet for spotting this bug)
2007-10-10 13:09:05 -05:00
Andrew Tridgell
9d2d16ce5f r4909: fixed name_trn_id generation (thanks to metze for spotting the bug!) 2007-10-10 13:09:05 -05:00
Andrew Tridgell
9a34af2938 r4901: a bit more info on nbt packets under high debug level 2007-10-10 13:09:05 -05:00
Andrew Tridgell
266fd2751c r4898: - removed the unused wins_srv_*() code
- expanded the generic async name resolver to try multiple methods

- added wins resolutions to the list of methods tried

- fixed up the random trn id generation to use the good random generator
2007-10-10 13:09:04 -05:00
Andrew Tridgell
c1063919c0 r4896: make sure the event context doesn't go away while waiting for event completion 2007-10-10 13:09:04 -05:00
Andrew Tridgell
24927e69d8 r4894: namecache.c is not used any more either 2007-10-10 13:09:04 -05:00
Andrew Bartlett
21bfda2a0d r4893: Move to using secrets.ldb for the Kerberos verify, instead of
secrets.tdb from Samba3.

Andrew Bartlett
2007-10-10 13:09:04 -05:00
Andrew Tridgell
239c310f25 r4891: - added a generic resolve_name() async interface in libcli/resolve/,
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!)
2007-10-10 13:09:03 -05:00
Andrew Bartlett
c1cae6b3b1 r4890: Try to cope with mechanism mismatch in the client speaks first version
of the SPNEGO state-machine.  (Such as on LDAP and HTTP)

Andrew Bartlett
2007-10-10 13:09:03 -05:00
Andrew Tridgell
bf74ea34fc r4886: fixed two places where we process the send side of a socket after the
recv side in the same event. That's a bad idea, as the first callback
could decide to destroy the socket.
2007-10-10 13:09:02 -05:00
Andrew Tridgell
ae7e625bfa r4885: added a new NBT client library. Features include:
- structures defined using IDL in nbt.idl
 - build around our events structure, and talloc
 - fully async
 - supports all NBT packet fields as per rfc1002
 - easy interfaces for name query and status

For the moment there are just a couple of test functions in
namequery.c, test_name_query() and test_name_status(). These will be
removed when we hook the new library into libcli/ fully

The new library will also be a fairly good basis for a nbt
server. Although it can't be a server as-is, I wrote it with the needs
of a server in mind (for example, extremely scalable idtree based
packet handling)
2007-10-10 13:09:01 -05:00
Andrew Tridgell
058ae5527e r4811: now that the event context is at the socket level, the event cleanup
should be there too
2007-10-10 13:08:58 -05:00
Andrew Tridgell
7da0af98a0 r4810: fixed anonymous connections with smbclient. Thanks to jbm for pointing this out. 2007-10-10 13:08:58 -05:00
Andrew Tridgell
e16f67c931 r4795: stronget type checking in composite connect function 2007-10-10 13:08:56 -05:00
Andrew Tridgell
0e1da827b3 r4791: used the new talloc type safety macros to make the "void *private"
pointers in the composite code type safe.

This is a bit of an experiement, I'd be interested in comments on
whether we should use this more widely.
2007-10-10 13:08:55 -05:00