Fix bug #6564 - SetPrinter fails (panics) as non root. Missing become_root()/unbecome...
authorJeremy Allison <jra@samba.org>
Sat, 18 Jul 2009 00:33:28 +0000 (17:33 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 21 Jul 2009 06:03:33 +0000 (08:03 +0200)
source3/rpc_server/srv_spoolss_nt.c
source3/smbd/server.c

index 79f0f14ad1ad8575d27efc71a422b3a0d66b2a64..855aa30a990c7544e2a335c4b9ca52edfe5937df 100644 (file)
@@ -309,7 +309,9 @@ WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *sh
                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;
@@ -6031,7 +6033,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 a6689b89ebab16ea3b029120799814b275f860d5..2c5ce4008549c3494b9ae53f269e422bd73f2304 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);
 }