gpupdate: Deprecate libgpo.get_gpo_list
authorDavid Mulder <dmulder@samba.org>
Tue, 14 Mar 2023 18:37:54 +0000 (12:37 -0600)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 28 Apr 2023 02:15:36 +0000 (02:15 +0000)
This is no longer used by gpupdate.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15225

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libgpo/pygpo.c
python/samba/gp/__init__.py [new file with mode: 0644]
python/samba/tests/gpo.py
python/samba/tests/gpo_member.py

index 138097084a9d6cfbd922298ecb834b88823151e1..bf63a60522fc2ae8e434dada863c549add16b92c 100644 (file)
@@ -577,6 +577,11 @@ static PyObject *py_ads_get_gpo_list(ADS *self, PyObject *args, PyObject *kwds)
        size_t i;
 
        static const char *kwlist[] = {"samaccountname", NULL};
+
+       PyErr_WarnEx(PyExc_DeprecationWarning, "The get_gpo_list function"
+                               " is deprecated as of Samba 4.19. Please use "
+                               "the samba.gp module instead.", 2);
+
        if (!PyArg_ParseTupleAndKeywords(args, kwds, "s",
                                         discard_const_p(char *, kwlist),
                                         &samaccountname)) {
diff --git a/python/samba/gp/__init__.py b/python/samba/gp/__init__.py
new file mode 100644 (file)
index 0000000..af6e639
--- /dev/null
@@ -0,0 +1,17 @@
+# Unix SMB/CIFS implementation.
+# Copyright (C) David Mulder <dmulder@samba.org> 2023
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+from samba.gp.gpclass import get_gpo_list
index 580bf7450cb1d9b3d97201841ac6bc0368ea5453..b912d53c83cfc4471fc3f0fe46f27e63a118c7f2 100644 (file)
@@ -5062,12 +5062,6 @@ class GPOTests(tests.TestCase):
             self.assertEqual(gpos[i].ds_path, ds_paths[i],
                               'ds_path did not match expected %s' % gpos[i].ds_path)
 
-    def test_gpo_ads_does_not_segfault(self):
-        try:
-            ads = gpo.ADS_STRUCT(self.server, 42, self.creds)
-        except:
-            pass
-
     def test_gpt_version(self):
         global gpt_data
         local_path = self.lp.cache_path('gpo_cache')
index 642eb13a639961901c662aa58c66fafce8b277d9..0fc09e81b03dc41d3b12d158f4ea412241c462e6 100644 (file)
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import os
-from samba import gpo, tests
+from samba import tests
 from samba.gp.gpclass import GPOStorage
 from samba.param import LoadParm
 from samba.credentials import Credentials