diff options
author | Luke Leighton <lkcl@samba.org> | 1998-11-11 14:23:55 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-11-11 14:23:55 +0000 |
commit | 9f14f281ff7efa1af0242a1dd1f5220d5cfdbf49 (patch) | |
tree | 65504cd76855cbf4e4662fdb4b776d24469b33aa /source3/lib | |
parent | 0e09fba835d0d65e2a927befaf3713dd481d8939 (diff) | |
download | samba-9f14f281ff7efa1af0242a1dd1f5220d5cfdbf49.tar.gz samba-9f14f281ff7efa1af0242a1dd1f5220d5cfdbf49.tar.bz2 samba-9f14f281ff7efa1af0242a1dd1f5220d5cfdbf49.zip |
changed syntax of registry commands so keys can start with HKLM or HKU.
sorted lookupsids command
(This used to be commit 13a0ee851fe0ce9acddfe57f9aba19fc78085c39)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util.c | 68 | ||||
-rw-r--r-- | source3/lib/util_str.c | 31 |
2 files changed, 86 insertions, 13 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index 5db404196b..f1fae9155c 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -924,20 +924,9 @@ static void expand_one(char *Mask,int len) /**************************************************************************** parse out a directory name from a path name. Assumes dos style filenames. ****************************************************************************/ -static char *dirname_dos(char *path,char *buf) +static void dirname_dos(char *path,char *buf) { - char *p = strrchr(path,'\\'); - - if (!p) - pstrcpy(buf,path); - else - { - *p = 0; - pstrcpy(buf,path); - *p = '\\'; - } - - return(buf); + split_at_last_component(path, buf, '\\', NULL); } @@ -3053,3 +3042,56 @@ int set_maxfiles(int requested_max) return requested_max; #endif } + + +/***************************************************************** + splits out the last subkey of a key + *****************************************************************/ +void reg_get_subkey(char *full_keyname, char *key_name, char *subkey_name) +{ + split_at_last_component(full_keyname, key_name, '\\', subkey_name); +} + +/***************************************************************** + splits out the start of the key (HKLM or HKU) and the rest of the key + *****************************************************************/ +BOOL reg_split_key(char *full_keyname, uint32 *reg_type, char *key_name) +{ + pstring tmp; + + if (!next_token(&full_keyname, tmp, "\\", sizeof(tmp))) + { + return False; + } + + (*reg_type) = 0; + + DEBUG(10, ("reg_split_key: hive %s\n", tmp)); + + if (strequal(tmp, "HKLM") || strequal(tmp, "HKEY_LOCAL_MACHINE")) + { + (*reg_type) = HKEY_LOCAL_MACHINE; + } + else if (strequal(tmp, "HKU") || strequal(tmp, "HKEY_USERS")) + { + (*reg_type) = HKEY_USERS; + } + else + { + DEBUG(10,("reg_split_key: unrecognised hive key %s\n", tmp)); + return False; + } + + if (next_token(NULL, tmp, "\n\r", sizeof(tmp))) + { + fstrcpy(key_name, tmp); + } + else + { + key_name[0] = 0; + } + + DEBUG(10, ("reg_split_key: name %s\n", key_name)); + + return True; +} diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 15eefb0001..996273bf3a 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1024,3 +1024,34 @@ BOOL string_sub(char *s,char *pattern,char *insert) return(ret); } +/**************************************************************************** + splits out the front and back at a separator. +****************************************************************************/ +void split_at_last_component(char *path, char *front, char sep, char *back) +{ + char *p = strrchr(path, sep); + + if (p != NULL) + { + *p = 0; + } + if (front != NULL) + { + pstrcpy(front, path); + } + if (p != NULL) + { + if (back != NULL) + { + pstrcpy(back, p+1); + } + *p = '\\'; + } + else + { + if (back != NULL) + { + back[0] = 0; + } + } +} |