diff options
author | Gerald Carter <jerry@samba.org> | 2003-01-19 05:04:03 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-01-19 05:04:03 +0000 |
commit | dd99a6a81619c46ea512076f0ca860748d2fae4a (patch) | |
tree | cb6d9a70eed21a6306bd040ebe6153e107ad652e | |
parent | d7478da11dc5974d95567023a1a01f9bca52250f (diff) | |
download | samba-dd99a6a81619c46ea512076f0ca860748d2fae4a.tar.gz samba-dd99a6a81619c46ea512076f0ca860748d2fae4a.tar.bz2 samba-dd99a6a81619c46ea512076f0ca860748d2fae4a.zip |
strip any trailing \'s from reg key names in an open
(This used to be commit d13f727c4b442d2327d134a0944c15f4cdc82aa2)
-rw-r--r-- | source3/rpc_server/srv_reg_nt.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source3/rpc_server/srv_reg_nt.c b/source3/rpc_server/srv_reg_nt.c index db711dc6af..8fc038eab5 100644 --- a/source3/rpc_server/srv_reg_nt.c +++ b/source3/rpc_server/srv_reg_nt.c @@ -85,10 +85,18 @@ static NTSTATUS open_registry_key(pipes_struct *p, POLICY_HND *hnd, REGISTRY_KEY REGISTRY_KEY *regkey = NULL; NTSTATUS result = NT_STATUS_OK; REGSUBKEY_CTR subkeys; + pstring subkeyname2; + int subkey_len; DEBUG(7,("open_registry_key: name = [%s][%s]\n", parent ? parent->name : "NULL", subkeyname)); + /* strip any trailing '\'s */ + pstrcpy( subkeyname2, subkeyname ); + subkey_len = strlen ( subkeyname2 ); + if ( subkey_len && subkeyname2[subkey_len-1] == '\\' ) + subkeyname2[subkey_len-1] = '\0'; + if ((regkey=(REGISTRY_KEY*)malloc(sizeof(REGISTRY_KEY))) == NULL) return NT_STATUS_NO_MEMORY; @@ -101,7 +109,7 @@ static NTSTATUS open_registry_key(pipes_struct *p, POLICY_HND *hnd, REGISTRY_KEY * not do this stupidity. --jerry */ - if (!subkeyname || !*subkeyname ) { + if ( !subkey_len ) { pstrcpy( regkey->name, parent->name ); } else { @@ -110,7 +118,7 @@ static NTSTATUS open_registry_key(pipes_struct *p, POLICY_HND *hnd, REGISTRY_KEY pstrcat( regkey->name, parent->name ); pstrcat( regkey->name, "\\" ); } - pstrcat( regkey->name, subkeyname ); + pstrcat( regkey->name, subkeyname2 ); } /* Look up the table of registry I/O operations */ |