prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  SafeConfigParser was removed in 3.12
  ### Describe the bug
  
  From https://docs.python.org/3.12/whatsnew/3.12.html:
  
  Several names deprecated in the configparser way back in 3.2 have been removed per gh-89336:
  - configparser.ParsingError no longer has a filename attribute or argument. Use the source attribute and argument instead.
  - configparser no longer has a SafeConfigParser class. Use the shorter ConfigParser name instead.
  - configparser.ConfigParser no longer has a readfp method. Use read_file() instead.
  
  
  <!--- HINT: You can paste gist.github.com links for long logs or larger files -->
  
  ### Steps to reproduce
  
  1. systemctl start cobblerd
  
  ### Expected behavior
  
  <!--- A clear and concise description of what you expected to happen. -->
  
  ### Cobbler version
  
  <!--- Paste output from `cobbler version` -->
  ````paste below
  Cobbler 3.4.0
  ````
  
  ### Operating system
  
  Fedora 39
  
  ### Cobbler log
  
  <!--- Paste (partial) output from `/var/log/cobbler/cobbler.log` -->
  ````paste below
  cobblerd[1614]: INFO | Exception raised when loading module authorization.configfile
  cobblerd[1614]: INFO | Exception occurred: <class 'ImportError'>
  cobblerd[1614]: INFO | Exception value: cannot import name 'SafeConfigParser' from 'configparser' (/usr/lib64/python3.12/configparser.py)
  ````
  
  ### Screenshots
  
  <!--- If applicable, add screenshots to help explain your problem. -->
  
  ### Additional information
  
  <!--- Add any other context about the problem here. -->
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `cobbler/modules/authorization/configfile.py`
  Content:
  ```
  1 """
  2 Authorization module that allow users listed in
  3 /etc/cobbler/users.conf to be permitted to access resources.
  4 For instance, when using authz_ldap, you want to use authn_configfile,
  5 not authz_allowall, which will most likely NOT do what you want.
  6 """
  7 # SPDX-License-Identifier: GPL-2.0-or-later
  8 # SPDX-FileCopyrightText: Copyright 2007-2009, Red Hat, Inc and Others
  9 # SPDX-FileCopyrightText: Michael DeHaan <michael.dehaan AT gmail>
  10 
  11 
  12 import os
  13 from configparser import SafeConfigParser
  14 from typing import TYPE_CHECKING, Any, Dict
  15 
  16 if TYPE_CHECKING:
  17     from cobbler.api import CobblerAPI
  18 
  19 
  20 CONFIG_FILE = "/etc/cobbler/users.conf"
  21 
  22 
  23 def register() -> str:
  24     """
  25     The mandatory Cobbler module registration hook.
  26 
  27     :return: Always "authz".
  28     """
  29     return "authz"
  30 
  31 
  32 def __parse_config() -> Dict[str, Dict[Any, Any]]:
  33     """
  34     Parse the the users.conf file.
  35 
  36     :return: The data of the config file.
  37     """
  38     if not os.path.exists(CONFIG_FILE):
  39         return {}
  40     config = SafeConfigParser()
  41     config.read(CONFIG_FILE)
  42     alldata: Dict[str, Dict[str, Any]] = {}
  43     groups = config.sections()
  44     for group in groups:
  45         alldata[str(group)] = {}
  46         options = config.options(group)
  47         for option in options:
  48             alldata[group][option] = 1
  49     return alldata
  50 
  51 
  52 def authorize(
  53     api_handle: "CobblerAPI",
  54     user: str,
  55     resource: str,
  56     arg1: Any = None,
  57     arg2: Any = None,
  58 ) -> int:
  59     """
  60     Validate a user against a resource. All users in the file are permitted by this module.
  61 
  62     :param api_handle: This parameter is not used currently.
  63     :param user: The user to authorize.
  64     :param resource: This parameter is not used currently.
  65     :param arg1: This parameter is not used currently.
  66     :param arg2: This parameter is not used currently.
  67     :return: "0" if no authorized, "1" if authorized.
  68     """
  69     # FIXME: this must be modified to use the new ACL engine
  70 
  71     data = __parse_config()
  72     for _, group_data in data.items():
  73         if user.lower() in group_data:
  74             return 1
  75     return 0
  76
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/cobbler/modules/authorization/configfile.py b/cobbler/modules/authorization/configfile.py
  --- a/cobbler/modules/authorization/configfile.py
  +++ b/cobbler/modules/authorization/configfile.py
  @@ -10,7 +10,7 @@
   
   
   import os
  -from configparser import SafeConfigParser
  +from configparser import ConfigParser
   from typing import TYPE_CHECKING, Any, Dict
   
   if TYPE_CHECKING:
  @@ -37,7 +37,7 @@
       """
       if not os.path.exists(CONFIG_FILE):
           return {}
  -    config = SafeConfigParser()
  +    config = ConfigParser()
       config.read(CONFIG_FILE)
       alldata: Dict[str, Dict[str, Any]] = {}
       groups = config.sections()
  
verification_info: {"golden_diff": "diff --git a/cobbler/modules/authorization/configfile.py b/cobbler/modules/authorization/configfile.py\n--- a/cobbler/modules/authorization/configfile.py\n+++ b/cobbler/modules/authorization/configfile.py\n@@ -10,7 +10,7 @@\n \n \n import os\n-from configparser import SafeConfigParser\n+from configparser import ConfigParser\n from typing import TYPE_CHECKING, Any, Dict\n \n if TYPE_CHECKING:\n@@ -37,7 +37,7 @@\n     \"\"\"\n     if not os.path.exists(CONFIG_FILE):\n         return {}\n-    config = SafeConfigParser()\n+    config = ConfigParser()\n     config.read(CONFIG_FILE)\n     alldata: Dict[str, Dict[str, Any]] = {}\n     groups = config.sections()\n", "issue": "SafeConfigParser was removed in 3.12\n### Describe the bug\r\n\r\nFrom https://docs.python.org/3.12/whatsnew/3.12.html:\r\n\r\nSeveral names deprecated in the configparser way back in 3.2 have been removed per gh-89336:\r\n- configparser.ParsingError no longer has a filename attribute or argument. Use the source attribute and argument instead.\r\n- configparser no longer has a SafeConfigParser class. Use the shorter ConfigParser name instead.\r\n- configparser.ConfigParser no longer has a readfp method. Use read_file() instead.\r\n\r\n\r\n<!--- HINT: You can paste gist.github.com links for long logs or larger files -->\r\n\r\n### Steps to reproduce\r\n\r\n1. systemctl start cobblerd\r\n\r\n### Expected behavior\r\n\r\n<!--- A clear and concise description of what you expected to happen. -->\r\n\r\n### Cobbler version\r\n\r\n<!--- Paste output from `cobbler version` -->\r\n````paste below\r\nCobbler 3.4.0\r\n````\r\n\r\n### Operating system\r\n\r\nFedora 39\r\n\r\n### Cobbler log\r\n\r\n<!--- Paste (partial) output from `/var/log/cobbler/cobbler.log` -->\r\n````paste below\r\ncobblerd[1614]: INFO | Exception raised when loading module authorization.configfile\r\ncobblerd[1614]: INFO | Exception occurred: <class 'ImportError'>\r\ncobblerd[1614]: INFO | Exception value: cannot import name 'SafeConfigParser' from 'configparser' (/usr/lib64/python3.12/configparser.py)\r\n````\r\n\r\n### Screenshots\r\n\r\n<!--- If applicable, add screenshots to help explain your problem. -->\r\n\r\n### Additional information\r\n\r\n<!--- Add any other context about the problem here. -->\r\n\n", "before_files": [{"content": "\"\"\"\nAuthorization module that allow users listed in\n/etc/cobbler/users.conf to be permitted to access resources.\nFor instance, when using authz_ldap, you want to use authn_configfile,\nnot authz_allowall, which will most likely NOT do what you want.\n\"\"\"\n# SPDX-License-Identifier: GPL-2.0-or-later\n# SPDX-FileCopyrightText: Copyright 2007-2009, Red Hat, Inc and Others\n# SPDX-FileCopyrightText: Michael DeHaan <michael.dehaan AT gmail>\n\n\nimport os\nfrom configparser import SafeConfigParser\nfrom typing import TYPE_CHECKING, Any, Dict\n\nif TYPE_CHECKING:\n    from cobbler.api import CobblerAPI\n\n\nCONFIG_FILE = \"/etc/cobbler/users.conf\"\n\n\ndef register() -> str:\n    \"\"\"\n    The mandatory Cobbler module registration hook.\n\n    :return: Always \"authz\".\n    \"\"\"\n    return \"authz\"\n\n\ndef __parse_config() -> Dict[str, Dict[Any, Any]]:\n    \"\"\"\n    Parse the the users.conf file.\n\n    :return: The data of the config file.\n    \"\"\"\n    if not os.path.exists(CONFIG_FILE):\n        return {}\n    config = SafeConfigParser()\n    config.read(CONFIG_FILE)\n    alldata: Dict[str, Dict[str, Any]] = {}\n    groups = config.sections()\n    for group in groups:\n        alldata[str(group)] = {}\n        options = config.options(group)\n        for option in options:\n            alldata[group][option] = 1\n    return alldata\n\n\ndef authorize(\n    api_handle: \"CobblerAPI\",\n    user: str,\n    resource: str,\n    arg1: Any = None,\n    arg2: Any = None,\n) -> int:\n    \"\"\"\n    Validate a user against a resource. All users in the file are permitted by this module.\n\n    :param api_handle: This parameter is not used currently.\n    :param user: The user to authorize.\n    :param resource: This parameter is not used currently.\n    :param arg1: This parameter is not used currently.\n    :param arg2: This parameter is not used currently.\n    :return: \"0\" if no authorized, \"1\" if authorized.\n    \"\"\"\n    # FIXME: this must be modified to use the new ACL engine\n\n    data = __parse_config()\n    for _, group_data in data.items():\n        if user.lower() in group_data:\n            return 1\n    return 0\n", "path": "cobbler/modules/authorization/configfile.py"}], "after_files": [{"content": "\"\"\"\nAuthorization module that allow users listed in\n/etc/cobbler/users.conf to be permitted to access resources.\nFor instance, when using authz_ldap, you want to use authn_configfile,\nnot authz_allowall, which will most likely NOT do what you want.\n\"\"\"\n# SPDX-License-Identifier: GPL-2.0-or-later\n# SPDX-FileCopyrightText: Copyright 2007-2009, Red Hat, Inc and Others\n# SPDX-FileCopyrightText: Michael DeHaan <michael.dehaan AT gmail>\n\n\nimport os\nfrom configparser import ConfigParser\nfrom typing import TYPE_CHECKING, Any, Dict\n\nif TYPE_CHECKING:\n    from cobbler.api import CobblerAPI\n\n\nCONFIG_FILE = \"/etc/cobbler/users.conf\"\n\n\ndef register() -> str:\n    \"\"\"\n    The mandatory Cobbler module registration hook.\n\n    :return: Always \"authz\".\n    \"\"\"\n    return \"authz\"\n\n\ndef __parse_config() -> Dict[str, Dict[Any, Any]]:\n    \"\"\"\n    Parse the the users.conf file.\n\n    :return: The data of the config file.\n    \"\"\"\n    if not os.path.exists(CONFIG_FILE):\n        return {}\n    config = ConfigParser()\n    config.read(CONFIG_FILE)\n    alldata: Dict[str, Dict[str, Any]] = {}\n    groups = config.sections()\n    for group in groups:\n        alldata[str(group)] = {}\n        options = config.options(group)\n        for option in options:\n            alldata[group][option] = 1\n    return alldata\n\n\ndef authorize(\n    api_handle: \"CobblerAPI\",\n    user: str,\n    resource: str,\n    arg1: Any = None,\n    arg2: Any = None,\n) -> int:\n    \"\"\"\n    Validate a user against a resource. All users in the file are permitted by this module.\n\n    :param api_handle: This parameter is not used currently.\n    :param user: The user to authorize.\n    :param resource: This parameter is not used currently.\n    :param arg1: This parameter is not used currently.\n    :param arg2: This parameter is not used currently.\n    :return: \"0\" if no authorized, \"1\" if authorized.\n    \"\"\"\n    # FIXME: this must be modified to use the new ACL engine\n\n    data = __parse_config()\n    for _, group_data in data.items():\n        if user.lower() in group_data:\n            return 1\n    return 0\n", "path": "cobbler/modules/authorization/configfile.py"}]}