From c416ff851b4ecc7a44aee9d00d07dd481d8ae2a7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2001 20:15:12 +0000 Subject: Merge the become_XXX -> change_to_XXX fixes from 2.2.2 to HEAD. Ensure make_conection() can only be called as root. Jeremy. (This used to be commit 8d23a7441b4687458ee021bfe8880558506eddba) --- source3/printing/nt_printing.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index c61893e0fe..9b5f7379f5 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -944,7 +944,10 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in, /* connect to the print$ share under the same account as the user connected to the rpc pipe */ /* Null password is ok - we are already an authenticated user... */ *null_pw = '\0'; + + become_root(); conn = make_connection("print$", null_pw, 0, "A:", user->vuid, &nt_status); + unbecome_root(); if (conn == NULL) { DEBUG(0,("get_correct_cversion: Unable to connect\n")); @@ -952,13 +955,9 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in, return -1; } - /* Save who we are - we are temporarily becoming the connection user. */ - push_sec_ctx(); - if (!become_user(conn, conn->vuid)) { DEBUG(0,("get_correct_cversion: Can't become user!\n")); *perr = WERR_ACCESS_DENIED; - pop_sec_ctx(); return -1; } @@ -1017,16 +1016,16 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in, close_file(fsp, True); close_cnum(conn, user->vuid); - pop_sec_ctx(); + unbecome_user(); return cversion; + error_exit: - error_exit: if(fsp) close_file(fsp, True); close_cnum(conn, user->vuid); - pop_sec_ctx(); + unbecome_user(); return -1; } -- cgit