The branch, master has been updated
via db0ea16 s3-spoolss: Check return type of update_dsspooler().
via c3c3d3a s3-spoolss: Check return codes in update_dsspooler.
via fd85cd2 s3-printing: Check for browseable too.
via 1a65f90 s3-printing: Make printer a const char *.
via 0344897 s3-rpc_client: Add debug message for printer dataex errors.
via 4bccc91 s3-rpc_server: Increase debug level for policy handle.
from 26d68c3 samba3util: Add ccan to dependency list now that
str_checksum() uses a ccan function.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit db0ea166043416c4a5635c0f20b60f3e030c9441
Author: Andreas Schneider <[email protected]>
Date: Tue Feb 14 11:56:37 2012 +0100
s3-spoolss: Check return type of update_dsspooler().
Autobuild-User: Andreas Schneider <[email protected]>
Autobuild-Date: Wed Mar 14 19:38:45 CET 2012 on sn-devel-104
commit c3c3d3ac3fc0eddf8ce4d4d71ac5bf8f6bcefd4f
Author: Andreas Schneider <[email protected]>
Date: Mon Feb 13 19:00:41 2012 +0100
s3-spoolss: Check return codes in update_dsspooler.
commit fd85cd25e088bfd0bd304e980fa8776cf8ca376d
Author: Andreas Schneider <[email protected]>
Date: Fri Feb 10 14:00:05 2012 +0100
s3-printing: Check for browseable too.
commit 1a65f90a341752e5b6c9b3f7e8f301bb4a093d65
Author: Andreas Schneider <[email protected]>
Date: Fri Feb 10 13:45:24 2012 +0100
s3-printing: Make printer a const char *.
commit 034489718ca45a7b7e5a400f99d45387b1449746
Author: Andreas Schneider <[email protected]>
Date: Mon Feb 13 18:57:26 2012 +0100
s3-rpc_client: Add debug message for printer dataex errors.
commit 4bccc911b82d82091bbb4c22a99518172f768c93
Author: Andreas Schneider <[email protected]>
Date: Mon Feb 13 18:58:32 2012 +0100
s3-rpc_server: Increase debug level for policy handle.
-----------------------------------------------------------------------
Summary of changes:
source3/include/nt_printing.h | 4 +-
source3/printing/nt_printing_ads.c | 8 +-
source3/rpc_client/cli_winreg_spoolss.c | 4 +
source3/rpc_server/rpc_handles.c | 10 +-
source3/rpc_server/spoolss/srv_spoolss_nt.c | 240 +++++++++++++++++++++------
source3/smbd/server_reload.c | 7 +-
6 files changed, 212 insertions(+), 61 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/nt_printing.h b/source3/include/nt_printing.h
index 08a2161..2243a3d 100644
--- a/source3/include/nt_printing.h
+++ b/source3/include/nt_printing.h
@@ -141,7 +141,9 @@ WERROR nt_printer_publish(TALLOC_CTX *mem_ctx,
bool is_printer_published(TALLOC_CTX *mem_ctx,
const struct auth_session_info *server_info,
struct messaging_context *msg_ctx,
- const char *servername, char *printer, struct GUID
*guid,
+ const char *servername,
+ const char *printer,
+ struct GUID *guid,
struct spoolss_PrinterInfo2 **info2);
WERROR check_published_printers(struct messaging_context *msg_ctx);
diff --git a/source3/printing/nt_printing_ads.c
b/source3/printing/nt_printing_ads.c
index 728fefb..3551148 100644
--- a/source3/printing/nt_printing_ads.c
+++ b/source3/printing/nt_printing_ads.c
@@ -390,7 +390,9 @@ done:
bool is_printer_published(TALLOC_CTX *mem_ctx,
const struct auth_session_info *session_info,
struct messaging_context *msg_ctx,
- const char *servername, char *printer, struct GUID
*guid,
+ const char *servername,
+ const char *printer,
+ struct GUID *guid,
struct spoolss_PrinterInfo2 **info2)
{
struct spoolss_PrinterInfo2 *pinfo2 = NULL;
@@ -485,7 +487,9 @@ WERROR check_published_printers(struct messaging_context
*msg_ctx)
bool is_printer_published(TALLOC_CTX *mem_ctx,
const struct auth_session_info *session_info,
struct messaging_context *msg_ctx,
- const char *servername, char *printer, struct GUID
*guid,
+ const char *servername,
+ const char *printer,
+ struct GUID *guid,
struct spoolss_PrinterInfo2 **info2)
{
return False;
diff --git a/source3/rpc_client/cli_winreg_spoolss.c
b/source3/rpc_client/cli_winreg_spoolss.c
index a50fcc7..49b67aa 100644
--- a/source3/rpc_client/cli_winreg_spoolss.c
+++ b/source3/rpc_client/cli_winreg_spoolss.c
@@ -2049,6 +2049,8 @@ WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx,
goto done;
}
if (!W_ERROR_IS_OK(result)) {
+ DEBUG(2, ("winreg_get_printer_dataex: Could not query value %s:
%s\n",
+ value, win_errstr(result)));
goto done;
}
@@ -2075,6 +2077,8 @@ WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx,
goto done;
}
if (!W_ERROR_IS_OK(result)) {
+ DEBUG(2, ("winreg_get_printer_dataex: Could not query value %s:
%s\n",
+ value, win_errstr(result)));
goto done;
}
diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c
index d547f18..f98b235 100644
--- a/source3/rpc_server/rpc_handles.c
+++ b/source3/rpc_server/rpc_handles.c
@@ -299,8 +299,8 @@ static struct dcesrv_handle
*create_rpc_handle_internal(struct pipes_struct *p,
*hnd = rpc_hnd->wire_handle;
- DEBUG(4, ("Opened policy hnd[%d] ", (int)p->pipe_handles->count));
- dump_data(4, (uint8_t *)hnd, sizeof(*hnd));
+ DEBUG(6, ("Opened policy hnd[%d] ", (int)p->pipe_handles->count));
+ dump_data(6, (uint8_t *)hnd, sizeof(*hnd));
return rpc_hnd;
}
@@ -334,8 +334,8 @@ static struct dcesrv_handle
*find_policy_by_hnd_internal(struct pipes_struct *p,
count = 0;
for (h = p->pipe_handles->handles; h != NULL; h = h->next) {
if (memcmp(&h->wire_handle, hnd, sizeof(*hnd)) == 0) {
- DEBUG(4,("Found policy hnd[%u] ", count));
- dump_data(4, (const uint8 *)hnd, sizeof(*hnd));
+ DEBUG(6,("Found policy hnd[%u] ", count));
+ dump_data(6, (const uint8 *)hnd, sizeof(*hnd));
if (data_p) {
*data_p = h->data;
}
@@ -383,7 +383,7 @@ bool close_policy_hnd(struct pipes_struct *p, struct
policy_handle *hnd)
return false;
}
- DEBUG(3,("Closed policy\n"));
+ DEBUG(6,("Closed policy\n"));
p->pipe_handles->count--;
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c
b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index daed990..ef987e5 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -6257,6 +6257,7 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
WERROR result = WERR_OK;
struct dcerpc_binding_handle *b;
TALLOC_CTX *tmp_ctx;
+ bool ok;
tmp_ctx = talloc_new(mem_ctx);
if (!tmp_ctx) {
@@ -6271,15 +6272,26 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
goto done;
}
- if (force_update || !strequal(printer->drivername,
old_printer->drivername)) {
- push_reg_sz(tmp_ctx, &buffer, printer->drivername);
- winreg_set_printer_dataex(tmp_ctx, b,
+ if (printer->drivername != NULL &&
+ (force_update ||
+ !strequal(printer->drivername, old_printer->drivername))) {
+ ok = push_reg_sz(tmp_ctx, &buffer, printer->drivername);
+ if (!ok) {
+ DEBUG(0, ("%s data corrupted\n", SPOOL_REG_DRIVERNAME));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_DRIVERNAME,
REG_SZ,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n", SPOOL_REG_DRIVERNAME));
+ goto done;
+ }
if (!force_update) {
DEBUG(10,("update_printer: changing driver [%s]!
Sending event!\n",
@@ -6291,15 +6303,26 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
}
}
- if (force_update || !strequal(printer->comment, old_printer->comment)) {
- push_reg_sz(tmp_ctx, &buffer, printer->comment);
- winreg_set_printer_dataex(tmp_ctx, b,
+ if (printer->comment != NULL &&
+ (force_update ||
+ !strequal(printer->comment, old_printer->comment))) {
+ ok = push_reg_sz(tmp_ctx, &buffer, printer->comment);
+ if (!ok) {
+ DEBUG(0, ("comment data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_DESCRIPTION,
REG_SZ,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n", SPOOL_REG_DESCRIPTION));
+ goto done;
+ }
if (!force_update) {
notify_printer_comment(server_event_context(), msg_ctx,
@@ -6308,15 +6331,26 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
}
}
- if (force_update || !strequal(printer->sharename,
old_printer->sharename)) {
- push_reg_sz(tmp_ctx, &buffer, printer->sharename);
- winreg_set_printer_dataex(tmp_ctx, b,
+ if (printer->sharename != NULL &&
+ (force_update ||
+ !strequal(printer->sharename, old_printer->sharename))) {
+ ok = push_reg_sz(tmp_ctx, &buffer, printer->sharename);
+ if (!ok) {
+ DEBUG(0, ("sharename data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTSHARENAME,
REG_SZ,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n",
SPOOL_REG_PRINTSHARENAME));
+ goto done;
+ }
if (!force_update) {
notify_printer_sharename(server_event_context(),
@@ -6326,7 +6360,9 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
}
}
- if (force_update || !strequal(printer->printername,
old_printer->printername)) {
+ if (printer->printername != NULL &&
+ (force_update ||
+ !strequal(printer->printername, old_printer->printername))) {
const char *p;
p = strrchr(printer->printername, '\\' );
@@ -6336,14 +6372,23 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
p = printer->printername;
}
- push_reg_sz(tmp_ctx, &buffer, p);
- winreg_set_printer_dataex(tmp_ctx, b,
+ ok = push_reg_sz(tmp_ctx, &buffer, p);
+ if (!ok) {
+ DEBUG(0, ("printername data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTERNAME,
REG_SZ,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n",
SPOOL_REG_PRINTSHARENAME));
+ goto done;
+ }
if (!force_update) {
notify_printer_printername(server_event_context(),
@@ -6351,15 +6396,26 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
}
}
- if (force_update || !strequal(printer->portname,
old_printer->portname)) {
- push_reg_sz(tmp_ctx, &buffer, printer->portname);
- winreg_set_printer_dataex(tmp_ctx, b,
+ if (printer->portname != NULL &&
+ (force_update ||
+ !strequal(printer->portname, old_printer->portname))) {
+ ok = push_reg_sz(tmp_ctx, &buffer, printer->portname);
+ if (!ok) {
+ DEBUG(0, ("portname data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PORTNAME,
REG_SZ,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n", SPOOL_REG_PORTNAME));
+ goto done;
+ }
if (!force_update) {
notify_printer_port(server_event_context(),
@@ -6368,15 +6424,26 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
}
}
- if (force_update || !strequal(printer->location,
old_printer->location)) {
- push_reg_sz(tmp_ctx, &buffer, printer->location);
- winreg_set_printer_dataex(tmp_ctx, b,
+ if (printer->location != NULL &&
+ (force_update ||
+ !strequal(printer->location, old_printer->location))) {
+ ok = push_reg_sz(tmp_ctx, &buffer, printer->location);
+ if (!ok) {
+ DEBUG(0, ("location data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_LOCATION,
REG_SZ,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n", SPOOL_REG_LOCATION));
+ goto done;
+ }
if (!force_update) {
notify_printer_location(server_event_context(),
@@ -6386,15 +6453,26 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
}
}
- if (force_update || !strequal(printer->sepfile, old_printer->sepfile)) {
- push_reg_sz(tmp_ctx, &buffer, printer->sepfile);
- winreg_set_printer_dataex(tmp_ctx, b,
+ if (printer->sepfile != NULL &&
+ (force_update ||
+ !strequal(printer->sepfile, old_printer->sepfile))) {
+ ok = push_reg_sz(tmp_ctx, &buffer, printer->sepfile);
+ if (!ok) {
+ DEBUG(0, ("sepfile data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTSEPARATORFILE,
REG_SZ,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n",
SPOOL_REG_PRINTSEPARATORFILE));
+ goto done;
+ }
if (!force_update) {
notify_printer_sepfile(server_event_context(),
@@ -6404,53 +6482,73 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
}
}
- if (force_update || printer->starttime != old_printer->starttime) {
+ if (printer->starttime != 0 &&
+ (force_update ||
+ printer->starttime != old_printer->starttime)) {
buffer = data_blob_talloc(tmp_ctx, NULL, 4);
SIVAL(buffer.data, 0, printer->starttime);
- winreg_set_printer_dataex(tmp_ctx, b,
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTSTARTTIME,
REG_DWORD,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n",
SPOOL_REG_PRINTSTARTTIME));
+ goto done;
+ }
}
- if (force_update || printer->untiltime != old_printer->untiltime) {
+ if (printer->untiltime != 0 &&
+ (force_update ||
+ printer->untiltime != old_printer->untiltime)) {
buffer = data_blob_talloc(tmp_ctx, NULL, 4);
SIVAL(buffer.data, 0, printer->untiltime);
- winreg_set_printer_dataex(tmp_ctx, b,
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTENDTIME,
REG_DWORD,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n",
SPOOL_REG_PRINTENDTIME));
+ goto done;
+ }
}
if (force_update || printer->priority != old_printer->priority) {
buffer = data_blob_talloc(tmp_ctx, NULL, 4);
SIVAL(buffer.data, 0, printer->priority);
- winreg_set_printer_dataex(tmp_ctx, b,
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRIORITY,
REG_DWORD,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n",
SPOOL_REG_PRINTENDTIME));
+ goto done;
+ }
}
if (force_update || printer->attributes != old_printer->attributes) {
buffer = data_blob_talloc(tmp_ctx, NULL, 4);
SIVAL(buffer.data, 0, (printer->attributes &
PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS));
- winreg_set_printer_dataex(tmp_ctx, b,
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_PRINTKEEPPRINTEDJOBS,
REG_DWORD,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n",
SPOOL_REG_PRINTENDTIME));
+ goto done;
+ }
switch (printer->attributes & 0x3) {
case 0:
@@ -6465,7 +6563,12 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
default:
spooling = "unknown";
}
- push_reg_sz(tmp_ctx, &buffer, spooling);
+ ok = push_reg_sz(tmp_ctx, &buffer, spooling);
+ if (!ok) {
+ DEBUG(0, ("printSpooling data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
@@ -6475,14 +6578,23 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
buffer.length);
}
- push_reg_sz(tmp_ctx, &buffer, lp_netbios_name());
- winreg_set_printer_dataex(tmp_ctx, b,
+ ok = push_reg_sz(tmp_ctx, &buffer, lp_netbios_name());
+ if (!ok) {
+ DEBUG(0, ("shortServerName data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_SHORTSERVERNAME,
REG_SZ,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n", SPOOL_REG_SHORTSERVERNAME));
+ goto done;
+ }
dnsdomname = get_mydnsfullname();
if (dnsdomname != NULL && dnsdomname[0] != '\0') {
@@ -6495,25 +6607,43 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
goto done;
}
- push_reg_sz(tmp_ctx, &buffer, longname);
- winreg_set_printer_dataex(tmp_ctx, b,
- printer->sharename,
- SPOOL_DSSPOOLER_KEY,
- SPOOL_REG_SERVERNAME,
- REG_SZ,
- buffer.data,
- buffer.length);
+ ok = push_reg_sz(tmp_ctx, &buffer, longname);
+ if (!ok) {
+ DEBUG(0, ("longname data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
+ printer->sharename,
+ SPOOL_DSSPOOLER_KEY,
+ SPOOL_REG_SERVERNAME,
+ REG_SZ,
+ buffer.data,
+ buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n", SPOOL_REG_SERVERNAME));
+ goto done;
+ }
uncname = talloc_asprintf(tmp_ctx, "\\\\%s\\%s",
lp_netbios_name(), printer->sharename);
- push_reg_sz(tmp_ctx, &buffer, uncname);
- winreg_set_printer_dataex(tmp_ctx, b,
+ ok = push_reg_sz(tmp_ctx, &buffer, uncname);
+ if (!ok) {
+ DEBUG(0, ("uncName data corrupted\n"));
+ result = WERR_INVALID_DATA;
+ goto done;
+ }
+ result = winreg_set_printer_dataex(tmp_ctx, b,
printer->sharename,
SPOOL_DSSPOOLER_KEY,
SPOOL_REG_UNCNAME,
REG_SZ,
buffer.data,
buffer.length);
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("Failed to set %s\n", SPOOL_REG_UNCNAME));
+ goto done;
+ }
done:
--
Samba Shared Repository