summaryrefslogtreecommitdiff
path: root/source4/rpc_server/winreg/rpc_winreg.c
diff options
context:
space:
mode:
authorAndrew Kroeger <andrew@sprocks.gotdns.com>2008-01-18 01:50:33 +0100
committerJelmer Vernooij <jelmer@samba.org>2008-01-18 03:41:59 +0100
commit4d8a60f617f941ff6481bcfbac73d7ed69e43daa (patch)
tree3e1dc32100479edcc6992442309df9a595524fd4 /source4/rpc_server/winreg/rpc_winreg.c
parent158a2eed334512c28a7101b3af2c364b4ac1b3fd (diff)
downloadsamba-4d8a60f617f941ff6481bcfbac73d7ed69e43daa.tar.gz
samba-4d8a60f617f941ff6481bcfbac73d7ed69e43daa.tar.bz2
samba-4d8a60f617f941ff6481bcfbac73d7ed69e43daa.zip
When Windows initially creates a new value, the value name is "New Value #1".
The '#' character was causing problems, as it was not being escaped for the dn, but the failure returned by ldb_dn_add_child_fmt() was not being caught. This was causing the new value to be added on the parent key, not the current key. When attempting to delete the new value (now on the parent key) the same escaping error was returned by ldb_dn_add_child_fmt(), causing the delete to delete the key and not the value. When attempting to rename a value, Windows first tries to ensure the new name does not already exist. When a value does not exist, Windows expects a return value of WERR_BADFILE, but WERR_NOT_FOUND was being returned instead. Providing the WERR_BADFILE that Windows expects allows values to be renamed. (This used to be commit 94fb39cfd967455ce5a554720c1c7e6183f91056)
Diffstat (limited to 'source4/rpc_server/winreg/rpc_winreg.c')
-rw-r--r--source4/rpc_server/winreg/rpc_winreg.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c
index 681e3b918f..7eba428aef 100644
--- a/source4/rpc_server/winreg/rpc_winreg.c
+++ b/source4/rpc_server/winreg/rpc_winreg.c
@@ -411,7 +411,15 @@ static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call,
&value_type, &value_data);
if (!W_ERROR_IS_OK(result)) {
- return result;
+ /*
+ * Windows expects WERR_BADFILE when a particular value
+ * is not found. If we receive WERR_NOT_FOUND from the lower
+ * layer calls, translate it here to return what is expected.
+ */
+ if (W_ERROR_EQUAL(result, WERR_NOT_FOUND))
+ return WERR_BADFILE;
+ else
+ return result;
}
/* Just asking for the size of the buffer */