X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/0683126dc365b9ce34b517547ce27dcbd4805556..20d884ddac6b8cacedb2701e282efe3ff9785cbf:/stglibs/srvconf.lib/parsers/get_admin.cpp?ds=sidebyside diff --git a/stglibs/srvconf.lib/parsers/get_admin.cpp b/stglibs/srvconf.lib/parsers/get_admin.cpp index a728e7d1..809280b7 100644 --- a/stglibs/srvconf.lib/parsers/get_admin.cpp +++ b/stglibs/srvconf.lib/parsers/get_admin.cpp @@ -34,10 +34,10 @@ namespace STG template <> inline -bool GetValue(const char ** attr, PRIV & value) +bool GetValue(const char ** attr, PRIV & value, const std::string & attrName) { uint32_t priv; -if (!GetValue(attr, priv)) +if (!GetValue(attr, priv, attrName)) return false; value = priv; return true; @@ -69,8 +69,8 @@ depth++; if (depth == 1) ParseAdmin(el, attr); -if (depth == 2 && parsingAnswer) - ParseAdminParams(el, attr); +/*if (depth == 2 && parsingAnswer) + ParseAdminParams(el, attr);*/ return 0; } @@ -90,6 +90,7 @@ if (depth == 0 && parsingAnswer) void GET_ADMIN::PARSER::ParseAdmin(const char * el, const char ** attr) { if (strcasecmp(el, "admin") == 0) + { if (attr && attr[0] && attr[1]) { if (strcasecmp(attr[1], "error") == 0) @@ -100,14 +101,23 @@ if (strcasecmp(el, "admin") == 0) error = "Admin not found."; } else + { parsingAnswer = true; + for (const char ** pos = attr; *pos != NULL; pos = pos + 2) + if (!TryParse(propertyParsers, ToLower(*pos), pos, *pos)) + { + error = "Invalid parameter."; + break; + } + } } else parsingAnswer = true; + } } //----------------------------------------------------------------------------- -void GET_ADMIN::PARSER::ParseAdminParams(const char * el, const char ** attr) +/*void GET_ADMIN::PARSER::ParseAdminParams(const char * el, const char ** attr) { if (!TryParse(propertyParsers, ToLower(el), attr)) error = "Invalid parameter."; -} +}*/