summaryrefslogtreecommitdiffstats
path: root/source/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-10-18 20:15:12 +0000
committerJeremy Allison <jra@samba.org>2001-10-18 20:15:12 +0000
commit8d23a7441b4687458ee021bfe8880558506eddba (patch)
treea1d58b46bde8898a9c04cce7fe931fdc9b8f2aff /source/printing
parentd8262286ddb6105a9d3b0730912447ea2401a3fb (diff)
downloadsamba-8d23a7441b4687458ee021bfe8880558506eddba.tar.gz
samba-8d23a7441b4687458ee021bfe8880558506eddba.tar.xz
samba-8d23a7441b4687458ee021bfe8880558506eddba.zip
Merge the become_XXX -> change_to_XXX fixes from 2.2.2 to HEAD.
Ensure make_conection() can only be called as root. Jeremy.
Diffstat (limited to 'source/printing')
-rw-r--r--source/printing/nt_printing.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c
index c61893e0feb..9b5f7379f54 100644
--- a/source/printing/nt_printing.c
+++ b/source/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;
}