summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVicentiu Ciorbaru <cvicentiu@gmail.com>2011-07-12 19:54:45 +0300
committerAndreas Schneider <asn@cryptomilk.org>2011-07-13 12:42:02 +0200
commite858ec6e92c0232bbf82dc117c03b71e9a413be3 (patch)
tree1a539262bde773b648b70bbba789fd1508b1b84b /source3
parent0b1ba88f228592bd7ced01025a4045c946096ab4 (diff)
downloadsamba-e858ec6e92c0232bbf82dc117c03b71e9a413be3.tar.gz
samba-e858ec6e92c0232bbf82dc117c03b71e9a413be3.tar.bz2
samba-e858ec6e92c0232bbf82dc117c03b71e9a413be3.zip
s3-rpc_server: Removed no longer used functions.
Removed winreg_printer_delete_subkeys(). Removed winreg_printer_enumvalues(). Signed-off-by: Andreas Schneider <asn@samba.org> Autobuild-User: Andreas Schneider <asn@cryptomilk.org> Autobuild-Date: Wed Jul 13 12:42:02 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_client/cli_winreg_spoolss.c281
1 files changed, 0 insertions, 281 deletions
diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c
index 83ea617946..9b7c72421c 100644
--- a/source3/rpc_client/cli_winreg_spoolss.c
+++ b/source3/rpc_client/cli_winreg_spoolss.c
@@ -320,287 +320,6 @@ static char *winreg_printer_data_keyname(TALLOC_CTX *mem_ctx, const char *printe
return talloc_asprintf(mem_ctx, "%s\\%s", TOP_LEVEL_PRINT_PRINTERS_KEY, printer);
}
-/**
- * @internal
- *
- * @brief Enumerate values of an opened key handle and retrieve the data.
- *
- * @param[in] mem_ctx The memory context to use.
- *
- * @param[in] winreg_handle The binding handle for the rpc connection.
- *
- * @param[in] key_hnd The opened key handle.
- *
- * @param[out] pnum_values A pointer to store he number of values found.
- *
- * @param[out] pnum_values A pointer to store the number of values we found.
- *
- * @return WERR_OK on success, the corresponding DOS error
- * code if something gone wrong.
- */
-static WERROR winreg_printer_enumvalues(TALLOC_CTX *mem_ctx,
- struct dcerpc_binding_handle *winreg_handle,
- struct policy_handle *key_hnd,
- uint32_t *pnum_values,
- struct spoolss_PrinterEnumValues **penum_values)
-{
- TALLOC_CTX *tmp_ctx;
- uint32_t num_subkeys, max_subkeylen, max_classlen;
- uint32_t num_values, max_valnamelen, max_valbufsize;
- uint32_t secdescsize;
- uint32_t i;
- NTTIME last_changed_time;
- struct winreg_String classname;
-
- struct spoolss_PrinterEnumValues *enum_values;
-
- WERROR result = WERR_OK;
- NTSTATUS status;
-
- tmp_ctx = talloc_stackframe();
- if (tmp_ctx == NULL) {
- return WERR_NOMEM;
- }
-
- ZERO_STRUCT(classname);
-
- status = dcerpc_winreg_QueryInfoKey(winreg_handle,
- tmp_ctx,
- key_hnd,
- &classname,
- &num_subkeys,
- &max_subkeylen,
- &max_classlen,
- &num_values,
- &max_valnamelen,
- &max_valbufsize,
- &secdescsize,
- &last_changed_time,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("winreg_printer_enumvalues: Could not query info: %s\n",
- nt_errstr(status)));
- result = ntstatus_to_werror(status);
- goto error;
- }
- if (!W_ERROR_IS_OK(result)) {
- DEBUG(0, ("winreg_printer_enumvalues: Could not query info: %s\n",
- win_errstr(result)));
- goto error;
- }
-
- if (num_values == 0) {
- *pnum_values = 0;
- TALLOC_FREE(tmp_ctx);
- return WERR_OK;
- }
-
- enum_values = talloc_array(tmp_ctx, struct spoolss_PrinterEnumValues, num_values);
- if (enum_values == NULL) {
- result = WERR_NOMEM;
- goto error;
- }
-
- for (i = 0; i < num_values; i++) {
- struct spoolss_PrinterEnumValues val;
- struct winreg_ValNameBuf name_buf;
- enum winreg_Type type = REG_NONE;
- uint8_t *data;
- uint32_t data_size;
- uint32_t length;
- char n = '\0';
-
- name_buf.name = &n;
- name_buf.size = max_valnamelen + 2;
- name_buf.length = 0;
-
- data_size = max_valbufsize;
- data = NULL;
- if (data_size) {
- data = (uint8_t *) talloc_zero_size(tmp_ctx, data_size);
- }
- length = 0;
-
- status = dcerpc_winreg_EnumValue(winreg_handle,
- tmp_ctx,
- key_hnd,
- i,
- &name_buf,
- &type,
- data,
- data_size ? &data_size : NULL,
- &length,
- &result);
- if (W_ERROR_EQUAL(result, WERR_NO_MORE_ITEMS) ) {
- result = WERR_OK;
- status = NT_STATUS_OK;
- break;
- }
-
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("winreg_printer_enumvalues: Could not enumerate values: %s\n",
- nt_errstr(status)));
- result = ntstatus_to_werror(status);
- goto error;
- }
- if (!W_ERROR_IS_OK(result)) {
- DEBUG(0, ("winreg_printer_enumvalues: Could not enumerate values: %s\n",
- win_errstr(result)));
- goto error;
- }
-
- if (name_buf.name == NULL) {
- result = WERR_INVALID_PARAMETER;
- goto error;
- }
-
- val.value_name = talloc_strdup(enum_values, name_buf.name);
- if (val.value_name == NULL) {
- result = WERR_NOMEM;
- goto error;
- }
- val.value_name_len = strlen_m_term(val.value_name) * 2;
-
- val.type = type;
- val.data_length = length;
- val.data = NULL;
- if (val.data_length) {
- val.data = talloc(enum_values, DATA_BLOB);
- if (val.data == NULL) {
- result = WERR_NOMEM;
- goto error;
- }
- *val.data = data_blob_talloc(val.data, data, val.data_length);
- }
-
- enum_values[i] = val;
- }
-
- *pnum_values = num_values;
- if (penum_values) {
- *penum_values = talloc_move(mem_ctx, &enum_values);
- }
-
- result = WERR_OK;
-
- error:
- TALLOC_FREE(tmp_ctx);
- return result;
-}
-
-/**
- * @internal
- *
- * @brief A function to delete a key and its subkeys recurively.
- *
- * @param[in] mem_ctx The memory context to use.
- *
- * @param[in] winreg_handle The binding handle for the rpc connection.
- *
- * @param[in] hive_handle A opened hive handle to the key.
- *
- * @param[in] access_mask The access mask to access the key.
- *
- * @param[in] key The key to delete
- *
- * @return WERR_OK on success, the corresponding DOS error
- * code if something gone wrong.
- */
-static WERROR winreg_printer_delete_subkeys(TALLOC_CTX *mem_ctx,
- struct dcerpc_binding_handle *winreg_handle,
- struct policy_handle *hive_handle,
- uint32_t access_mask,
- const char *key)
-{
- const char **subkeys = NULL;
- uint32_t num_subkeys = 0;
- struct policy_handle key_hnd;
- struct winreg_String wkey = { 0, };
- WERROR result = WERR_OK;
- NTSTATUS status;
- uint32_t i;
-
- ZERO_STRUCT(key_hnd);
- wkey.name = key;
-
- DEBUG(2, ("winreg_printer_delete_subkeys: delete key %s\n", key));
- /* open the key */
- status = dcerpc_winreg_OpenKey(winreg_handle,
- mem_ctx,
- hive_handle,
- wkey,
- 0,
- access_mask,
- &key_hnd,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("winreg_printer_delete_subkeys: Could not open key %s: %s\n",
- wkey.name, nt_errstr(status)));
- return ntstatus_to_werror(status);
- }
- if (!W_ERROR_IS_OK(result)) {
- DEBUG(0, ("winreg_printer_delete_subkeys: Could not open key %s: %s\n",
- wkey.name, win_errstr(result)));
- return result;
- }
-
- status = dcerpc_winreg_enum_keys(mem_ctx,
- winreg_handle,
- &key_hnd,
- &num_subkeys,
- &subkeys,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- result = ntstatus_to_werror(status);
- }
- if (!W_ERROR_IS_OK(result)) {
- goto done;
- }
-
- for (i = 0; i < num_subkeys; i++) {
- /* create key + subkey */
- char *subkey = talloc_asprintf(mem_ctx, "%s\\%s", key, subkeys[i]);
- if (subkey == NULL) {
- goto done;
- }
-
- DEBUG(2, ("winreg_printer_delete_subkeys: delete subkey %s\n", subkey));
- result = winreg_printer_delete_subkeys(mem_ctx,
- winreg_handle,
- hive_handle,
- access_mask,
- subkey);
- if (!W_ERROR_IS_OK(result)) {
- goto done;
- }
- }
-
- if (is_valid_policy_hnd(&key_hnd)) {
- WERROR ignore;
- dcerpc_winreg_CloseKey(winreg_handle, mem_ctx, &key_hnd, &ignore);
- }
-
- wkey.name = key;
-
- status = dcerpc_winreg_DeleteKey(winreg_handle,
- mem_ctx,
- hive_handle,
- wkey,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- result = ntstatus_to_werror(status);
- }
-
-done:
- if (is_valid_policy_hnd(&key_hnd)) {
- WERROR ignore;
-
- dcerpc_winreg_CloseKey(winreg_handle, mem_ctx, &key_hnd, &ignore);
- }
-
- return result;
-}
-
static WERROR winreg_printer_opendriver(TALLOC_CTX *mem_ctx,
struct dcerpc_binding_handle *winreg_handle,
const char *drivername,