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

160 Commits

Author SHA1 Message Date
Michael Adam
6f7fcdcda5 net conf: implement "net conf delincludes".
usage: "net conf delincludes <servicename>"

This is equivalent to "net conf setincludes <servicename>"
(without further arguments).

Michael
(This used to be commit a1d09f34ec)
2008-04-10 01:29:03 +02:00
Michael Adam
f3cfc1446e net conf: implement a "net conf setincludes" command.
given zero or more filenames as command line parameters

Michael
(This used to be commit ab51e4d44c)
2008-04-10 01:29:03 +02:00
Michael Adam
68fb75857b net conf: implement "net conf getincludes".
Michael
(This used to be commit 30bc48623c)
2008-04-10 01:29:02 +02:00
Michael Adam
9765828d97 net conf: add diagnostic message for failure to load text file.
Michael
(This used to be commit 8f2c3efa67)
2008-04-10 01:29:02 +02:00
Michael Adam
52a16b4945 net conf: reduce indentation by grouping testmode code together.
Michael
(This used to be commit 97f9cb8575)
2008-04-10 01:29:02 +02:00
Michael Adam
2a94369946 net conf: don't drop config in testmode
Michael
(This used to be commit 74e87b9775)
2008-04-10 01:29:02 +02:00
Michael Adam
a98c08c151 net conf: fix import to correctly add includes (at the end)
Michael
(This used to be commit 3e81db8370)
2008-04-10 01:29:02 +02:00
Michael Adam
3d38f143df libsmbconf: add a "verbatim" parameter to smbconf_init_txt_simple().
Michael
(This used to be commit b9e72b402d)
2008-04-10 01:28:56 +02:00
Michael Adam
65b4a93c4a net_conf: fix non-testmode import function.
Michael
(This used to be commit cd17cc745a)
2008-03-27 00:32:09 +01:00
Michael Adam
0bdcc557ee net_conf: reformat - re-indent one function call.
Michael
(This used to be commit 9ef9d4c4e7)
2008-03-26 14:55:06 +01:00
Michael Adam
3253cffced net_conf: add casts to avoid compiler warnings.
Michael
(This used to be commit 1c6b9a0ac3)
2008-03-26 14:55:06 +01:00
Michael Adam
0234cc8bdd net_conf: rename "ctx" to "mem_ctx" for clarity.
There are also smbconf contexts arount...

Michael
(This used to be commit 5171df66eb)
2008-03-26 14:55:06 +01:00
Michael Adam
c2acc30bcb net_conf: use talloc_stackframe() instead of talloc_init().
Michael
(This used to be commit ab4fd03705)
2008-03-26 14:55:06 +01:00
Michael Adam
ca2f9297c2 net_conf: fix import function by using the new text backend of smbconf.
Originally, lp_load() was used to import files to registry.
This had several bugs. Most notably, options explicitly set to
default values were silently dropped, and all parametric options
were ignored.

This new implementation reads config from the text backend and
stuffs everything verbatim in to the registry backend.

Michael
(This used to be commit e41c6650f8)
2008-03-26 14:55:06 +01:00
Michael Adam
6f7cfeddd6 libsmbconf: add a "path" variable to the conf context.
This is passed to the module init routines.
In case of the registry, this is the path of the
basekey in registry, that is to be used, defaulting
to KEY_SMBCONF (HKLM\software\samba\smbconf), when
NULL is given. This is the only case currently used.

In order to support other keys, registry initialization
for smbconf has to be changed to support different keys.

Michael
(This used to be commit 96434d9dc7)
2008-03-21 18:19:24 +01:00
Michael Adam
fececde181 libsmbconf: add backend specific init function.
Hide generic init function taking smbconf_ops argument
from public api.

Michael
(This used to be commit b3f6920ccb)
2008-03-21 02:25:56 +01:00
Michael Adam
23b1d721b8 libsmbconf: rename smbconf_close() to smbconf_shutdown().
Michael
(This used to be commit 797b26ad3f)
2008-03-21 02:25:56 +01:00
Michael Adam
adf5bf554c libsmbconf: rename smbconf_open() to smbconf_init().
That's more appropriate.

Michael
(This used to be commit d7bd9bb8aa)
2008-03-21 02:25:56 +01:00
Michael Adam
153ed797e6 libsmbconf: change the API to always take the smbconf_ctx parameter first.
..for consistency. Exception: the open/init function, where the smbconf_ctx
is created from the given talloc context.

Michael
(This used to be commit 304dba6cb2)
2008-03-21 02:25:55 +01:00
Michael Adam
6274929b1e libsmbconf: rename all occurrences of libnet_conf_ to smbconf_ .
Michael
(This used to be commit 097af0309d)
2008-03-17 18:03:02 +01:00
Michael Adam
801eeaec09 Add and modify comments in net_conf.c
Michael
(This used to be commit b3afc8391d)
2008-01-13 23:45:57 +01:00
Michael Adam
a6bf13ce97 Add explicit creation of shares to net conf import function.
It has been removed from libnet_conf_set_parameter().

Michael
(This used to be commit b5c533b06c)
2008-01-13 23:30:08 +01:00
Michael Adam
1ee6d3e1ee Introduce a libnet_conf context created by libnet_conf_open().
The libnet_conf_ctx stores the information necessary to interoperate
with the configuration. It is created by calling libnet_conf_open()
and destroyed by calling libnet_conf_close(). The context is passed
to all the libnet_conf functions. It currently stores the token to
access the registry. Later, it could store more data, e.g. the server
to connect to, credentials, and so on. For support of other backends
than registry or support of remote configuration, only the open
function will have to be changed.

In net_conf, the calls to the actual net_conf functions is wrapped
into a function that calls libnet_conf_open()/_close(). Thus an
individual variant of net_conf_runfunction2() and functable2 is
used to cope with functions being called by the wrapper with the
additional libnet_conf_ctx argument.

Michael
(This used to be commit c2a9346faa)
2008-01-13 02:14:34 +01:00
Michael Adam
517ad5318d Fix spacing - spaces mixed with tabs.
Michael
(This used to be commit a4ef828102)
2008-01-04 21:16:48 +01:00
Michael Adam
dbdaa5eeec Fix a comment.
Michael
(This used to be commit fc9c3f39b5)
2008-01-04 21:09:55 +01:00
Michael Adam
dee8e32d8d Remove the word "registry" from the help output of the "net conf" command.
Michael
(This used to be commit 8d9e3e08f3)
2008-01-04 21:05:59 +01:00
Michael Adam
34fb783965 Update the introductory comment to net_conf.c to mention linbet_conf.
Michael
(This used to be commit e166b88637)
2008-01-04 21:05:59 +01:00
Michael Adam
b1472c0956 Remove the final regdb_close() from net_conf.c
This is to hide the registry from net_conf.
Right now, it does not harm if "net conf" does not close
the registry file explicitly just before exiting.
I am working out a proper way of handling open/close
operations transparently in the libnet_conf library.

Michael
(This used to be commit 790ef78944)
2008-01-04 19:52:22 +01:00
Michael Adam
2a8722d4c3 Fix the behaviour of "net conf setparm" to create the share if necessary.
This moves functionality taken away from libnet_conf_set_parameter() to the
higher level user frontend function. (Somehow I thought I had done this
already ... :-)

Michael
(This used to be commit fc0fca980f)
2008-01-04 19:49:57 +01:00
Günther Deschner
77219ddd22 Fix build warning.
Guenther
(This used to be commit a43125d9e9)
2008-01-04 17:43:23 +01:00
Michael Adam
5470f8f638 Make libnet_conf handle opening/initialization of the registry.
Open state is currently tracked by a global variable
to avoid double initialization.

Later, this can possibly be replaced by a conf-context
created by an initialization function and passed around
to the other api functions.

Michael
(This used to be commit 77713e7764)
2008-01-03 15:33:09 +01:00
Michael Adam
2476254ccd Rename libnet_smbconf_delparm() to libnet_conf_delete_parameter().
Michael
(This used to be commit 073eeca51e)
2008-01-03 14:17:49 +01:00
Michael Adam
55771b356d Rename libnet_smbconf_getparm() to libnet_conf_get_parameter().
Michael
(This used to be commit d08556dbc7)
2008-01-03 14:17:49 +01:00
Michael Adam
b9f904b59d Rename libnet_smbconf_setparm() to libnet_conf_set_parameter().
Michael
(This used to be commit e00cb415d3)
2008-01-03 14:17:49 +01:00
Michael Adam
e89411effd Rename libnet_smbconf_delshare() to libnet_conf_delete_share().
Michael
(This used to be commit 2075baf551)
2008-01-03 14:17:49 +01:00
Michael Adam
e1aa474a32 Rename libnet_smbconf_getshare() to libnet_conf_get_share().
Michael
(This used to be commit 1575612f19)
2008-01-03 14:17:49 +01:00
Michael Adam
3f3a29ed50 Rename libnet_smbconf_create_share() to libnet_conf_create_share().
Michael
(This used to be commit 6bc4ee2108)
2008-01-03 14:17:49 +01:00
Michael Adam
630de5f555 Rename libnet_smbconf_share_exists() to libnet_conf_share_exists().
Michael
(This used to be commit 3258758e5c)
2008-01-03 14:17:49 +01:00
Michael Adam
daf1a460c8 Rename libnet_smbconf_get_share_names() to libnet_conf_get_share_names().
Michael
(This used to be commit 2e4beee66b)
2008-01-03 14:17:49 +01:00
Michael Adam
90837d048b Rename libnet_smbconf_get_config() to libnet_conf_get_config().
Michael
(This used to be commit e8f7c07699)
2008-01-03 14:17:49 +01:00
Michael Adam
05ff62cf78 Rename libnet_smbconf_drop() to libnet_conf_drop().
Michael
(This used to be commit 42ae33a962)
2008-01-03 14:17:49 +01:00
Michael Adam
78acbddbd5 Happy new year again.
Michael
(This used to be commit e568f42e21)
2008-01-03 14:17:48 +01:00
Michael Adam
fd597c7e6d Add libnet_conf API function libnet_smbconf_create_share().
And make libnet_smbconf_setparm() return error if the share
does not already exist. Adapt net_conf_addshare to this new
situation.

Michael
(This used to be commit de349bd26d)
2008-01-03 11:30:14 +01:00
Michael Adam
4c7ef1c03e Make grouping in if statement more explicit.
Michael
(This used to be commit a1bb47695a)
2007-12-31 03:55:22 +01:00
Michael Adam
8d9fb62a45 Change net_conf_import() to only use libnet_conf API functions.
More precisely, only import_process_service() is changed.
This removes all references to registry code from net_conf.c.

net_conf_import() is currently -- like net_conf_addshare() -- also
considered a high-level add-on, not an API function.

Michael
(This used to be commit b4dca117c0)
2007-12-31 03:02:39 +01:00
Michael Adam
01f8fd55a7 Rewrite net_conf_addshare() to only use libnet_conf API functions.
Also exit on error if the share already exists.

net_conf_addshare() is considered a high level utility function.
It should not be an libnet_conf API function in itself since it is
kind of arbitrary.

Michael
(This used to be commit af5218f150)
2007-12-31 01:56:18 +01:00
Michael Adam
e8a680cdf3 Rename libnet_smbconf_key_exists() to libnet_smbconf_share_exists()
and move it to the api section of libnet_conf.c

Michael
(This used to be commit 9b5d8f4d95)
2007-12-31 01:14:44 +01:00
Michael Adam
a74de0c7eb Remove an unused variable.
Michael
(This used to be commit 332be113a7)
2007-12-30 22:36:02 +01:00
Michael Adam
80957726b6 Remove all d_fprintf-s from libnet_conf.c
Replacing them buy DEBUG statements and filling in
d_fprintfs in callers in net_conf.c.

Michael
(This used to be commit 1f0122d8d4)
2007-12-30 22:36:01 +01:00
Michael Adam
59128c7837 Remove list_values() from net_conf.c - it is not needed any more.
Also make libnet.c:libnet_smbconf_format_registry_value() static.
(There are nor more external callers.)

Michael
(This used to be commit ac7baa17e8)
2007-12-30 00:32:41 +01:00
Michael Adam
9c14495944 Use libnet_smbconf_get_config() in net_conf_list().
This leaves only output logic in net_conf_list().

Michael
(This used to be commit 95d9981d59)
2007-12-30 00:32:41 +01:00
Michael Adam
a6d6fbb73d Dont return count - 1 but count from libnet_smbconf_reg_get_values().
Michael
(This used to be commit ded60dec7d)
2007-12-29 17:02:27 +01:00
Michael Adam
e8cb7cecf2 Make sure libnet_smbconf_get_share_names() always lists "global" first.
And don't return count-1 but count.

Michael
(This used to be commit b7cb9b7823)
2007-12-29 17:00:27 +01:00
Michael Adam
0b7aafff11 Fix a const warning.
Michael
(This used to be commit e276e48177)
2007-12-29 13:02:22 +01:00
Michael Adam
1c03f6b608 Rename libnet_smbconf_getshares() to libnet_smbconf_get_share_names().
Michael
(This used to be commit 9b3b9aa7e1)
2007-12-29 12:55:42 +01:00
Michael Adam
2a642a6e2b Move functionality of net_conf_listshares() to libnet_conf.c
into new function libnet_smbconf_getshares().

Michael
(This used to be commit 306c7e4d9c)
2007-12-29 12:52:09 +01:00
Michael Adam
f8c39cbb7b Move functionality of net_conf_showshare() to libnet_conf.c
The functionality is moved to a new function libnet_smbconf_getshare().
This returns the parameters of the given share as two lists: the list
of parameter names and the list of matching (formatted) parameter values.

The retrieval and formatting is done in a new internal helper function
libnet_smbconf_reg_get_values() that is to become the replacement for
list_values() from net_conf.c once functionality of net_conf_list() has
been moved to libnet_conf, too.

Michael
(This used to be commit 198232bd52)
2007-12-29 12:32:16 +01:00
Michael Adam
8093a75d6f Make the main net_conf functions static in net_conf.c
Michael
(This used to be commit dd6e09a65e)
2007-12-29 02:27:20 +01:00
Michael Adam
eb356fbafc Hide the registry backend from libnet_smbconf_getparm().
Return a formatted string of the value instead.

Michael
(This used to be commit 7d0ec5bae1)
2007-12-29 02:12:33 +01:00
Michael Adam
4b75bc63bb Rename format_value() to libnet_smbconf_format_registry_value().
Michael
(This used to be commit 95d5dd9bb0)
2007-12-29 01:17:39 +01:00
Michael Adam
dfa8d9356c Move format_value() to libnet_conf.c.
Michael
(This used to be commit 3422a5048a)
2007-12-29 00:05:58 +01:00
Michael Adam
afca308742 Rename libnet_smbconf_open_basepath() to libnet_smbconf_reg_open_basepath().
Michael
(This used to be commit 4c0e7270c4)
2007-12-26 01:01:14 +01:00
Michael Adam
18ea20e19b Rename libnet_smbconf_open_path() to libnet_smbconf_reg_open_path().
Michael
(This used to be commit 4b0e636965)
2007-12-26 00:58:11 +01:00
Michael Adam
c2ab4bd705 Add two missing free-s.
Michael
(This used to be commit 4efac39c36)
2007-12-25 03:35:00 +01:00
Michael Adam
44631bfd4d Remove talloc context parameter from libnet_smbconf_delparm().
Make use of talloc stackframe internally.
This removes talloc contxt from net_conf_delparm.

Michael
(This used to be commit 16f1373938)
2007-12-25 03:34:04 +01:00
Michael Adam
726f32b672 Add a missing free.
Michael
(This used to be commit bf6031287f)
2007-12-25 03:29:41 +01:00
Michael Adam
f3b0469b4a Remove talloc context parameter from libnet_smbconf_setparm().
Make use of talloc stackframe internally.
This removes talloc contxt from net_conf_setparm.

Michael
(This used to be commit efaffefc43)
2007-12-25 03:29:05 +01:00
Michael Adam
e5a87c2543 Remove talloc context parameter from libnet_smbconf_drop().
Make use of talloc_stackframe.

Michael
(This used to be commit aaceab1153)
2007-12-25 03:05:06 +01:00
Michael Adam
2764f5a0a6 Rename drop_smbconf_internal() to libnet_smbconf_drop().
Michael
(This used to be commit 5873e6a1f8)
2007-12-25 03:01:59 +01:00
Michael Adam
8e53343a74 Move drop_smbconf_internal() to libnet_conf.c
Michael
(This used to be commit 4c2a3396bb)
2007-12-25 02:55:07 +01:00
Michael Adam
9626fffe14 Use the proper boolean constants in net_conf.c
Michael
(This used to be commit 1fe4ea63b1)
2007-12-25 02:48:45 +01:00
Michael Adam
734ddacc91 Add error reporting to net_conf_delshare().
Michael
(This used to be commit 8d02a2de61)
2007-12-25 02:42:33 +01:00
Michael Adam
86486fcc98 Simplify libnet_smbconf_delshare().
Remove talloc context parameter.
Remove d_printf error message.

Michael
(This used to be commit 870d35c048)
2007-12-25 02:37:02 +01:00
Michael Adam
9c20b9a731 Rename reg_delkey_internal() to libnet_smbconf_delshare().
Michael
(This used to be commit 7d501f0d78)
2007-12-25 02:24:39 +01:00
Michael Adam
c9f65929b7 Move reg_delkey_internal() to libnet/libnet_conf.c
Michael
(This used to be commit c1b863fd05)
2007-12-25 02:21:30 +01:00
Michael Adam
c74579f491 Make libnet_smbconf_key_exists() use talloc_stackframe().
And not pass a talloc context.

Michael
(This used to be commit 7e8451f2f0)
2007-12-24 00:53:22 +01:00
Michael Adam
8f163d5c5a Move logic of net_conf_getparm() to libnet_conf.c.
Michael
(This used to be commit d3a20c4d5a)
2007-12-24 00:18:35 +01:00
Michael Adam
d1c2280cd4 Rename libnet_reg_createkey_internal() to libnet_smbconf_reg_createkey_internal().
Michael
(This used to be commit 0e7f215f54)
2007-12-23 04:10:32 +01:00
Michael Adam
62f08d3dd9 Move net_conf_setparm() to libnet_conf.c
renaming it to libnet_smbconf_setparm()

Michael
(This used to be commit 60f49b22b5)
2007-12-23 04:10:32 +01:00
Michael Adam
31d436e54c Move reg_setvalue_internal() to libnet_conf.c
renaming it to libnet_smbconf_setvalue_internal()

Michael
(This used to be commit 7cb51a1d6d)
2007-12-23 04:10:31 +01:00
Michael Adam
b04708866f Move logic of net_smbconf_delparm() to libnet/libnet_conf.c
Logic in new function libnet_smbconf_delparm().

Michael
(This used to be commit 0cff79e355)
2007-12-23 04:10:31 +01:00
Michael Adam
ec3e8587ec Move smbconf_value_exists() to libnet/net_conf.c
renaming it to libnet_smbconf_value_exists().

Michael
(This used to be commit ba71c68445)
2007-12-23 04:10:31 +01:00
Günther Deschner
41410c86cc Some libnet and netapi build fixes.
Guenther
(This used to be commit 1d47247283)
2007-12-21 15:29:10 +01:00
Günther Deschner
1b5c1ae742 Very quick conversion of net_conf functions into the libnet_conf layer.
Certainly needs cleanup later.

Guenther
(This used to be commit 2b41ac926d)
2007-12-21 15:29:09 +01:00
Jeremy Allison
ade51769d5 We don't need P_GSTRING or P_UGSTRING anymore.
Jeremy.
(This used to be commit 78dc756000)
2007-12-07 12:43:10 -08:00
Volker Lendecke
78c6ee0090 Remove some globals
(This used to be commit 31d0a846db)
2007-12-05 14:39:07 +01:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Michael Adam
c56874d112 r24527: Add a function lp_canonicalize_parameter_with_value that turns
a parameter and value into the canonical paramter with the value
inverted if it was in invers boolean synonym.

Make net conf use this function when storing parameters.

Michael
(This used to be commit 3b762ab183)
2007-10-10 12:29:54 -05:00
Michael Adam
8b0b1408a0 r24513: Reformatting: eliminate trailing spaces, overly long lines
and adjust some formattings to standard.

Michael
(This used to be commit 00432bcd69)
2007-10-10 12:29:53 -05:00
Michael Adam
53f5c4adfb r24496: Add initial synonym handling to "net conf":
When storing parameters in the smbconf portion of the registry,
up to now, synonyms could be misused to store a parameter twice.
Now this is prevented by canonicalizing the paramter name first.

Also, the value for a boolean parameter checked for validity
before storing the bool in registry.

(The canonicalization should finally go into the registry smbconf
code to also prevent e.g. "regedit" or "net rpc registry" from
storing synonyms. - This is in the making.)

Michael
(This used to be commit 95447dde86)
2007-10-10 12:29:52 -05:00
Andrew Tridgell
153cfb9c83 r23801: The FSF has moved around a lot. This fixes their Mass Ave address.
(This used to be commit 87c91e4362)
2007-10-10 12:28:27 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Michael Adam
d4f1b08c93 r23760: Untangle use of strrchr_m and strequal and add some checks
for the validity of the given registry key name.

Michael
(This used to be commit 4b4ba7724e)
2007-10-10 12:23:53 -05:00
Michael Adam
a5946cb46a r23750: Change the behaviour of net conf import when there is a global section
in the current registry and there is no global section in the input
file (or only global options with default values):
In that case the existing global section is now not touched. Before, it
would have been deleted and recreated empty. The new behaviour is how
other shares are treated too.

Note that since the input file is parsed by lp_load, there is currently
no way to distinguish between a section with only default parameters
and a non-existing section in net conf import.

Michael

PS: A couple of trailing white-spaces have been eliminated
and a line was broken to be not longer than 80 chars, too.
(This used to be commit ec21a0cf9f)
2007-10-10 12:23:52 -05:00
Michael Adam
1bea19c127 r23749: Simplify prototype of reg_setvalue_internal:
eliminate "type" parameter since we store only REG_SZ.

Michael
(This used to be commit 65ce463317)
2007-10-10 12:23:52 -05:00
Michael Adam
cba898808e r23748: Clean use of talloc in import_process_service:
create a temporary talloc ctx for the function.

Michael
(This used to be commit 39df7faaa9)
2007-10-10 12:23:51 -05:00
Michael Adam
c2c96bccda r23747: Move formatting of a parameter's value into a value string
to a function of its own. (for storing it in registry),
Eliminate the valtype variable : store everything as "sz".
Eliminate some trailing white spaces on the way.

Michael
(This used to be commit 76f4f224aa)
2007-10-10 12:23:51 -05:00
Michael Adam
feff1fcfd8 r23746: Fix missing assignments to target string of asprintf in import function.
Michael
(This used to be commit 6b1bf7c1f4)
2007-10-10 12:23:51 -05:00
Michael Adam
f7b8a3782a r23745: Fix: Check whether top subkeyname instead of whole registry key name
is equal to GLOBAL_NAME.

Michael
(This used to be commit fdcdcacf0a)
2007-10-10 12:23:51 -05:00
Michael Adam
ea78cb941a r23744: Remove TODO-comment. lp_load returns False if opening
of the config file fails. That's enough of checking for
existence and readbility to my taste.

Michael
(This used to be commit 204f4f1a94)
2007-10-10 12:23:51 -05:00