summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2010-04-26 13:36:19 +0200
committerGünther Deschner <gd@samba.org>2010-05-05 17:32:51 +0200
commit053ed7d554fe8822ceabda48968da5a87030104a (patch)
tree071472a4d19cfdbf6039ff4612b39032af100288 /source3
parenta5fb4117e18cfa334a455ff0ab37ab71ef23dfd2 (diff)
downloadsamba-053ed7d554fe8822ceabda48968da5a87030104a.tar.gz
samba-053ed7d554fe8822ceabda48968da5a87030104a.tar.bz2
samba-053ed7d554fe8822ceabda48968da5a87030104a.zip
s3-spoolss: Added missing servername option to winreg_{create,get}_printer.
This is needed to be able to pass the correct servername from Printer_entry. Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_spoolss_util.c26
-rw-r--r--source3/rpc_server/srv_spoolss_util.h4
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);