r6800: A big GENSEC update:
[samba.git] / prog_guide.txt
index 4bf8671e6008737a26c70f0d58ddc7b21b13e2ac..f5ac600f88032c89e7837bb51384f8197e48c42f 100644 (file)
@@ -1,3 +1,5 @@
+
+
 THIS IS INCOMPLETE! I'M ONLY COMMITING IT IN ORDER TO SOLICIT COMMENTS
 FROM A FEW PEOPLE. DON'T TAKE THIS AS THE FINAL VERSION YET.
 
@@ -191,53 +193,8 @@ in the data and bss columns in "size" anyway (it will be included in
 How to use talloc
 -----------------
 
-If you are used to talloc from Samba3 then please read this carefully,
-as talloc has changed rather a lot.
-
-The new talloc is a hierarchical, reference counted memory pool system
-with destructors. Quite a mounthful really, but not too bad once you
-get used to it.
-
-Perhaps the biggest change from Samba3 is that there is no distinction
-between a "talloc context" and a "talloc pointer". Any pointer
-returned from talloc() is itself a valid talloc context. This means
-you can do this:
-
-  struct foo *a = talloc(mem_ctx, sizeof(*s));
-  a->name = talloc(a, strlen("foo")+1);
-
-and the pointer a->name would be a "child" of the talloc context "a"
-which is itself a child of mem_ctx. So if you do talloc_free(mem_ctx)
-then it is all destroyed, whereas if you do talloc_free(a) then just a
-and a->name are destroyed.
-
-If you think about this, then what this effectively gives you is an
-n-ary tree, where you can free any part of the tree with
-talloc_free().
-
-The next big change with the new talloc is reference counts. A talloc
-pointer starts with a reference count of 1. You can call
-talloc_increase_ref_count() on any talloc pointer and that increases
-the reference count by 1. If you then call talloc_free() on a pointer
-that has a reference count greater than 1, then the reference count is
-decreased, but the memory is not released.
-
-Finally, talloc now has destructors. You can set a destructor on any
-talloc pointer using talloc_set_destructor(). Your destructor will
-then be called before the memory is released. An interesting feature
-of these destructors is that they can return a error. If the
-destructor returns -1 then that is interpreted as a refusal to release
-the memory, and the talloc_free() will return. It will also prevent
-the release of all memory "below" that memory in the tree.
-
-You should also go and look at a new talloc function in Samba4 called
-talloc_steal(). By using talloc_steal() you can move a lump of memory
-from one memory context to another without copying the data. This
-should be used when a backend function (such as a packet parser)
-produces a result as a lump of talloc memory and you need to keep it
-around for a longer lifetime than the talloc context it is in. You
-just "steal" the memory from the short-lived context, putting it into
-your long lived context.
+Please see the separate document, source/lib/talloc/talloc_guide.txt
+You _must_ read this if you want to program in Samba4.
 
 
 Interface Structures
@@ -250,7 +207,7 @@ an idea of what I am talking about.
 In Samba3 many of the core wire structures in the SMB protocol were
 never explicitly defined in Samba. Instead, our parse and generation
 functions just worked directly with wire buffers. The biggest problem
-with this is that is tied our parse code with out "business logic"
+with this is that is tied our parse code with our "business logic"
 much too closely, which meant the code got extremely confusing to
 read.
 
@@ -275,7 +232,7 @@ msrpc code from Samba3", and while to some extent this is true there
 are extremely important differences in the approach that are worth
 pointing out.
 
-In the Samba3 msrpc code we used explicit parse strucrures for all
+In the Samba3 msrpc code we used explicit parse structures for all
 msrpc functions. The problem is that we didn't just put all of the
 real variables in these structures, we also put in all the artifacts
 as well. A good example is the security descriptor strucrure that
@@ -306,7 +263,7 @@ parser where to find the following four variables, but they should
 *NOT* be in the interface structure.
 
 In Samba3 there were unwritten rules about which variables in a
-strucrure a high level caller has to fill in and which ones are filled
+structure a high level caller has to fill in and which ones are filled
 in by the marshalling code. In Samba4 those rules are gone, because
 the redundent artifact variables are gone. The high level caller just
 sets up the real variables and the marshalling code worries about
@@ -438,7 +395,7 @@ function, so smbd has a _send() function and the parse function for
 each SMB.
 
 As an example go and have a look at reply_getatr_send() and
-reply_getatr() in smbd/reply.c. Read them? Good.
+reply_getatr() in smb_server/reply.c. Read them? Good.
 
 Notice that reply_getatr() sets up the req->async structure to contain
 the send function. Thats how the backend gets to do an async reply, it
@@ -569,11 +526,13 @@ string.
 
 The format is:
 
-  TRANSPORT:host:[flags]
+  TRANSPORT:host[flags]
 
 where TRANSPORT is either ncacn_np for SMB or ncacn_ip_tcp for RPC/TCP
 
-"host" is an IP or hostname or netbios name
+"host" is an IP or hostname or netbios name. If the binding string 
+identifies the server side of an endpoint, "host" may be an empty 
+string.
 
 "flags" can include a SMB pipe name if using the ncacn_np transport or
 a TCP port number if using the ncacn_ip_tcp transport, otherwise they
@@ -581,37 +540,39 @@ will be auto-determined.
 
 other recognised flags are:
 
-  sign : enable ntlmssp signing
-  seal : enable ntlmssp sealing
-  validate: enable the NDR validator
-  print: enable debugging of the packets
-  bigendian: use bigendian RPC
+  sign      : enable ntlmssp signing
+  seal      : enable ntlmssp sealing
+  spnego    : use SPNEGO instead of NTLMSSP authentication
+  krb5      : use KRB5 instead of NTLMSSP authentication
+  connect   : enable rpc connect level auth (auth, but no sign or seal)
+  validate  : enable the NDR validator
+  print     : enable debugging of the packets
+  bigendian : use bigendian RPC
+  padcheck  : check reply data for non-zero pad bytes
 
 
-For example, these all connect to the samr pipe:
+Here are some examples:
 
    ncacn_np:myserver
-   ncacn_np:myserver:samr
-   ncacn_np:myserver:samr,seal
-   ncacn_np:myserver:\pipe\samr
-   ncacn_np:myserver:/pipe/samr
    ncacn_np:myserver[samr]
    ncacn_np:myserver[\pipe\samr]
    ncacn_np:myserver[/pipe/samr]
-   ncacn_np:myserver:[samr,sign,print]
-   ncacn_np:myserver:[\pipe\samr,sign,seal,bigendian]
-   ncacn_np:myserver:[/pipe/samr,seal,validate]
-
+   ncacn_np:myserver[samr,sign,print]
+   ncacn_np:myserver[sign,spnego]
+   ncacn_np:myserver[\pipe\samr,sign,seal,bigendian]
+   ncacn_np:myserver[/pipe/samr,seal,validate]
+   ncacn_np:
+   ncacn_np:[/pipe/samr]
    ncacn_ip_tcp:myserver
-   ncacn_ip_tcp:myserver:1024
    ncacn_ip_tcp:myserver[1024]
-   ncacn_ip_tcp:myserver:[1024,sign,seal]
+   ncacn_ip_tcp:myserver[sign,seal]
+   ncacn_ip_tcp:myserver[spnego,seal]
 
 
 IDEA: Maybe extend UNC names like this?
 
  smbclient //server/share
- smbclient //server/share:[sign,seal,spnego]
+ smbclient //server/share[sign,seal,spnego]
 
 DCERPC Handles
 --------------
@@ -645,8 +606,6 @@ MSRPC
  - msrpc
 
 
-- use _p talloc varients
-
 don't zero structures! avoid ZERO_STRUCT() and talloc_zero()
 
 
@@ -656,8 +615,6 @@ put in full UNC path in tconx
 
 test timezone handling by using a server in different zone from client
 
-don't just use any old TALLOC_CTX, use the right one!
-
 do {} while (0) system
 
 NT_STATUS_IS_OK() is NOT the opposite of NT_STATUS_IS_ERR()
@@ -665,8 +622,6 @@ NT_STATUS_IS_OK() is NOT the opposite of NT_STATUS_IS_ERR()
 need to implement secondary parts of trans2 and nttrans in server and
 client
 
-add talloc_steal() to move a talloc ptr from one pool to another
-
 document access_mask in openx reply
 
 check all capabilities and flag1, flag2 fields (eg. EAs)
@@ -803,7 +758,6 @@ Ideas
 
 
 BUGS:
-  non-signed non-sealed RPC (level == 2 == "connect")
   add a test case for last_entry_offset in trans2 find interfaces
   conn refused
   connect -> errno
@@ -814,5 +768,21 @@ BUGS:
      trans2 and other calls
   handle servers that don't have the setattre call in torture
   add max file coponent length test and max path len test
-
+  check for alloc failure in all core reply.c and trans2.c code where
+    allocation size depends on client parameter
+
+case-insenstive idea:
+  all filenames on disk lowercase
+  real case in extended attribute
+  keep cache of what dirs are all lowercase
+  when searching for name, don't search if dir is definately all lowercase
+  when creating file, use dnotify to tell if someone else creates at
+  same time
+
+solve del *.* idea:
+  make mangle cache dynamic size
+  fill during a dir scan
+  setup a timer
+  destroy cache after 30 sec
+  destroy if a 2nd dir scan happens on same dir