diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 036cf3809..c2c078a67 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -34,16 +34,16 @@ #include #include #include -#include "gui/plugins.h"//for relodplugins +#include //for relodplugins #include #include -#include "gui/rc_lock.h" +#include // yhttpd -#include "yhttpd.h" -#include "ytypes_globals.h" -#include "ylogging.h" -#include "helper.h" +#include +#include +#include +#include // nhttpd #include "neutrinoapi.h" #include "controlapi.h" @@ -220,7 +220,6 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= void CControlAPI::Execute(CyhookHandler *hh) { int index = -1; - std::string yresult; std::string filename = hh->UrlData["filename"]; log_level_printf(4,"ControlAPI.Execute filename:(%s)\n",filename.c_str()); @@ -892,7 +891,6 @@ void CControlAPI::ChannellistCGI(CyhookHandler *hh) std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChannel * channel) { std::string result, firstEPG, secondEPG = ""; t_channel_id current_channel = CZapit::getInstance()->GetCurrentChannelID(); - int percentage = 100; std::string timestr; CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo; @@ -900,6 +898,7 @@ std::string CControlAPI::_GetBouquetActualEPGItem(CyhookHandler *hh, CZapitChann event = NeutrinoAPI->ChannelListEvents[channel->channel_id]; if (event) { + int percentage = 100; if (event->duration > 0) percentage = 100 * (time(NULL) - event->startTime) / event->duration; CEitManager::getInstance()->getCurrentNextServiceKey(channel->channel_id, currentNextInfo); @@ -1366,7 +1365,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) { else if (hh->ParamList.empty() || hh->ParamList["1"] == "ext") { hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8"); bool isExt = (hh->ParamList["1"] == "ext"); - CChannelEvent *event; + CChannelEvent *event = NULL; NeutrinoAPI->GetChannelEvents(); int mode = NeutrinoAPI->Zapit->getMode(); @@ -1389,7 +1388,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) { // query details for given eventid else if (hh->ParamList["eventid"] != "") { //special epg query - uint64_t epgid; + uint64_t epgid = 0; sscanf(hh->ParamList["eventid"].c_str(), "%llu", &epgid); CShortEPGData epg; if (CEitManager::getInstance()->getEPGidShort(epgid, &epg)) { @@ -1400,8 +1399,8 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) { } else if (hh->ParamList["eventid2fsk"] != "") { if (hh->ParamList["starttime"] != "") { - uint64_t epgid; - time_t starttime; + uint64_t epgid = 0; + time_t starttime = 0; sscanf(hh->ParamList["fskid"].c_str(), "%llu", &epgid); sscanf(hh->ParamList["starttime"].c_str(), "%lu", &starttime); CEPGData longepg; @@ -1414,7 +1413,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) { } // list EPG for channel id else if (!(hh->ParamList["id"].empty())) { - t_channel_id channel_id; + t_channel_id channel_id = 0; sscanf(hh->ParamList["id"].c_str(), SCANF_CHANNEL_ID_TYPE, &channel_id); CEitManager::getInstance()->getEventsServiceKey(channel_id, NeutrinoAPI->eList); CChannelEventList::iterator eventIterator; @@ -1431,7 +1430,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) { // list EPG for channelID 64Bit else { //eventlist for a chan - t_channel_id channel_id; + t_channel_id channel_id = 0; sscanf(hh->ParamList["1"].c_str(), SCANF_CHANNEL_ID_TYPE, &channel_id); SendEventList(hh, channel_id); } @@ -2006,10 +2005,9 @@ void CControlAPI::SendTimersXML(CyhookHandler *hh) void CControlAPI::YWebCGI(CyhookHandler *hh) { bool status=true; - int para; if (hh->ParamList["video_stream_pids"] != "") { - para=0; + int para=0; sscanf( hh->ParamList["video_stream_pids"].c_str(), "%d", ¶); YWeb_SendVideoStreamingPids(hh, para); } @@ -2072,7 +2070,7 @@ std::string CControlAPI::YexecuteScript(CyhookHandler *, std::string cmd) // get file std::string fullfilename; script += ".sh"; //add script extention - char cwd[255]; + char cwd[255]={0}; getcwd(cwd, 254); for (unsigned int i=0; iParamList["alarm"] != "") @@ -2145,7 +2142,7 @@ void CControlAPI::doNewTimer(CyhookHandler *hh) // Alarm Time - Format exact! HH:MM if(hh->ParamList["alTime"] != "") strptime(hh->ParamList["alTime"].c_str(), "%H:%M", alarmTime); - alHour = alarmTime->tm_hour; + int alHour = alarmTime->tm_hour; correctTime(alarmTime); alarmTimeT = mktime(alarmTime); @@ -2389,10 +2386,8 @@ void CControlAPI::moveBouquetCGI(CyhookHandler *hh) //------------------------------------------------------------------------- void CControlAPI::deleteBouquetCGI(CyhookHandler *hh) { - int selected = -1; - if (hh->ParamList["selected"] != "") { - selected = atoi(hh->ParamList["selected"].c_str()); + int selected = atoi(hh->ParamList["selected"].c_str()); NeutrinoAPI->Zapit->deleteBouquet(selected - 1); hh->SendOk(); } @@ -2479,7 +2474,7 @@ void CControlAPI::updateBouquetCGI(CyhookHandler *hh) // host : (optional) ip of dbox void CControlAPI::build_live_url(CyhookHandler *hh) { - std::string xpids,port,yresult; + std::string xpids; int mode = NeutrinoAPI->Zapit->getMode(); if ( mode == CZapitClient::MODE_TV) @@ -2735,18 +2730,13 @@ void CControlAPI::FileCGI(CyhookHandler *hh) { if (hh->ParamList["action"] == "list") { // directory list: action=list&path= DIR *dirp; - struct dirent*entry; - struct stat statbuf; - struct passwd *pwd; - struct group *grp; - struct tm *tm; - char datestring[256]; TOutType outType = hh->outStart(); std::string path = hh->ParamList["path"]; if ((dirp = opendir(path.c_str()))) { bool isFirstLine = true; + struct dirent *entry; while ((entry = readdir(dirp))) { std::string item = ""; item += hh->outPair("name", @@ -2767,6 +2757,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) { std::string fullname = path + entry->d_name; item += hh->outPair("fullname", hh->outValue(fullname), true); + struct stat statbuf; if (stat(fullname.c_str(), &statbuf) != -1) { item += hh->outPair( @@ -2780,6 +2771,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) { string_printf("%d", statbuf.st_nlink), true); /* Print out owner's name if it is found using getpwuid(). */ + struct passwd *pwd; if ((pwd = getpwuid(statbuf.st_uid)) != NULL) { item += hh->outPair("user", pwd->pw_name, true); } @@ -2788,6 +2780,7 @@ void CControlAPI::FileCGI(CyhookHandler *hh) { string_printf("%d", statbuf.st_uid), true); } /* Print out group name if it is found using getgrgid(). */ + struct group *grp; if ((grp = getgrgid(statbuf.st_gid)) != NULL) item += hh->outPair("group", grp->gr_name, true); else { @@ -2798,7 +2791,8 @@ void CControlAPI::FileCGI(CyhookHandler *hh) { item += hh->outPair("size", string_printf("%jd", (intmax_t) statbuf.st_size), true); - tm = localtime(&statbuf.st_mtime); + struct tm *tm = localtime(&statbuf.st_mtime); + char datestring[256] = {0}; /* Get localized date string. */ strftime(datestring, sizeof(datestring), nl_langinfo(D_T_FMT), tm); diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.h b/src/nhttpd/tuxboxapi/coolstream/controlapi.h index 052739005..db8670cd3 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.h @@ -8,7 +8,7 @@ #include // yhttpd #include -#include "yhook.h" +#include // forward declaration class CNeutrinoAPI; diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp index 2ca05cfd4..65b433331 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp @@ -50,7 +50,7 @@ extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CZapitClient::SatelliteList satList; // yhttpd -#include "ylogging.h" +#include // nhttpd #include "neutrinoapi.h" @@ -266,7 +266,7 @@ bool CNeutrinoAPI::GetChannelEvents(void) if (eList.begin() == eList.end()) return false; - for (eventIterator = eList.begin(); eventIterator != eList.end(); eventIterator++) + for (eventIterator = eList.begin(); eventIterator != eList.end(); ++eventIterator) ChannelListEvents[(*eventIterator).get_channel_id()] = &(*eventIterator); return true; @@ -457,14 +457,13 @@ std::string CNeutrinoAPI::getAudioInfoAsString(void) { //------------------------------------------------------------------------- std::string CNeutrinoAPI::getCryptInfoAsString(void) { - unsigned short i; std::stringstream out; std::string casys[11]= {"Irdeto:","Betacrypt:","Seca:","Viaccess:","Nagra:","Conax: ","Cryptoworks:","Videoguard:","EBU:","XCrypt:","PowerVU:"}; int caids[] = { 0x600, 0x1700, 0x0100, 0x0500, 0x1800, 0xB00, 0xD00, 0x900, 0x2600, 0x4a00, 0x0E00 }; CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); if(channel) { - for (i = 0; i < 11; i++) { + for (unsigned short i = 0; i < 11; i++) { for(casys_map_iterator_t it = channel->camap.begin(); it != channel->camap.end(); ++it) { int caid = (*it) & 0xFF00; if(caid == caids[i]) diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h index 892dde995..a98a7b5bf 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h @@ -12,7 +12,7 @@ #include // nhttpd -#include "helper.h" +#include #include "neutrinoyparser.h" #include "controlapi.h" diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 4498f8064..3e988b22a 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -13,9 +13,9 @@ #include //ntohs #include //ntohs // yhttpd -#include "yhttpd.h" -#include "ytypes_globals.h" -#include "mod_yparser.h" +#include +#include +#include // tuxbox #include //timer list // nhttpd @@ -209,7 +209,7 @@ std::string CNeutrinoYParser::func_mount_set_values(CyhookHandler *hh, std::str //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, std::string para) { - std::string ynr, yresult, sel, nr_str, do_show_hidden; + std::string yresult, sel, nr_str, do_show_hidden; int nr=1; ySplitString(para," ",nr_str, do_show_hidden); @@ -268,7 +268,7 @@ std::string CNeutrinoYParser::func_get_actual_bouquet_number(CyhookHandler *, s //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, std::string para) { - std::string abouquet, achannel_id, yresult, sel, sid; + std::string abouquet, achannel_id, yresult, sel; int bnumber = 1; int mode = NeutrinoAPI->Zapit->getMode(); @@ -596,7 +596,7 @@ std::string CNeutrinoYParser::func_get_audio_pids_as_dropdown(CyhookHandler *, //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_unmount_get_list(CyhookHandler *, std::string) { - std::string ysel, ymount, ylocal_dir, yfstype, ynr, yresult, mounts; + std::string ysel, ymount, ylocal_dir, yfstype, yresult, mounts; std::ifstream in; in.open("/proc/mounts", std::ifstream::in); @@ -832,7 +832,7 @@ std::string CNeutrinoYParser::func_get_timer_list(CyhookHandler *, std::string yresult += string_printf(para.c_str(), classname, zAlarmTime, zStopTime, zRep.c_str(), zRepCount.c_str(), zType.c_str(), sAddData.c_str(),timer->eventID,timer->eventID); } - classname = (i++&1)?'a':'b'; + //classname = (i++&1)?'a':'b'; return yresult; } diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h index 2d8da7697..b32f99c32 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.h @@ -9,9 +9,9 @@ // c++ #include // yhttpd -#include "yhttpd.h" -#include "ytypes_globals.h" -#include "mod_yparser.h" +#include +#include +#include // forward declaration class CNeutrinoAPI; diff --git a/src/nhttpd/yhttpd.cpp b/src/nhttpd/yhttpd.cpp index a7039798b..7e37a46a4 100644 --- a/src/nhttpd/yhttpd.cpp +++ b/src/nhttpd/yhttpd.cpp @@ -34,28 +34,28 @@ CStringList Cyhttpd::ConfigList; //============================================================================= #ifdef Y_CONFIG_USE_AUTHHOOK -#include "mod_auth.h" +#include static CmAuth *auth = NULL; #endif #ifdef Y_CONFIG_USE_WEBLOG -#include "mod_weblog.h" +#include static CmWebLog *weblog = NULL; #endif #ifdef Y_CONFIG_USE_SENDFILE -#include "mod_sendfile.h" +#include static CmodSendfile *mod_sendfile = NULL; #endif #ifdef Y_CONFIG_USE_CACHE -#include "mod_cache.h" +#include static CmodCache mod_cache; // static instance #endif //----------------------------------------------------------------------------- #if defined(CONFIG_SYSTEM_TUXBOX) || defined(CONFIG_SYSTEM_TUXBOX_COOLSTREAM) -#include "neutrinoapi.h" +#include static CNeutrinoAPI *NeutrinoAPI; #endif diff --git a/src/nhttpd/yhttpd_core/helper.cpp b/src/nhttpd/yhttpd_core/helper.cpp index 38b188ba2..e2449fbbd 100644 --- a/src/nhttpd/yhttpd_core/helper.cpp +++ b/src/nhttpd/yhttpd_core/helper.cpp @@ -12,7 +12,7 @@ #include // yhttpd -#include "yconfig.h" +#include #include "ytypes_globals.h" #include "helper.h" #include "ylogging.h" @@ -220,10 +220,10 @@ std::string encodeString(std::string decodedString) { unsigned int len = sizeof(char) * decodedString.length() * 5 + 1; std::string result(len, '\0'); char *newString = (char *) result.c_str(); - char *dstring = (char *) decodedString.c_str(); char one_char; if (len == result.length()) // got memory needed { + char *dstring = (char *) decodedString.c_str(); while ((one_char = *dstring++)) /* use the null character as a loop terminator */ { if (isalnum(one_char)) diff --git a/src/nhttpd/yhttpd_core/yconnection.cpp b/src/nhttpd/yhttpd_core/yconnection.cpp index 7c035c12d..ea16280b5 100644 --- a/src/nhttpd/yhttpd_core/yconnection.cpp +++ b/src/nhttpd/yhttpd_core/yconnection.cpp @@ -8,7 +8,7 @@ #include #include // yhttpd -#include "yconfig.h" +#include #include "ytypes_globals.h" #include "ywebserver.h" #include "yconnection.h" @@ -44,6 +44,7 @@ CWebserverConnection::CWebserverConnection(CWebserver *pWebserver) { //------------------------------------------------------------------------- CWebserverConnection::CWebserverConnection() { // aprintf("test CWebserverConnection::CWebserverConnection()\n"); + Method = M_UNKNOWN; sock = 0; RequestCanceled = 0; keep_alive = 0; diff --git a/src/nhttpd/yhttpd_core/yconnection.h b/src/nhttpd/yhttpd_core/yconnection.h index 50dca5580..cc8ebc6ca 100644 --- a/src/nhttpd/yhttpd_core/yconnection.h +++ b/src/nhttpd/yhttpd_core/yconnection.h @@ -14,7 +14,7 @@ // c++ #include // yhttpd -#include "yconfig.h" +#include #include "ytypes_globals.h" #include "ywebserver.h" #include "yrequest.h" diff --git a/src/nhttpd/yhttpd_core/yhook.h b/src/nhttpd/yhttpd_core/yhook.h index 9556be9f5..b313dadda 100644 --- a/src/nhttpd/yhttpd_core/yhook.h +++ b/src/nhttpd/yhttpd_core/yhook.h @@ -51,7 +51,7 @@ #include #include // yhttpd -#include "yconfig.h" +#include #include "ytypes_globals.h" #include "ylogging.h" // tuxbox @@ -141,7 +141,7 @@ public: CStringList HookVarList; // Variables in Hook-Handling passing to other Hooks THttp_Method Method; // HTTP Method (requested) // constructor & deconstructor - CyhookHandler(){ContentLength = 0; keep_alive = 0; _outIndent = 0;}; + CyhookHandler(){ContentLength = 0; keep_alive = 0; _outIndent = 0;status = HANDLED_NONE;Method = M_UNKNOWN;httpStatus = HTTP_NIL;outType = plain;}; virtual ~CyhookHandler(){}; // hook slot handler diff --git a/src/nhttpd/yhttpd_core/ylanguage.h b/src/nhttpd/yhttpd_core/ylanguage.h index 3ba368f7c..e90658fc2 100644 --- a/src/nhttpd/yhttpd_core/ylanguage.h +++ b/src/nhttpd/yhttpd_core/ylanguage.h @@ -8,7 +8,7 @@ #include #include // yhttpd -#include "yconfig.h" +#include #include "ytypes_globals.h" #include "ywebserver.h" diff --git a/src/nhttpd/yhttpd_core/yrequest.cpp b/src/nhttpd/yhttpd_core/yrequest.cpp index 94fb344bd..999903915 100644 --- a/src/nhttpd/yhttpd_core/yrequest.cpp +++ b/src/nhttpd/yhttpd_core/yrequest.cpp @@ -116,7 +116,7 @@ bool CWebserverRequest::HandleRequest(void) { // Split URL into path, filename, fileext .. UrlData[] //----------------------------------------------------------------------------- bool CWebserverRequest::ParseStartLine(std::string start_line) { - std::string method, url, http, tmp; + std::string method, url, tmp; log_level_printf(8, ": line: %s\n", start_line.c_str()); if (ySplitString(start_line, " ", method, tmp)) { diff --git a/src/nhttpd/yhttpd_core/yresponse.cpp b/src/nhttpd/yhttpd_core/yresponse.cpp index c010a0f74..96ed8f510 100644 --- a/src/nhttpd/yhttpd_core/yresponse.cpp +++ b/src/nhttpd/yhttpd_core/yresponse.cpp @@ -15,8 +15,8 @@ #include #include // yhttpd -#include "yconfig.h" -#include "yhttpd.h" +#include +#include #include "ytypes_globals.h" #include "ylogging.h" #include "ywebserver.h" diff --git a/src/nhttpd/yhttpd_core/yresponse.h b/src/nhttpd/yhttpd_core/yresponse.h index 6bdaeab1b..4eb2bf864 100644 --- a/src/nhttpd/yhttpd_core/yresponse.h +++ b/src/nhttpd/yhttpd_core/yresponse.h @@ -9,7 +9,7 @@ // c++ #include // yhttpd -#include "yconfig.h" +#include #include "ytypes_globals.h" #include "yhook.h" @@ -42,8 +42,8 @@ public: void printf(const char *fmt, ...); bool Write(char const *text); bool WriteLn(char const *text); - bool Write(const std::string text) { return Write(text.c_str()); } - bool WriteLn(const std::string text) { return WriteLn(text.c_str()); } + bool Write(const std::string &text) { return Write(text.c_str()); } + bool WriteLn(const std::string &text) { return WriteLn(text.c_str()); } // Headers void SendError(HttpResponseType responseType) {SendHeader(responseType, false, "text/html");} diff --git a/src/nhttpd/yhttpd_core/ysocket.cpp b/src/nhttpd/yhttpd_core/ysocket.cpp index d78912640..6c51d3324 100644 --- a/src/nhttpd/yhttpd_core/ysocket.cpp +++ b/src/nhttpd/yhttpd_core/ysocket.cpp @@ -17,7 +17,7 @@ #include // yhttpd -#include "yhttpd.h" +#include #include "ysocket.h" #include "ylogging.h" // system @@ -64,6 +64,7 @@ CySocket::~CySocket() { // initialize //----------------------------------------------------------------------------- void CySocket::init(void) { + BytesSend = 0; handling = false; isOpened = false; isValid = true; @@ -194,8 +195,8 @@ CySocket* CySocket::accept() { #else set_tcp_nodelay(); #endif + new_ySocket->isOpened = true; } - new_ySocket->isOpened = true; // handling = true; return new_ySocket; } diff --git a/src/nhttpd/yhttpd_core/ywebserver.cpp b/src/nhttpd/yhttpd_core/ywebserver.cpp index 601b966a3..eae380b95 100644 --- a/src/nhttpd/yhttpd_core/ywebserver.cpp +++ b/src/nhttpd/yhttpd_core/ywebserver.cpp @@ -19,7 +19,7 @@ #include // yhttpd -#include "yhttpd.h" +#include #include "ytypes_globals.h" #include "ywebserver.h" #include "ylogging.h" @@ -241,7 +241,6 @@ bool CWebserver::run(void) { int CWebserver::AcceptNewConnectionSocket() { int slot = -1; CySocket *connectionSock = NULL; - int newfd; if (!(connectionSock = listenSocket.accept())) // Blocking wait { @@ -265,7 +264,7 @@ int CWebserver::AcceptNewConnectionSocket() { SocketList[slot] = connectionSock; // put it to list fcntl(connectionSock->get_socket(), F_SETFD, O_NONBLOCK); // set non-blocking open_connections++; // count open connectins - newfd = connectionSock->get_socket(); + int newfd = connectionSock->get_socket(); if (newfd > fdmax) // keep track of the maximum fd fdmax = newfd; } @@ -377,7 +376,7 @@ bool CWebserver::CheckKeepAliveAllowedByIP(std::string client_ip) { while (it != conf_no_keep_alive_ips.end()) { if (trim(*it) == client_ip) do_keep_alive = false; - it++; + ++it; } pthread_mutex_unlock(&mutex); return do_keep_alive; diff --git a/src/nhttpd/yhttpd_mods/mod_auth.cpp b/src/nhttpd/yhttpd_mods/mod_auth.cpp index 3934dc0e4..8e747243c 100644 --- a/src/nhttpd/yhttpd_mods/mod_auth.cpp +++ b/src/nhttpd/yhttpd_mods/mod_auth.cpp @@ -6,7 +6,7 @@ #include #include #include "mod_auth.h" -#include "helper.h" +#include //----------------------------------------------------------------------------- // HOOK: response_hook @@ -65,11 +65,11 @@ bool CmAuth::CheckAuth(CyhookHandler *hh) { // decode Base64 buffer to String //----------------------------------------------------------------------------- std::string CmAuth::decodeBase64(const char *b64buffer) { - char *newString, *org_newString; //shorter then b64buffer + char *newString; //shorter then b64buffer std::string result; if ((newString = (char *) malloc(sizeof(char) * strlen(b64buffer) + 1)) != NULL) { - org_newString = newString; + char *org_newString = newString; int i = 0; unsigned long c = 0; diff --git a/src/nhttpd/yhttpd_mods/mod_auth.h b/src/nhttpd/yhttpd_mods/mod_auth.h index 6215c3fb9..4efdcd8e9 100644 --- a/src/nhttpd/yhttpd_mods/mod_auth.h +++ b/src/nhttpd/yhttpd_mods/mod_auth.h @@ -5,11 +5,12 @@ #ifndef __yhttpd_mod_auth_h__ #define __yhttpd_mod_auth_h__ -#include "yhook.h" +#include class CmAuth: public Cyhook { public: bool authenticate; CmAuth() { + authenticate = false; } ; ~CmAuth() { diff --git a/src/nhttpd/yhttpd_mods/mod_cache.cpp b/src/nhttpd/yhttpd_mods/mod_cache.cpp index 2c59edf20..2172e17e0 100644 --- a/src/nhttpd/yhttpd_mods/mod_cache.cpp +++ b/src/nhttpd/yhttpd_mods/mod_cache.cpp @@ -8,9 +8,9 @@ #include #include // yhttpd -#include "yconfig.h" -#include "ytypes_globals.h" -#include "helper.h" +#include +#include +#include #include "mod_cache.h" //============================================================================= @@ -128,7 +128,7 @@ void CmodCache::AddToCache(CyhookHandler *, std::string url, CacheList[url].mime_type = mime_type; CacheList[url].category = category; CacheList[url].created = time(NULL); - std::string test = CacheList[url].filename; +// std::string test = CacheList[url].filename; } fflush(fd); // flush and close file fclose(fd); @@ -154,7 +154,7 @@ void CmodCache::RemoveCategoryFromCache(std::string category) { do { restart = false; TCacheList::iterator i = CacheList.begin(); - for (; i != CacheList.end(); i++) { + for (; i != CacheList.end(); ++i) { TCache *item = &((*i).second); if (item->category == category) { CacheList.erase(((*i).first)); @@ -198,7 +198,7 @@ void CmodCache::yshowCacheInfo(CyhookHandler *hh) { "URLMimeFilenameCategoryCreatedRemove\n"); pthread_mutex_lock(&mutex); TCacheList::iterator i = CacheList.begin(); - for (; i != CacheList.end(); i++) { + for (; i != CacheList.end(); ++i) { TCache *item = &((*i).second); char timeStr[80]; strftime(timeStr, sizeof(timeStr), RFC1123FMT, gmtime(&(item->created))); diff --git a/src/nhttpd/yhttpd_mods/mod_cache.h b/src/nhttpd/yhttpd_mods/mod_cache.h index 149c0f8a3..d4172e6aa 100644 --- a/src/nhttpd/yhttpd_mods/mod_cache.h +++ b/src/nhttpd/yhttpd_mods/mod_cache.h @@ -11,9 +11,9 @@ // c++ #include // yhttpd -#include "yconfig.h" -#include "ytypes_globals.h" -#include "yhook.h" +#include +#include +#include //----------------------------------------------------------------------------- typedef struct { diff --git a/src/nhttpd/yhttpd_mods/mod_sendfile.cpp b/src/nhttpd/yhttpd_mods/mod_sendfile.cpp index 1e0d42b02..ce3a2551f 100644 --- a/src/nhttpd/yhttpd_mods/mod_sendfile.cpp +++ b/src/nhttpd/yhttpd_mods/mod_sendfile.cpp @@ -47,9 +47,9 @@ #include #include // yhttpd -#include "yconfig.h" -#include "ytypes_globals.h" -#include "helper.h" +#include +#include +#include #include "mod_sendfile.h" //============================================================================= @@ -64,7 +64,6 @@ CStringList CmodSendfile::sendfileTypes; THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) { hh->status = HANDLED_NONE; - int filed; log_level_printf(4, "mod_sendfile prepare hook start url:%s\n", hh->UrlData["fullurl"].c_str()); std::string mime = sendfileTypes[hh->UrlData["fileext"]]; if (((mime != "") || (hh->WebserverConfigList["mod_sendfile.sendAll"] == "true")) @@ -73,7 +72,7 @@ THandleStatus CmodSendfile::Hook_PrepareResponse(CyhookHandler *hh) { // build filename std::string fullfilename = GetFileName(hh, hh->UrlData["path"], hh->UrlData["filename"]); - + int filed; if ((filed = OpenFile(hh, fullfilename)) != -1) //can access file? { struct stat statbuf; @@ -180,7 +179,6 @@ std::string CmodSendfile::GetFileName(CyhookHandler *hh, std::string path, std:: //----------------------------------------------------------------------------- int CmodSendfile::OpenFile(CyhookHandler *, std::string fullfilename) { int fd = -1; - std::string tmpstring; if (fullfilename.length() > 0) { fd = open(fullfilename.c_str(), O_RDONLY | O_LARGEFILE); if (fd <= 0) { diff --git a/src/nhttpd/yhttpd_mods/mod_sendfile.h b/src/nhttpd/yhttpd_mods/mod_sendfile.h index 0bdcf157e..e4294a25f 100644 --- a/src/nhttpd/yhttpd_mods/mod_sendfile.h +++ b/src/nhttpd/yhttpd_mods/mod_sendfile.h @@ -11,9 +11,9 @@ // c++ #include // yhttpd -#include "yconfig.h" -#include "ytypes_globals.h" -#include "yhook.h" +#include +#include +#include //----------------------------------------------------------------------------- class CmodSendfile : public Cyhook diff --git a/src/nhttpd/yhttpd_mods/mod_testhook.h b/src/nhttpd/yhttpd_mods/mod_testhook.h index a92f9ed98..1f6ed9f2e 100644 --- a/src/nhttpd/yhttpd_mods/mod_testhook.h +++ b/src/nhttpd/yhttpd_mods/mod_testhook.h @@ -6,7 +6,7 @@ #define TESTHOOK_H_ -#include "yhook.h" +#include class CTesthook : public Cyhook { public: diff --git a/src/nhttpd/yhttpd_mods/mod_weblog.cpp b/src/nhttpd/yhttpd_mods/mod_weblog.cpp index 4d25f6e3f..49e88dab4 100644 --- a/src/nhttpd/yhttpd_mods/mod_weblog.cpp +++ b/src/nhttpd/yhttpd_mods/mod_weblog.cpp @@ -11,7 +11,7 @@ #include #include "mod_weblog.h" -#include "helper.h" +#include //============================================================================= // Initialization of static variables @@ -97,8 +97,8 @@ bool CmWebLog::printf(const char *fmt, ...) { if (!OpenLogFile()) return false; bool success = false; - char buffer[bufferlen]; if (WebLogFile != NULL) { + char buffer[bufferlen]={0}; pthread_mutex_lock(&WebLog_mutex); // yeah, its mine va_list arglist; va_start(arglist, fmt); @@ -130,6 +130,8 @@ bool CmWebLog::printf(const char *fmt, ...) { //----------------------------------------------------------------------------- void CmWebLog::AddLogEntry_CLF(CyhookHandler *hh) { +#if 0 +//never used std::string cs_method; switch (hh->Method) { @@ -141,6 +143,7 @@ void CmWebLog::AddLogEntry_CLF(CyhookHandler *hh) cs_method = "unknown"; break; } +#endif std::string c_ip = hh->UrlData["clientaddr"].c_str(); std::string request_startline = hh->UrlData["startline"].c_str(); int s_status = hh->httpStatus; @@ -315,7 +318,6 @@ void CmWebLog::AddLogEntry_ELF(CyhookHandler *hh) std::string c_ip = hh->UrlData["clientaddr"].c_str(); std::string request_startline = hh->UrlData["startline"].c_str(); std::string cs_uri = hh->UrlData["fullurl"]; - std::string cs_uri_stem = hh->UrlData["url"]; int sc_status = hh->httpStatus; int bytes = hh->GetContentLength(); int cached = (hh->HookVarList["CacheCategory"].empty()) ? 0 : 1; diff --git a/src/nhttpd/yhttpd_mods/mod_weblog.h b/src/nhttpd/yhttpd_mods/mod_weblog.h index f65026b55..bcdf2d96e 100644 --- a/src/nhttpd/yhttpd_mods/mod_weblog.h +++ b/src/nhttpd/yhttpd_mods/mod_weblog.h @@ -5,8 +5,8 @@ #ifndef __yhttpd_mod_weblog_h__ #define __yhttpd_mod_weblog_h__ -#include "yconfig.h" -#include "yhook.h" +#include +#include //----------------------------------------------------------------------------- // Defaults #ifndef LOG_FILE diff --git a/src/nhttpd/yhttpd_mods/mod_yparser.cpp b/src/nhttpd/yhttpd_mods/mod_yparser.cpp index 9ad6eb7e6..3fd7a1c5e 100644 --- a/src/nhttpd/yhttpd_mods/mod_yparser.cpp +++ b/src/nhttpd/yhttpd_mods/mod_yparser.cpp @@ -18,12 +18,12 @@ // tuxbox #include // yhttpd -#include "yconfig.h" -#include "ytypes_globals.h" -#include "helper.h" -#include "ylogging.h" +#include +#include +#include +#include #include "mod_yparser.h" -#include "ylanguage.h" +#include //============================================================================= // Initialization of static variables @@ -111,7 +111,7 @@ void CyParser::Execute(CyhookHandler *hh) { if (CLogging::getInstance()->getDebug()) { dprintf("Execute CGI : %s\n", filename.c_str()); for (CStringList::iterator it = hh->ParamList.begin(); it - != hh->ParamList.end(); it++) + != hh->ParamList.end(); ++it) dprintf(" Parameter %s : %s\n", it->first.c_str(), it->second.c_str()); } @@ -156,7 +156,6 @@ void CyParser::Execute(CyhookHandler *hh) { // mini cgi Engine (Entry for ycgi) //----------------------------------------------------------------------------- void CyParser::cgi(CyhookHandler *hh) { - bool ydebug = false; std::string htmlfilename, yresult, ycmd; if ( !hh->ParamList.empty() ) { @@ -164,6 +163,7 @@ void CyParser::cgi(CyhookHandler *hh) { htmlfilename = hh->ParamList["tmpl"]; else htmlfilename = hh->ParamList["1"]; + bool ydebug = false; if (hh->ParamList["debug"] != "") // switch debug on ydebug = true; @@ -171,7 +171,6 @@ void CyParser::cgi(CyhookHandler *hh) { { ycmd = hh->ParamList["execute"]; ycmd = YPARSER_ESCAPE_START + ycmd + YPARSER_ESCAPE_END; - ycmd = ycmd; yresult = cgi_cmd_parsing(hh, ycmd, ydebug); // parsing engine } // parsing given file @@ -471,7 +470,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) { pthread_mutex_unlock(&yParser_mutex); } } else if (ycmd_type == "file-action") { - std::string filename, actionname, content, tmp, ydefault; + std::string filename, actionname, content, tmp; if (ySplitString(ycmd_name, ";", filename, tmp)) { ySplitString(tmp, ";", actionname, content); replace(content, "\r\n", "\n"); @@ -522,7 +521,6 @@ std::string CyParser::YWeb_cgi_get_ini(CyhookHandler *, std::string filename, //------------------------------------------------------------------------- void CyParser::YWeb_cgi_set_ini(CyhookHandler *, std::string filename, std::string varname, std::string varvalue, std::string yaccess) { - std::string result; if ((yaccess == "open") || (yaccess == "")) { yConfig->clear(); yConfig->loadConfig(filename); @@ -738,11 +736,11 @@ std::string CyParser::func_get_languages_as_dropdown(CyhookHandler *, std::string para) { std::string yresult, sel; DIR *d; - struct dirent *dir; std::string act_language = CLanguage::getInstance()->language; d = opendir((CLanguage::getInstance()->language_dir).c_str()); if (d != NULL) { + struct dirent *dir; while ((dir = readdir(d))) { if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0) continue; diff --git a/src/nhttpd/yhttpd_mods/mod_yparser.h b/src/nhttpd/yhttpd_mods/mod_yparser.h index 628ed0a7e..ae5d49118 100644 --- a/src/nhttpd/yhttpd_mods/mod_yparser.h +++ b/src/nhttpd/yhttpd_mods/mod_yparser.h @@ -16,10 +16,10 @@ #include // yhttpd -#include "helper.h" -#include "yconfig.h" -#include "ytypes_globals.h" -#include "yhook.h" +#include +#include +#include +#include // forward declaration class CWebserverConnection;