diff options
| -rw-r--r-- | source3/printing/nt_printing.c | 50 | ||||
| -rw-r--r-- | source3/rpc_server/srv_srvsvc_nt.c | 2 | 
2 files changed, 9 insertions, 43 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index b678f583d7..3c029775d0 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -926,14 +926,12 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in,  	int               cversion;  	int               access_mode;  	int               action; -	NTSTATUS          ecode; +	NTSTATUS          nt_status;  	pstring           driverpath; -	fstring           user_name;  	fstring           null_pw;  	files_struct      *fsp = NULL;  	BOOL              bad_path;  	SMB_STRUCT_STAT   st; -	struct passwd *pass;  	connection_struct *conn;  	ZERO_STRUCT(st); @@ -944,29 +942,14 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in,  		return 0;  	} -	become_root(); -	pass = sys_getpwuid(user->uid); -	if(pass == NULL) { -		DEBUG(0,("get_correct_cversion: Unable to get passwd entry for uid %u\n", -				(unsigned int)user->uid )); -		unbecome_root(); -		*perr = WERR_ACCESS_DENIED; -		return -1; -	} -	unbecome_root(); - -	/* connect to the print$ share under the same account as the user connected -	 * to the rpc pipe */	 -	fstrcpy(user_name, pass->pw_name ); -	DEBUG(10,("get_correct_cversion: uid %d -> user %s\n", (int)user->uid, user_name)); - +	/* 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'; -	conn = make_connection("print$", user_name, null_pw, 0, "A:", user->vuid, &ecode); +	conn = make_connection("print$", null_pw, 0, "A:", user->vuid, &nt_status);  	if (conn == NULL) {  		DEBUG(0,("get_correct_cversion: Unable to connect\n")); -		*perr = ntstatus_to_werror(ecode); +		*perr = ntstatus_to_werror(nt_status);  		return -1;  	} @@ -974,7 +957,7 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in,  	push_sec_ctx();  	if (!become_user(conn, conn->vuid)) { -		DEBUG(0,("get_correct_cversion: Can't become user %s\n", user_name )); +		DEBUG(0,("get_correct_cversion: Can't become user!\n"));  		*perr = WERR_ACCESS_DENIED;  		pop_sec_ctx();  		return -1; @@ -1249,11 +1232,9 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract,  	pstring new_dir;  	pstring old_name;  	pstring new_name; -	fstring user_name;  	fstring null_pw;  	connection_struct *conn; -	struct passwd *pass; -	NTSTATUS ecode; +	NTSTATUS nt_status;  	int ver = 0;  	int i; @@ -1271,27 +1252,14 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract,  	get_short_archi(architecture, driver->environment); -	become_root(); -	pass = sys_getpwuid(user->uid); -	if(pass == NULL) { -		DEBUG(0,("move_driver_to_download_area: Unable to get passwd entry for uid %u\n", -				(unsigned int)user->uid )); -		unbecome_root(); -		return False; -	} -	unbecome_root(); -  	/* connect to the print$ share under the same account as the user connected to the rpc pipe */	 -	fstrcpy(user_name, pass->pw_name ); -	DEBUG(10,("move_driver_to_download_area: uid %d -> user %s\n", (int)user->uid, user_name)); -  	/* Null password is ok - we are already an authenticated user... */  	*null_pw = '\0'; -	conn = make_connection("print$", user_name, null_pw, 0, "A:", user->vuid, &ecode); +	conn = make_connection("print$", null_pw, 0, "A:", user->vuid, &nt_status);  	if (conn == NULL) {  		DEBUG(0,("move_driver_to_download_area: Unable to connect\n")); -		*perr = ntstatus_to_werror(ecode); +		*perr = ntstatus_to_werror(nt_status);  		return False;  	} @@ -1302,7 +1270,7 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract,  	push_sec_ctx();  	if (!become_user(conn, conn->vuid)) { -		DEBUG(0,("move_driver_to_download_area: Can't become user %s\n", user_name )); +		DEBUG(0,("move_driver_to_download_area: Can't become user!\n"));  		pop_sec_ctx();  		return False;  	} diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 9f156a3d95..70c6579f38 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -1600,7 +1600,6 @@ NTSTATUS _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDE  	int action;  	NTSTATUS nt_status;  	struct current_user user; -	fstring user_name;  	connection_struct *conn = NULL;  	ZERO_STRUCT(st); @@ -1689,7 +1688,6 @@ NTSTATUS _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *  	int action;  	NTSTATUS nt_status;  	struct current_user user; -	fstring user_name;  	connection_struct *conn = NULL;  	BOOL became_user = False;  | 
