The branch, master has been updated
via 3f0562f... s3-spoolss: Fixed memory error in winreg_get_driver.
via c95a79a... s3-spoolss: Added a sharename arg to
winreg_update_printer.
via 053ed7d... s3-spoolss: Added missing servername option to
winreg_{create,get}_printer.
via a5fb411... s3-spoolss: Added missing Printer Driver in
winreg_{update,get}_printer.
from 6659a0f... s3-net: fix crash in rap_share_add().
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 3f0562f4b4cfe770baf2e529a445404a7b8f1141
Author: Andreas Schneider <[email protected]>
Date: Wed Apr 28 11:26:08 2010 +0200
s3-spoolss: Fixed memory error in winreg_get_driver.
The strings in the structure need to be initialized with an empty
string.
Signed-off-by: Günther Deschner <[email protected]>
commit c95a79aae9f67dd476b7f6d1d12ad574b54c15ba
Author: Andreas Schneider <[email protected]>
Date: Tue May 4 11:37:42 2010 +0200
s3-spoolss: Added a sharename arg to winreg_update_printer.
Signed-off-by: Günther Deschner <[email protected]>
commit 053ed7d554fe8822ceabda48968da5a87030104a
Author: Andreas Schneider <[email protected]>
Date: Mon Apr 26 13:36:19 2010 +0200
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 <[email protected]>
commit a5fb4117e18cfa334a455ff0ab37ab71ef23dfd2
Author: Andreas Schneider <[email protected]>
Date: Fri Apr 23 21:37:13 2010 +0200
s3-spoolss: Added missing Printer Driver in winreg_{update,get}_printer.
Signed-off-by: Günther Deschner <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
source3/rpc_server/srv_spoolss_util.c | 82 +++++++++++++++++++++++++++++---
source3/rpc_server/srv_spoolss_util.h | 7 +++
2 files changed, 81 insertions(+), 8 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/rpc_server/srv_spoolss_util.c
b/source3/rpc_server/srv_spoolss_util.c
index 0044279..995cb7b 100644
--- a/source3/rpc_server/srv_spoolss_util.c
+++ b/source3/rpc_server/srv_spoolss_util.c
@@ -30,6 +30,8 @@
#define TOP_LEVEL_CONTROL_FORMS_KEY TOP_LEVEL_CONTROL_KEY "\\Forms"
#define EMPTY_STRING ""
+static const char *empty_string_array[1] = { NULL };
+#define EMPTY_STRING_ARRAY empty_string_array
#define CHECK_ERROR(result) \
if (W_ERROR_IS_OK(result)) continue; \
@@ -1362,6 +1364,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;
@@ -1535,6 +1538,7 @@ WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
result = winreg_update_printer(tmp_ctx,
server_info,
+ sharename,
info2_mask,
info2,
devmode,
@@ -1556,6 +1560,7 @@ done:
WERROR winreg_update_printer(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info *server_info,
+ const char *sharename,
uint32_t info2_mask,
struct spoolss_SetPrinterInfo2 *info2,
struct spoolss_DeviceMode *devmode,
@@ -1575,7 +1580,7 @@ WERROR winreg_update_printer(TALLOC_CTX *mem_ctx,
return WERR_NOMEM;
}
- path = winreg_printer_data_keyname(tmp_ctx, info2->sharename);
+ path = winreg_printer_data_keyname(tmp_ctx, sharename);
if (path == NULL) {
TALLOC_FREE(tmp_ctx);
return WERR_NOMEM;
@@ -1675,6 +1680,17 @@ WERROR winreg_update_printer(TALLOC_CTX *mem_ctx,
}
}
+ if (info2_mask & SPOOLSS_PRINTER_INFO_DRIVERNAME) {
+ result = winreg_printer_write_sz(tmp_ctx,
+ winreg_pipe,
+ &key_hnd,
+ "Printer Driver",
+ info2->drivername);
+ if (!W_ERROR_IS_OK(result)) {
+ goto done;
+ }
+ }
+
if (info2_mask & SPOOLSS_PRINTER_INFO_LOCATION) {
result = winreg_printer_write_sz(tmp_ctx,
winreg_pipe,
@@ -1865,6 +1881,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)
{
@@ -1925,12 +1942,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;
@@ -1942,6 +1954,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];
@@ -1949,6 +1969,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,
@@ -1999,6 +2028,12 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
&info2->parameters);
CHECK_ERROR(result);
+ result = winreg_enumval_to_sz(info2,
+ v,
+ "Printer Driver",
+ &info2->drivername);
+ CHECK_ERROR(result);
+
result = winreg_enumval_to_dword(info2,
v,
"Attributes",
@@ -3621,11 +3656,42 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
}
info8 = talloc_zero(tmp_ctx, struct spoolss_DriverInfo8);
- if (!info8) {
+ if (info8 == NULL) {
result = WERR_NOMEM;
goto done;
}
+ info8->driver_name = talloc_strdup(info8, driver_name);
+ if (info8->driver_name == NULL) {
+ result = WERR_NOMEM;
+ goto done;
+ }
+
+ info8->architecture = talloc_strdup(info8, architecture);
+ if (info8->architecture == NULL) {
+ result = WERR_NOMEM;
+ goto done;
+ }
+
+ info8->config_file = EMPTY_STRING;
+ info8->data_file = EMPTY_STRING;
+ info8->default_datatype = EMPTY_STRING;
+ info8->driver_path = EMPTY_STRING;
+ info8->hardware_id = EMPTY_STRING;
+ info8->help_file = EMPTY_STRING;
+ info8->inf_path = EMPTY_STRING;
+ info8->manufacturer_name = EMPTY_STRING;
+ info8->manufacturer_url = EMPTY_STRING;
+ info8->monitor_name = EMPTY_STRING;
+ info8->print_processor = EMPTY_STRING;
+ info8->provider = EMPTY_STRING;
+ info8->vendor_setup = EMPTY_STRING;
+
+ info8->color_profiles = empty_string_array;
+ info8->core_driver_dependencies = EMPTY_STRING_ARRAY;
+ info8->dependent_files = EMPTY_STRING_ARRAY;
+ info8->previous_names = EMPTY_STRING_ARRAY;
+
result = WERR_OK;
for (i = 0; i < num_values; i++) {
diff --git a/source3/rpc_server/srv_spoolss_util.h
b/source3/rpc_server/srv_spoolss_util.h
index 4b5117e..fbb34bb 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);
/**
@@ -84,6 +85,8 @@ WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
*
* @param[in] server_info The server supplied session info.
*
+ * @param[in] sharename The share name.
+ *
* @param[in] info2_mask A bitmask which defines which values should be set.
*
* @param[in] info2 A SetPrinterInfo2 structure with the data to set.
@@ -97,6 +100,7 @@ WERROR winreg_create_printer(TALLOC_CTX *mem_ctx,
*/
WERROR winreg_update_printer(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info *server_info,
+ const char *sharename,
uint32_t info2_mask,
struct spoolss_SetPrinterInfo2 *info2,
struct spoolss_DeviceMode *devmode,
@@ -110,6 +114,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 +125,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);
--
Samba Shared Repository