More cleanups.
authorTim Potter <tpot@samba.org>
Thu, 16 May 2002 04:00:31 +0000 (04:00 +0000)
committerTim Potter <tpot@samba.org>
Thu, 16 May 2002 04:00:31 +0000 (04:00 +0000)
 - removed dodgy fprintf() error handling

 - return an error string from open_pipe_creds() so the appropriate
   exception can be raised by the caller

 - reformatting

source/python/py_common.c
source/python/py_common_proto.h
source/python/py_lsa.c
source/python/py_samr.c
source/python/py_spoolss_drivers.c
source/python/py_spoolss_forms.c
source/python/py_spoolss_jobs.c
source/python/py_spoolss_ports.c
source/python/py_spoolss_printerdata.c
source/python/py_spoolss_printers.c
source/python/py_spoolss_proto.h

index d286ed68f05194bde61525d03e14611f06cef126..61eacced271ed9f972ab09036fe9d57cb95ce5a9 100644 (file)
@@ -95,8 +95,8 @@ PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw)
        char *logfilename = NULL;
        static char *kwlist[] = {"interactive", "logfilename", NULL};
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "|is", kwlist,
-                                        &interactive, &logfilename))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "|is", kwlist, &interactive, &logfilename))
                return NULL;
        
        if (interactive && logfilename) {
@@ -119,18 +119,19 @@ PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw)
 }
 
 /* Return a cli_state to a RPC pipe on the given server.  Use the
-   credentials passed if not NULL.  Set an exception and return NULL if
-   there was an error creating the connection. */
+   credentials passed if not NULL.  If an error occurs errstr is set to a
+   string describing the error and NULL is returned.  If set, errstr must
+   be freed by calling free(). */
 
-struct cli_state *open_pipe_creds(char *system_name, PyObject *creds, 
-                                 cli_pipe_fn *connect_fn)
+struct cli_state *open_pipe_creds(char *server, PyObject *creds, 
+                                 cli_pipe_fn *connect_fn, char **errstr)
 {
        struct ntuser_creds nt_creds;
        struct cli_state *cli;
        
        cli = (struct cli_state *)malloc(sizeof(struct cli_state));
        if (!cli) {
-               PyErr_SetString(PyExc_RuntimeError, "out of memory");
+               *errstr = strdup("out of memory");
                return NULL;
        }
 
@@ -156,13 +157,7 @@ struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
 
                if (!username_obj || !domain_obj || !password_obj) {
                creds_error:
-
-                       /* TODO: Either pass in the exception for the
-                          module calling open_pipe_creds() or have a
-                          global samba python module exception. */
-
-                       PyErr_SetString(PyExc_RuntimeError, 
-                                       "invalid credentials");
+                       *errstr = strdup("invalid credentials");
                        return NULL;
                }
 
@@ -193,24 +188,12 @@ struct cli_state *open_pipe_creds(char *system_name, PyObject *creds,
 
        /* Now try to connect */
 
-       if (!connect_fn(cli, system_name, &nt_creds)) {
-               if (cli) {
-                       NTSTATUS error = cli_nt_error(cli);
-
-                       /* Raise an exception if something went wrong.
-                          FIXME: This should be a more appropriate
-                          exception than PyExc_RuntimeError */
-
-                       if (!NT_STATUS_IS_OK(error))
-                               PyErr_SetObject(PyExc_RuntimeError,
-                                               py_ntstatus_tuple(error));
-                       else
-                               PyErr_SetString(PyExc_RuntimeError,
-                                               "error connecting to pipe");
-               }
-               
+       if (!connect_fn(cli, server, &nt_creds)) {
+               *errstr = strdup("error connecting to RPC pipe");
                return NULL;
        }
 
+       *errstr = NULL;
+
        return cli;
 }
index 98d970d7bcf6847a238a183c69871830100eb351..dd823dd4c0384e2488bcdf1aecbfddd055cf6d62 100644 (file)
@@ -12,8 +12,8 @@ void py_samba_init(void);
 PyObject *get_debuglevel(PyObject *self, PyObject *args);
 PyObject *set_debuglevel(PyObject *self, PyObject *args);
 PyObject *py_setup_logging(PyObject *self, PyObject *args, PyObject *kw);
-struct cli_state *open_pipe_creds(char *system_name, PyObject *creds, 
-                                 cli_pipe_fn *connect_fn);
+struct cli_state *open_pipe_creds(char *server, PyObject *creds, 
+                                 cli_pipe_fn *connect_fn, char **errstr);
 
 /* The following definitions come from python/py_ntsec.c  */
 
index cf96928790fa0ad1c7ea97f185ada3d7def5a6e2..82055181ccd5254bf45e74734fd3a4589f901839 100644 (file)
@@ -53,7 +53,7 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args,
                                PyObject *kw) 
 {
        static char *kwlist[] = { "servername", "creds", "access", NULL };
-       char *server_name;
+       char *server, *errstr;
        PyObject *creds = NULL, *result;
        uint32 desired_access = MAXIMUM_ALLOWED_ACCESS;
        struct cli_state *cli;
@@ -62,17 +62,20 @@ static PyObject *lsa_open_policy(PyObject *self, PyObject *args,
        POLICY_HND hnd;
 
        if (!PyArg_ParseTupleAndKeywords(
-               args, kw, "s|O!i", kwlist, &server_name, &PyDict_Type,
-               &creds, &desired_access))
+                   args, kw, "s|O!i", kwlist, &server, &PyDict_Type,
+                   &creds, &desired_access))
                return NULL;
 
-       if (!(cli = open_pipe_creds(server_name, creds, cli_lsa_initialise))) {
-               fprintf(stderr, "could not initialise cli state\n");
+       if (!(cli = open_pipe_creds(
+                     server, creds, cli_lsa_initialise, &errstr))) {
+               PyErr_SetString(lsa_error, errstr);
+               free(errstr);
                return NULL;
        }
 
        if (!(mem_ctx = talloc_init())) {
-               fprintf(stderr, "unable to initialise talloc context\n");
+               PyErr_SetString(
+                       lsa_error, "unable to initialise talloc context\n");
                return NULL;
        }
 
index 66d6266d104a08c4ba217624e37cbea7e66ff501..d0573171f3ba174bee14a0736e47c668f8eb9f11 100644 (file)
@@ -275,7 +275,7 @@ static PyObject *samr_connect(PyObject *self, PyObject *args, PyObject *kw)
 {
        static char *kwlist[] = { "server", "creds", "access", NULL };
        uint32 desired_access = MAXIMUM_ALLOWED_ACCESS;
-       char *server_name;
+       char *server, *errstr;
        struct cli_state *cli;
        POLICY_HND hnd;
        TALLOC_CTX *mem_ctx;
@@ -283,12 +283,16 @@ static PyObject *samr_connect(PyObject *self, PyObject *args, PyObject *kw)
        NTSTATUS ntstatus;
 
        if (!PyArg_ParseTupleAndKeywords(
-                   args, kw, "s|O!i", kwlist, &server_name, &PyDict_Type,
+                   args, kw, "s|O!i", kwlist, &server, &PyDict_Type,
                    &creds, &desired_access)) 
                return NULL;
 
-       if (!(cli = open_pipe_creds(server_name, creds, cli_samr_initialise)))
-               goto done;
+       if (!(cli = open_pipe_creds(
+                     server, creds, cli_lsa_initialise, &errstr))) {
+               PyErr_SetString(samr_error, errstr);
+               free(errstr);
+               return NULL;
+       }
 
        if (!(mem_ctx = talloc_init())) {
                PyErr_SetString(samr_ntstatus,
index 416d46f1d2d2d9dcc993bef002b4d9fce7d73d50..64d3a37afa20f4e80b7f092af5f50bb8a46ac4cf 100644 (file)
@@ -30,28 +30,30 @@ PyObject *spoolss_enumprinterdrivers(PyObject *self, PyObject *args,
        PRINTER_DRIVER_CTR ctr;
        int level = 1, i;
        uint32 needed, num_drivers;
-       char *arch = "Windows NT x86", *server_name;
+       char *arch = "Windows NT x86", *server, *errstr;
        static char *kwlist[] = {"server", "creds", "level", "arch", NULL};
        struct cli_state *cli = NULL;
        TALLOC_CTX *mem_ctx = NULL;
        
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "s|O!is", kwlist, 
-                                        &server_name, &PyDict_Type, &creds,
-                                        &level, &arch))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "s|O!is", kwlist, &server, &PyDict_Type,
+                   &creds, &level, &arch))
                return NULL;
        
        /* Call rpc function */
        
        if (!(cli = open_pipe_creds(
-                     server_name, creds, cli_spoolss_initialise))) {
-               fprintf(stderr, "could not initialise cli state\n");
+                     server, creds, cli_spoolss_initialise, &errstr))) {
+               PyErr_SetString(spoolss_error, errstr);
+               free(errstr);
                goto done;
        }
 
        if (!(mem_ctx = talloc_init())) {
-               fprintf(stderr, "unable to initialise talloc context\n");
+               PyErr_SetString(
+                       spoolss_error, "unable to initialise talloc context\n");
                goto done;
        }       
 
@@ -181,8 +183,8 @@ PyObject *spoolss_hnd_getprinterdriver(PyObject *self, PyObject *args,
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "|is", kwlist, 
-                                        &level, &arch))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "|is", kwlist, &level, &arch))
                return NULL;
 
        /* Call rpc function */
@@ -230,28 +232,30 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
        PyObject *result = Py_None, *creds = NULL;
        DRIVER_DIRECTORY_CTR ctr;
        uint32 needed, level;
-       char *arch = "Windows NT x86", *server_name;
+       char *arch = "Windows NT x86", *server, *errstr;
        static char *kwlist[] = {"server", "level", "arch", "creds", NULL};
        struct cli_state *cli = NULL;
        TALLOC_CTX *mem_ctx = NULL;
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "s|isO!", kwlist, 
-                                        &server_name, &level, &arch,
-                                        &PyDict_Type, &creds))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "s|isO!", kwlist, &server, &level,
+                   &arch, &PyDict_Type, &creds))
                return NULL;
 
        /* Call rpc function */
 
        if (!(cli = open_pipe_creds(
-                     server_name, creds, cli_spoolss_initialise))) {
-               fprintf(stderr, "could not initialise cli state\n");
+                     server, creds, cli_spoolss_initialise, &errstr))) {
+               PyErr_SetString(spoolss_error, errstr);
+               free(errstr);
                goto done;
        }
        
        if (!(mem_ctx = talloc_init())) {
-               fprintf(stderr, "unable to initialise talloc context\n");
+               PyErr_SetString(
+                       spoolss_error, "unable to initialise talloc context\n");
                goto done;
        }       
 
@@ -290,7 +294,7 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
                                   PyObject *kw)
 {
        static char *kwlist[] = { "server", "info", "creds", NULL };
-       char *server;
+       char *server, *errstr;
        uint32 level;
        PyObject *info, *result = NULL, *creds = NULL, *level_obj;
        WERROR werror;
@@ -309,10 +313,18 @@ PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
        if (server[0] == '\\' && server[1] == '\\')
                server += 2;
 
-       mem_ctx = talloc_init();
+       if (!(mem_ctx = talloc_init())) {
+               PyErr_SetString(
+                       spoolss_error, "unable to initialise talloc context\n");
+               return NULL;
+       }
 
-       if (!(cli = open_pipe_creds(server, creds, cli_spoolss_initialise)))
+       if (!(cli = open_pipe_creds(
+                     server, creds, cli_spoolss_initialise, &errstr))) {
+               PyErr_SetString(spoolss_error, errstr);
+               free(errstr);
                goto done;
+       }
 
        if ((level_obj = PyDict_GetItemString(info, "level"))) {
 
index 83cdf9badd6b202372cb13dbd8c940e9e5a3d5b0..762b13f73be6afe02fa5f91ef4fc08051b70c9b3 100644 (file)
@@ -84,8 +84,8 @@ PyObject *spoolss_hnd_getform(PyObject *self, PyObject *args, PyObject *kw)
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "s|i", kwlist, 
-                                        &form_name, &level))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "s|i", kwlist, &form_name, &level))
                return NULL;
        
        /* Call rpc function */
@@ -129,8 +129,9 @@ PyObject *spoolss_hnd_setform(PyObject *self, PyObject *args, PyObject *kw)
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "O!|i", kwlist, 
-                                        &PyDict_Type, &py_form, &level))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "O!|i", kwlist, &PyDict_Type, &py_form,
+                   &level))
                return NULL;
        
        /* Call rpc function */
index d98fdba13760544d492fb3c9754a5d1475e16137..29475f9e3bff4b2c99cf771242f3a57e93bd57dd 100644 (file)
@@ -96,8 +96,8 @@ PyObject *spoolss_hnd_setjob(PyObject *self, PyObject *args, PyObject *kw)
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "ii|i", kwlist, &jobid,
-                                        &command, &level))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "ii|i", kwlist, &jobid, &command, &level))
                return NULL;
        
        /* Call rpc function */
@@ -127,8 +127,8 @@ PyObject *spoolss_hnd_getjob(PyObject *self, PyObject *args, PyObject *kw)
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "i|i", kwlist, &jobid,
-                                        &level))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "i|i", kwlist, &jobid, &level))
                return NULL;
        
        /* Call rpc function */
@@ -228,8 +228,8 @@ PyObject *spoolss_hnd_startdocprinter(PyObject *self, PyObject *args, PyObject *
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "O!", kwlist,
-               &PyDict_Type, &doc_info))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "O!", kwlist, &PyDict_Type, &doc_info))
                return NULL;
        
        /* Check document_info parameter */
@@ -362,8 +362,8 @@ PyObject *spoolss_hnd_writeprinter(PyObject *self, PyObject *args, PyObject *kw)
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "O!", kwlist,
-                                        &PyString_Type, &data))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "O!", kwlist, &PyString_Type, &data))
                return NULL;
        
        /* Call rpc function */
index 8e74017f4a71d40c8968c0021c13278545f5374d..fb3f47c746a0236dd110d9e1ad355ae634016082 100644 (file)
@@ -31,21 +31,31 @@ PyObject *spoolss_enumports(PyObject *self, PyObject *args, PyObject *kw)
        static char *kwlist[] = {"server", "level", "creds", NULL};
        TALLOC_CTX *mem_ctx = NULL;
        struct cli_state *cli = NULL;
-       char *server;
+       char *server, *errstr;
        PORT_INFO_CTR ctr;
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "s|iO!", kwlist, 
-                                        &server, &creds, &level, 
-                                        &PyDict_Type))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "s|iO!", kwlist, &server, &creds, &level,
+                   &PyDict_Type))
                return NULL;
        
        if (server[0] == '\\' && server[1] == '\\')
                server += 2;
 
-       mem_ctx = talloc_init();
-       cli = open_pipe_creds(server, creds, cli_spoolss_initialise);
+       if (!(cli = open_pipe_creds(
+                     server, creds, cli_spoolss_initialise, &errstr))) {
+               PyErr_SetString(spoolss_error, errstr);
+               free(errstr);
+               return NULL;
+       }
+
+       if (!(mem_ctx = talloc_init())) {
+               PyErr_SetString(
+                       spoolss_error, "unable to initialise talloc context\n");
+               return NULL;
+       }
 
        /* Call rpc function */
        
index 24e2340059b2cea6c11855821527ba5b4ee6388f..e1e43fa7366f3ea4ad889812082218c7d81e3255 100644 (file)
@@ -100,7 +100,7 @@ PyObject *spoolss_hnd_getprinterdata(PyObject *self, PyObject *args, PyObject *k
        /* Parse parameters */
 
        if (!PyArg_ParseTupleAndKeywords(args, kw, "s", kwlist, &value))
-           return NULL;
+               return NULL;
 
        /* Call rpc function */
 
@@ -132,8 +132,8 @@ PyObject *spoolss_hnd_setprinterdata(PyObject *self, PyObject *args, PyObject *k
        uint32 data_size, data_type;
        WERROR werror;
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "O!", kwlist,
-                                        &PyDict_Type, &py_data))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "O!", kwlist, &PyDict_Type, &py_data))
                return NULL;
        
        if (!py_to_printerdata(&value, &data_type, &data, &data_size, py_data))
@@ -209,7 +209,7 @@ PyObject *spoolss_hnd_deleteprinterdata(PyObject *self, PyObject *args, PyObject
        /* Parse parameters */
 
        if (!PyArg_ParseTupleAndKeywords(args, kw, "s", kwlist, &value))
-           return NULL;
+               return NULL;
 
        /* Call rpc function */
 
index 36ba22a7c479719e38bad431ba3e3fcef69d1b11..7ee94a48f79e2595a068564c33d46cdc42f0c687 100644 (file)
@@ -24,7 +24,7 @@
 
 PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
 {
-       char *full_name, *computer_name = NULL;
+       char *unc_name, *server = NULL, *errstr;
        TALLOC_CTX *mem_ctx;
        POLICY_HND hnd;
        WERROR werror;
@@ -34,25 +34,26 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
        struct cli_state *cli;
 
        if (!PyArg_ParseTupleAndKeywords(
-               args, kw, "s|O!i", kwlist, &full_name, &PyDict_Type, &creds,
-               &desired_access)) {
-
+                   args, kw, "s|O!i", kwlist, &unc_name, &PyDict_Type, &creds,
+                   &desired_access))
                goto done;
-       }
 
        /* FIXME: Return name format exception for names without a UNC
           prefix */ 
 
-       computer_name = strdup(full_name + 2);
+       server = strdup(unc_name + 2);
 
-       if (strchr(computer_name, '\\')) {
-               char *c = strchr(computer_name, '\\');
+       if (strchr(server, '\\')) {
+               char *c = strchr(server, '\\');
                *c = 0;
        }
 
        if (!(cli = open_pipe_creds(
-                     computer_name, creds, cli_spoolss_initialise)))
+                     server, creds, cli_spoolss_initialise, &errstr))) {
+               PyErr_SetString(spoolss_error, errstr);
+               free(errstr);
                goto done;
+       }
 
        if (!(mem_ctx = talloc_init())) {
                PyErr_SetString(spoolss_error, 
@@ -61,7 +62,7 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
        }
 
        werror = cli_spoolss_open_printer_ex(
-               cli, mem_ctx, full_name, "", desired_access, computer_name
+               cli, mem_ctx, unc_name, "", desired_access, server
                "", &hnd);
 
        if (!W_ERROR_IS_OK(werror)) {
@@ -74,7 +75,7 @@ PyObject *spoolss_openprinter(PyObject *self, PyObject *args, PyObject *kw)
        result = new_spoolss_policy_hnd_object(cli, mem_ctx, &hnd);
 
  done:
-       SAFE_FREE(computer_name);
+       SAFE_FREE(server);
 
        return result;
 }
@@ -187,8 +188,8 @@ PyObject *spoolss_hnd_setprinter(PyObject *self, PyObject *args, PyObject *kw)
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "O!", kwlist, 
-                                        &PyDict_Type, &info))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "O!", kwlist, &PyDict_Type, &info))
                return NULL;
        
        /* Check dictionary contains a level */
@@ -277,20 +278,30 @@ PyObject *spoolss_enumprinters(PyObject *self, PyObject *args, PyObject *kw)
                                 "creds", NULL};
        TALLOC_CTX *mem_ctx;
        struct cli_state *cli;
-       char *server, *name = NULL;
+       char *server, *errstr;
 
        /* Parse parameters */
 
-       if (!PyArg_ParseTupleAndKeywords(args, kw, "s|siiO!", kwlist, 
-                                        &server, &name, &level, &flags, 
-                                        &PyDict_Type, &creds))
+       if (!PyArg_ParseTupleAndKeywords(
+                   args, kw, "s|iiO!", kwlist, &server, &level, &flags, 
+                   &PyDict_Type, &creds))
                return NULL;
        
        if (server[0] == '\\' && server[1] == '\\')
                server += 2;
 
-       mem_ctx = talloc_init();
-       cli = open_pipe_creds(server, creds, cli_spoolss_initialise);
+       if (!(cli = open_pipe_creds(
+                     server, creds, cli_spoolss_initialise, &errstr))) {
+               PyErr_SetString(spoolss_error, errstr);
+               free(errstr);
+               return NULL;
+       }
+
+       if (!(mem_ctx = talloc_init())) {
+               PyErr_SetString(
+                       spoolss_error, "unable to initialise talloc context\n");
+               return NULL;
+       }
 
        /* Call rpc function */
        
@@ -369,7 +380,7 @@ PyObject *spoolss_addprinterex(PyObject *self, PyObject *args, PyObject *kw)
 {
        static char *kwlist[] = { "server", "printername", "info", "creds", 
                                  NULL};
-       char *printername, *server;
+       char *printername, *server, *errstr;
        PyObject *info, *result = NULL, *creds = NULL;
        struct cli_state *cli = NULL;
        TALLOC_CTX *mem_ctx = NULL;
@@ -383,13 +394,17 @@ PyObject *spoolss_addprinterex(PyObject *self, PyObject *args, PyObject *kw)
                return NULL;
 
        if (!(cli = open_pipe_creds(
-                     server, creds, cli_spoolss_initialise)))
+                     server, creds, cli_spoolss_initialise, &errstr))) {
+               PyErr_SetString(spoolss_error, errstr);
+               free(errstr);
                goto done;
+       }
 
-       mem_ctx = talloc_init();
-
-       if (!(cli = open_pipe_creds(server, creds, cli_spoolss_initialise)))
-               goto done;
+       if (!(mem_ctx = talloc_init())) {
+               PyErr_SetString(
+                       spoolss_error, "unable to initialise talloc context\n");
+               return NULL;
+       }
 
        if (!py_to_PRINTER_INFO_2(&info2, info, mem_ctx)) {
                PyErr_SetString(spoolss_error,
index b197003c79ef0b4ce6f58c8b8bdc7d41773ce6ee..5b68ef815af8779cd914c6cd79106cc0f520b632 100644 (file)
@@ -21,7 +21,7 @@ PyObject *spoolss_getprinterdriverdir(PyObject *self, PyObject *args,
 PyObject *spoolss_addprinterdriver(PyObject *self, PyObject *args,
                                   PyObject *kw);
 PyObject *spoolss_addprinterdriverex(PyObject *self, PyObject *args,
-                                    PyObject *kw);
+                                            PyObject *kw);
 PyObject *spoolss_deleteprinterdriver(PyObject *self, PyObject *args,
                                      PyObject *kw);
 PyObject *spoolss_deleteprinterdriverex(PyObject *self, PyObject *args,