Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 117268
Collapse All | Expand All

(-)dansguardian-2.9.3.2/src/contentscanners/kavdscan.cpp (-4 / +25 lines)
Lines 153-174 Link Here
153
		return DGCS_SCANERROR;
153
		return DGCS_SCANERROR;
154
	}
154
	}
155
	String reply = buff;
155
	String reply = buff;
156
	delete[]buff;
157
	reply.removeWhiteSpace();
158
#ifdef DGDEBUG
156
#ifdef DGDEBUG
159
	std::cout << "Got from kavdscan:" << reply << std::endl;
157
	std::cout << "Got from kavdscan:" << reply << std::endl;
160
#endif
158
#endif
161
	stripedsocks.close();
162
	if (reply[0] == '2') {	// clean
159
	if (reply[0] == '2') {	// clean
163
#ifdef DGDEBUG
160
#ifdef DGDEBUG
164
		std::cerr << "kavdscan - clean" << std::endl;
161
		std::cerr << "kavdscan - clean" << std::endl;
165
#endif
162
#endif
163
		delete[]buff;
164
		stripedsocks.close();
166
		return DGCS_CLEAN;
165
		return DGCS_CLEAN;
167
	}
166
	}
168
	if (reply.startsWith("322")) {	// infected
167
	if (reply.startsWith("322")) {	// infected
169
		lastvirusname = reply.after(" ").before(" ");
168
		while(reply[0] != '2' && rc != 0) {
169
			reply.removeWhiteSpace();
170
			lastvirusname = lastvirusname + " " + reply.after("322-").before(" ");
171
			try {
172
				rc = stripedsocks.getLine(buff, 4096, o.content_scanner_timeout);
173
			}
174
			catch(exception & e) {
175
				delete[]buff;
176
				stripedsocks.close();
177
				syslog(LOG_ERR, "%s", "Error reading kavdscan socket");
178
				return DGCS_SCANERROR;
179
			}
180
			reply = buff;
181
#ifdef DGDEBUG
182
			std::cout << "Got from kavdscan:" << reply << std::endl;
183
#endif
184
		}
185
		std::cout << "lastvirusname: " << lastvirusname << std::endl;
186
		delete[]buff;
187
		stripedsocks.close();
170
		// format: 322 nastyvirus blah
188
		// format: 322 nastyvirus blah
189
		return DGCS_INFECTED;
171
	}
190
	}
191
	delete[]buff;
192
	stripedsocks.close();
172
	// must be an error then
193
	// must be an error then
173
	lastmessage = reply;
194
	lastmessage = reply;
174
	return DGCS_SCANERROR;
195
	return DGCS_SCANERROR;

Return to bug 117268