summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-08-30 21:09:21 +0000
committerJeremy Allison <jra@samba.org>2000-08-30 21:09:21 +0000
commitc77bf3d9e2ef416050bd2a25576f8fa584107fb5 (patch)
tree5c8ee4b03ff434f339b332f32ce3670caea0033e /source3/printing
parent177b962dfe4c6215424ff2a2e69a4da3cecb3687 (diff)
downloadsamba-c77bf3d9e2ef416050bd2a25576f8fa584107fb5.tar.gz
samba-c77bf3d9e2ef416050bd2a25576f8fa584107fb5.tar.bz2
samba-c77bf3d9e2ef416050bd2a25576f8fa584107fb5.zip
Fixed error returns for moving printer driver files around so generic
"Access denied" isn't always returned. More fixes found using Gerald's wonderful Win32 test progs :-). Jeremy. (This used to be commit 67b9d40e3df19523714430cb4457717575f2a61e)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 7fe21dc7e7..1dfced705b 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -383,7 +383,7 @@ void clean_up_driver_struct(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, uint32
/****************************************************************************
****************************************************************************/
-BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, uint32 level, struct current_user *user)
+BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, uint32 level, struct current_user *user, uint32 *perr)
{
NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver;
fstring architecture;
@@ -400,31 +400,36 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract,
int outsize = 0;
int i;
+ *perr = 0;
+ memset(inbuf, '\0', sizeof(inbuf));
+ memset(outbuf, '\0', sizeof(outbuf));
+
if (level==3)
driver=driver_abstract.info_3;
get_short_archi(architecture, driver->environment);
- /* connect to the print$ share under the same account as the user connected to the rpc pipe */
- fstrcpy(user_name, uidtoname(user->uid));
- DEBUG(10,("move_driver_to_download_area: uid %d -> user %s\n", (int)user->uid, user_name));
-
become_root();
- smb_pass = getsmbpwnam(user_name);
+ smb_pass = getsmbpwuid(user->uid);
if(smb_pass == NULL) {
- DEBUG(0,("move_driver_to_download_area: Unable to get smbpasswd entry for user %s\n",
- user_name ));
+ DEBUG(0,("move_driver_to_download_area: Unable to get smbpasswd 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, smb_pass->smb_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);
if (conn == NULL) {
DEBUG(0,("move_driver_to_download_area: Unable to connect\n"));
+ *perr = (uint32)ecode;
return False;
}
@@ -468,6 +473,7 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract,
old_name, new_name ));
close_cnum(conn, user->vuid);
pop_sec_ctx();
+ *perr = (uint32)SVAL(outbuf,smb_err);
return False;
}
@@ -479,6 +485,7 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract,
old_name, new_name ));
close_cnum(conn, user->vuid);
pop_sec_ctx();
+ *perr = (uint32)SVAL(outbuf,smb_err);
return False;
}
}
@@ -492,6 +499,7 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract,
old_name, new_name ));
close_cnum(conn, user->vuid);
pop_sec_ctx();
+ *perr = (uint32)SVAL(outbuf,smb_err);
return False;
}
}
@@ -506,6 +514,7 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract,
old_name, new_name ));
close_cnum(conn, user->vuid);
pop_sec_ctx();
+ *perr = (uint32)SVAL(outbuf,smb_err);
return False;
}
}
@@ -530,6 +539,7 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract,
old_name, new_name ));
close_cnum(conn, user->vuid);
pop_sec_ctx();
+ *perr = (uint32)SVAL(outbuf,smb_err);
return False;
}
}