Warning: The myGlobals and BufferOverflow changes make for huge diffs, most
of which aren't meaningful. See the bottom for a method to wash these
out...
Continuing the list of changes since mid-January, these are the internals
changes - of interest to developers...
1. myGlobals - Most of the global variables have now been moved into a
structure and are accessed through myGlobals.whatever. This is defined in
the new file, globals.h. It makes it clearer what's global and what's not.
It's taken a bit of cleanup to get the comments fixed back up etc.
Also, initialization logic has been moved. This, like BufferOverflow(),
makes for a big diff, but no functional impact.
If you add a global variable, you also MUST put initialization into
initNtopGlobals(int argc, char * argv[]) (in globals-core.c) - all variables
need to be initialized here to a REASONABLE default value.
If you add a command option, you also MUST put it into typedef struct
ntopGlobals in the right place, e.g.:
#ifdef HAVE_GDCHART
int throughput_chart_type; /* '129' */
#endif
u_short noAdminPasswordHint; /* '130' */
Finally, a strong request from Luca to keep the short options list
(still in main.c) alphabetized! It's now up to this:
#ifdef WIN32
char * theOpts = "a:ce:f:g:hi:jkl:m:np:qr:s:t:w:A:D:F:MP:R:S:U:VW:12";
#else
char * theOpts =
"a:b:cde:f:g:hi:jkl:m:np:qr:s:t:u:v:w:A:D:EF:IKLMNP:R:S:U:VW:12";
#endif
So as you can see there isn't much room for many more short names.
Usage is now in main.c - update it if you add an option!
The option handling case statement in main.c was resequenced in order -
please keep it so.
2. New source file, sessions.c - most of the session related code has been
moved here (_checkSessionIdx, freeSession, scanTimedoutTCPSessions,
handleTCPSession, handleUDPSession)
3. Some changes in hash.c - interesting and experimental code, looks
unfinished (specifically resizeHostHash to work on the resize problems??).
I'd be real careful poking in there!
4. zlib - looks like Ntop is now creating compressed files if zlib is
available. Look for the #ifdef HAVE_ZLIB stuff.
5. The ubiquitous traceEvent(TRACE_ERROR, "Buffer Overflow!") has been
changed to a #define, so that the file name and line number are reported.
This is probably only of interest to developers who mung the code. (Me!)
6. I've sent Luca a new version of the URLsecurity function. Because my 1st
two tries mucked up pages I didn't realize we could generate, I *think* he's
a little reluctant - imagine that :-) The only problem I *know* the new
version has is with names like xxx-12.123.domain.com - but it rejects
Unicode URLs, e.g. the exploits that we've see so many of recently in
various web servers. The version that is in there now, does protect Ntop
against the directory transveral issue.
*****If anybody want's to / can test it out, let me know and I'll ship
you the new code*****
7. Some code that looks like it's work on the BSD zombie problem... grep for
usedFork... then again...
8. More work on the hashing in pbuf.c - look for /* The entry is not the one
we expect */ around line 195.
9. processDNSPacket - looks like the sniffing of other peoples responses has
been cleaned up...
10. missing releaseMutex added in makeHostLink (webInterface.c) - may cure
some Ntop hangs.
-----Burton
Diffs:
What you can do is to process the OLDER version to do the traceEvent() ->
BufferOverflow() change via one sed script and then process the NEWER
version to "back-out" the myGlobals change. You are left with two versions
that won't work, but can be diffed...
1st. unpack the two .tgzs, into, say ntop-older and ntop-current. I usually
delete irrelevant stuff and move everything up to the 1st level (e.g.
ntop-current) for these type of diffs.
in ntop-older, run this:
for i in `ls *.c`; do
echo " Processing" $i "..." >>patchlog
mv $i $i.pre
sed -e 's/traceEvent(TRACE_ERROR, \"Buffer
overflow!\");/BufferOverflow();/g' $i.pre >$i
rm $i.pre
done
in ntop-current, run this:
for i in `ls *.c`; do
echo " Processing" $i "..." >>patchlog
mv $i $i.pre
sed -e 's/myGlobals\.//g' $i.pre >$i
rm $i.pre
done
You can then diff them - without the distractions!
_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://listmanager.unipi.it/mailman/listinfo/ntop-dev