From 0fe72492f14d484e7c761c50269d6e0db376b3c3 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Fri, 27 Feb 2004 03:58:04 +0000 Subject: Seems, like we don't really need LANMAN until now --- Makefile | 4 ++-- src/nu_defines.h | 20 ++++++++++++++++++++ src/nu_lanman.c | 6 ++++-- src/nu_server.c | 41 +++++++++++++++++++++++------------------ 4 files changed, 49 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 270b1f4..03df825 100755 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ all: nudossi nudossi: - gcc -O -o bin/nudossi src/nu_server.c src/nu_lanman.c + gcc -O -o bin/nudossi src/nu_server.c # src/nu_lanman.c strip bin/nudossi debug: - gcc -g -o bin/nudossi src/nu_server.c src/nu_lanman.c + gcc -g -o bin/nudossi src/nu_server.c # src/nu_lanman.c clean: rm -f bin/nudossi nudossi.core diff --git a/src/nu_defines.h b/src/nu_defines.h index 75c3f2b..36bbb56 100755 --- a/src/nu_defines.h +++ b/src/nu_defines.h @@ -98,6 +98,26 @@ typedef enum { SMB_COM_WRITE_BULK_DATA = 0xDA } SMB_COMMAND; +typedef enum { + SMB_TRANS2_OPEN2 = 0x00, + SMB_TRANS2_FIND_FIRST2 = 0x01, + SMB_TRANS2_FIND_NEXT2 = 0x02, + SMB_TRANS2_QUERY_FS_INFORMATION = 0x03, + /* Reserved */ + SMB_TRANS2_QUERY_PATH_INFORMATION = 0x05, + SMB_TRANS2_SET_PATH_INFORMATION = 0x06, + SMB_TRANS2_QUERY_FILE_INFORMATION = 0x07, + SMB_TRANS2_SET_FILE_INFORMATION = 0x08, + SMB_TRANS2_FSCTL = 0x09, + SMB_TRANS2_IOCTL2 = 0x0A, + SMB_TRANS2_FIND_NOTIFY_FIRST = 0x0B, + SMB_TRANS2_FIND_NOTIFY_NEXT = 0x0C, + SMB_TRANS2_CREATE_DIRECTORY = 0x0D, + SMB_TRANS2_SESSION_SETUP = 0x0E, + SMB_TRANS2_GET_DFS_REFERRAL = 0x10, + SMB_TRANS2_REPORT_DFS_INCONSISTENCY = 0x11, +} SMB_TRANS2_SUBCOMMAND; + typedef enum { STATUS_SUCCESS = 0x00000000, STATUS_WAIT_0 = 0x00000000, diff --git a/src/nu_lanman.c b/src/nu_lanman.c index 0ab935e..3d78b06 100644 --- a/src/nu_lanman.c +++ b/src/nu_lanman.c @@ -1,6 +1,7 @@ #include "nu_lanman.h" -BYTE LANMAN_NetShareGetInfo_1_bytes[] = { 20,0,'S','H','A','R','E',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; +BYTE LANMAN_NetShareGetInfo_1_params[] = { 10,6,0,20,0,0,0,6,0,55,0,0,0,20,0,61,0,0,0,0,0 }; +BYTE LANMAN_NetShareGetInfo_1_bytes[] = { 26,0,0,0,0,0,20,0,'S','H','A','R','E',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; SMB_STATUS handle_LANMAN( SMB_HEADER *header, SMB_DATA *data, SMB_TRANSACTION_BYTES *bytes ) { switch( GETNWORD( bytes->params ) ) { @@ -12,7 +13,8 @@ SMB_STATUS handle_LANMAN( SMB_HEADER *header, SMB_DATA *data, SMB_TRANSACTION_BY switch( GETNWORD(type)) { case 1: /* Medium set of information */ - memcpy( bytes->params, LANMAN_NetShareGetInfo_1_bytes, sizeof( LANMAN_NetShareGetInfo_1_bytes )); /* possible buffer overflow */ + data->params = (SMB_PARAMS*)LANMAN_NetShareGetInfo_1_params; + data->bytes = (SMB_BYTES*) LANMAN_NetShareGetInfo_1_bytes; break; default: /* Later */ return 0x00400002; diff --git a/src/nu_server.c b/src/nu_server.c index 186c2d7..5112f1e 100755 --- a/src/nu_server.c +++ b/src/nu_server.c @@ -91,30 +91,35 @@ static SMB_STATUS handle_SMB_COM_TREE_CONNECT_ANDX( SMB_HEADER *header, SMB_DATA return STATUS_SUCCESS; } -static SMB_STATUS handle_SMB_COM_TRANSACTION( SMB_HEADER *header, SMB_DATA *data ) { - if( !strcmp( (char*)&data->bytes[1], "\\PIPE\\LANMAN")) - { - /* TODO: Sanity Check on DataCount vs. ByteCount */ - SMB_PARAMS_TRANSACTION *params = (SMB_PARAMS_TRANSACTION *)data->params; - SMB_TRANSACTION_BYTES bytes; - - bytes.params = ((BYTE*)&header->Protocol) + GETNWORD( params->ParameterOffset ); - bytes.paramc = GETNWORD( params->ParameterCount ); - bytes.data = ((BYTE*)&header->Protocol) + GETNWORD( params->DataOffset ); - bytes.datac = GETNWORD( params->DataCount ); - - return handle_LANMAN( header, data, &bytes ); - } - else - return 0x00400002; -} +//static SMB_STATUS handle_SMB_COM_TRANSACTION( SMB_HEADER *header, SMB_DATA *data ) { +// if( !strcmp( (char*)&data->bytes[1], "\\PIPE\\LANMAN")) +// { +// /* TODO: Sanity Check on DataCount vs. ByteCount */ +// SMB_PARAMS_TRANSACTION *params = (SMB_PARAMS_TRANSACTION *)data->params; +// SMB_TRANSACTION_BYTES bytes; +// +// bytes.params = ((BYTE*)&header->Protocol) + GETNWORD( params->ParameterOffset ); +// bytes.paramc = GETNWORD( params->ParameterCount ); +// bytes.data = ((BYTE*)&header->Protocol) + GETNWORD( params->DataOffset ); +// bytes.datac = GETNWORD( params->DataCount ); +// +// return handle_LANMAN( header, data, &bytes ); +// } +// else +// return 0x00400002; +//} + +//static SMB_STATUS handle_SMB_COM_TRANSACTION2( SMB_HEADER *header, SMB_DATA *data ) { +// return 0x00400002; /* No handler yet */ +//} static int command_handler_match(const void *a, const void *b ) { return *(BYTE*)a - *(BYTE*)b; } /* If you add command handlers, please insert them in the right position, this list is sorted by command, for later bsearch*/ static SMB_COMMAND_HANDLER command_handler[] = { - { SMB_COM_TRANSACTION, 0x00, handle_SMB_COM_TRANSACTION }, +// { SMB_COM_TRANSACTION, 0x00, handle_SMB_COM_TRANSACTION }, +// { SMB_COM_TRANSACTION2, 0x00, handle_SMB_COM_TRANSACTION2 }, { SMB_COM_NEGOTIATE, 0x00, handle_SMB_COM_NEGOTIATE }, { SMB_COM_SESSION_SETUP_ANDX, 0x01, handle_SMB_COM_SESSION_SETUP_ANDX }, { SMB_COM_TREE_CONNECT_ANDX, 0x01, handle_SMB_COM_TREE_CONNECT_ANDX } -- cgit v1.2.3