From 7cb302f0876b90996ffa8e5f904eb30e24e3e1b2 Mon Sep 17 00:00:00 2001 From: "ernesto.avedillo" Date: Tue, 25 Jun 2024 16:05:39 +0200 Subject: [PATCH] Corrections in executable CGI --- conf/simple.conf | 12 ++++++-- mandatory/inc/CGI.hpp | 5 ++-- mandatory/src/CGI.cpp | 46 +++++++++++++++++-------------- mandatory/src/LocationParser.cpp | 2 +- www/web4/cgi/test.cgi | Bin 27824 -> 17096 bytes www/web4/cgi/test.cpp | 18 +----------- 6 files changed, 40 insertions(+), 43 deletions(-) diff --git a/conf/simple.conf b/conf/simple.conf index 1bd3455..b412eff 100644 --- a/conf/simple.conf +++ b/conf/simple.conf @@ -62,9 +62,15 @@ server:{ root:./www/web4; # root folder of site directory, full or relative path, mandatory parameter autoindex: on; # cgi-bin folder index:index.html; # default page when requesting a directory, index.html by default -# CGI_folder:./www/web4/cgi/; # cgi-bin folder -# CGI_extension:cgi; # cgi-bin folder - }; + location:{ + name:/cgi-bin; + alias:./www/web4; + allow_methods: GET, POST, DELETE; + autoindex:on; + cgi_path:/bin/sh; + cgi_extension:cgi; + } +}; server:{ port:9002; # listening port, mandatory parameter diff --git a/mandatory/inc/CGI.hpp b/mandatory/inc/CGI.hpp index 1cef87b..31e1243 100644 --- a/mandatory/inc/CGI.hpp +++ b/mandatory/inc/CGI.hpp @@ -11,6 +11,7 @@ #include "colors.h" #include "StatusCodesDefinition.hpp" #include +#include "ExtendedString.hpp" class CGI { private: @@ -18,7 +19,7 @@ class CGI { std::string fileName; std::string fileArgs; bool isCGI; - std::vector args; + std::vector args; std::map CGIExtensions; public: @@ -39,7 +40,7 @@ class CGI { //getters std::string getFileName(); std::string getCGIFolder(); - std::vector getArgs(); + std::vector getArgs(); std::string getCGIExtension(const std::string &); std::string getFileExtension(); std::map::iterator findCGIExtension(const std::string &); diff --git a/mandatory/src/CGI.cpp b/mandatory/src/CGI.cpp index 3c9d440..d48ba56 100644 --- a/mandatory/src/CGI.cpp +++ b/mandatory/src/CGI.cpp @@ -39,16 +39,17 @@ void CGI::setFileName(const std::string &Name, const std::string &Args) std::vector tmp; fileName = Name; - tmp = splitString(Args, '?'); - std::map::iterator it = this->findCGIExtension(this->getFileExtension()); - if (it != this->CGIExtensions.end()) - { - if (it->second.size() != 0) - { - fileName =it->second; - this->setArgs(tmp[1]); - } - } + this->setArgs(Args); + tmp = splitString(Args, '&'); + // std::map::iterator it = this->findCGIExtension(this->getFileExtension()); + // if (it != this->CGIExtensions.end()) + // { + // if (it->second.size() != 0) + // { + // fileName =it->second; + // this->setArgs(tmp[1]); + // } + // } } void CGI::setIsCGI(bool valCGI) @@ -86,14 +87,17 @@ std::string CGI::getCGIFolder() void CGI::setArgs(const std::string &str) { + std::cout << "Args: " << str << std::endl; std::vector vec = splitString(str, '&'); for (size_t i = 0; i < vec.size(); i++) { + std::cout << "Args: " << vec[i] << std::endl; args.push_back(vec[i]); } + } -std::vector CGI::getArgs() +std::vector CGI::getArgs() { return args; } @@ -111,19 +115,21 @@ std::string CGI::getFileExtension() std::string CGI::execute() { int timeout = 5; - + ExtendedString Executable = this->getFileName(); + Executable.replaceString("//", "/"); signal(SIGALRM, &CGI::alarm_handler); int fd[2], tmp_fd; tmp_fd = dup(STDOUT_FILENO); - std::vector argsArray; - argsArray.push_back(const_cast(fileName.c_str())); - std::vector::iterator itb = args.begin(); - std::vector::iterator ite = args.end(); + std::cout << "Executable: " << Executable << std::endl; + std::vector ExecArray; + ExecArray.push_back(const_cast(Executable.c_str())); + std::vector::iterator itb = args.begin(); + std::vector::iterator ite = args.end(); while (itb != ite) { - argsArray.push_back(const_cast(itb->c_str())); + ExecArray.push_back(const_cast(itb->c_str())); ++itb; } - argsArray.push_back(NULL); + ExecArray.push_back(NULL); if (pipe(fd) == -1) { throw INTERNAL_SERVER_ERROR_CODE; } @@ -139,10 +145,10 @@ std::string CGI::execute() close(fd[0]); // Convert the arguments vector to a null-terminated array // Execute the file with its parameters - if (execve(fileName.c_str(), argsArray.data(), NULL) == -1) + if (execve(Executable.c_str(), ExecArray.data(), NULL) == -1) { // Handle error executing file - std::cerr << "Error executing file " << fileName << " with errno " << errno << std::endl; + std::cerr << "Error executing file " << Executable << " with errno " << errno << std::endl; exit(EXIT_FAILURE); } } diff --git a/mandatory/src/LocationParser.cpp b/mandatory/src/LocationParser.cpp index b9db189..afab276 100644 --- a/mandatory/src/LocationParser.cpp +++ b/mandatory/src/LocationParser.cpp @@ -207,7 +207,7 @@ void LocationParser::checks() std::string path; if (this->request.getPath().find("?") != std::string::npos) { - this->query = this->request.getPath().substr(this->request.getPath().find("?")); + this->query = this->request.getPath().substr(this->request.getPath().find("?") + 1); this->request.setPath(this->request.getPath().substr(0, this->request.getPath().find("?"))); } switch (this->matchingLocation()) diff --git a/www/web4/cgi/test.cgi b/www/web4/cgi/test.cgi index caabec92f115051b4c7a6f99afa0061ee83dbf85..29f5a9843928fb34a4a47af028ecb45b449bf7a4 100755 GIT binary patch literal 17096 zcmeHOe{dYteSas(k_?hg{BUvY5DxLnB=K42Ux;9vlclp(LBEhrSfq8b*6NN=^uJGyWgLm@AvK7-M8=U?fZ79ZcC2GBe>*)xcJv+p{7!ND^d4eGsVlZ;B} z`}(!3I%6w46WzUiEBh+euUx;@pHBK$OApiwIdDzYG_;DGelZFi(y`D&x!%}mqLPkv@yb`8e>20ke8*Hy~OUgAna%{H`aCp`KibPjo4b643>S&zqCXgvrcyXk>8A~O zhf0IApD7*0LO z+U|s<0-HPg`plkqDxK_(bSA9b=C1N=Y6^hVEmmi`_WUHFX40)uRY_7^;*qY}XxI$3 ztTQRCs`BiNI$lG||N2mLBeYm+qsd-Nn62I4OmxT0=6JfdD^6`lcP-ijZP*n_bdx69 z7cnDNyf0x1GN!Fq^vhqyZM+_0SC-ouB^;yx^iid+sj4#9_{&92UG3&7bG3i9e_fVe zvsP5KwN-AeH3R-NO54^(-fNw_e|3P)bq?Kid2|;pA`bfk+B~%7OX?AO>6*cH>Z7gc z+TC=U7Kn%Rb>tz;pthHjy?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sn07gwH`^*D|iidw=<-}f``_H|ow(5I4LSE5f zsZU(+sX=1Tnye z=)lQWDpu;)MR~nXwy*vk6+LgGXT{2Y)h{fEn!a;I`Bl13Y#4NLuoTs" << "Argumento de entrada NÂș" << i << "= " << ac[i] << "\n"; - } - for (int i = 0; i < 24; i++) - { - cout << "" << ENV[i] << ""; - - // attempt to retrieve value of environment variable - char *value = getenv(ENV[i].c_str()); - if (value != 0) - { - cout << value; - } - else - { - cout << "Environment variable does not exist."; - } - cout << "\n"; + cout << "" << "Argumento de entrada N." << i << "= " << ac[i] << "\n"; } cout << "<\n";