summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-09-30 20:00:52 +0200
committerGünther Deschner <gd@samba.org>2009-10-01 11:40:30 +0200
commitad836c4d48e7c7a8a6f1d240f20cca730487a651 (patch)
treeaeab897279f88524727cc4c7703ff5e1dca77938 /source3
parent98245727c9a314849248e5419b347b444e79a2f7 (diff)
downloadsamba-ad836c4d48e7c7a8a6f1d240f20cca730487a651.tar.gz
samba-ad836c4d48e7c7a8a6f1d240f20cca730487a651.tar.bz2
samba-ad836c4d48e7c7a8a6f1d240f20cca730487a651.zip
s3-registry: use pull_reg_sz() where appropriate.
(and move away from rpcstr_pull and rpcstr_pull_talloc). Guenther
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/printing/nt_printing.c9
-rw-r--r--source3/registry/reg_objects.c9
-rw-r--r--source3/rpcclient/cmd_spoolss.c12
-rw-r--r--source3/services/services_db.c14
-rw-r--r--source3/utils/net_rpc_printer.c12
-rw-r--r--source3/utils/net_rpc_registry.c10
7 files changed, 36 insertions, 32 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 25b04fe510..7fff5a6406 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5126,7 +5126,7 @@ int regval_ctr_delvalue(struct regval_ctr *ctr, const char *name);
struct regval_blob* regval_ctr_getvalue(struct regval_ctr *ctr,
const char *name);
uint32 regval_dword(struct regval_blob *val);
-char *regval_sz(struct regval_blob *val);
+const char *regval_sz(struct regval_blob *val);
/* The following definitions come from registry/reg_perfcount.c */
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 3c7f053ff2..9995dfe472 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -3436,6 +3436,7 @@ bool is_printer_published(Printer_entry *print_hnd, int snum,
WERROR win_rc;
int i;
bool ret = False;
+ DATA_BLOB blob;
win_rc = get_a_printer(print_hnd, &printer, 2, lp_servicename(snum));
@@ -3452,16 +3453,18 @@ bool is_printer_published(Printer_entry *print_hnd, int snum,
/* fetching printer guids really ought to be a separate function. */
if ( guid ) {
- fstring guid_str;
+ char *guid_str;
/* We used to store the guid as REG_BINARY, then swapped
to REG_SZ for Vista compatibility so check for both */
switch ( regval_type(guid_val) ){
case REG_SZ:
- rpcstr_pull( guid_str, regval_data_p(guid_val),
- sizeof(guid_str)-1, -1, STR_TERMINATE );
+ blob = data_blob_const(regval_data_p(guid_val),
+ regval_size(guid_val));
+ pull_reg_sz(talloc_tos(), &blob, (const char **)&guid_str);
ret = NT_STATUS_IS_OK(GUID_from_string( guid_str, guid ));
+ talloc_free(guid_str);
break;
case REG_BINARY:
if ( regval_size(guid_val) != sizeof(struct GUID) ) {
diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c
index 21ebba6540..b4b8ff2630 100644
--- a/source3/registry/reg_objects.c
+++ b/source3/registry/reg_objects.c
@@ -602,11 +602,12 @@ uint32 regval_dword(struct regval_blob *val)
return the data_p as a character string
**********************************************************************/
-char *regval_sz(struct regval_blob *val)
+const char *regval_sz(struct regval_blob *val)
{
- char *data = NULL;
+ const char *data = NULL;
+ DATA_BLOB blob = data_blob_const(regval_data_p(val), regval_size(val));
+
+ pull_reg_sz(talloc_tos(), &blob, &data);
- rpcstr_pull_talloc(talloc_tos(), &data,
- regval_data_p(val), regval_size(val),0);
return data;
}
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 6a525514a4..8b1a6eac03 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -689,7 +689,8 @@ static WERROR cmd_spoolss_getprinter(struct rpc_pipe_client *cli,
static void display_reg_value(struct regval_blob value)
{
- char *text = NULL;
+ const char *text = NULL;
+ DATA_BLOB blob;
switch(value.type) {
case REG_DWORD:
@@ -697,11 +698,8 @@ static void display_reg_value(struct regval_blob value)
*((uint32_t *) value.data_p));
break;
case REG_SZ:
- rpcstr_pull_talloc(talloc_tos(),
- &text,
- value.data_p,
- value.size,
- STR_TERMINATE);
+ blob = data_blob_const(value.data_p, value.size);
+ pull_reg_sz(talloc_tos(), &blob, &text);
printf("%s: REG_SZ: %s\n", value.valuename, text ? text : "");
break;
case REG_BINARY: {
@@ -725,7 +723,7 @@ static void display_reg_value(struct regval_blob value)
case REG_MULTI_SZ: {
uint32_t i;
const char **values;
- DATA_BLOB blob = data_blob_const(value.data_p, value.size);
+ blob = data_blob_const(value.data_p, value.size);
if (!pull_reg_multi_sz(NULL, &blob, &values)) {
d_printf("pull_reg_multi_sz failed\n");
diff --git a/source3/services/services_db.c b/source3/services/services_db.c
index b36774484d..b610c922a9 100644
--- a/source3/services/services_db.c
+++ b/source3/services/services_db.c
@@ -611,12 +611,13 @@ bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, SEC_DESC *sec_desc,
const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token )
{
- char *display_name = NULL;
+ const char *display_name = NULL;
struct registry_key_handle *key = NULL;
struct regval_ctr *values = NULL;
struct regval_blob *val = NULL;
char *path = NULL;
WERROR wresult;
+ DATA_BLOB blob;
/* now add the security descriptor */
@@ -644,7 +645,8 @@ const char *svcctl_lookup_dispname(TALLOC_CTX *ctx, const char *name, NT_USER_TO
if ( !(val = regval_ctr_getvalue( values, "DisplayName" )) )
goto fail;
- rpcstr_pull_talloc(ctx, &display_name, regval_data_p(val), regval_size(val), 0 );
+ blob = data_blob_const(regval_data_p(val), regval_size(val));
+ pull_reg_sz(ctx, &blob, &display_name);
TALLOC_FREE( key );
@@ -661,12 +663,13 @@ fail:
const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER_TOKEN *token )
{
- char *description = NULL;
+ const char *description = NULL;
struct registry_key_handle *key = NULL;
struct regval_ctr *values = NULL;
struct regval_blob *val = NULL;
char *path = NULL;
WERROR wresult;
+ DATA_BLOB blob;
/* now add the security descriptor */
@@ -695,7 +698,10 @@ const char *svcctl_lookup_description(TALLOC_CTX *ctx, const char *name, NT_USER
TALLOC_FREE( key );
return "Unix Service";
}
- rpcstr_pull_talloc(ctx, &description, regval_data_p(val), regval_size(val), 0 );
+
+ blob = data_blob_const(regval_data_p(val), regval_size(val));
+ pull_reg_sz(ctx, &blob, &description);
+
TALLOC_FREE(key);
return description;
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index 9a8e0a9ba6..5652caf834 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -72,7 +72,8 @@ static void display_print_driver3(struct spoolss_DriverInfo3 *r)
static void display_reg_value(const char *subkey, struct regval_blob value)
{
- char *text;
+ const char *text;
+ DATA_BLOB blob;
switch(value.type) {
case REG_DWORD:
@@ -81,11 +82,8 @@ static void display_reg_value(const char *subkey, struct regval_blob value)
break;
case REG_SZ:
- rpcstr_pull_talloc(talloc_tos(),
- &text,
- value.data_p,
- value.size,
- STR_TERMINATE);
+ blob = data_blob_const(value.data_p, value.size);
+ pull_reg_sz(talloc_tos(), &blob, &text);
if (!text) {
break;
}
@@ -102,7 +100,7 @@ static void display_reg_value(const char *subkey, struct regval_blob value)
case REG_MULTI_SZ: {
uint32_t i;
const char **values;
- DATA_BLOB blob = data_blob_const(value.data_p, value.size);
+ blob = data_blob_const(value.data_p, value.size);
if (!pull_reg_multi_sz(NULL, &blob, &values)) {
d_printf("pull_reg_multi_sz failed\n");
diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c
index 1ad1d74ca0..d9eb9b3c09 100644
--- a/source3/utils/net_rpc_registry.c
+++ b/source3/utils/net_rpc_registry.c
@@ -895,8 +895,9 @@ static int rpc_registry_save(struct net_context *c, int argc, const char **argv
static void dump_values( REGF_NK_REC *nk )
{
int i, j;
- char *data_str = NULL;
+ const char *data_str = NULL;
uint32 data_size, data;
+ DATA_BLOB blob;
if ( !nk->values )
return;
@@ -908,11 +909,8 @@ static void dump_values( REGF_NK_REC *nk )
data_size = nk->values[i].data_size & ~VK_DATA_IN_OFFSET;
switch ( nk->values[i].type ) {
case REG_SZ:
- rpcstr_pull_talloc(talloc_tos(),
- &data_str,
- nk->values[i].data,
- -1,
- STR_TERMINATE);
+ blob = data_blob_const(nk->values[i].data, data_size);
+ pull_reg_sz(talloc_tos(), &blob, &data_str);
if (!data_str) {
break;
}