summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVicentiu Ciorbaru <cvicentiu@gmail.com>2011-07-12 19:42:15 +0300
committerAndreas Schneider <asn@samba.org>2011-07-13 11:30:55 +0200
commita336cc44d94532d064cb272f3c2ff3c5b9230039 (patch)
treebeb458666e1e66ce5bbad667ede4beb8c3650111 /source3
parent4558225cdd9c29a4b683101f39f627bf61a580af (diff)
downloadsamba-a336cc44d94532d064cb272f3c2ff3c5b9230039.tar.gz
samba-a336cc44d94532d064cb272f3c2ff3c5b9230039.tar.bz2
samba-a336cc44d94532d064cb272f3c2ff3c5b9230039.zip
s3-rpc_client: Migrate to dcerpc_winreg_enumvals() function.
The functions that called winreg_printer_enumvalues() function now use dcerpc_winreg_enumvals(). Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_client/cli_winreg_spoolss.c164
1 files changed, 142 insertions, 22 deletions
diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c
index f742a47759..a7e2cdb9b9 100644
--- a/source3/rpc_client/cli_winreg_spoolss.c
+++ b/source3/rpc_client/cli_winreg_spoolss.c
@@ -1608,7 +1608,7 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
struct spoolss_PrinterInfo2 *info2;
uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
struct policy_handle hive_hnd, key_hnd;
- struct spoolss_PrinterEnumValues *enum_values = NULL;
+ struct spoolss_PrinterEnumValues enum_value;
struct spoolss_PrinterEnumValues *v = NULL;
enum ndr_err_code ndr_err;
DATA_BLOB blob;
@@ -1618,6 +1618,9 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
char *path;
NTSTATUS status;
WERROR result = WERR_OK;
+ const char **enum_names = NULL;
+ enum winreg_Type *enum_types = NULL;
+ DATA_BLOB *enum_data_blobs = NULL;
TALLOC_CTX *tmp_ctx;
tmp_ctx = talloc_stackframe();
@@ -1645,11 +1648,18 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
goto done;
}
- result = winreg_printer_enumvalues(tmp_ctx,
- winreg_handle,
- &key_hnd,
- &num_values,
- &enum_values);
+ status = dcerpc_winreg_enumvals(tmp_ctx,
+ winreg_handle,
+ &key_hnd,
+ &num_values,
+ &enum_names,
+ &enum_types,
+ &enum_data_blobs,
+ &result);
+ if (!NT_STATUS_IS_OK(status)){
+ result = ntstatus_to_werror(status);
+ }
+
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("winreg_get_printer: Could not enumerate values in %s: %s\n",
path, win_errstr(result)));
@@ -1675,7 +1685,15 @@ WERROR winreg_get_printer(TALLOC_CTX *mem_ctx,
FILL_STRING(info2, EMPTY_STRING, info2->parameters);
for (i = 0; i < num_values; i++) {
- v = &enum_values[i];
+ enum_value.value_name = enum_names[i];
+ enum_value.value_name_len = 2*strlen_m_term(enum_names[i]);
+ enum_value.type = enum_types[i];
+ enum_value.data_length = enum_data_blobs[i].length;
+ enum_value.data = NULL;
+ if (enum_value.data_length != 0){
+ enum_value.data = &enum_data_blobs[i];
+ }
+ v = &enum_value;
result = winreg_enumval_to_sz(info2,
v,
@@ -2343,6 +2361,7 @@ WERROR winreg_enum_printer_dataex(TALLOC_CTX *mem_ctx,
uint32_t *pnum_values,
struct spoolss_PrinterEnumValues **penum_values)
{
+ uint32_t i;
uint32_t access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
struct policy_handle hive_hnd, key_hnd;
@@ -2350,6 +2369,10 @@ WERROR winreg_enum_printer_dataex(TALLOC_CTX *mem_ctx,
uint32_t num_values = 0;
char *path;
WERROR result = WERR_OK;
+ NTSTATUS status;
+ const char **enum_names = NULL;
+ enum winreg_Type *enum_types = NULL;
+ DATA_BLOB *enum_data_blobs = NULL;
TALLOC_CTX *tmp_ctx;
@@ -2378,17 +2401,48 @@ WERROR winreg_enum_printer_dataex(TALLOC_CTX *mem_ctx,
goto done;
}
- result = winreg_printer_enumvalues(tmp_ctx,
- winreg_handle,
- &key_hnd,
- &num_values,
- &enum_values);
+ status = dcerpc_winreg_enumvals(tmp_ctx,
+ winreg_handle,
+ &key_hnd,
+ &num_values,
+ &enum_names,
+ &enum_types,
+ &enum_data_blobs,
+ &result);
+ if (!NT_STATUS_IS_OK(status)){
+ result = ntstatus_to_werror(status);
+ }
+
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("winreg_enum_printer_dataex: Could not enumerate values in %s: %s\n",
key, win_errstr(result)));
goto done;
}
+ enum_values = talloc_array(tmp_ctx, struct spoolss_PrinterEnumValues, num_values);
+ if (enum_values == NULL){
+ result = WERR_NOMEM;
+ DEBUG(0, ("winreg_enum_printer_dataex: Could not enumerate values in %s: %s\n",
+ key, win_errstr(result)));
+ goto done;
+ }
+
+ for (i = 0; i < num_values; i++){
+ enum_values[i].value_name = enum_names[i];
+ enum_values[i].value_name_len = strlen_m_term(enum_names[i]) * 2;
+ enum_values[i].type = enum_types[i];
+ enum_values[i].data_length = enum_data_blobs[i].length;
+ enum_values[i].data = NULL;
+
+ if (enum_values[i].data_length != 0){
+ enum_values[i].data = &enum_data_blobs[i];
+ }
+ }
+
+ enum_names = talloc_move(mem_ctx, &enum_names);
+ enum_types = talloc_move(mem_ctx, &enum_types);
+ enum_data_blobs = talloc_move(mem_ctx, &enum_data_blobs);
+
*pnum_values = num_values;
if (penum_values) {
*penum_values = talloc_move(mem_ctx, &enum_values);
@@ -2917,6 +2971,10 @@ WERROR winreg_printer_enumforms1(TALLOC_CTX *mem_ctx,
uint32_t num_builtin = ARRAY_SIZE(builtin_forms1);
uint32_t i;
WERROR result;
+ NTSTATUS status;
+ const char **enum_names = NULL;
+ enum winreg_Type *enum_types = NULL;
+ DATA_BLOB *enum_data_blobs = NULL;
TALLOC_CTX *tmp_ctx;
tmp_ctx = talloc_stackframe();
@@ -2947,11 +3005,43 @@ WERROR winreg_printer_enumforms1(TALLOC_CTX *mem_ctx,
goto done;
}
- result = winreg_printer_enumvalues(tmp_ctx,
- winreg_handle,
- &key_hnd,
- &num_values,
- &enum_values);
+ status = dcerpc_winreg_enumvals(tmp_ctx,
+ winreg_handle,
+ &key_hnd,
+ &num_values,
+ &enum_names,
+ &enum_types,
+ &enum_data_blobs,
+ &result);
+ if (!NT_STATUS_IS_OK(status)){
+ result = ntstatus_to_werror(status);
+ }
+
+ if (!W_ERROR_IS_OK(result)) {
+ DEBUG(0, ("winreg_printer_enumforms1: Could not enumerate values in %s: %s\n",
+ TOP_LEVEL_CONTROL_FORMS_KEY, win_errstr(result)));
+ goto done;
+ }
+
+ enum_values = talloc_zero_array(tmp_ctx,
+ struct spoolss_PrinterEnumValues,
+ num_values);
+ if (enum_values == NULL){
+ result = WERR_NOMEM;
+ goto done;
+ }
+
+ for (i = 0; i < num_values; i++){
+ enum_values[i].value_name = enum_names[i];
+ enum_values[i].value_name_len = strlen_m_term(enum_names[i]) * 2;
+ enum_values[i].type = enum_types[i];
+ enum_values[i].data_length = enum_data_blobs[i].length;
+ enum_values[i].data = NULL;
+ if (enum_values[i].data_length != 0){
+ enum_values[i].data = &enum_data_blobs[i];
+ }
+ }
+
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("winreg_printer_enumforms1: Could not enumerate values in %s: %s\n",
TOP_LEVEL_CONTROL_FORMS_KEY, win_errstr(result)));
@@ -3678,7 +3768,11 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
uint32_t num_values = 0;
TALLOC_CTX *tmp_ctx;
WERROR result;
+ NTSTATUS status;
uint32_t i;
+ const char **enum_names = NULL;
+ enum winreg_Type *enum_types = NULL;
+ DATA_BLOB *enum_data_blobs = NULL;
ZERO_STRUCT(hive_hnd);
ZERO_STRUCT(key_hnd);
@@ -3728,11 +3822,18 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
goto done;
}
- result = winreg_printer_enumvalues(tmp_ctx,
- winreg_handle,
- &key_hnd,
- &num_values,
- &enum_values);
+ status = dcerpc_winreg_enumvals(tmp_ctx,
+ winreg_handle,
+ &key_hnd,
+ &num_values,
+ &enum_names,
+ &enum_types,
+ &enum_data_blobs,
+ &result);
+ if (!NT_STATUS_IS_OK(status)){
+ result = ntstatus_to_werror(status);
+ }
+
if (!W_ERROR_IS_OK(result)) {
DEBUG(0, ("winreg_get_driver: "
"Could not enumerate values for (%s,%s,%d): %s\n",
@@ -3741,6 +3842,25 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
goto done;
}
+ enum_values = talloc_zero_array(tmp_ctx,
+ struct spoolss_PrinterEnumValues,
+ num_values);
+ if (enum_values == NULL){
+ result = WERR_NOMEM;
+ goto done;
+ }
+
+ for (i = 0; i < num_values; i++){
+ enum_values[i].value_name = enum_names[i];
+ enum_values[i].value_name_len = strlen_m_term(enum_names[i]) * 2;
+ enum_values[i].type = enum_types[i];
+ enum_values[i].data_length = enum_data_blobs[i].length;
+ enum_values[i].data = NULL;
+ if (enum_values[i].data_length != 0){
+ enum_values[i].data = &enum_data_blobs[i];
+ }
+ }
+
info8 = talloc_zero(tmp_ctx, struct spoolss_DriverInfo8);
if (info8 == NULL) {
result = WERR_NOMEM;