[cpp-sp] 04/06: Allow for escaped name characters.
Scott Cantor
cantor.2 at osu.edu
Fri Nov 1 13:04:17 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository cpp-sp.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=3798a34620a7a70d51c8d094977cae38d46ce84f
commit 3798a34620a7a70d51c8d094977cae38d46ce84f
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu May 20 10:25:06 2021 -0400
Allow for escaped name characters.
---
shibsp/remoting/impl/ddf.cpp | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/shibsp/remoting/impl/ddf.cpp b/shibsp/remoting/impl/ddf.cpp
index 72e654a5..973f4ee4 100644
--- a/shibsp/remoting/impl/ddf.cpp
+++ b/shibsp/remoting/impl/ddf.cpp
@@ -955,7 +955,27 @@ DDF deserialize(istream& is)
DDF obj(nullptr);
if (name != ".") {
- obj.name(name.c_str());
+ if (name.find('%') != string::npos) {
+ char* dup = strdup(name.c_str());
+ if (!dup) {
+ return obj;
+ }
+ // Walk the string and decode any %XX sequences.
+ register int x,y;
+ for(x=0,y=0; dup[y]; ++x,++y) {
+ if((dup[x] = dup[y]) == '%' && isxdigit(dup[y+1]) && isxdigit(dup[y+2])) {
+ dup[x] = x2c(&dup[y+1]);
+ y+=2;
+ }
+ }
+ dup[x] = '\0';
+
+ obj.name(dup);
+ free(dup);
+ }
+ else {
+ obj.name(name.c_str());
+ }
}
// Type is next and should match enums.
@@ -990,7 +1010,7 @@ DDF deserialize(istream& is)
return obj;
}
- // Walk the string and decode any %XX sequences and plus to space.
+ // Walk the string and decode any %XX sequences.
register int x,y;
for(x=0,y=0; dup[y]; ++x,++y) {
if((dup[x] = dup[y]) == '%' && isxdigit(dup[y+1]) && isxdigit(dup[y+2])) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list