diff options
author | Andreas Schneider <asn@samba.org> | 2011-02-01 15:29:48 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-02-07 12:32:02 +0100 |
commit | 1f0c766fa6f776f7ec25cab8634e2ad1f6c7aa50 (patch) | |
tree | a597be445b4e5bee6820cae1cca72f25fe3e5b34 | |
parent | df75045e0d52b01f650f40e62c65426b5ce2264e (diff) | |
download | samba-1f0c766fa6f776f7ec25cab8634e2ad1f6c7aa50.tar.gz samba-1f0c766fa6f776f7ec25cab8634e2ad1f6c7aa50.tar.bz2 samba-1f0c766fa6f776f7ec25cab8634e2ad1f6c7aa50.zip |
s3-rpc_server: Migrated spoolss to dcerpc_winreg_query_dword.
Signed-off-by: Günther Deschner <gd@samba.org>
-rw-r--r-- | source3/rpc_server/srv_spoolss_util.c | 90 |
1 files changed, 10 insertions, 80 deletions
diff --git a/source3/rpc_server/srv_spoolss_util.c b/source3/rpc_server/srv_spoolss_util.c index 1e3a533f7a..9f9611de18 100644 --- a/source3/rpc_server/srv_spoolss_util.c +++ b/source3/rpc_server/srv_spoolss_util.c @@ -655,81 +655,6 @@ done: return result; } -static WERROR winreg_printer_query_dword(TALLOC_CTX *mem_ctx, - struct dcerpc_binding_handle *winreg_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; - uint32_t data_size = 0; - NTSTATUS status; - DATA_BLOB blob; - - wvalue.name = value; - status = dcerpc_winreg_QueryValue(winreg_handle, - mem_ctx, - key_handle, - &wvalue, - &type, - NULL, - &data_size, - &value_len, - &result); - if (!NT_STATUS_IS_OK(status)) { - result = ntstatus_to_werror(status); - } - if (!W_ERROR_IS_OK(result)) { - DEBUG(2, ("winreg_printer_query_dword: Could not query value %s: %s\n", - wvalue.name, win_errstr(result))); - goto done; - } - - if (type != REG_DWORD) { - result = WERR_INVALID_DATATYPE; - goto done; - } - - if (data_size != 4) { - result = WERR_INVALID_DATA; - goto done; - } - - blob = data_blob_talloc(mem_ctx, NULL, data_size); - if (blob.data == NULL) { - result = WERR_NOMEM; - goto done; - } - value_len = 0; - - status = dcerpc_winreg_QueryValue(winreg_handle, - mem_ctx, - key_handle, - &wvalue, - &type, - blob.data, - &data_size, - &value_len, - &result); - if (!NT_STATUS_IS_OK(status)) { - result = ntstatus_to_werror(status); - } - if (!W_ERROR_IS_OK(result)) { - DEBUG(2, ("winreg_printer_query_dword: Could not query value %s: %s\n", - wvalue.name, win_errstr(result))); - goto done; - } - - if (data) { - *data = IVAL(blob.data, 0); - } -done: - return result; -} - static WERROR winreg_printer_write_multi_sz(TALLOC_CTX *mem_ctx, struct dcerpc_binding_handle *winreg_handle, struct policy_handle *key_handle, @@ -2955,6 +2880,7 @@ WERROR winreg_printer_get_changeid(TALLOC_CTX *mem_ctx, struct policy_handle hive_hnd, key_hnd; uint32_t changeid = 0; char *path; + NTSTATUS status; WERROR result; TALLOC_CTX *tmp_ctx; @@ -2990,11 +2916,15 @@ WERROR winreg_printer_get_changeid(TALLOC_CTX *mem_ctx, DEBUG(10, ("winreg_printer_get_changeid: get changeid from %s\n", path)); - result = winreg_printer_query_dword(tmp_ctx, - winreg_handle, - &key_hnd, - "ChangeID", - &changeid); + status = dcerpc_winreg_query_dword(tmp_ctx, + winreg_handle, + &key_hnd, + "ChangeID", + &changeid, + &result); + if (!NT_STATUS_IS_OK(status)) { + result = ntstatus_to_werror(status); + } if (!W_ERROR_IS_OK(result)) { goto done; } |