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

79 Commits

Author SHA1 Message Date
Andreas Schneider
189f156c8c lib:smbconf: Fix code spelling
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>
2023-04-14 05:25:33 +00:00
Jeremy Allison
7e0eb0f31a s3:lib: Change file_modtime() to return an error code and a struct timespec.
Removes need for external stat() code when checking for timechange.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jan 27 08:30:35 UTC 2023 on atb-devel-224
2023-01-27 08:30:35 +00:00
Michael Tokarev
96154a26fe spelling fixes for 4.18 (errror implemenation proces Controler)
One of changes is somewhat interesting, it is "tfork waiter proces"
process title in tfork.c. I wonder why no one noticed this before.
There's another similar process title in there, "tfork waiter process(%d)".
Hopefully no one does grep for "proces$" (and there's no reason to).

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Rowland Penny <rpenny@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jan 26 20:46:11 UTC 2023 on atb-devel-224
2023-01-26 20:46:11 +00:00
John Mulligan
1b6d675feb lib/smbconf: expose smbconf error codes to python wrapper
The smbconf library defines an enum of error codes that can be returned
from the C calls. The error codes were getting stored in the python
SMBConfError type but it was not easy to access or obvious what the
integer code represented.

This change makes it easier to get the returned error code: via a
`error_code` attribute on the exception value. It also exposes the
integer constants to the module. Simple tests for a few of the more
obvious error codes check that this new error handling correctly
exposes the error code values.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Jun  8 13:13:10 UTC 2022 on sn-devel-184
2022-06-08 13:13:10 +00:00
John Mulligan
f9df57043e lib/smbconf: add python wrapper functions for transaction management
The smbconf API supports transactions. This changes adds wrapper
functions transaction_start, transaction_commit, and transaction_cancel.
It also adds tests for the functions, one of which demonstrates a
semi-pythonic way to use said functions.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri May  6 18:14:30 UTC 2022 on sn-devel-184
2022-05-06 18:14:30 +00:00
John Mulligan
cc26fe829c lib/smbconf: add delete_global_parameter method to SMBConf
Add a delete_global_parameter method wrapping smbconf_delete_global_parameter.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
John Mulligan
64a36f5bf0 lib/smbconf: add delete_parameter method to SMBConf
Add a delete_parameter method wrapping smbconf_delete_parameter.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
John Mulligan
2b6bd70cdc lib/smbconf: add create_set_share method to SMBConf
Add the create_set_share method wrapping smbconf_create_set_share.
This method is one of the most complex as it must "unpack" the list
of key-value pairs from python and convert that to a `struct
smbconf_service` for the smbconfig C API.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
John Mulligan
7e4bc41983 lib/smbconf: add delete_share method to SMBConf
Add a delete_share method wrapping smbconf_delete_share.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
John Mulligan
35df07d5ca lib/smbconf: add set_global_parameter method to SMBConf
Add a set_global_parameter method wrapping smbconf_set_global_parameter.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
John Mulligan
565d8ae8cd lib/smbconf: add set_parameter method to SMBConf
Add a set_parameter method wrapping smbconf_set_parameter.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
John Mulligan
ff603de514 lib/smbconf: add drop method to SMBConf
Add a drop method wrapping smbconf_drop.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
John Mulligan
eb84f67e80 lib/smbconf: add create_share method to SMBConf
Add a create_share method wrapping smbconf_create_share.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
John Mulligan
fcd50ea4ab lib/smbconf: add a python function for raising smbconf exceptions
The previous implementation in C was private to the module. Add
a small python wrapper function so that a different python module
may reuse the implementation.

The python level function is prefixed with "_" to mark it as
"private". Only future cooperating modules in the samba sources
should make use of it.

The function is shared at the python level as per the recommendation:
    https://stackoverflow.com/a/2136670

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
John Mulligan
f74d163ef0 lib/smbconf: move python smbconf type definition to header
Moving the definition of the type to a header file will allow
future reuse of the C-type fields in a different C-API python
module.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2022-05-06 17:16:30 +00:00
Anoop C S
e2392729f3 libsmbconf: Avoid initial declaration inside 'for' loop
Building Samba on CentOS 7 with GCC version 4.8.5 results in the
following error:

[2725/3398] Compiling libcli/echo/tests/echo.c
../../lib/smbconf/pysmbconf.c: In function 'py_from_smbconf_service':
../../lib/smbconf/pysmbconf.c:72:2: error: 'for' loop initial
                               declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < svc->num_params; i++) {
  ^
../../lib/smbconf/pysmbconf.c:72:2: note: use option -std=c99 or
                                         -std=gnu99 to compile your code
../../lib/smbconf/pysmbconf.c: In function 'obj_share_names':
../../lib/smbconf/pysmbconf.c:181:2: error: 'for' loop initial
                               declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < num_shares; i++) {
  ^
../../lib/smbconf/pysmbconf.c: In function 'obj_get_config':
../../lib/smbconf/pysmbconf.c:267:2: error: 'for' loop initial
                               declarations are only allowed in C99 mode
  for (uint32_t i = 0; i < num_shares; i++) {
  ^

Therefore declare variables right at the start aligning to default C90
standard available with GCC version on CentOS 7.

Signed-off-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Apr 25 13:23:18 UTC 2022 on sn-devel-184
2022-04-25 13:23:18 +00:00
John Mulligan
d948cb1c6d lib/smbconf: add an initial set of python bindings
The smbconf library provides a generic interface for Samba configuration
backends. In order to access these backends, including the read-write
registry backend, we add a new python binding for smbconf - the general
interface library.

This initial set of bindings covers some basic read-only calls.  This
includes function calls for listing shares (config sections) and getting
the parameters of the shares. The `init_txt` construction function must
be used to get a new SMBConf object.  This is done so that other
backends, specifically the registry backend from source3 can be used in
the future. Those will provide their own construction funcs.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz
Reviewed-by: David Mulder <dmulder@suse.com>
Reviewed-by: Guenther Deschner <gd@samba.org>
2022-04-21 14:41:32 +00:00
Björn Jacke
b8bf7ef87e waf: add library dependency for sendfile on Solaris
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-02-17 13:33:15 +01:00
Chris Lamb
a4ab7c73bd Correct "occured" typos.
Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2017-02-22 08:26:21 +01:00
Stefan Metzmacher
530e3db70b lib/smbconf: remove const warning
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-11-14 23:27:05 +01:00
David Disseldorp
caf83bcb76 libsmbconf: add smbconf_create_set_share
This call creates a new share definition, using the parameters provided
with a smbconf_service structure.
Such an interface allows for simple cloning of services with:
smbconf_get_share(conf_ctx, mem_ctx, base_sharename, &base_service_def);
base_service_def->name = clone_sharename;
smbconf_create_set_share(conf_ctx, base_service_def);

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: David Disseldorp <ddiss@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
2013-05-28 18:12:26 +02:00
Michael Adam
57634fd87d libsmbconf: fix documentation of transaction calls.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-05-28 18:12:26 +02:00
Michael Adam
0048dd95cd smbconf: remove python shebang from wscript_build
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Fri May 11 22:05:32 CEST 2012 on sn-devel-104
2012-05-11 22:05:32 +02:00
Andreas Schneider
419e03ab18 libsmbconf: Define a doxygen group for libsmbconf.
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:26 +02:00
Andreas Schneider
60109a0e6d libsmbconf: Document smbconf_transaction_cancel().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:25 +02:00
Andreas Schneider
9bbf4bd0f3 libsmbconf: Document smbconf_transaction_commit().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:25 +02:00
Andreas Schneider
6babdaf6b7 libsmbconf: Document smbconf_transaction_start().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:25 +02:00
Andreas Schneider
d9407a5a55 libsmbconf: Document smbconf_delete_global_includes().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:25 +02:00
Andreas Schneider
3ace1716a0 libsmbconf: Document smbconf_delete_includes().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:25 +02:00
Andreas Schneider
a606d5219e libsmbconf: Document smbconf_set_global_includes().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:25 +02:00
Andreas Schneider
0ab8a8e5ba libsmbconf: Document smbconf_set_includes().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:25 +02:00
Andreas Schneider
a7ac2a87c6 libsmbconf: Document smbconf_get_global_includes().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:25 +02:00
Andreas Schneider
74dc8c351c libsmbconf: Document smbconf_get_includes().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:25 +02:00
Andreas Schneider
b7ba46d1c0 libsmbconf: Document smbconf_delete_global_parameter().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:24 +02:00
Andreas Schneider
d70acdc554 libsmbconf: Document smbconf_delete_parameter().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:24 +02:00
Andreas Schneider
1cb649f57f libsmbconf: Document smbconf_get_global_parameter().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:24 +02:00
Andreas Schneider
8417e3485e libsmbconf: Document smbconf_get_parameter().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:24 +02:00
Andreas Schneider
70c5143ea4 libsmbconf: Document smbconf_set_global_parameter().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:24 +02:00
Andreas Schneider
62f3560e98 libsmbconf: Document smbconf_set_parameter().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:24 +02:00
Andreas Schneider
7e04bd1f85 libsmbconf: Document smbconf_delete_share().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:24 +02:00
Andreas Schneider
474805794e libsmbconf: Document smbconf_get_share().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:24 +02:00
Andreas Schneider
529e064586 libsmbconf: Document smbconf_create_share().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:24 +02:00
Andreas Schneider
44fa842ae9 libsmbconf: Document smbconf_share_exists().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:23 +02:00
Andreas Schneider
211286042d libsmbconf: Document smbconf_get_share_names().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:23 +02:00
Andreas Schneider
87c4096092 libsmbconf: Document smbconf_get_config().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:23 +02:00
Andreas Schneider
938690c771 libsmbconf: Document smbconf_drop().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:23 +02:00
Andreas Schneider
1b0809bd73 libsmbconf: Document smbconf_changed().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:23 +02:00
Andreas Schneider
5cd229ca5e libsmbconf: Document smbconf_shutdown().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:23 +02:00
Andreas Schneider
25e798e641 libsmbconf: Document smbconf_is_writeable().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:23 +02:00
Andreas Schneider
7a57ccd2c5 libsmbconf: Document smbconf_backend_requires_messaging().
Signed-off-by: Michael Adam <obnox@samba.org>
2011-05-10 19:13:23 +02:00