Added DUMPSMBLEVEL option which controls how much raw data output is produced. By default (level 0) no raw data output is produced at all. Level 1 will print the contents of the command data area. Level 2 will print the raw data used by the respective commands, with any management/control information stripped off.

SMB decoder output can now be stored in a file and does not have to go to stdout.
This commit is contained in:
Olaf Barthel
2016-04-17 11:42:30 +02:00
parent 0e7a0ff3d6
commit 08f08e8071
+28 -8
View File
@@ -623,6 +623,8 @@ main(VOID)
NUMBER DSTOffset;
SWITCH NetBIOSTransport;
SWITCH DumpSMB;
NUMBER DumpSMBLevel;
KEY DumpSMBFile;
SWITCH UTF8;
KEY TranslationFile;
KEY Service;
@@ -647,6 +649,8 @@ main(VOID)
"DST=DSTOFFSET/N/K,"
"NETBIOS/S,"
"DUMPSMB/S,"
"DUMPSMBLEVEL/N/K,"
"DUMPSMBFILE/K,"
"UTF8/S,"
"TRANSLATE=TRANSLATIONFILE/K,"
"SERVICE/A";
@@ -1013,8 +1017,13 @@ main(VOID)
/* Enable SMB packet decoding, but only if not started from Workbench. */
#if defined(DUMP_SMB)
{
LONG dump_smb_level = 0;
if(args.DumpSMBLevel != NULL)
dump_smb_level = (*args.DumpSMBLevel);
if(args.DumpSMB && WBStartup == NULL)
control_smb_dump(TRUE);
control_smb_dump(TRUE, dump_smb_level, (const char *)args.DumpSMBFile);
}
#endif /* DUMP_SMB */
@@ -1054,6 +1063,13 @@ main(VOID)
out:
#if defined(DUMP_SMB)
{
if(args.DumpSMB && WBStartup == NULL)
control_smb_dump(FALSE, 0, NULL);
}
#endif /* DUMP_SMB */
Cleanup();
return(result);
@@ -1095,8 +1111,6 @@ amitcp_strerror(int error)
struct TagItem tags[2];
STRPTR result;
ENTER();
tags[0].ti_Tag = SBTM_GETVAL(SBTC_ERRNOSTRPTR);
tags[0].ti_Data = error;
tags[1].ti_Tag = TAG_END;
@@ -1105,7 +1119,6 @@ amitcp_strerror(int error)
result = (STRPTR)tags[0].ti_Data;
RETURN(result);
return(result);
}
@@ -1118,8 +1131,6 @@ host_strerror(int error)
struct TagItem tags[2];
STRPTR result;
ENTER();
tags[0].ti_Tag = SBTM_GETVAL(SBTC_HERRNOSTRPTR);
tags[0].ti_Data = error;
tags[1].ti_Tag = TAG_END;
@@ -1128,7 +1139,6 @@ host_strerror(int error)
result = (STRPTR)tags[0].ti_Data;
RETURN(result);
return(result);
}
@@ -2062,7 +2072,7 @@ MapErrnoToIoErr(int error)
{ E2BIG, ERROR_TOO_MANY_ARGS }, /* Argument list too long */
{ EBADF, ERROR_INVALID_LOCK }, /* Bad file descriptor */
{ ENOMEM, ERROR_NO_FREE_STORE }, /* Cannot allocate memory */
{ EACCES, ERROR_OBJECT_NOT_FOUND}, /* Permission denied */
{ EACCES, ERROR_OBJECT_NOT_FOUND }, /* Permission denied */
{ ENOTBLK, ERROR_OBJECT_WRONG_TYPE }, /* Block device required */
{ EBUSY, ERROR_OBJECT_IN_USE }, /* Device busy */
{ EEXIST, ERROR_OBJECT_EXISTS }, /* File exists */
@@ -2126,6 +2136,16 @@ MapErrnoToIoErr(int error)
}
}
#if DEBUG
{
UBYTE amigados_error_text[256];
Fault(result,NULL,amigados_error_text,sizeof(amigados_error_text));
LOG(("Translated POSIX error code %ld (%s), to AmigaDOS error code %ld (%s)\n", error, amitcp_strerror(error), result, amigados_error_text));
}
#endif /* DEBUG */
RETURN(result);
return(result);
}