logo       

[PATCH] Change C++ comments to C comments in nmapfe and nsock: msg#00077

security.nmap.devel

Subject: [PATCH] Change C++ comments to C comments in nmapfe and nsock

This just changes the C++ comments (//) to C comments (/**/) in nmapfe/*
and nsock/* since some older C compilers don't like any C99 additions.

It's a diff against 4.21ALPHA1

Thanks,
Kris Katterjohn
--- x/nmapfe/nmapfe.c 2006-09-26 02:49:21.000000000 -0500
+++ y/nmapfe/nmapfe.c 2006-12-15 09:14:36.000000000 -0600
@@ -520,14 +520,14 @@ GtkAdjustment *adjust;

/* Scan page (first in notebook) */
nblabel = gtk_label_new("Scan");
- // nbpage = gtk_vbox_new(FALSE, 5);
+ /* nbpage = gtk_vbox_new(FALSE, 5); */
nbpage = gtk_table_new(5, 3, TRUE);
gtk_table_set_col_spacings(GTK_TABLE(nbpage), 5);
gtk_table_set_row_spacings(GTK_TABLE(nbpage), 5);
gtk_container_set_border_width(GTK_CONTAINER(nbpage), 5);

frame = gtk_frame_new("Scan Type");
- // gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0);
+ /* gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0); */
gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 2, 0, 3);

table = gtk_table_new(2, 4, FALSE);
@@ -629,7 +629,7 @@ GtkAdjustment *adjust;


frame = gtk_frame_new("Scan Extensions");
- // gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0);
+ /* gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0); */
gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 2, 3, 5);

table = gtk_table_new(1, 4, FALSE);
@@ -674,20 +674,20 @@ GtkAdjustment *adjust;
/* Discover/Ping page (second in notebook) */
nblabel = gtk_label_new("Discover");
nbpage = gtk_table_new(4, 4, FALSE);
- // nbpage = gtk_vbox_new(FALSE, 5);
+ /* nbpage = gtk_vbox_new(FALSE, 5); */
gtk_container_set_border_width(GTK_CONTAINER(nbpage), 5);

opt.dontPing = gtk_check_button_new_with_label("Don't Ping");
g_signal_connect(GTK_OBJECT(opt.dontPing), "released",
GTK_SIGNAL_FUNC(pingButton_toggled_cb), opt.dontPing);
gtk_table_attach_defaults(GTK_TABLE(nbpage), opt.dontPing, 0, 1, 0, 1);
- // gtk_box_pack_start(GTK_BOX(nbpage), opt.dontPing, FALSE, FALSE, 0);
+ /* gtk_box_pack_start(GTK_BOX(nbpage), opt.dontPing, FALSE, FALSE, 0); */
gtk_widget_show(opt.dontPing);


frame = gtk_frame_new("Ping Types");
gtk_table_attach_defaults(GTK_TABLE(nbpage), frame, 0, 3, 1, 4);
- // gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0);
+ /* gtk_box_pack_start(GTK_BOX(nbpage), frame, FALSE, FALSE, 0); */

table = gtk_table_new(3, 4, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 5);
@@ -1037,7 +1037,7 @@ GtkAdjustment *adjust;
nblabel = gtk_label_new("Files");
nbpage = gtk_hbox_new(TRUE, 5);
gtk_container_set_border_width(GTK_CONTAINER(nbpage), 5);
- // gtk_table_set_col_spacings(GTK_TABLE(nbpage), 5);
+ /* gtk_table_set_col_spacings(GTK_TABLE(nbpage), 5); */

frame = gtk_frame_new("Input File");
gtk_box_pack_start(GTK_BOX(nbpage), frame, TRUE, TRUE, 0);
@@ -1251,7 +1251,7 @@ GtkAdjustment *adjust;

table = gtk_table_new(4, 2, FALSE);
gtk_container_set_border_width(GTK_CONTAINER(table), 5);
- // gtk_table_set_col_spacings(GTK_TABLE(table), 5);
+ /* gtk_table_set_col_spacings(GTK_TABLE(table), 5); */
gtk_container_add(GTK_CONTAINER(frame), table);

opt.useSourceDevice = gtk_check_button_new_with_label("Device");

--- x/nmapfe/nmapfe_sig.c 2006-11-02 23:36:54.000000000 -0600
+++ y/nmapfe/nmapfe_sig.c 2006-12-15 09:19:01.000000000 -0600
@@ -201,7 +201,7 @@ main (int argc,
return 0;
}

-// tokensz is the total size of token in characters
+/* tokensz is the total size of token in characters */
static char *next_token(char *buf, char *token, int tokensz)
{
if ((buf != NULL) && (token != NULL)) {
@@ -238,15 +238,16 @@ static char *build_command()
static char *command = NULL;
int command_size = 2560;

- /* Find how much to malloc() */
- // size = strlen(gtk_entry_get_text(GTK_ENTRY(opt.range_text))) +
- // strlen(gtk_entry_get_text(GTK_ENTRY(opt.Decoy))) +
- // strlen(gtk_entry_get_text(GTK_ENTRY(opt.inputFilename))) +
- // strlen(gtk_entry_get_text(GTK_ENTRY(opt.SourceDevice)))+
- // strlen(gtk_entry_get_text(GTK_ENTRY(opt.scanRelay)))+
- // strlen(gtk_entry_get_text(GTK_ENTRY(opt.targetHost))) +
- // 2560;
- /* We get 60 from the chars required for each option */
+ /* Find how much to malloc()
+ * size = strlen(gtk_entry_get_text(GTK_ENTRY(opt.range_text))) +
+ * strlen(gtk_entry_get_text(GTK_ENTRY(opt.Decoy))) +
+ * strlen(gtk_entry_get_text(GTK_ENTRY(opt.inputFilename))) +
+ * strlen(gtk_entry_get_text(GTK_ENTRY(opt.SourceDevice)))+
+ * strlen(gtk_entry_get_text(GTK_ENTRY(opt.scanRelay)))+
+ * strlen(gtk_entry_get_text(GTK_ENTRY(opt.targetHost))) +
+ * 2560;
+ * We get 60 from the chars required for each option
+ */

if (!command)
command = safe_malloc(command_size);
@@ -713,7 +714,7 @@ static char *next_line(char *buf, int bu

if (eol != NULL) {
char *bol = buf;
- int linelen = MIN(bufsz - 1, eol - buf + 1); // we can't exceed buffer size
+ int linelen = MIN(bufsz - 1, eol - buf + 1); /* we can't exceed buffer
size */

/* copy line including \n to line */
memcpy(line, buf, linelen);
@@ -1014,13 +1015,13 @@ void scanType_cb
opt.scanValue = user[k].scantype;

if ((opt.scanValue == PING_SCAN) || (opt.scanValue == LIST_SCAN)) {
- // gtk_widget_set_sensitive(GTK_WIDGET(opt.protportFrame), FALSE);
+ /* gtk_widget_set_sensitive(GTK_WIDGET(opt.protportFrame), FALSE); */
gtk_widget_set_sensitive(GTK_WIDGET(opt.protportType), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(opt.protportRange), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(opt.OSInfo), FALSE);
} else {
- // gtk_widget_set_sensitive(GTK_WIDGET(opt.protportFrame), TRUE);
+ /* gtk_widget_set_sensitive(GTK_WIDGET(opt.protportFrame), TRUE); */
gtk_widget_set_sensitive(GTK_WIDGET(opt.protportType), TRUE);
gtk_widget_set_sensitive(GTK_WIDGET(opt.protportLabel),
(opt.protportValue == GIVEN_PROTPORT));

--- x/nsock/include/nsock.h 2006-08-24 20:48:01.000000000 -0500
+++ y/nsock/include/nsock.h 2006-12-15 09:19:51.000000000 -0600
@@ -71,10 +71,11 @@
extern "C" {
#endif

-// The read calls will generally return after reading at least this
-// much data so that the caller can process it and so that the
-// connection spewing data doesn't monopolize resources. The caller
-// can always initiate another read request to ask for more.
+/* The read calls will generally return after reading at least this
+ * much data so that the caller can process it and so that the
+ * connection spewing data doesn't monopolize resources. The caller
+ * can always initiate another read request to ask for more.
+ */
#define NSOCK_READ_CHUNK_SIZE 0x8FFFF

/********************* TYPEDEFS ********************/
@@ -133,11 +134,12 @@ int nsp_geterrorcode(nsock_pool nsp);
/* Every nsp has an ID that is unique across the program execution */
unsigned long nsp_getid(nsock_pool nsp);

-// Note that nsi_get1_ssl_session will increment the usage count
-// of the SSL_SESSION, since nsock does a free when the nsi is
-// destroyed. It's up to any calling function/etc to do a
-// SSL_SESSION_free() on it. nsi_get0_ssl_session doesn't
-// increment, and is for informational purposes only.
+/* Note that nsi_get1_ssl_session will increment the usage count
+ * of the SSL_SESSION, since nsock does a free when the nsi is
+ * destroyed. It's up to any calling function/etc to do a
+ * SSL_SESSION_free() on it. nsi_get0_ssl_session doesn't
+ * increment, and is for informational purposes only.
+ */
nsock_ssl_session nsi_get1_ssl_session(nsock_iod nsockiod);
nsock_ssl_session nsi_get0_ssl_session(nsock_iod nsockiod);


--- x/nsock/src/filespace.h 2006-08-24 20:48:01.000000000 -0500
+++ y/nsock/src/filespace.h 2006-12-15 09:20:03.000000000 -0600
@@ -136,7 +136,7 @@ char *tmpstr;
if (len < 0) return -1;
if (len == 0) return 0;

-// printf("fscat: current_alloc=%d; current_size=%d; len=%d\n",
fs->current_alloc, fs->current_size, len);
+/* printf("fscat: current_alloc=%d; current_size=%d; len=%d\n",
fs->current_alloc, fs->current_size, len); */

if (fs->current_alloc - fs->current_size < len + 2) {
fs->current_alloc = (int) (fs->current_alloc * 1.4 + 1 );

--- x/nsock/src/netutils.c 2006-08-24 20:48:01.000000000 -0500
+++ y/nsock/src/netutils.c 2006-12-15 09:11:33.000000000 -0600
@@ -124,7 +124,7 @@ static int maxfds = -1;
} else return 0;
}
#endif
-#endif // !WIN32
+#endif /* !WIN32 */
return 0;
}


--- x/nsock/src/nsock_connect.c 2006-08-24 20:48:01.000000000 -0500
+++ y/nsock/src/nsock_connect.c 2006-12-15 09:11:44.000000000 -0600
@@ -194,7 +194,7 @@ nsock_event_id nsock_connect_ssl(nsock_p
userdata);
assert(nse);

- // Set our SSL_SESSION so we can benefit from session-id reuse.
+ /* Set our SSL_SESSION so we can benefit from session-id reuse. */
nsi_set_ssl_session(nsi, (SSL_SESSION *) ssl_session);

if (ms->tracelevel > 0)
@@ -230,7 +230,7 @@ nsock_event_id nsock_reconnect_ssl(nsock
nse = msevent_new(ms, NSE_TYPE_CONNECT_SSL, nsi, timeout_msecs, handler,
userdata);
assert(nse);

- // Set our SSL_SESSION so we can benefit from session-id reuse.
+ /* Set our SSL_SESSION so we can benefit from session-id reuse. */
nsi_set_ssl_session(nsi, (SSL_SESSION *) ssl_session);

if (ms->tracelevel > 0)

--- x/nsock/src/nsock_core.c 2006-08-24 20:48:01.000000000 -0500
+++ y/nsock/src/nsock_core.c 2006-12-15 09:12:34.000000000 -0600
@@ -115,7 +115,7 @@ static int wait_for_events(mspool *ms, i
no timeout) */
combined_msecs = MIN((unsigned) event_msecs, (unsigned) msec_timeout);

- // printf("wait_for_events: starting wait -- combined_msecs=%d\n",
combined_msecs);
+ /* printf("wait_for_events: starting wait -- combined_msecs=%d\n",
combined_msecs); */
/* Set up the timeval pointer we will give to select() */
memset(&select_tv, 0, sizeof(select_tv));
if (combined_msecs > 0) {
@@ -468,15 +468,17 @@ static int do_actual_read(mspool *ms, ms
return -1;
}

- // Sometimes a service just spews and spews data. So we return
- // after a somewhat large amount to avoid monopolizing resources
- // and avoid DOS attacks.
+ /* Sometimes a service just spews and spews data. So we return
+ * after a somewhat large amount to avoid monopolizing resources
+ * and avoid DOS attacks.
+ */
if (FILESPACE_LENGTH(&nse->iobuf) > max_chunk)
return FILESPACE_LENGTH(&nse->iobuf) - startlen;

- // No good reason to read again if we we were successful in the read but
- // didn't fill up the buffer. I'll insist on it being TCP too, because
I
- // think UDP might only give me one packet worth at a time (I dunno
...).
+ /* No good reason to read again if we we were successful in the read but
+ * didn't fill up the buffer. I'll insist on it being TCP too, because
I
+ * think UDP might only give me one packet worth at a time (I dunno
...).
+ */
if (buflen > 0 && buflen < sizeof(buf) && iod->lastproto == IPPROTO_TCP)
return FILESPACE_LENGTH(&nse->iobuf) - startlen;
}
@@ -502,9 +504,10 @@ static int do_actual_read(mspool *ms, ms
return -1;
}

- // Sometimes a service just spews and spews data. So we return
- // after a somewhat large amount to avoid monopolizing resources
- // and avoid DOS attacks.
+ /* Sometimes a service just spews and spews data. So we return
+ * after a somewhat large amount to avoid monopolizing resources
+ * and avoid DOS attacks.
+ */
if (FILESPACE_LENGTH(&nse->iobuf) > NSOCK_READ_CHUNK_SIZE)
return FILESPACE_LENGTH(&nse->iobuf) - startlen;
}
@@ -622,8 +625,9 @@ void handle_read_result(mspool *ms, msev
FD_CLR(iod->sd, &ms->mioi.fds_results_w);
}

- // Note -- I only want to decrement IOD if there are no other events
hinging on it.
- // For example, there could be a READ and WRITE outstanding at once
+ /* Note -- I only want to decrement IOD if there are no other events
hinging on it.
+ * For example, there could be a READ and WRITE outstanding at once
+ */
if (iod->events_pending <= 1 && ms->mioi.max_sd == iod->sd)
ms->mioi.max_sd--;
}
@@ -954,7 +958,7 @@ void nsock_trace_handler_callback(mspool
snprintf(errstr, sizeof(errstr), "[%s (%d)] ", strerror(nse->errnum),
nse->errnum);
} else errstr[0] = '\0';

- // Some types have special tracing treatment
+ /* Some types have special tracing treatment */
switch(nse->type) {
case NSE_TYPE_CONNECT:
case NSE_TYPE_CONNECT_SSL:

--- x/nsock/src/nsock_iod.c 2006-08-24 20:48:01.000000000 -0500
+++ y/nsock/src/nsock_iod.c 2006-12-15 09:12:43.000000000 -0600
@@ -162,8 +162,8 @@ void nsi_delete(nsock_iod nsockiod, int
currev = (msevent *) GH_LIST_ELEM_DATA(currev_elem);
next_elem = GH_LIST_ELEM_NEXT(currev_elem);
if (currev->iod == nsi) {
- // OK - we found an event pending on this IOD. Kill it.
- // printf("Found an outstanding event (out of %d), removing\n",
nsi->events_pending);
+ /* OK - we found an event pending on this IOD. Kill it. */
+ /* printf("Found an outstanding event (out of %d), removing\n",
nsi->events_pending); */
msevent_cancel(nsi->nsp, currev, elist_ar[elist], currev_elem,
pending_response == NSOCK_PENDING_NOTIFY);
}
if (nsi->events_pending == 0)

--- x/nsock/src/nsock_ssl.c 2006-08-24 20:48:01.000000000 -0500
+++ y/nsock/src/nsock_ssl.c 2006-12-15 09:12:48.000000000 -0600
@@ -123,7 +123,7 @@ void Nsock_SSL_Init() {
SSL_CTX_set_session_cache_mode(
sslnfo->ctx, SSL_SESS_CACHE_OFF | SSL_SESS_CACHE_NO_AUTO_CLEAR );
SSL_CTX_sess_set_cache_size( sslnfo->ctx, 1 );
- SSL_CTX_set_timeout( sslnfo->ctx, 3600); // pretty unnecessary
+ SSL_CTX_set_timeout( sslnfo->ctx, 3600); /* pretty unnecessary */

}


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise