diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2002-06-09 16:39:07 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2002-06-09 16:39:07 +0000 |
commit | 8f5c4e1acaeeeb9c8a36e701e8d585ae0e77a88d (patch) | |
tree | 45a467b82c158305a90f48918311d2a6cf8222e1 | |
parent | 219a40255b9022d71e52101912ef3e2ca458c07e (diff) | |
download | ATCD-8f5c4e1acaeeeb9c8a36e701e8d585ae0e77a88d.tar.gz |
ChangeLogTag:Sun Jun 9 08:51:04 2002 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 4 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 4 | ||||
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | ace/Configuration.cpp | 28 | ||||
-rw-r--r-- | ace/Configuration.h | 5 |
6 files changed, 33 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog index d9629547bc8..3332f2ed2d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ Sun Jun 9 08:51:04 2002 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> + * ace/Configuration.{h,cpp}: Added support for the path separator + ('\\') in key names. Thanks to Eugene <eugenea@bremer-inc.com> + for contributing this patch. + * ace/Date_Time.{h,i}: Added support for weekday. Thanks to Eyal Lubetzky <eyall@BANDWIZ.COM> for reporting this. diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index d9629547bc8..3332f2ed2d3 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,5 +1,9 @@ Sun Jun 9 08:51:04 2002 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> + * ace/Configuration.{h,cpp}: Added support for the path separator + ('\\') in key names. Thanks to Eugene <eugenea@bremer-inc.com> + for contributing this patch. + * ace/Date_Time.{h,i}: Added support for weekday. Thanks to Eyal Lubetzky <eyall@BANDWIZ.COM> for reporting this. diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index d9629547bc8..3332f2ed2d3 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,5 +1,9 @@ Sun Jun 9 08:51:04 2002 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> + * ace/Configuration.{h,cpp}: Added support for the path separator + ('\\') in key names. Thanks to Eugene <eugenea@bremer-inc.com> + for contributing this patch. + * ace/Date_Time.{h,i}: Added support for weekday. Thanks to Eyal Lubetzky <eyall@BANDWIZ.COM> for reporting this. @@ -1526,6 +1526,7 @@ David Smith <dts@prismtechnologies.com> Dimitrije Jankovic <djankov99@yahoo.com> Frank O. Flemisch <f.o.flemisch@larc.nasa.gov> Ken Sedgwick <ken@bonsai.com> +Eugene <eugenea@bremer-inc.com> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/ace/Configuration.cpp b/ace/Configuration.cpp index 87f46cee0ed..0e5a2eabde0 100644 --- a/ace/Configuration.cpp +++ b/ace/Configuration.cpp @@ -212,19 +212,25 @@ ACE_Configuration::import_config (const ACE_TCHAR* filename) } int -ACE_Configuration::validate_name (const ACE_TCHAR* name) +ACE_Configuration::validate_name (const ACE_TCHAR* name, int allow_path) { - const ACE_TCHAR *pos; + // Invalid character set + const ACE_TCHAR* reject = + allow_path ? ACE_LIB_TEXT("][") : ACE_LIB_TEXT("\\]["); + + // Position of the first invalid character or terminating null. + size_t pos = ACE_OS_String::strcspn (name, reject); - for (pos = name; - // Make sure it doesn't contain any invalid characters - *pos != '\0'; - pos++) - if (ACE_OS::strchr (ACE_LIB_TEXT ("\\]["), *pos)) - return -1; + // Check if it is an invalid character. + if (name[pos] != ACE_LIB_TEXT ('\0')) + return -1; - // Make sure its not too long. - if (pos - name > 255) + // The first character can never be a path separator. + if (name[0] == ACE_LIB_TEXT ('\\')) + return -1; + + // Validate length. + if (pos == 0 || pos > 255) return -2; return 0; @@ -510,7 +516,7 @@ ACE_Configuration_Win32Registry::open_section (const ACE_Configuration_Section_K int create, ACE_Configuration_Section_Key& result) { - if (validate_name (sub_section)) + if (validate_name (sub_section, 1)) return -1; HKEY base_key; diff --git a/ace/Configuration.h b/ace/Configuration.h index d0d85f18fd0..42e8f4d6950 100644 --- a/ace/Configuration.h +++ b/ace/Configuration.h @@ -291,9 +291,10 @@ protected: * Tests to see if <name> is valid. <name> must be < 255 characters * and not contain the path separator '\', brackets [] or = (maybe * just restrict to alphanumeric?) returns non zero if name is not - * valid + * valid. The path separator is allowed, except for the first character, + * if <allow_path> is true. */ - int validate_name (const ACE_TCHAR* name); + int validate_name (const ACE_TCHAR* name, int allow_path = 0); // Not used ACE_Configuration (const ACE_Configuration& rhs); |