diff options
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/nt_printing.c | 21 | ||||
-rw-r--r-- | source3/printing/printing.c | 5 |
2 files changed, 19 insertions, 7 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 3712cfbb14..18652d8c92 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -640,7 +640,7 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, connection_struct *conn; pstring inbuf; pstring outbuf; - struct smb_passwd *smb_pass; + struct passwd *pass; int ecode; int outsize = 0; int i; @@ -662,9 +662,9 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, get_short_archi(architecture, driver->environment); become_root(); - smb_pass = getsmbpwuid(user->uid); - if(smb_pass == NULL) { - DEBUG(0,("move_driver_to_download_area: Unable to get smbpasswd entry for uid %u\n", + pass = 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; @@ -672,7 +672,7 @@ BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, 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 ); + 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... */ @@ -1714,6 +1714,7 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen NT_PRINTER_INFO_LEVEL_2 info; int len = 0; TDB_DATA kbuf, dbuf; + fstring printername; ZERO_STRUCT(info); @@ -1753,6 +1754,12 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen /* Samba has to have shared raw drivers. */ info.attributes |= (PRINTER_ATTRIBUTE_SHARED|PRINTER_ATTRIBUTE_RAW_ONLY); + /* Restore the stripped strings. */ + slprintf(info.servername, sizeof(info.servername), "\\\\%s", global_myname); + slprintf(printername, sizeof(printername), "\\\\%s\\%s", global_myname, + info.printername); + fstrcpy(info.printername, printername); + len += unpack_devicemode(&info.devmode,dbuf.dptr+len, dbuf.dsize-len); len += unpack_specifics(&info.specific,dbuf.dptr+len, dbuf.dsize-len); @@ -1761,8 +1768,8 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen safe_free(dbuf.dptr); *info_ptr=memdup(&info, sizeof(info)); - DEBUG(9,("Unpacked printer [%s] running driver [%s]\n", - sharename, info.drivername)); + DEBUG(9,("Unpacked printer [%s] name [%s] running driver [%s]\n", + sharename, info.printername, info.drivername)); return 0; diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 9fa4b9b8c6..77e32d5bf0 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1003,6 +1003,8 @@ int print_queue_status(int snum, /* make sure the database is up to date */ if (print_cache_expired(snum)) print_queue_update(snum); + + *queue = NULL; /* * Count the number of entries. @@ -1011,6 +1013,9 @@ int print_queue_status(int snum, tsc.snum = snum; tdb_traverse(tdb, traverse_count_fn_queue, (void *)&tsc); + if (tsc.count == 0) + return 0; + /* Allocate the queue size. */ if (( tstruct.queue = (print_queue_struct *)malloc(sizeof(print_queue_struct)*tsc.count)) == NULL) |