summaryrefslogtreecommitdiff
path: root/source4/param/pyparam.c
AgeCommit message (Collapse)AuthorFilesLines
2023-11-20Use python.h from libreplaceAndreas Schneider1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15513 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-08-08python: Use correct function signaturesJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-10-03python: whitespace fixesVolker Lendecke1-11/+11
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-08-06pyparam: expose lpcfg_dump_globals()Douglas Bagnall1-0/+33
This is needed by samba-tool testparm, in the next commit. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15070 Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: David Mulder <dmulder@suse.com>
2020-10-29s4:param: Add 'weak crypto' getter to pyparamAndreas Schneider1-0/+22
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2020-06-23Add python binding for DATADIR build pathDavid Mulder1-0/+7
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2020-05-08Fix clang 9 missing-field-initializer warningsGary Lockyer1-3/+3
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
2020-03-23py3: Remove #define PyInt_FromLong PyLong_FromLongAndrew Bartlett1-1/+1
This allows us to end the use of Python 2/3 compatability macros. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power
2019-09-01Spelling fixes s/tempates/templates/Mathieu Parent1-1/+1
Signed-off-by: Mathieu Parent <math.parent@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-06-24py3: Remove duplicated PyUnicode_Check() after the py3 compat macros were ↵Andrew Bartlett1-1/+1
removed This came about because in py2 we had to check for strings and unicode. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <noel.power@suse.com> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Mon Jun 24 18:48:53 UTC 2019 on sn-devel-184
2019-06-24py3: Remove PyStr_AsString() compatability macroAndrew Bartlett1-1/+1
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard function names. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
2019-06-24py3: Remove PyStr_FromFormat() compatability macroAndrew Bartlett1-2/+2
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard function names. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
2019-06-24py3: Remove PyStr_FromString() compatability macroAndrew Bartlett1-16/+16
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard function names. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
2019-06-24py3: Remove PyStr_Check() compatability macroAndrew Bartlett1-1/+1
We no longer need Samba to be py2/py3 compatible so we choose to return to the standard function names. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Noel Power <noel.power@suse.com>
2019-05-16s4: squash 'cast between incompatible function types' warningNoel Power1-6/+6
To avoid warning above produced by using -Wcast-function-type we; + ensure PyCFunctions of type METH_NOARGS defined dummy arg + ensure PyCFunctions of type METH_KEYWORDS use PY_DISCARD_FUNC_SIG macro + ensure PyCFunctions of type METH_KEYWORDS really actually use the problematic kargs param, if not remove it Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
2019-01-28s4:pyparam: Use C99 initializer for PyGetSetDefAndreas Schneider1-4/+10
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2018-11-08debug: Use debuglevel_(get|set) functionAndreas Schneider1-1/+1
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Nov 8 11:03:11 CET 2018 on sn-devel-144
2018-07-12param: Add python binding for lpcfg_state_pathDavid Mulder1-0/+27
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-06-28param: Add non-global smb.cfg option (support 2 different smb.confs)Aaron Haslett1-1/+46
The default behaviour is that there is only a single global underlying LoadParm object. E.g. if you create 2 different LoadParm objects in python, they both modify the same underlying object. This patch adds a mechanism to override this and create a separate non-global LoadParm object. The use-case is the backup tool, where we want to manipulate 2 different smb.conf files (the one used to create the backup, and the smb.conf in the backup itself). Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-04-30s4/param: Additionally accept unicode as string param in Py2Noel Power1-1/+1
With the changes to make samba python code Py2/Py3 compatible there now are many instances where string content is decoded. Decoded string variables in Py2 are returned as the unicode type. Many Py2 c-module functions that take string arguments only check for the string type. However now it's quite possibe the content formally passed as a string argument is now passed as unicode after being decoded, such arguments are rejected and code can fail subtly. This only affects places where the type is directly checked e.g. via PyStr_Check etc. arguments that are parsed by ParseTuple* functions generally already accept both string and unicode (if 's', 'z', 's*' format specifiers are used) Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2018-04-12param: Add python binding for lpcfg_cache_pathDavid Mulder1-0/+25
Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-10-27s4:pyparam: Fix resource leaks on errorAndreas Schneider1-0/+6
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13101 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-03-10python: samba.param: Port param module to Python 3Lumir Balhar1-39/+80
Port Python bindings of samba.param module to Python3-compatible form. Because native Python file objects are officially no longer backed by FILE*, API of some _dump() functions is changed. File argument is now optional and contains only name of file. Stdout is default if no file name is specified. Otherwise opening and closing files is done on C layer instead of Python. Signed-off-by: Lumir Balhar <lbalhar@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2016-09-14s4:param add log_level function to retrieve log level in Python codeChristian Ambach1-0/+9
Signed-off-by: Christian Ambach <ambi@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-05-10source4/param/pyparam.c: fix strange indentationDouglas Bagnall1-4/+4
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-03-08pyparam: Use pytalloc_BaseObject_PyType_Ready()Andrew Bartlett1-10/+2
This changes pyparam to use talloc.BaseObject() just like the PIDL output Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-03-08pyparam: Do not use pytalloc_Object directlyAndrew Bartlett1-42/+27
This type should not be used directly, it should have been made private to pytalloc. This then allows removal of the (PyCFunction) cast Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-01-07python: Remove Python 2.4 support macrosAndrew Bartlett1-6/+0
We require Python 2.6 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2015-05-02param: Remove unused P_SEP and P_SEPARATORMichael Adam1-2/+0
This was only used in swat. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
2014-01-28s4-param: add error messages for failure to dump a parameterGarming Sam1-3/+11
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2014-01-28param: fix incorrect file error handling in s4 pyparamGarming Sam1-2/+0
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2014-01-28s4-testparm: modify dumping of parameters to use the lib/param code to have ↵Garming Sam1-0/+37
more consistent output In making this change, it also fixes a bug where attempting to dump a parameter would immediately cause an error (due to a lack of string conversion). Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2012-02-26pyparam: fix formatting.Jelmer Vernooij1-11/+11
2011-12-13s4-param: Added bin_dir(),sbin_dir() methods to get compiled in dirsAmitay Isaacs1-3/+17
2011-11-17py-param: Add python interface to get server_roleAmitay Isaacs1-0/+15
2011-09-20s4:param/pyparam.c - suppress "P_SEP" compilation warningMatthias Dieter Wallnöfer1-2/+2
Reviewed-by: Jelmer
2011-08-14Use public pytalloc header file.Jelmer Vernooij1-1/+1
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sun Aug 14 17:18:46 CEST 2011 on sn-devel-104
2011-08-10pytalloc: Use consistent prefix for functions, add ABI file.Jelmer Vernooij1-19/+19
2011-07-28s4-param: Fix object names for python objects PyLoadparm and PyLoadparmContextAmitay Isaacs1-2/+2
Use the object names <modulename>.<objectname> to correctly generate the object hierarchy in pydoc. Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-20s4-param Handle P_CHAR and P_BOOLREV in pyparamAndrew Bartlett1-0/+4
Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-07-08param: Add hooks to s3 parm_struct and the parameters void * pointerAndrew Bartlett1-2/+2
This is to that the pyparam hooks can use the hooks to connect with the s3 loadparm system. This now also includes per-service parameters. Andrew Bartlett
2011-06-29s4-param Merge struct parm_struct with version from source3/Andrew Bartlett1-1/+1
2011-06-06s4-param Remove 'modules dir'Andrew Bartlett1-0/+7
The Samba waf build ensures that dyn_MODULESDIR is always correct (even for in-tree binaries), so we don't need to allow the user to configure this at run time. Andrew Bartlett
2011-06-06s4-param Remove 'sam database' parameterAndrew Bartlett1-0/+9
This now just relies on the private dir parameter, which remains. Andrew Bartlett
2011-04-29s4-param Rename private_path() -> lpcfg_private_path()Andrew Bartlett1-1/+1
This is consistent with lock_path() Andrew Bartlett
2011-03-22s4:python bindings - handle NULL returns from "loadparm_init_global"Matthias Dieter Wallnöfer1-0/+4
Reviewed-by: Jelmer Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date: Tue Mar 22 19:52:57 CET 2011 on sn-devel-104
2011-03-19source4/param: Fix prototypes for all functions.Jelmer Vernooij1-1/+3
2011-02-07s4-provision Remove setup_path, setup_dir and find_setup_dirAndrew Bartlett1-0/+8
We now have a reliable way to know the current location of the templates: dyn_SETUPDIR, which is updated for both the in-build and installed binaries. This replaces the function arguments and the distributed resolution of the setup directory with one 'global' function (imported as required). This also removes the ability to specify an alternate setup directory on the command line, as this was rarely if ever used and never tested. Andrew Bartlett
2010-12-08s4-param Allow +foo syntax in smb.conf list parsingAndrew Bartlett1-0/+1
The idea here is to allow an smb.conf file to work from the defaults, rather than override them. For example, 'server services = +openchange'. Pair-Programmed-With: Andrew Tridgell <tridge@samba.org> Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Dec 8 09:39:06 CET 2010 on sn-devel-104
2010-12-01pyparam: Use talloc.Object.Jelmer Vernooij1-2/+6