diff options
-rw-r--r-- | source3/rpc_server/srv_spoolss_util.c | 26 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_util.h | 4 |
2 files changed, 24 insertions, 6 deletions
diff --git a/source3/rpc_server/srv_spoolss_util.c b/source3/rpc_server/srv_spoolss_util.c index b70090f44b..f04e5dec97 100644 --- a/source3/rpc_server/srv_spoolss_util.c +++ b/source3/rpc_server/srv_spoolss_util.c @@ -1362,6 +1362,7 @@ static WERROR winreg_printer_ver_to_dword(const char *str, uint64_t *data) WERROR winreg_create_printer(TALLOC_CTX *mem_ctx, struct auth_serversupplied_info *server_info, + const char *servername, const char *sharename) { uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -1876,6 +1877,7 @@ done: WERROR winreg_get_printer(TALLOC_CTX *mem_ctx, struct auth_serversupplied_info *server_info, + const char *servername, const char *printer, struct spoolss_PrinterInfo2 **pinfo2) { @@ -1936,12 +1938,7 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx, goto done; } - info2->servername = talloc_asprintf(info2, "\\\\%s", global_myname()); - if (info2->servername == NULL) { - result = WERR_NOMEM; - goto done; - } - + info2->servername = EMPTY_STRING; info2->printername = EMPTY_STRING; info2->sharename = EMPTY_STRING; info2->portname = EMPTY_STRING; @@ -1953,6 +1950,14 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx, info2->datatype = EMPTY_STRING; info2->parameters = EMPTY_STRING; + if (servername != NULL && servername[0] != '\0') { + info2->servername = talloc_asprintf(info2, "\\\\%s", servername); + if (info2->servername == NULL) { + result = WERR_NOMEM; + goto done; + } + } + for (i = 0; i < num_values; i++) { v = &enum_values[i]; @@ -1960,6 +1965,15 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx, v, "Name", &info2->printername); + if (W_ERROR_IS_OK(result) && info2->servername[0] != '\0') { + char *p = talloc_asprintf(info2, "%s\\%s", + info2->servername, + info2->printername); + if (p == NULL) { + result = WERR_NOMEM; + } + info2->printername = p; + } CHECK_ERROR(result); result = winreg_enumval_to_sz(info2, diff --git a/source3/rpc_server/srv_spoolss_util.h b/source3/rpc_server/srv_spoolss_util.h index 4b5117e937..f883f20a45 100644 --- a/source3/rpc_server/srv_spoolss_util.h +++ b/source3/rpc_server/srv_spoolss_util.h @@ -73,6 +73,7 @@ enum spoolss_PrinterInfo2Mask { WERROR winreg_create_printer(TALLOC_CTX *mem_ctx, struct auth_serversupplied_info *server_info, + const char *servername, const char *sharename); /** @@ -110,6 +111,8 @@ WERROR winreg_update_printer(TALLOC_CTX *mem_ctx, * * @param[in] server_info The server supplied session info. * + * @param[in] printer The servername to use. + * * @param[in] printer The name of the printer to get. * * @param[out] pinfo2 A pointer to store a PRINTER_INFO_2 structure. @@ -119,6 +122,7 @@ WERROR winreg_update_printer(TALLOC_CTX *mem_ctx, */ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx, struct auth_serversupplied_info *server_info, + const char *servername, const char *printer, struct spoolss_PrinterInfo2 **pinfo2); |