comparison src/scanner.cpp @ 272:a99b6c1f5f67

Code cleanup, increase minimum hostname length for uribl checking
author Carl Byington <carl@five-ten-sg.com>
date Mon, 09 Sep 2013 19:30:21 -0700
parents f92f24950bd3
children 1686cb639269
comparison
equal deleted inserted replaced
271:93d1337fd5bc 272:a99b6c1f5f67
1255 if (!strchr((const char *)pending, '@')) { 1255 if (!strchr((const char *)pending, '@')) {
1256 // not an email address or message id 1256 // not an email address or message id
1257 const char *p1 = strchr((const char *)pending, '.'); 1257 const char *p1 = strchr((const char *)pending, '.');
1258 const char *p2 = strrchr((const char *)pending, '.'); 1258 const char *p2 = strrchr((const char *)pending, '.');
1259 const char *p3 = strstr((const char *)pending, ".."); 1259 const char *p3 = strstr((const char *)pending, "..");
1260 if (p1 && (p1 != (char*)pending) & !p3) { 1260 size_t n = strlen((const char *)pending);
1261 // have a period, so at least two components, and no empty components 1261 if (p1 && (p1 != (char*)pending) && !p3 && (n > 6)) {
1262 // have a period, so at least two components, and no empty components, and longer than 6 chars
1262 in_addr ip; 1263 in_addr ip;
1263 if (inet_aton((const char*)pending, &ip)) { 1264 if (inet_aton((const char*)pending, &ip)) {
1264 // have an ip address if at least two periods 1265 // have an ip address if at least two periods
1265 if (p1 != p2) memory->new_url((char*)pending); 1266 if (p1 != p2) memory->new_url((char*)pending);
1266 } 1267 }