[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Fri Apr 23 08:34:17 MDT 2010
The branch, master has been updated
via 251cd42... s3-spoolss: Added a winreg_get_printer function.
via e15d624... s3-spoolss: Added a winreg_create_printer function.
via a612976... s3-spoolss: Added a winreg_update_printer function.
via 8cb79bf... s3-spoolss: Added a winreg_get_driver_list function.
via 8db203a... s3-spoolss: Added a winreg_del_driver function.
via 16e0f80... s3-spoolss: Added a winreg_get_driver function.
via a91f6f8... s3-spoolss: Added a winreg_add_driver function.
via 8f56cdf... s3-spoolss: Move info_ctr conversion to a public helper.
via 94a8482... s3-spoolss: Fixed winreg_delete_printer_key if key is NULL or emtpy.
via 96a04b0... s3-spoolss: Add date and version winreg helpers.
via b33e877... s3-spoolss: Added more winreg hepler functions.
via d4f563d... s3-spoolss: Added winreg helper functions
via 0ed5e36... s3-spoolss: Added a winreg function to query a dword.
via e7d6742... s3-spoolss: Added a function to get the ChangeID from a printer.
via b04a260... s3-spoolss: Added a function to update the ChangeID of a printer.
via a18cd32... s3-spoolss: Added winreg helper functions to write registry values.
via b320fad... s3-spoolss: Fixed return values of winreg_printer_deleteform1.
via 012c1fe... s3-spoolss: Added missing return value to winreg_printer_enumforms1 docs.
via d65485b... s3-spoolss: Use const values for notify functions.
via 3f1cc29... s3-time: Added a function to get the startup time of the server.
from bb22855... s3-lanman: fix uninitialized variable in api_RDosPrintJobDel().
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 251cd42ed5b62afe8272099707347c1b0f61023e
Author: Andreas Schneider <asn at samba.org>
Date: Wed Apr 21 17:13:02 2010 +0200
s3-spoolss: Added a winreg_get_printer function.
Signed-off-by: Günther Deschner <gd at samba.org>
commit e15d624c0ae539460de367ab2b33f83f41d81393
Author: Andreas Schneider <asn at samba.org>
Date: Wed Apr 21 12:56:39 2010 +0200
s3-spoolss: Added a winreg_create_printer function.
Signed-off-by: Günther Deschner <gd at samba.org>
commit a61297647db696d193c081522f44ff09bf260bce
Author: Andreas Schneider <asn at samba.org>
Date: Thu Apr 15 17:53:39 2010 +0200
s3-spoolss: Added a winreg_update_printer function.
Signed-off-by: Günther Deschner <gd at samba.org>
commit 8cb79bf4cd577468dd891106ce6e0d01969b2233
Author: Simo Sorce <idra at samba.org>
Date: Mon Apr 19 21:50:52 2010 -0400
s3-spoolss: Added a winreg_get_driver_list function.
Signed-off-by: Günther Deschner <gd at samba.org>
commit 8db203a4a60a8d043e36138873ed457f48acce72
Author: Simo Sorce <idra at samba.org>
Date: Mon Apr 19 21:01:38 2010 -0400
s3-spoolss: Added a winreg_del_driver function.
Signed-off-by: Günther Deschner <gd at samba.org>
commit 16e0f806872eaf620b12c375d25f0043d5dea704
Author: Simo Sorce <idra at samba.org>
Date: Wed Apr 21 09:38:39 2010 -0400
s3-spoolss: Added a winreg_get_driver function.
Signed-off-by: Günther Deschner <gd at samba.org>
commit a91f6f8b03b5c9342853229dc634bd217e289d5d
Author: Simo Sorce <idra at samba.org>
Date: Wed Apr 21 09:37:08 2010 -0400
s3-spoolss: Added a winreg_add_driver function.
Signed-off-by: Günther Deschner <gd at samba.org>
commit 8f56cdfaee571a5b4bb735290dfd668ef8c4d730
Author: Simo Sorce <idra at samba.org>
Date: Wed Apr 14 20:46:55 2010 -0400
s3-spoolss: Move info_ctr conversion to a public helper.
Signed-off-by: Günther Deschner <gd at samba.org>
commit 94a8482261526c7bb3ae15194bf3939978b324b6
Author: Andreas Schneider <asn at samba.org>
Date: Fri Apr 23 14:45:48 2010 +0200
s3-spoolss: Fixed winreg_delete_printer_key if key is NULL or emtpy.
Signed-off-by: Günther Deschner <gd at samba.org>
commit 96a04b067efe34d16ab14339703be89d27e64b0b
Author: Simo Sorce <idra at samba.org>
Date: Wed Apr 21 09:58:51 2010 -0400
s3-spoolss: Add date and version winreg helpers.
Signed-off-by: Günther Deschner <gd at samba.org>
commit b33e877aad0485c88ba4ff0223004e92c4cb78e2
Author: Andreas Schneider <asn at samba.org>
Date: Wed Apr 21 18:12:50 2010 +0200
s3-spoolss: Added more winreg hepler functions.
Signed-off-by: Günther Deschner <gd at samba.org>
commit d4f563d9d4fcefc0523cfdc5c75b2256e4f28aeb
Author: Simo Sorce <idra at samba.org>
Date: Wed Apr 21 09:51:37 2010 -0400
s3-spoolss: Added winreg helper functions
Signed-off-by: Günther Deschner <gd at samba.org>
commit 0ed5e36c67020f11c865f66584c0f800f5b27cf3
Author: Andreas Schneider <asn at samba.org>
Date: Mon Apr 12 15:54:01 2010 +0200
s3-spoolss: Added a winreg function to query a dword.
Signed-off-by: Günther Deschner <gd at samba.org>
commit e7d674282191152f29d0fe812af9c5afcba084b9
Author: Andreas Schneider <asn at samba.org>
Date: Thu Apr 15 21:51:16 2010 +0200
s3-spoolss: Added a function to get the ChangeID from a printer.
Signed-off-by: Günther Deschner <gd at samba.org>
commit b04a260e4e8b5d317e36d758f16aff090d567d7c
Author: Andreas Schneider <asn at samba.org>
Date: Thu Apr 15 15:18:26 2010 +0200
s3-spoolss: Added a function to update the ChangeID of a printer.
Signed-off-by: Günther Deschner <gd at samba.org>
commit a18cd32a3478d533b679bc134b7dda66e1869521
Author: Andreas Schneider <asn at samba.org>
Date: Fri Apr 9 12:36:37 2010 +0200
s3-spoolss: Added winreg helper functions to write registry values.
Signed-off-by: Günther Deschner <gd at samba.org>
commit b320fad6e4c6991f636e3635aeba3d5e1a7a9ed5
Author: Andreas Schneider <asn at samba.org>
Date: Fri Apr 9 09:26:24 2010 +0200
s3-spoolss: Fixed return values of winreg_printer_deleteform1.
Signed-off-by: Günther Deschner <gd at samba.org>
commit 012c1feda5dc4b0841724e914a8ad30e0d2f1e91
Author: Andreas Schneider <asn at samba.org>
Date: Fri Apr 9 09:26:08 2010 +0200
s3-spoolss: Added missing return value to winreg_printer_enumforms1 docs.
Signed-off-by: Günther Deschner <gd at samba.org>
commit d65485b3c5b9168609069e0d771db11424fcddb4
Author: Andreas Schneider <asn at samba.org>
Date: Wed Apr 21 17:59:55 2010 +0200
s3-spoolss: Use const values for notify functions.
Signed-off-by: Günther Deschner <gd at samba.org>
commit 3f1cc29814c62b60a5615bb05c13addd171cc141
Author: Andreas Schneider <asn at samba.org>
Date: Thu Apr 22 12:33:29 2010 +0200
s3-time: Added a function to get the startup time of the server.
Signed-off-by: Günther Deschner <gd at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 15 +-
source3/lib/time.c | 13 +
source3/printing/notify.c | 12 +-
source3/printing/nt_printing.c | 29 +-
source3/rpc_server/srv_spoolss_util.c | 2181 ++++++++++++++++++++++++++++++++-
source3/rpc_server/srv_spoolss_util.h | 237 ++++
6 files changed, 2462 insertions(+), 25 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 7b279f6..073a0dc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1087,6 +1087,7 @@ time_t cli_make_unix_date2(struct cli_state *cli, const void *date_ptr);
time_t cli_make_unix_date3(struct cli_state *cli, const void *date_ptr);
void TimeInit(void);
void get_process_uptime(struct timeval *ret_time);
+void get_startup_time(struct timeval *ret_time);
time_t nt_time_to_unix_abs(const NTTIME *nt);
time_t uint64s_nt_time_to_unix_abs(const uint64_t *src);
void unix_timespec_to_nt_time(NTTIME *nt, struct timespec ts);
@@ -4825,12 +4826,12 @@ void notify_job_username(const char *sharename, uint32 jobid, char *name);
void notify_job_name(const char *sharename, uint32 jobid, char *name);
void notify_job_submitted(const char *sharename, uint32 jobid,
time_t submitted);
-void notify_printer_driver(int snum, char *driver_name);
-void notify_printer_comment(int snum, char *comment);
-void notify_printer_sharename(int snum, char *share_name);
-void notify_printer_printername(int snum, char *printername);
-void notify_printer_port(int snum, char *port_name);
-void notify_printer_location(int snum, char *location);
+void notify_printer_driver(int snum, const char *driver_name);
+void notify_printer_comment(int snum, const char *comment);
+void notify_printer_sharename(int snum, const char *share_name);
+void notify_printer_printername(int snum, const char *printername);
+void notify_printer_port(int snum, const char *port_name);
+void notify_printer_location(int snum, const char *location);
void notify_printer_byname( const char *printername, uint32 change, const char *value );
/* The following definitions come from printing/nt_printing.c */
@@ -4887,6 +4888,8 @@ WERROR get_a_printer_search( Printer_entry *print_hnd,
uint32 level,
const char *sharename);
uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level);
+bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r,
+ struct spoolss_DriverInfo8 *_info8);
uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx,
struct spoolss_AddDriverInfoCtr *r,
char **driver_name,
diff --git a/source3/lib/time.c b/source3/lib/time.c
index dffc03b..b965479 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -506,6 +506,19 @@ void get_process_uptime(struct timeval *ret_time)
}
}
+/**
+ * @brief Get the startup time of the server.
+ *
+ * @param[out] ret_time A pointer to a timveal structure to set the startup
+ * time.
+ */
+void get_startup_time(struct timeval *ret_time)
+{
+ ret_time->tv_sec = start_time_hires.tv_sec;
+ ret_time->tv_usec = start_time_hires.tv_usec;
+}
+
+
/****************************************************************************
Convert a NTTIME structure to a time_t.
It's originally in "100ns units".
diff --git a/source3/printing/notify.c b/source3/printing/notify.c
index 756a6c2..8d6bdc0 100644
--- a/source3/printing/notify.c
+++ b/source3/printing/notify.c
@@ -469,7 +469,7 @@ void notify_job_submitted(const char *sharename, uint32 jobid,
jobid, sizeof(submitted), (char *)&submitted);
}
-void notify_printer_driver(int snum, char *driver_name)
+void notify_printer_driver(int snum, const char *driver_name)
{
const char *sharename = SERVICE(snum);
@@ -478,7 +478,7 @@ void notify_printer_driver(int snum, char *driver_name)
snum, strlen(driver_name) + 1, driver_name);
}
-void notify_printer_comment(int snum, char *comment)
+void notify_printer_comment(int snum, const char *comment)
{
const char *sharename = SERVICE(snum);
@@ -487,7 +487,7 @@ void notify_printer_comment(int snum, char *comment)
snum, strlen(comment) + 1, comment);
}
-void notify_printer_sharename(int snum, char *share_name)
+void notify_printer_sharename(int snum, const char *share_name)
{
const char *sharename = SERVICE(snum);
@@ -496,7 +496,7 @@ void notify_printer_sharename(int snum, char *share_name)
snum, strlen(share_name) + 1, share_name);
}
-void notify_printer_printername(int snum, char *printername)
+void notify_printer_printername(int snum, const char *printername)
{
const char *sharename = SERVICE(snum);
@@ -505,7 +505,7 @@ void notify_printer_printername(int snum, char *printername)
snum, strlen(printername) + 1, printername);
}
-void notify_printer_port(int snum, char *port_name)
+void notify_printer_port(int snum, const char *port_name)
{
const char *sharename = SERVICE(snum);
@@ -514,7 +514,7 @@ void notify_printer_port(int snum, char *port_name)
snum, strlen(port_name) + 1, port_name);
}
-void notify_printer_location(int snum, char *location)
+void notify_printer_location(int snum, const char *location)
{
const char *sharename = SERVICE(snum);
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 56f5d18..ba667c3 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -4660,17 +4660,13 @@ uint32 free_a_printer(NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level)
/****************************************************************************
****************************************************************************/
-uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx,
- struct spoolss_AddDriverInfoCtr *r,
- char **driver_name,
- uint32_t *version)
+bool driver_info_ctr_to_info8(struct spoolss_AddDriverInfoCtr *r,
+ struct spoolss_DriverInfo8 *_info8)
{
struct spoolss_DriverInfo8 info8;
ZERO_STRUCT(info8);
- DEBUG(10,("adding a printer at level [%d]\n", r->level));
-
switch (r->level) {
case 3:
info8.version = r->info.info3->version;
@@ -4742,6 +4738,27 @@ uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx,
info8.min_inbox_driver_ver_version = r->info.info8->min_inbox_driver_ver_version;
break;
default:
+ return false;
+ }
+
+ *_info8 = info8;
+
+ return true;
+}
+
+
+uint32_t add_a_printer_driver(TALLOC_CTX *mem_ctx,
+ struct spoolss_AddDriverInfoCtr *r,
+ char **driver_name,
+ uint32_t *version)
+{
+ struct spoolss_DriverInfo8 info8;
+
+ ZERO_STRUCT(info8);
+
+ DEBUG(10,("adding a printer at level [%d]\n", r->level));
+
+ if (!driver_info_ctr_to_info8(r, &info8)) {
return -1;
}
diff --git a/source3/rpc_server/srv_spoolss_util.c b/source3/rpc_server/srv_spoolss_util.c
index efe3dd4..1035b20 100644
--- a/source3/rpc_server/srv_spoolss_util.c
+++ b/source3/rpc_server/srv_spoolss_util.c
@@ -29,6 +29,13 @@
#define TOP_LEVEL_CONTROL_KEY "SYSTEM\\CurrentControlSet\\Control\\Print"
#define TOP_LEVEL_CONTROL_FORMS_KEY TOP_LEVEL_CONTROL_KEY "\\Forms"
+#define EMPTY_STRING ""
+
+#define CHECK_ERROR(result) \
+ if (W_ERROR_IS_OK(result)) continue; \
+ if (W_ERROR_EQUAL(result, WERR_NOT_FOUND)) result = WERR_OK; \
+ if (!W_ERROR_IS_OK(result)) break
+
/* FLAGS, NAME, with, height, left, top, right, bottom */
static const struct spoolss_FormInfo1 builtin_forms1[] = {
{ SPOOLSS_FORM_BUILTIN, "Letter", {0x34b5c,0x44368}, {0x0,0x0,0x34b5c,0x44368} },
@@ -155,6 +162,183 @@ static const struct spoolss_FormInfo1 builtin_forms1[] = {
static helper functions
********************************************************************/
+/****************************************************************************
+ Update the changeid time.
+****************************************************************************/
+/**
+ * @internal
+ *
+ * @brief Update the ChangeID time of a printer.
+ *
+ * This is SO NASTY as some drivers need this to change, others need it
+ * static. This value will change every second, and I must hope that this
+ * is enough..... DON'T CHANGE THIS CODE WITHOUT A TEST MATRIX THE SIZE OF
+ * UTAH ! JRA.
+ *
+ * @return The ChangeID.
+ */
+static uint32_t winreg_printer_rev_changeid(void)
+{
+ struct timeval tv;
+
+ get_process_uptime(&tv);
+
+#if 1 /* JERRY */
+ /* Return changeid as msec since spooler restart */
+ return tv.tv_sec * 1000 + tv.tv_usec / 1000;
+#else
+ /*
+ * This setting seems to work well but is too untested
+ * to replace the above calculation. Left in for experiementation
+ * of the reader --jerry (Tue Mar 12 09:15:05 CST 2002)
+ */
+ return tv.tv_sec * 10 + tv.tv_usec / 100000;
+#endif
+}
+
+static struct spoolss_security_descriptor *winreg_printer_create_default_secdesc(TALLOC_CTX *ctx)
+{
+ SEC_ACE ace[5]; /* max number of ace entries */
+ int i = 0;
+ uint32_t sa;
+ SEC_ACL *psa = NULL;
+ SEC_DESC *psd = NULL;
+ DOM_SID adm_sid;
+ size_t sd_size;
+
+ /* Create an ACE where Everyone is allowed to print */
+
+ sa = PRINTER_ACE_PRINT;
+ init_sec_ace(&ace[i++], &global_sid_World, SEC_ACE_TYPE_ACCESS_ALLOWED,
+ sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
+
+ /* Add the domain admins group if we are a DC */
+
+ if ( IS_DC ) {
+ DOM_SID domadmins_sid;
+
+ sid_compose(&domadmins_sid, get_global_sam_sid(),
+ DOMAIN_GROUP_RID_ADMINS);
+
+ sa = PRINTER_ACE_FULL_CONTROL;
+ init_sec_ace(&ace[i++], &domadmins_sid,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
+ SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
+ init_sec_ace(&ace[i++], &domadmins_sid, SEC_ACE_TYPE_ACCESS_ALLOWED,
+ sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
+ }
+ else if (secrets_fetch_domain_sid(lp_workgroup(), &adm_sid)) {
+ sid_append_rid(&adm_sid, DOMAIN_USER_RID_ADMIN);
+
+ sa = PRINTER_ACE_FULL_CONTROL;
+ init_sec_ace(&ace[i++], &adm_sid,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
+ SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
+ init_sec_ace(&ace[i++], &adm_sid, SEC_ACE_TYPE_ACCESS_ALLOWED,
+ sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
+ }
+
+ /* add BUILTIN\Administrators as FULL CONTROL */
+
+ sa = PRINTER_ACE_FULL_CONTROL;
+ init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
+ SEC_ACE_TYPE_ACCESS_ALLOWED, sa,
+ SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_INHERIT_ONLY);
+ init_sec_ace(&ace[i++], &global_sid_Builtin_Administrators,
+ SEC_ACE_TYPE_ACCESS_ALLOWED,
+ sa, SEC_ACE_FLAG_CONTAINER_INHERIT);
+
+ /* Make the security descriptor owned by the BUILTIN\Administrators */
+
+ /* The ACL revision number in rpc_secdesc.h differs from the one
+ created by NT when setting ACE entries in printer
+ descriptors. NT4 complains about the property being edited by a
+ NT5 machine. */
+
+ if ((psa = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace)) != NULL) {
+ psd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE,
+ &global_sid_Builtin_Administrators,
+ &global_sid_Builtin_Administrators,
+ NULL, psa, &sd_size);
+ }
+
+ if (!psd) {
+ DEBUG(0,("construct_default_printer_sd: Failed to make SEC_DESC.\n"));
+ return NULL;
+ }
+
+ DEBUG(4,("construct_default_printer_sdb: size = %u.\n",
+ (unsigned int)sd_size));
+
+ return psd;
+}
+
+static struct spoolss_DeviceMode *winreg_printer_create_default_devmode(TALLOC_CTX *mem_ctx,
+ const char *default_devicename)
+{
+ char adevice[MAXDEVICENAME];
+ struct spoolss_DeviceMode *devmode;
+
+ devmode = talloc_zero(mem_ctx, struct spoolss_DeviceMode);
+ if (devmode == NULL) {
+ return NULL;
+ }
+
+ slprintf(adevice, sizeof(adevice), "%s", default_devicename);
+ devmode->devicename = talloc_strdup(mem_ctx, adevice);
+ if (devmode->devicename == NULL) {
+ return NULL;
+ }
+
+ devmode->formname = "Letter";
+
+ devmode->specversion = DMSPEC_NT4_AND_ABOVE;
+ devmode->driverversion = 0x0400;
+ devmode->size = 0x00DC;
+ devmode->__driverextra_length = 0;
+ devmode->fields = DEVMODE_FORMNAME |
+ DEVMODE_TTOPTION |
+ DEVMODE_PRINTQUALITY |
+ DEVMODE_DEFAULTSOURCE |
+ DEVMODE_COPIES |
+ DEVMODE_SCALE |
+ DEVMODE_PAPERSIZE |
+ DEVMODE_ORIENTATION;
+ devmode->orientation = DMORIENT_PORTRAIT;
+ devmode->papersize = DMPAPER_LETTER;
+ devmode->paperlength = 0;
+ devmode->paperwidth = 0;
+ devmode->scale = 0x64;
+ devmode->copies = 1;
+ devmode->defaultsource = DMBIN_FORMSOURCE;
+ devmode->printquality = DMRES_HIGH; /* 0x0258 */
+ devmode->color = DMRES_MONOCHROME;
+ devmode->duplex = DMDUP_SIMPLEX;
+ devmode->yresolution = 0;
+ devmode->ttoption = DMTT_SUBDEV;
+ devmode->collate = DMCOLLATE_FALSE;
+ devmode->icmmethod = 0;
+ devmode->icmintent = 0;
+ devmode->mediatype = 0;
+ devmode->dithertype = 0;
+
+ devmode->logpixels = 0;
+ devmode->bitsperpel = 0;
+ devmode->pelswidth = 0;
+ devmode->pelsheight = 0;
+ devmode->displayflags = 0;
+ devmode->displayfrequency = 0;
+ devmode->reserved1 = 0;
+ devmode->reserved2 = 0;
+ devmode->panningwidth = 0;
+ devmode->panningheight = 0;
+
+ devmode->driverextra_data.data = NULL;
+ devmode->driverextra_data.length = 0;
+
+ return devmode;
+}
+
/**
* @internal
*
@@ -720,10 +904,1217 @@ done:
return result;
}
+static WERROR winreg_printer_write_sz(TALLOC_CTX *mem_ctx,
+ struct rpc_pipe_client *pipe_handle,
+ struct policy_handle *key_handle,
+ const char *value,
+ const char *data)
+{
+ struct winreg_String wvalue;
+ DATA_BLOB blob;
+ WERROR result = WERR_OK;
+ NTSTATUS status;
+
+ wvalue.name = value;
+ if (data == NULL) {
+ blob = data_blob_string_const("");
+ } else {
+ if (!push_reg_sz(mem_ctx, NULL, &blob, data)) {
+ DEBUG(0, ("winreg_printer_write_sz: Could not marshall string %s for %s\n",
+ data, wvalue.name));
+ return WERR_NOMEM;
+ }
+ }
+ status = rpccli_winreg_SetValue(pipe_handle,
+ mem_ctx,
+ key_handle,
+ wvalue,
+ REG_SZ,
+ blob.data,
+ blob.length,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("winreg_printer_write_sz: Could not set value %s: %s\n",
+ wvalue.name, win_errstr(result)));
+ if (!W_ERROR_IS_OK(result)) {
+ result = ntstatus_to_werror(status);
+ }
+ }
+
+ return result;
+}
+
+static WERROR winreg_printer_write_dword(TALLOC_CTX *mem_ctx,
+ struct rpc_pipe_client *pipe_handle,
+ struct policy_handle *key_handle,
+ const char *value,
+ uint32_t data)
+{
+ struct winreg_String wvalue;
+ DATA_BLOB blob;
+ WERROR result = WERR_OK;
+ NTSTATUS status;
+
+ wvalue.name = value;
+ blob = data_blob_talloc(mem_ctx, NULL, 4);
+ SIVAL(blob.data, 0, data);
+
+ status = rpccli_winreg_SetValue(pipe_handle,
+ mem_ctx,
+ key_handle,
+ wvalue,
+ REG_DWORD,
+ blob.data,
+ blob.length,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("winreg_printer_write_dword: Could not set value %s: %s\n",
+ wvalue.name, win_errstr(result)));
+ if (!W_ERROR_IS_OK(result)) {
+ result = ntstatus_to_werror(status);
+ }
+ }
+
+ return result;
+}
+
+static WERROR winreg_printer_write_binary(TALLOC_CTX *mem_ctx,
+ struct rpc_pipe_client *pipe_handle,
+ struct policy_handle *key_handle,
+ const char *value,
+ DATA_BLOB blob)
+{
+ struct winreg_String wvalue;
+ WERROR result = WERR_OK;
+ NTSTATUS status;
+
+ wvalue.name = value;
+ status = rpccli_winreg_SetValue(pipe_handle,
+ mem_ctx,
+ key_handle,
+ wvalue,
+ REG_BINARY,
+ blob.data,
+ blob.length,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("winreg_printer_write_binary: Could not set value %s: %s\n",
+ wvalue.name, win_errstr(result)));
+ if (!W_ERROR_IS_OK(result)) {
+ result = ntstatus_to_werror(status);
+ }
+ }
+
+ return result;
+}
+
+static WERROR winreg_printer_query_dword(TALLOC_CTX *mem_ctx,
+ struct rpc_pipe_client *pipe_handle,
+ struct policy_handle *key_handle,
+ const char *value,
+ uint32_t *data)
+{
+ struct winreg_String wvalue;
+ enum winreg_Type type;
+ WERROR result = WERR_OK;
+ uint32_t value_len = 0;
+ NTSTATUS status;
+ DATA_BLOB blob;
+
+ wvalue.name = value;
+ status = rpccli_winreg_QueryValue(pipe_handle,
+ mem_ctx,
--
Samba Shared Repository
More information about the samba-cvs
mailing list