mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
merge soc07 r5233 - Changed perror()s with hardcoded function names to Nmap's gh_perror() and __func__, changed perror()s followed by exit()s to Nmap's pfatal(), and removed newlines from perror()s because it breaks the line after that and before the colon and error string, which doesn't make sense
This commit is contained in:
14
nmap.cc
14
nmap.cc
@@ -2430,7 +2430,7 @@ int ftp_anon_connect(struct ftpinfo *ftp) {
|
||||
ftp->server_name, ftp->port);
|
||||
|
||||
if ((sd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
|
||||
perror("Couldn't create ftp_anon_connect socket");
|
||||
gh_perror("Couldn't create %s socket", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2448,8 +2448,7 @@ int ftp_anon_connect(struct ftpinfo *ftp) {
|
||||
log_write(LOG_STDOUT, "%s", recvbuf);
|
||||
}
|
||||
if (res < 0) {
|
||||
perror("recv problem from ftp bounce server");
|
||||
exit(1);
|
||||
pfatal("recv problem from ftp bounce server");
|
||||
}
|
||||
|
||||
snprintf(command, 511, "USER %s\r\n", ftp->user);
|
||||
@@ -2457,8 +2456,7 @@ int ftp_anon_connect(struct ftpinfo *ftp) {
|
||||
send(sd, command, strlen(command), 0);
|
||||
res = recvtime(sd, recvbuf, sizeof(recvbuf) - 1,12, NULL);
|
||||
if (res <= 0) {
|
||||
perror("recv problem from ftp bounce server");
|
||||
exit(1);
|
||||
pfatal("recv problem from ftp bounce server");
|
||||
}
|
||||
recvbuf[res] = '\0';
|
||||
if (o.debugging) log_write(LOG_STDOUT, "sent username, received: %s", recvbuf);
|
||||
@@ -2471,8 +2469,7 @@ int ftp_anon_connect(struct ftpinfo *ftp) {
|
||||
send(sd, command, strlen(command), 0);
|
||||
res = recvtime(sd, recvbuf, sizeof(recvbuf) - 1,12, NULL);
|
||||
if (res < 0) {
|
||||
perror("recv problem from ftp bounce server\n");
|
||||
exit(1);
|
||||
pfatal("recv problem from ftp bounce server");
|
||||
}
|
||||
if (!res) error("Timeout from bounce server ...");
|
||||
else {
|
||||
@@ -2489,8 +2486,7 @@ int ftp_anon_connect(struct ftpinfo *ftp) {
|
||||
log_write(LOG_STDOUT, "%s", recvbuf);
|
||||
}
|
||||
if (res < 0) {
|
||||
perror("recv problem from ftp bounce server");
|
||||
exit(1);
|
||||
pfatal("recv problem from ftp bounce server");
|
||||
}
|
||||
if (o.verbose) log_write(LOG_STDOUT, "Login credentials accepted by ftp server!\n");
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ for(decoy=0; decoy < o.numdecoys; decoy++) {
|
||||
|
||||
if ((res = send_ip_packet(sd, eth, packet, ntohs(ip->ip_len))) == -1)
|
||||
{
|
||||
perror("send_ip_packet in send_closedupd_probe");
|
||||
gh_perror("send_ip_packet in %s", __func__);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3105,7 +3105,7 @@ int send_closedudp_probe_2(struct udpprobeinfo &upi, int sd,
|
||||
|
||||
if ((res = send_ip_packet(sd, eth, packet, ntohs(ip->ip_len))) == -1)
|
||||
{
|
||||
perror("send_ip_packet in send_closedupd_probe_2");
|
||||
gh_perror("send_ip_packet in %s", __func__);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3560,7 +3560,7 @@ void bounce_scan(Target *target, u16 *portarray, int numports,
|
||||
snprintf(command, 512, "PORT %s%i,%i\r\n", targetstr, p1,p2);
|
||||
if (o.debugging) log_write(LOG_STDOUT, "Attempting command: %s", command);
|
||||
if (send(sd, command, strlen(command), 0) < 0 ) {
|
||||
perror("send in bounce_scan");
|
||||
gh_perror("send in %s", __func__);
|
||||
if (retriesleft) {
|
||||
if (o.verbose || o.debugging)
|
||||
log_write(LOG_STDOUT, "Our ftp proxy server hung up on us! retrying\n");
|
||||
@@ -3580,7 +3580,7 @@ void bounce_scan(Target *target, u16 *portarray, int numports,
|
||||
} else { /* Our send is good */
|
||||
res = recvtime(sd, recvbuf, 2048, 15, NULL);
|
||||
if (res <= 0)
|
||||
perror("recv problem from ftp bounce server\n");
|
||||
perror("recv problem from ftp bounce server");
|
||||
|
||||
else { /* our recv is good */
|
||||
recvbuf[res] = '\0';
|
||||
@@ -3602,7 +3602,7 @@ void bounce_scan(Target *target, u16 *portarray, int numports,
|
||||
if (send(sd, "LIST\r\n", 6, 0) > 0 ) {
|
||||
res = recvtime(sd, recvbuf, 2048,12, &timedout);
|
||||
if (res < 0) {
|
||||
perror("recv problem from ftp bounce server\n");
|
||||
perror("recv problem from ftp bounce server");
|
||||
} else if (res == 0) {
|
||||
if (timedout)
|
||||
target->ports.addPort(portarray[i], IPPROTO_TCP, NULL,
|
||||
|
||||
4
tcpip.cc
4
tcpip.cc
@@ -3235,14 +3235,14 @@ int recvtime(int sd, char *buf, int len, int seconds, int *timedout) {
|
||||
if (res > 0 ) {
|
||||
res = recv(sd, buf, len, 0);
|
||||
if (res >= 0) return res;
|
||||
perror("recv in recvtime");
|
||||
gh_perror("recv in %s", __func__);
|
||||
return 0;
|
||||
}
|
||||
else if (!res) {
|
||||
if (timedout) *timedout = 1;
|
||||
return 0;
|
||||
}
|
||||
perror("select() in recvtime");
|
||||
gh_perror("select() in %s", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user