summaryrefslogtreecommitdiff
path: root/source4/param/pyparam.c
AgeCommit message (Collapse)AuthorFilesLines
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
2010-11-29s4-loadparm: use loadparm_init_global() instead of loadparm_init()Andrew Tridgell1-1/+1
this prevents us having two lp_ctx contexts in these tools which leads to bizarre behaviour Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2010-11-22Avoid the use of PyAPI_DATA, which is for internal Python API's.Arnaud Faucher1-2/+2
Signed-off-by: Jelmer Vernooij <jelmer@samba.org> Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Mon Nov 22 00:52:56 CET 2010 on sn-devel-104
2010-07-16s4-loadparm: 2nd half of lp_ to lpcfg_ conversionAndrew Tridgell1-24/+24
this converts all callers that use the Samba4 loadparm lp_ calling convention to use the lpcfg_ prefix. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2010-06-20testparm: Check netbios name and workgroup characters and length.Jelmer Vernooij1-2/+2
2010-06-20pyparam: Support Loadparm.get(p, "global")Jelmer Vernooij1-52/+52
2010-06-20pyparam: Allow specifying None as section name to LoadparmContext.get()Jelmer Vernooij1-1/+1
to mean default section.
2010-06-20s4-python: Add LoadparmService.dump()Jelmer Vernooij1-0/+40
2010-06-20s4-python: Implement LoadParm.dump().Jelmer Vernooij1-0/+23
2010-03-29pytalloc: allow for using a system libtalloc-dev with pytallocAndrew Tridgell1-1/+1
When we have a system talloc library, we still need to grab pytalloc.h from lib/talloc. We don't want to just use -Ilib/talloc, as otherwise we'll get the in-tree talloc.h which may not be compatible with the system talloc.h So we need to give the path to pytalloc.h
2010-02-09s4:Remove "Py_RETURN_NONE" compatibility codeMatthias Dieter Wallnöfer1-4/+0
This was needed only by Python 2.3 which we no longer support.
2009-12-21Fix initialisation of TypeObject samba.param.LoadparmService.Jelmer Vernooij1-0/+3
Found by Ricardo Jorge <rvelhote@gmail.com>.
2009-10-23s4-python: we need to include Python.h firstAndrew Tridgell1-4/+1
If we don't include Python.h first then we get a pile of warnings due to broken redefines of XOPEN_SOURCE in the Python includes.
2009-08-04param/pyparam: Cope with string list parameters being empty.Ricardo Jorge1-1/+7
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
2009-08-04python/loadparm: Get shares listing working.Ricardo Jorge1-5/+6
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
2009-07-01use py_talloc_reference instead of py_talloc_importAndrew Tridgell1-1/+1
This is one of the few cases where we want the object to be owned by both the python object and C code
2009-06-17param/python: Fix memory leak of LoadParm objects.Jelmer Vernooij1-1/+12
2009-06-16python: Provide way to iterate over available shares.Jelmer Vernooij1-0/+16
2009-06-02Fix unresolved symbol in python messaging module.Jelmer Vernooij1-9/+0