diff options
author | Gerald Carter <jerry@samba.org> | 2003-01-19 05:04:20 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2003-01-19 05:04:20 +0000 |
commit | 52b65f70caa1c6ac3f978cd3a349de921fe1eea7 (patch) | |
tree | a5157d22c4618b44c1ac5486246447f31afea7f5 /source3/rpc_server/srv_reg_nt.c | |
parent | ea5ffa0371712f822093240a42a9e93c9ff7a28d (diff) | |
download | samba-52b65f70caa1c6ac3f978cd3a349de921fe1eea7.tar.gz samba-52b65f70caa1c6ac3f978cd3a349de921fe1eea7.tar.bz2 samba-52b65f70caa1c6ac3f978cd3a349de921fe1eea7.zip |
strip any trailing \'s from reg key names in an open
(This used to be commit 03807cd56429e167ca8f3c003a4468461ecb854b)
Diffstat (limited to 'source3/rpc_server/srv_reg_nt.c')
-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 */ |