diff options
author | Günther Deschner <gd@samba.org> | 2010-04-29 13:27:58 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-04-29 13:47:33 +0200 |
commit | 9a313bbac02a808b3cd7c3d1308919f4acfac874 (patch) | |
tree | 320a203ff4f170c3f42c62f311ffac67c3a6e136 /source3/smbd | |
parent | 5e8db42d50809b7664bc7c477010b689918e62c8 (diff) | |
download | samba-9a313bbac02a808b3cd7c3d1308919f4acfac874.tar.gz samba-9a313bbac02a808b3cd7c3d1308919f4acfac874.tar.bz2 samba-9a313bbac02a808b3cd7c3d1308919f4acfac874.zip |
s3-lanman: fix api_DosPrintQGetInfo().
Found by torture test.
Guenther
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/lanman.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c index b44eb4031c..1a5d9e89f3 100644 --- a/source3/smbd/lanman.c +++ b/source3/smbd/lanman.c @@ -660,6 +660,20 @@ static void fill_printq_info_52(struct spoolss_DriverInfo3 *driver, } +static const char *strip_unc(const char *unc) +{ + char *p; + + if (unc == NULL) { + return NULL; + } + + if ((p = strrchr(unc, '\\')) != NULL) { + return p+1; + } + + return unc; +} static void fill_printq_info(int uLevel, struct pack_desc* desc, @@ -672,12 +686,12 @@ static void fill_printq_info(int uLevel, case 0: case 1: case 2: - PACKS(desc,"B13", printer_info->printername); + PACKS(desc,"B13", strip_unc(printer_info->printername)); break; case 3: case 4: case 5: - PACKS(desc,"z", printer_info->printername); + PACKS(desc,"z", strip_unc(printer_info->printername)); break; case 51: PACKI(desc,"K", printq_spoolss_status(printer_info->status)); @@ -691,7 +705,7 @@ static void fill_printq_info(int uLevel, PACKI(desc,"W",0); /* until time */ PACKS(desc,"z",""); /* pSepFile */ PACKS(desc,"z","lpd"); /* pPrProc */ - PACKS(desc,"z", printer_info->printername); /* pDestinations */ + PACKS(desc,"z", strip_unc(printer_info->printername)); /* pDestinations */ PACKS(desc,"z",""); /* pParms */ if (printer_info->printername == NULL) { PACKS(desc,"z","UNKNOWN PRINTER"); @@ -716,7 +730,7 @@ static void fill_printq_info(int uLevel, Win9X/ME printer comments. */ PACKI(desc,"W", printq_spoolss_status(printer_info->status)); /* fsStatus */ PACKI(desc,(uLevel == 3 ? "W" : "N"),count); /* cJobs */ - PACKS(desc,"z", printer_info->printername); /* pszPrinters */ + PACKS(desc,"z", strip_unc(printer_info->printername)); /* pszPrinters */ PACKS(desc,"z", printer_info->drivername); /* pszDriverName */ PackDriverData(desc); /* pDriverData */ } @@ -841,6 +855,16 @@ static bool api_DosPrintQGetInfo(connection_struct *conn, uint16 vuid, goto out; } + werr = rpccli_spoolss_getprinter(cli, mem_ctx, + &handle, + 2, + 0, + &printer_info); + if (!W_ERROR_IS_OK(werr)) { + desc.errcode = W_ERROR_V(werr); + goto out; + } + if (uLevel==52) { uint32_t server_major_version; uint32_t server_minor_version; |