1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/lib/param
Garming Sam 93448f4be9 param: change a number of parameters from P_LIST to P_CMDLIST
These parameters are being changed to use their original syntax to match source3.

netbios aliases, interfaces, auth methods, invalid users, valid users,
admin users, read list, write list, hosts allow, hosts deny, preload
modules, smb ports, name resolve order, svcctl list, cluster addresses,
init logon delayed hosts, wins server, eventlog list, usershare prefix
allow list, usershare prefix deny list, vfs objects, winbind nss info

The documentation has also been changed to be consistent with the
change.

Change-Id: I536481098a508e0366c910b180f2db6a6f0634a9
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
2014-07-07 23:32:35 +02: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 s4-winbind: Use winbindd in the AD DC by default 2014-07-04 05:19:54 +02:00
loadparm.h lib/param: Make lpcfg_equal_parameter static (again) 2014-05-07 19:49:17 +02:00
param_table.c param: change a number of parameters from P_LIST to P_CMDLIST 2014-07-07 23:32:35 +02:00
param.h param: use a single add_to_file_list method 2014-05-07 19:49:15 +02:00
README param: auto generate param_functions.c at build time 2014-02-12 13:17:13 +13:00
s3_param.h lib/param: remove unnecessary get_parametric s3 helper function 2014-05-07 19:49:17 +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 lib/param: Remove special handling for 'state dir' and 'cache dir' 2014-02-12 13:17:13 +13:00
wscript_build param: correctly use param_table.c as a regular C file 2014-05-07 19:49:16 +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 add the documentation to docs-xml/smbdotconf.
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.