summaryrefslogtreecommitdiff
path: root/source3/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
commitc416ff851b4ecc7a44aee9d00d07dd481d8ae2a7 (patch)
treea663818999f244e52704caab9906b7857edce355 /source3/printing
parent9a903a08a7c4f8407b4d6d0937f0bfda932d2ce3 (diff)
downloadsamba-c416ff851b4ecc7a44aee9d00d07dd481d8ae2a7.tar.gz
samba-c416ff851b4ecc7a44aee9d00d07dd481d8ae2a7.tar.bz2
samba-c416ff851b4ecc7a44aee9d00d07dd481d8ae2a7.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. (This used to be commit 8d23a7441b4687458ee021bfe8880558506eddba)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c13
1 files changed, 6 insertions, 7 deletions
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;
}