Fix bug #6564 - SetPrinter fails (panics) as non root.
authorJeremy Allison <jra@samba.org>
Sat, 18 Jul 2009 00:36:26 +0000 (17:36 -0700)
committerJeremy Allison <jra@samba.org>
Sat, 18 Jul 2009 00:36:26 +0000 (17:36 -0700)
Missing become_root()/unbecome_root() around reload_services.
Jeremy.

source3/rpc_server/srv_spoolss_nt.c
source3/smbd/server.c

index 48ac1036670ec1330ac9c7287ac63c7ab7f3ec4a..9dc1a26e3b383e815ba8535c44b7910d390c04f0 100644 (file)
@@ -309,7 +309,9 @@ static WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const c
                return WERR_BADFID; /* What to return here? */
 
        /* go ahead and re-read the services immediately */
+       become_root();
        reload_services(false);
+       unbecome_root();
 
        if ( lp_servicenumber( sharename )  < 0 )
                return WERR_ACCESS_DENIED;
@@ -6034,7 +6036,9 @@ bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEV
        }
 
        /* reload our services immediately */
+       become_root();
        reload_services(false);
+       unbecome_root();
 
        numlines = 0;
        /* Get lines and convert them back to dos-codepage */
index a1dec0327c6ec6e73619e4c6f5bc5e41125300b3..4b1c803d759530db9e3bd47b42f5cf7d9fbb23d3 100644 (file)
@@ -94,6 +94,7 @@ static void smb_conf_updated(struct messaging_context *msg,
 {
        DEBUG(10,("smb_conf_updated: Got message saying smb.conf was "
                  "updated. Reloading.\n"));
+       change_to_root_user();
        reload_services(False);
 }