1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/lib/param
Andrew Bartlett e665fc3940 lib/param: Consolidate code to enable smb signing on the server, always enable on AD DC
This uses the code from the source4/ SMB server (the NTVFS smb server)
in common, to force SMB Signing to be on when we are an AD DC.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Fri Nov 22 13:13:05 CET 2013 on sn-devel-104
2013-11-22 13:13:03 +01:00
..
generic.c lib/param move source4 param code to the top level 2011-10-11 13:41:34 +11:00
loadparm_server_role.c param: Remove _SAMBA_BUILD_ checks from now the autoconf build is gone 2013-05-28 12:17:11 +10:00
loadparm.c lib/param: Consolidate code to enable smb signing on the server, always enable on AD DC 2013-11-22 13:13:03 +01:00
loadparm.h build: Remove special case for the build farm 2012-08-21 06:39:04 +02:00
param_functions.c lib/param: lp_magicchar takes a const struct share_params *p so should be FN_LOCAL_PARM_CHAR 2013-10-16 09:27:47 +02:00
param_table.c lib/param: add PROTOCOL_SMB3_02 handling 2013-09-17 04:00:37 +02:00
param.h lib/param: lpcfg_private_db_path() 2013-04-12 14:59:23 -07:00
README lib/param: Add documentation on how loadparm works 2013-10-16 11:39:41 +02:00
samba-hostconfig.pc.in lib/param move source4 param code to the top level 2011-10-11 13:41:34 +11:00
util.c ntdb: remove --disable-ntdb. 2013-04-13 02:01:02 +02:00
wscript_build param: Autogenerate s3 lp_ctx glue table 2013-10-16 09:31:41 +02:00

libsamba-hostconfig
-------------------

This directory contains "libsamba-hostconfig". 

The libsamba-hostconfig library provides access to all host-wide configuration
such as the configured shares, default parameter values and host secret keys.


Adding a parameter
------------------

To add or change an smb.conf option, you only have to modify
lib/param/param_table.c and lib/param/param_functions.c.  The rest is
generated for you.


Using smb.conf parameters in the code
-------------------------------------

Call the lpcfg_*() function.  To get the lp_ctx, have the caller pass
it to you.  To get a lp_ctx for the source3/param loadparm system, use:

struct loadparm_context *lp_ctx = loadparm_init_s3(tmp_ctx, loadparm_s3_helpers());

Remember to talloc_unlink(tmp_ctx, lp_ctx) the result when you are done!

To get a lp_ctx for the lib/param loadparm system, typically the
pointer is already set up by popt at startup, and is passed down from
cmdline_lp_ctx.

In pure source3/ code, you may use lp_*() functions, but are
encouraged to use the lpcfg_*() functions so that code can be made
common.


How does loadparm_init_s3() work?
---------------------------------

loadparm_s3_helpers() returns a initialised table of function
pointers, pointing at all global lp_*() functions, except for those
that return substituted strings (% macros).  The lpcfg_*() function
then calls this plugged in function, allowing the one function and
pattern to use either loadparm system.


There is a lot of generated code, here, what generates what?
------------------------------------------------------------

The regular format of the CPP macros in param_functions.c is used to
generate up the prototypes (mkproto.pl, mks3param_proto.pl), the service
and globals table (mkparamdefs.pl), the glue table (mmks3param.pl) and
the initilisation of the glue table (mks3param_ctx_table.pl).

I have tried combining some of these, but it just makes the scripts more
complex.

The CPP macros are defined in and expand in lib/param/loadparm.c and
source3/param/loadparm.c to read the values from the generated
stuctures.  They are CPP #included into these files so that the same
macro has two definitions, depending on the system it is loading into.


Why was this done, rather than a 'proper' fix, or just using one system or the other?
-------------------------------------------------------------------------------------

This was done to allow merging from both ends - merging more parts of
the loadparm handling, and merging code that needs to read the
smb.conf, without having to do it all at once.  Ideally
param_functions.c would be generated from param_table.c or (even
better) our XML manpage source, and the CPP macros would instead be
generated expanded as generated C files, but this is a task nobody has
taken on yet.