Package: dansguardian Version: 2.8.0.4-2 Severity: serious Tags: patch dansguardian fails to build because it does not use "std::" for symbols in the std namespace:
> g++ -O2 -Wall -c String.cpp > In file included from > /usr/lib/gcc/i486-linux-gnu/4.0.1/../../../../include/c++/4.0.1/backward/strstream:51, > from String.cpp:27: > /usr/lib/gcc/i486-linux-gnu/4.0.1/../../../../include/c++/4.0.1/backward/backward_warning.h:32:2: > warning: #warning This file includes at least one deprecated or antiquated > header. Please consider using one of the 32 headers found in section 17.4.1.2 > of the C++ standard. Examples include substituting the <X> header for the > <X.h> header for C++ includes, or <iostream> instead of the deprecated header > <iostream.h>. To disable this warning use -Wno-deprecated. > String.hpp:43: error: ISO C++ forbids declaration of 'ostream' with no type > String.hpp:43: error: 'ostream' is neither function nor member function; > cannot be declared friend > String.hpp:43: error: expected ';' before '&' token > String.cpp:119: error: expected constructor, destructor, or type conversion > before '&' token The attached patch makes it do so. -- Matt
diff -u dansguardian-2.8.0.4/UDSocket.cpp dansguardian-2.8.0.4/UDSocket.cpp --- dansguardian-2.8.0.4/UDSocket.cpp +++ dansguardian-2.8.0.4/UDSocket.cpp @@ -173,7 +173,7 @@ } -void UDSocket::checkForInput(int timeout) throw (exception) { +void UDSocket::checkForInput(int timeout) throw (std::exception) { // blocks if socket blocking // until timeout fd_set fdSet; @@ -183,8 +183,8 @@ t.tv_sec = timeout; t.tv_usec = 0; if (UDSocket::selectEINTR(sck_un + 1, &fdSet, NULL, NULL, &t) < 1) { - string err("select() on input (unix socket): "); - throw runtime_error(err + (errno? strerror(errno) : "timeout")); + std::string err("select() on input (unix socket): "); + throw std::runtime_error(err + (errno? strerror(errno) : "timeout")); } } @@ -203,7 +203,7 @@ } -void UDSocket::readyForOutput(int timeout) throw(exception) { +void UDSocket::readyForOutput(int timeout) throw(std::exception) { // blocks if socket blocking // until timeout fd_set fdSet; @@ -213,12 +213,12 @@ t.tv_sec = timeout; t.tv_usec = 0; if (UDSocket::selectEINTR(sck_un + 1, NULL, &fdSet, NULL, &t) < 1) { - string err("select() on output (unix socket): "); - throw runtime_error(err + (errno? strerror(errno) : "timeout")); + std::string err("select() on output (unix socket): "); + throw std::runtime_error(err + (errno? strerror(errno) : "timeout")); } } -int UDSocket::getline(char* buff, int size, int timeout) throw(exception) { +int UDSocket::getline(char* buff, int size, int timeout) throw(std::exception) { char b[1]; int rc; @@ -227,7 +227,7 @@ while(i < (size - 1)) { rc = readFromSocket(b, 1, 0, timeout); if (rc < 0) { - throw runtime_error(string("Can't read from unix socket: ") + strerror(errno)); // on error + throw std::runtime_error(std::string("Can't read from unix socket: ") + strerror(errno)); // on error } if (rc == 0) { // eof, other end closed so b[0] = '\n'; // force it to return what read @@ -244,16 +244,16 @@ } -void UDSocket::writeString(const char* line) throw(exception) { +void UDSocket::writeString(const char* line) throw(std::exception) { int l = strlen(line); if (!writeToSocket((char*)line, l, 0, 10)) { - throw runtime_error(string("Can't write to unix socket: ") + strerror(errno)); + throw std::runtime_error(std::string("Can't write to unix socket: ") + strerror(errno)); } } -void UDSocket::writeToSockete(char* buff, int len, unsigned int flags, int timeout) throw(exception) { +void UDSocket::writeToSockete(char* buff, int len, unsigned int flags, int timeout) throw(std::exception) { if (!UDSocket::writeToSocket(buff, len, flags, timeout)) { - throw runtime_error(string("Can't write to unix socket: ") + strerror(errno)); + throw std::runtime_error(std::string("Can't write to unix socket: ") + strerror(errno)); } } @@ -263,7 +263,7 @@ while (actuallysent < len) { try { readyForOutput(timeout); // throws exception on error or timeout - } catch (exception& e) { + } catch (std::exception& e) { return false; } sent = send(sck_un, buff + actuallysent, len - actuallysent, 0); @@ -288,7 +288,7 @@ while (cnt > 0) { try { checkForInput(timeout); // throws exception on error or timeout - } catch (exception& e) { + } catch (std::exception& e) { return -1; } rc = recv(sck_un, buff, len, flags); @@ -312,7 +312,7 @@ int rc; try { checkForInput(timeout); - } catch (exception& e) { + } catch (std::exception& e) { return -1; } while (true) { only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/ConnectionHandler.cpp +++ dansguardian-2.8.0.4/ConnectionHandler.cpp @@ -145,10 +145,10 @@ peerconn.writeString(o.language_list.getTranslation(200)); // The requested URL is malformed. peerconn.writeString("</BODY></HTML>\n"); - } catch (exception& e) {} + } catch (std::exception& e) {} try { proxysock.close(); // close connection to proxy - } catch (exception& e) {} + } catch (std::exception& e) {} return; } @@ -268,10 +268,10 @@ decideHowToLog(clientuser, clientip, url.toCharArray(), header.port, exceptionreason, header.requesttype().toCharArray(), docsize, o.ll, false, isexception, o.log_exception_hits, false, &thestart, cachehit, 200, mimetype); } - } catch (exception& e) {} + } catch (std::exception& e) {} try { proxysock.close(); // close connection to proxy - } catch (exception& e) {} + } catch (std::exception& e) {} return; // connection dealt with so exit } @@ -303,10 +303,10 @@ fdt.tunnel(proxysock.getFD(), peerconn.getFD()); // not expected to exception docsize = fdt.throughput; decideHowToLog(clientuser, clientip, url.toCharArray(), header.port, exceptionreason, header.requesttype().toCharArray(), docsize, o.ll, false, isexception, o.log_exception_hits, false, &thestart, cachehit, 200, mimetype); - } catch (exception& e) {} + } catch (std::exception& e) {} try { proxysock.close(); // close connection to proxy - } catch (exception& e) {} + } catch (std::exception& e) {} return; // connection dealt with so exit } @@ -581,23 +581,23 @@ decideHowToLog(clientuser, clientip, url.toCharArray(), header.port, exceptionreason, header.requesttype().toCharArray(), docsize, o.ll, false, isexception, o.log_exception_hits, docheader.iscontenttype("text"), &thestart, cachehit, 200, mimetype); } - } catch (exception& e) { + } catch (std::exception& e) { #ifdef DGDEBUG std::cout << "connection handler caught an exception" << std::endl; #endif try { proxysock.close(); // close connection to proxy - } catch (exception& e) {} + } catch (std::exception& e) {} return; } try { proxysock.close(); // close conection to squid - } catch (exception& e) {} + } catch (std::exception& e) {} try { peerconn.readyForOutput(10); } - catch (exception& e) { + catch (std::exception& e) { return; } return; @@ -780,7 +780,7 @@ try { ipcsock.writeString(url.toCharArray()); // throws on err } - catch (exception& e) { + catch (std::exception& e) { #ifdef DGDEBUG std::cerr << "Exception writing to url cache" << std::endl; std::cerr << e.what() << std::endl; @@ -791,7 +791,7 @@ try { ipcsock.getline(reply, 7, 6); // throws on err } - catch (exception& e) { + catch (std::exception& e) { #ifdef DGDEBUG std::cerr << "Exception reading from url cache" << std::endl; std::cerr << e.what() << std::endl; @@ -828,7 +828,7 @@ try { ipcsock.writeString(url.toCharArray()); // throws on err } - catch (exception& e) { + catch (std::exception& e) { #ifdef DGDEBUG std::cerr << "Exception adding to url cache" << std::endl; std::cerr << e.what() << std::endl; @@ -1000,7 +1000,7 @@ writestring += redirhttps; writestring += "\n\n"; (*peerconn).writeString(writestring.toCharArray()); - } catch (exception& e) {} + } catch (std::exception& e) {} } else { @@ -1024,7 +1024,7 @@ try { // writestring throws exception on error/timeout (*peerconn).writeString(writestring.toCharArray()); - } catch (exception& e) {} + } catch (std::exception& e) {} } } else { @@ -1155,14 +1155,14 @@ else if (o.reporting_level == -1) { // stealth (*checkme).isItNaughty = false; // dont block } - } catch (exception& e) {} + } catch (std::exception& e) {} if ((*checkme).isItNaughty) { // not stealth mode then try { (*peerconn).readyForOutput(10); //as best a flush as I can - } catch (exception& e) {} + } catch (std::exception& e) {} try { (*proxysock).close(); // close connection to proxy - } catch (exception& e) {} + } catch (std::exception& e) {} return true; // we said no, so return true saying exit } return false; only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/dansguardian.cpp +++ dansguardian-2.8.0.4/dansguardian.cpp @@ -58,14 +58,14 @@ int rc = open(configfile, 0, O_RDONLY); if (rc < 0) { syslog(LOG_ERR, "Error opening %s", configfile); - cerr << "Error opening " << configfile << std::endl; + std::cerr << "Error opening " << configfile << std::endl; exit(1); // could not open conf file for reading, exit with error } close (rc); if (!o.read(configfile, type)) { syslog(LOG_ERR, "%s","Error parsing the dansguardian.conf file or other DansGuardian configuration files"); - cerr << "Error parsing the dansguardian.conf file or other DansGuardian configuration files" << std::endl; + std::cerr << "Error parsing the dansguardian.conf file or other DansGuardian configuration files" << std::endl; exit(1); // OptionContainer class had an error reading the conf or other files so exit with error } } @@ -187,15 +187,15 @@ } else { syslog(LOG_ERR, "%s","Unable to getpwnam() - does the proxy user exist?"); - cerr << "Unable to getpwnam() - does the proxy user exist?" << std::endl; - cerr << "Proxy user looking for is '" << o.daemon_user_name << "'" << std::endl; + std::cerr << "Unable to getpwnam() - does the proxy user exist?" << std::endl; + std::cerr << "Proxy user looking for is '" << o.daemon_user_name << "'" << std::endl; return 1; // was unable to lockup the user id from passwd // for some reason, so exit with error } if (o.no_logger == 0) { - ofstream logfiletest(o.log_location.c_str(), ios::app); + std::ofstream logfiletest(o.log_location.c_str(), std::ios::app); if (logfiletest.fail()) { syslog(LOG_ERR, "%s","Error opening/creating log file. (check ownership and access rights)."); std::cout << "Error opening/creating log file. (check ownership and access rights)." << std::endl; only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/DataBuffer.cpp +++ dansguardian-2.8.0.4/DataBuffer.cpp @@ -76,7 +76,7 @@ block = new char[newsize]; try { (*sock).checkForInput(timeout); - } catch (exception& e) { + } catch (std::exception& e) { delete[] block; break; } @@ -119,7 +119,7 @@ return toobig; } -void DataBuffer::read(Socket *sock, int l) throw (exception) { +void DataBuffer::read(Socket *sock, int l) throw (std::exception) { delete[] data; // delete the current data store (should be emtpy anyway) data = new char[l + 2]; // create a new store large enough int rc; @@ -127,7 +127,7 @@ rc = (*sock).readFromSocketn(data, l, 0, timeout); // read in the [POST] data if (rc < 0) { - throw exception(); // danger, danger Will Robinson + throw std::exception(); // danger, danger Will Robinson } // The above should be all that's needed - but wait there's more! @@ -152,13 +152,13 @@ } -void DataBuffer::out(Socket *sock) throw(exception) { +void DataBuffer::out(Socket *sock) throw(std::exception) { (*sock).readyForOutput(timeout); // exceptions on timeout or error // need exception or something for a bad write if (!(*sock).writeToSocket(data, buffer_length, 0, timeout)) { - throw exception(); + throw std::exception(); } // write the data block out to the stream } only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/FatController.cpp +++ dansguardian-2.8.0.4/FatController.cpp @@ -550,7 +550,7 @@ if (pids[i + 1].fd != -1) { try { close(pids[i + 1].fd); - } catch (exception& e) {} + } catch (std::exception& e) {} } } if (numchildren > 0) { @@ -802,11 +802,11 @@ int rc = handleConnections(sv[1]); try { close(sv[1]); // connection to parent - } catch (exception& e) {} + } catch (std::exception& e) {} try { serversock.close(); // listening connection } - catch (exception& e) {} + catch (std::exception& e) {} _exit(rc); // baby go bye bye } else { // must be parent @@ -856,7 +856,7 @@ if (pids[i + 1].fd != -1) { try { close(pids[i + 1].fd); - } catch (exception& e) {} + } catch (std::exception& e) {} } } delete[] childrenpids; @@ -944,7 +944,7 @@ numchildren--; try { close(pids[i + 1].fd); - } catch (exception& e) {} + } catch (std::exception& e) {} pids[i + 1].fd = -1; if (count >= num) { break; @@ -1000,7 +1000,7 @@ try { rc = getLineFromFD(pids[f].fd, buf, 4, 100); } - catch (exception& e) { + catch (std::exception& e) { kill(childrenpids[f - 1], SIGTERM); deleteChild(childrenpids[f - 1], -1); tofind--; @@ -1048,7 +1048,7 @@ numchildren--; // so no need to duplicate try { close(pids[i + 1].fd); // closing etc - } catch (exception& e) {} + } catch (std::exception& e) {} pids[i + 1].fd = -1; } childrenstates[i] = -1; // unused @@ -1079,7 +1079,7 @@ return -1; } } - catch (exception& e) { + catch (std::exception& e) { return -1; } return 0; @@ -1091,7 +1091,7 @@ String message = "G\n"; try { writeToFd(fd, message.toCharArray(), message.length(), 5); - } catch (exception& e) { + } catch (std::exception& e) { kill(childrenpids[num], SIGTERM); deleteChild(childrenpids[num], -1); return; @@ -1099,7 +1099,7 @@ char* buf = new char[5]; try { getLineFromFD(fd, buf, 4, 5); - } catch (exception& e) { + } catch (std::exception& e) { kill(childrenpids[num], SIGTERM); deleteChild(childrenpids[num], -1); delete[] buf; @@ -1122,7 +1122,7 @@ try { rc = getLineFromFD(fd, buf, 4, 360); // blocks for a few mins } - catch (exception& e) { + catch (std::exception& e) { delete[] buf; reloadconfig = true; @@ -1164,11 +1164,11 @@ writeToFd(fd, "K\n", 2, 10); // need to make parent wait for OK // so effectively providing a lock } - catch (exception& e) { + catch (std::exception& e) { try { close(peersockfd); } - catch (exception& e) { + catch (std::exception& e) { } return false; } @@ -1320,7 +1320,7 @@ int rc, ipcsockfd; char* logline = new char[4096]; - ofstream logfile(log_location.c_str(), ios::app); + std::ofstream logfile(log_location.c_str(), ios::app); if (logfile.fail()) { syslog(LOG_ERR, "%s","Error opening/creating log file."); #ifdef DGDEBUG @@ -1371,7 +1371,7 @@ } try { rc = ipcpeersock.getline(logline, 4096, 3); // throws on err - } catch (exception& e) { + } catch (std::exception& e) { ipcpeersock.close(); if (logconerror == 1) { syslog(LOG_ERR, "%s","Error reading ipc. (Ignorable)"); @@ -1495,7 +1495,7 @@ } try { rc = ipcpeersock.getline(logline, 4096, 3); // throws on err - } catch (exception& e) { + } catch (std::exception& e) { ipcpeersock.close(); // close the connection if (logconerror == 1) { #ifdef DGDEBUG @@ -1534,7 +1534,7 @@ } try { ipcpeersock.writeString(reply.toCharArray()); - } catch (exception& e) { + } catch (std::exception& e) { ipcpeersock.close(); // close the connection if (logconerror == 1) { syslog(LOG_ERR, "%s","Error writing url ipc. (Ignorable)"); @@ -1601,7 +1601,7 @@ try { fipcsock.writeString(request.toCharArray()); // throws on err } - catch (exception& e) { + catch (std::exception& e) { #ifdef DGDEBUG std::cerr << "Exception flushing url cache" << std::endl; std::cerr << e.what() << std::endl; only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/FOptionContainer.cpp +++ dansguardian-2.8.0.4/FOptionContainer.cpp @@ -75,7 +75,7 @@ std::string linebuffer; String temp; // for tempory conversion and storage int j; // counter - ifstream conffiles(filename.c_str(), ios::in); // dansguardianfN.conf + std::ifstream conffiles(filename.c_str(), std::ios::in); // dansguardianfN.conf if (!conffiles.good()) { if (!isDaemonised) { std::cerr << "error reading: " << filename << std::endl; @@ -111,7 +111,7 @@ // deque. They are only seperate files for clarity. linebuffer = findoptionS("picsfile"); - ifstream picsfiles(linebuffer.c_str(), ios::in); // pics file + std::ifstream picsfiles(linebuffer.c_str(), std::ios::in); // pics file if (!picsfiles.good()) { if (!isDaemonised) { std::cerr << "error reading: " << linebuffer << std::endl; @@ -323,7 +323,7 @@ else { blanket_ip_block = 0; } - } catch (exception& e) { + } catch (std::exception& e) { if (!isDaemonised) { std::cerr << e.what() << std::endl; // when called the daemon has not // detached so we can do this only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/HTMLTemplate.cpp +++ dansguardian-2.8.0.4/HTMLTemplate.cpp @@ -44,7 +44,7 @@ unsigned int offset; String result; String line; - std::ifstream templatefile(filename, ios::in); // dansguardian.conf + std::ifstream templatefile(filename, std::ios::in); // dansguardian.conf if (!templatefile.good()) { if (!isDaemonised) { std::cerr << "error reading: " << filename << std::endl; only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/HTTPHeader.cpp +++ dansguardian-2.8.0.4/HTTPHeader.cpp @@ -523,7 +523,7 @@ } -void HTTPHeader::out(Socket *sock) throw(exception) { +void HTTPHeader::out(Socket *sock) throw(std::exception) { String l; // for amalgamating to avoid conflict with the Nagel algorithm for(int i = 0; i < (signed)header.size(); i++) { l += header[i] + "\n"; @@ -535,7 +535,7 @@ // need exception for bad write if (!(*sock).writeToSocket(l.toCharArray(), l.length(), 0, timeout)) { - throw exception(); + throw std::exception(); } if (postdata.buffer_length > 0) { @@ -794,9 +794,9 @@ if (res != postdatablockend) { answer = true; } - } catch (exception& e) {}; + } catch (std::exception& e) {}; delete[] p; - } catch (exception& e) {}; + } catch (std::exception& e) {}; delete[] postdatablock; return answer; } only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/Ident.cpp +++ dansguardian-2.8.0.4/Ident.cpp @@ -30,7 +30,7 @@ :username("") {} -std::string Ident::getUsername(HTTPHeader* h, string* s, int port) { +std::string Ident::getUsername(HTTPHeader* h, std::string* s, int port) { #ifdef DGDEBUG std::cout << "getting username..." << std::endl; #endif @@ -70,7 +70,7 @@ } -bool Ident::getUsernameIdent(string* s, int port, int serverport, int timeout) { +bool Ident::getUsernameIdent(std::string* s, int port, int serverport, int timeout) { #ifdef DGDEBUG std::cout << "Connecting to:" << (*s) << std::endl; std::cout << "to ask about:" << port << std::endl; @@ -101,7 +101,7 @@ #endif try { iq.close(); // close conection to client - } catch (exception& e) {} + } catch (std::exception& e) {} return false; } #ifdef DGDEBUG @@ -110,7 +110,7 @@ char buff[8192]; try { iq.getline(buff, 8192, timeout); - } catch (exception& e) {return false;} + } catch (std::exception& e) {return false;} String temp; temp = buff; // convert to String #ifdef DGDEBUG @@ -118,7 +118,7 @@ #endif try { iq.close(); // close conection to client - } catch (exception& e) {} + } catch (std::exception& e) {} temp = temp.after(":"); if (!temp.before(":").contains("USERID")) { return false; only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/ImageContainer.cpp +++ dansguardian-2.8.0.4/ImageContainer.cpp @@ -57,11 +57,11 @@ mimetype = "image/gif"; } - ifstream imagefile; - imagefile.open(filename, ifstream::binary); - imagefile.seekg(0, ios::end); + std::ifstream imagefile; + imagefile.open(filename, std::ifstream::binary); + imagefile.seekg(0, std::ios::end); imagelength = imagefile.tellg(); - imagefile.seekg(0, ios::beg); + imagefile.seekg(0, std::ios::beg); if (imagelength) { image = new char[imagelength+1]; only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/LanguageContainer.cpp +++ dansguardian-2.8.0.4/LanguageContainer.cpp @@ -44,7 +44,7 @@ String v; String line; unsigned int k; - ifstream Languagefile(filename, ios::in); // open the file for reading + std::ifstream Languagefile(filename, std::ios::in); // open the file for reading if (!Languagefile.good()) { if (!isDaemonised) { std::cerr << "Error opening messages file (does it exist?): " << filename << std::endl; only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/ListContainer.cpp +++ dansguardian-2.8.0.4/ListContainer.cpp @@ -116,7 +116,7 @@ } filedate = getFileDate(filename); increaseMemoryBy(len + 1); // Allocate some memory to hold file - ifstream listfile(filename, ios::in); // open the file for reading + std::ifstream listfile(filename, std::ios::in); // open the file for reading if (!listfile.good()) { if (!isDaemonised) { std::cerr << "Error opening file (does it exist?): " << filename << std::endl; @@ -289,7 +289,7 @@ } increaseMemoryBy(len + 1); // Allocate some memory to hold file // The plus one is to cope with files not ending in a new line - ifstream listfile(filename, ios::in); + std::ifstream listfile(filename, std::ios::in); if (!listfile.good()) { if (!isDaemonised) { std::cerr << "Error opening :"<< filename << std::endl; @@ -550,7 +550,7 @@ #ifdef DGDEBUG std::cout << "creating processed file:" << f << std::endl; #endif - ofstream listfile(f.toCharArray(), ios::out); + std::ofstream listfile(f.toCharArray(), std::ios::out); if (listfile.fail()) { if (!isDaemonised) { std::cerr << "Error creating cache file." << std::endl; @@ -986,7 +986,7 @@ return false; } increaseMemoryBy(len + 2); - ifstream listfile(filename, ios::in); + std::ifstream listfile(filename, std::ios::in); if (!listfile.good()) { if (!isDaemonised) { std::cerr << "Error opening: "<< filename << std::endl; @@ -1204,7 +1204,7 @@ syslog(LOG_ERR, "%s", filename); return false; } - ifstream listfile(filename, ios::in); + std::ifstream listfile(filename, std::ios::in); if (!listfile.good()) { if (!isDaemonised) { std::cerr << "Error opening: "<< filename << std::endl; only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/OptionContainer.cpp +++ dansguardian-2.8.0.4/OptionContainer.cpp @@ -72,7 +72,7 @@ std::string linebuffer; String temp; // for tempory conversion and storage int j; // counter - ifstream conffiles(filename, ios::in); // dansguardian.conf + std::ifstream conffiles(filename, std::ios::in); // dansguardian.conf if (!conffiles.good()) { if (!isDaemonised) { std::cerr << "error reading: " << filename << std::endl; @@ -358,7 +358,7 @@ if (reporting_level == 1 || reporting_level == 2) { if (ada.length() < 4) { if (!isDaemonised) { - cerr << "accessdeniedaddress setting appears to be wrong." << endl; + std::cerr << "accessdeniedaddress setting appears to be wrong." << std::endl; } syslog(LOG_ERR, "%s", "accessdeniedaddress setting appears to be wrong."); return false; @@ -405,7 +405,7 @@ } - } catch (exception& e) { + } catch (std::exception& e) { if (!isDaemonised) { std::cerr << e.what() << std::endl; // when called the daemon has not // detached so we can do this only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/Socket.cpp +++ dansguardian-2.8.0.4/Socket.cpp @@ -174,7 +174,7 @@ } -void Socket::checkForInput(int timeout) throw (exception) { +void Socket::checkForInput(int timeout) throw (std::exception) { // blocks if socket blocking // until timeout fd_set fdSet; @@ -184,8 +184,8 @@ t.tv_sec = timeout; t.tv_usec = 0; if (Socket::selectEINTR(sck_inet + 1, &fdSet, NULL, NULL, &t) < 1) { - string err("select() on input: "); - throw runtime_error(err + (errno? strerror(errno) : "timeout")); + std::string err("select() on input: "); + throw std::runtime_error(err + (errno? strerror(errno) : "timeout")); } } @@ -204,7 +204,7 @@ } -void Socket::readyForOutput(int timeout) throw(exception) { +void Socket::readyForOutput(int timeout) throw(std::exception) { // blocks if socket blocking // until timeout fd_set fdSet; @@ -214,12 +214,12 @@ t.tv_sec = timeout; t.tv_usec = 0; if (Socket::selectEINTR(sck_inet + 1, NULL, &fdSet, NULL, &t) < 1) { - string err("select() on output: "); - throw runtime_error(err + (errno? strerror(errno) : "timeout")); + std::string err("select() on output: "); + throw std::runtime_error(err + (errno? strerror(errno) : "timeout")); } } -int Socket::getline(char* buff, int size, int timeout) throw(exception) { +int Socket::getline(char* buff, int size, int timeout) throw(std::exception) { char b[1]; int rc; @@ -228,7 +228,7 @@ while(i < (size - 1)) { rc = readFromSocket(b, 1, 0, timeout); if (rc < 0) { - throw runtime_error(string("Can't read from socket: ") + strerror(errno)); // on error + throw std::runtime_error(std::string("Can't read from socket: ") + strerror(errno)); // on error } if (rc == 0) { // eof, other end closed so b[0] = '\n'; // force it to return what read @@ -245,16 +245,16 @@ } -void Socket::writeString(const char* line) throw(exception) { +void Socket::writeString(const char* line) throw(std::exception) { int l = strlen(line); if (!writeToSocket((char*)line, l, 0, timeout)) { - throw runtime_error(string("Can't write to socket: ") + strerror(errno)); + throw std::runtime_error(std::string("Can't write to socket: ") + strerror(errno)); } } -void Socket::writeToSockete(char* buff, int len, unsigned int flags, int timeout) throw(exception) { +void Socket::writeToSockete(char* buff, int len, unsigned int flags, int timeout) throw(std::exception) { if (!Socket::writeToSocket(buff, len, flags, timeout)) { - throw runtime_error(string("Can't write to socket: ") + strerror(errno)); + throw std::runtime_error(std::string("Can't write to socket: ") + strerror(errno)); } } @@ -264,7 +264,7 @@ while (actuallysent < len) { try { readyForOutput(timeout); // throws exception on error or timeout - } catch (exception& e) { + } catch (std::exception& e) { return false; } sent = send(sck_inet, buff + actuallysent, len - actuallysent, 0); @@ -289,7 +289,7 @@ while (cnt > 0) { try { checkForInput(timeout); // throws exception on error or timeout - } catch (exception& e) { + } catch (std::exception& e) { return -1; } rc = recv(sck_inet, buff, len, flags); @@ -313,7 +313,7 @@ int rc; try { checkForInput(timeout); - } catch (exception& e) { + } catch (std::exception& e) { return -1; } while (true) { only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/String.cpp +++ dansguardian-2.8.0.4/String.cpp @@ -116,7 +116,7 @@ data[sl] = '\0'; } -ostream& operator << (ostream& out, const String& s) { +std::ostream& operator << (std::ostream& out, const String& s) { out.write(s.data, s.sl); return out; } only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/DataBuffer.hpp +++ dansguardian-2.8.0.4/DataBuffer.hpp @@ -33,11 +33,11 @@ int compressed_buffer_length; DataBuffer(); ~DataBuffer(); - void read(Socket *sock, int length) throw(exception); + void read(Socket *sock, int length) throw(std::exception); int length() {return buffer_length;} void copytomemory(char* location); bool in(Socket *sock); // gives true if it pauses due to too much data - void out(Socket *sock) throw(exception); + void out(Socket *sock) throw(std::exception); void setTimeout(int t); void setDecompress(String d); bool contentRegExp(int filtergroup); only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/HTTPHeader.hpp +++ dansguardian-2.8.0.4/HTTPHeader.hpp @@ -31,7 +31,7 @@ DataBuffer postdata; unsigned int port; void in(Socket *sock); - void out(Socket *sock) throw(exception); + void out(Socket *sock) throw(std::exception); int contentlength(); bool iscontenttype(String t); bool malformedURL(String url); only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/Ident.hpp +++ dansguardian-2.8.0.4/Ident.hpp @@ -28,12 +28,12 @@ public: Ident(); - std::string getUsername(HTTPHeader* h, string* s, int port); + std::string getUsername(HTTPHeader* h, std::string* s, int port); private: bool getUsernameProxyAuth(HTTPHeader* h); bool getUsernameNTLM(HTTPHeader* h); - bool getUsernameIdent(string* s, int port, int serverport, int timeout); + bool getUsernameIdent(std::string* s, int port, int serverport, int timeout); std::string username; }; only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/Socket.hpp +++ dansguardian-2.8.0.4/Socket.hpp @@ -54,15 +54,15 @@ int getTimeout(); bool checkForInput(); - void checkForInput(int timeout) throw(exception); + void checkForInput(int timeout) throw(std::exception); bool readyForOutput(); - void readyForOutput(int timeout) throw(exception); - int getline(char* buff, int size, int timeout) throw(exception); - void writeString(const char* line) throw(exception); + void readyForOutput(int timeout) throw(std::exception); + int getline(char* buff, int size, int timeout) throw(std::exception); + void writeString(const char* line) throw(std::exception); bool writeToSocket(char* buff, int len, unsigned int flags, int timeout); int readFromSocketn(char* buff, int len, unsigned int flags, int timeout); int readFromSocket(char* buff, int len, unsigned int flags, int timeout); - void writeToSockete(char* buff, int len, unsigned int flags, int timeout) throw(exception); + void writeToSockete(char* buff, int len, unsigned int flags, int timeout) throw(std::exception); private: only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/String.hpp +++ dansguardian-2.8.0.4/String.hpp @@ -40,7 +40,7 @@ String(const long num); String(const char bs[], int len); String(const char bs[], int start, int len); - friend ostream & operator << (ostream & out, const String& s); + friend std::ostream & operator << (std::ostream & out, const String& s); friend String operator+ (const String & lhs, const String & s); String& operator = (const String & s); bool operator != (const String & s); only in patch2: unchanged: --- dansguardian-2.8.0.4.orig/UDSocket.hpp +++ dansguardian-2.8.0.4/UDSocket.hpp @@ -52,15 +52,15 @@ int getTimeout(); bool checkForInput(); - void checkForInput(int timeout) throw(exception); + void checkForInput(int timeout) throw(std::exception); bool readyForOutput(); - void readyForOutput(int timeout) throw(exception); - int getline(char* buff, int size, int timeout) throw(exception); - void writeString(const char* line) throw(exception); + void readyForOutput(int timeout) throw(std::exception); + int getline(char* buff, int size, int timeout) throw(std::exception); + void writeString(const char* line) throw(std::exception); bool writeToSocket(char* buff, int len, unsigned int flags, int timeout); int readFromSocketn(char* buff, int len, unsigned int flags, int timeout); int readFromSocket(char* buff, int len, unsigned int flags, int timeout); - void writeToSockete(char* buff, int len, unsigned int flags, int timeout) throw(exception); + void writeToSockete(char* buff, int len, unsigned int flags, int timeout) throw(std::exception); private:
signature.asc
Description: Digital signature