OpenVAS Scanner 23.40.3
smb.h File Reference

Unix SMB/CIFS implementation. More...

#include "charset.h"
#include <ctype.h>
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for smb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _smb_iconv_t

Macros

#define SMB_PORT1   445
#define SMB_PORT2   139
#define SMB_PORTS   "445 139"
#define smb_com   8
#define smb_rcls   9
#define smb_reh   10
#define smb_err   11
#define smb_flg   13
#define smb_flg2   14
#define smb_pidhigh   16
#define smb_ss_field   18
#define smb_tid   28
#define smb_pid   30
#define smb_uid   32
#define smb_mid   34
#define smb_wct   36
#define smb_vwv   37
#define smb_vwv0   37
#define smb_vwv1   39
#define smb_vwv2   41
#define smb_vwv3   43
#define smb_vwv4   45
#define smb_vwv5   47
#define smb_vwv6   49
#define smb_vwv7   51
#define smb_vwv8   53
#define smb_vwv9   55
#define smb_vwv10   57
#define smb_vwv11   59
#define smb_vwv12   61
#define smb_vwv13   63
#define smb_vwv14   65
#define smb_vwv15   67
#define smb_vwv16   69
#define smb_vwv17   71
#define STR_TERMINATE   1
#define STR_UPPER   2
#define STR_ASCII   4
#define STR_UNICODE   8
#define STR_NOALIGN   16
#define STR_TERMINATE_ASCII   128
#define NEGOTIATE_SECURITY_USER_LEVEL   0x01
#define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE   0x02
#define NEGOTIATE_SECURITY_SIGNATURES_ENABLED   0x04
#define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED   0x08
#define FLAGS2_LONG_PATH_COMPONENTS   0x0001
#define FLAGS2_EXTENDED_ATTRIBUTES   0x0002
#define FLAGS2_SMB_SECURITY_SIGNATURES   0x0004
#define FLAGS2_UNKNOWN_BIT4   0x0010
#define FLAGS2_IS_LONG_NAME   0x0040
#define FLAGS2_EXTENDED_SECURITY   0x0800
#define FLAGS2_DFS_PATHNAMES   0x1000
#define FLAGS2_READ_PERMIT_EXECUTE   0x2000
#define FLAGS2_32_BIT_ERROR_CODES   0x4000
#define FLAGS2_UNICODE_STRINGS   0x8000
#define FLAGS2_WIN2K_SIGNATURE   0xC852 /* Hack alert ! For now... JRA. */
#define TCONX_FLAG_EXTENDED_RESPONSE   0x8
#define CAP_RAW_MODE   0x0001
#define CAP_MPX_MODE   0x0002
#define CAP_UNICODE   0x0004
#define CAP_LARGE_FILES   0x0008
#define CAP_NT_SMBS   0x0010
#define CAP_RPC_REMOTE_APIS   0x0020
#define CAP_STATUS32   0x0040
#define CAP_LEVEL_II_OPLOCKS   0x0080
#define CAP_LOCK_AND_READ   0x0100
#define CAP_NT_FIND   0x0200
#define CAP_DFS   0x1000
#define CAP_W2K_SMBS   0x2000
#define CAP_LARGE_READX   0x4000
#define CAP_LARGE_WRITEX   0x8000
#define CAP_UNIX
#define CAP_EXTENDED_SECURITY   0x80000000
#define UCS2_SHIFT   0
#define UCS2_CHAR(c)
#define UCS2_TO_CHAR(c)
#define COPY_UCS2_CHAR(dest, src)
#define SMB_MALLOC_P(type)
#define SMB_REALLOC(p, s)
#define SMB_STRDUP(s)
#define SMB_STRNDUP(s, n)
#define smb_len(buf)

Typedefs

typedef struct _smb_iconv_tsmb_iconv_t
typedef uint64_t NTTIME

Enumerations

enum  protocol_types {
  PROTOCOL_NONE , PROTOCOL_CORE , PROTOCOL_COREPLUS , PROTOCOL_LANMAN1 ,
  PROTOCOL_LANMAN2 , PROTOCOL_NT1
}

Detailed Description

Unix SMB/CIFS implementation.

SMB parameters and setup, plus a whole lot more.

MODIFICATION: changes for OpenVAS

  1. declarations useful for OpenVAS are retained, others are removed
  2. malloc_ changes to malloc in SMB_MALLOC_P

Definition in file smb.h.

Macro Definition Documentation

◆ CAP_DFS

#define CAP_DFS   0x1000

Definition at line 130 of file smb.h.

◆ CAP_EXTENDED_SECURITY

#define CAP_EXTENDED_SECURITY   0x80000000

Definition at line 136 of file smb.h.

◆ CAP_LARGE_FILES

#define CAP_LARGE_FILES   0x0008

Definition at line 123 of file smb.h.

◆ CAP_LARGE_READX

#define CAP_LARGE_READX   0x4000

Definition at line 132 of file smb.h.

◆ CAP_LARGE_WRITEX

#define CAP_LARGE_WRITEX   0x8000

Definition at line 133 of file smb.h.

◆ CAP_LEVEL_II_OPLOCKS

#define CAP_LEVEL_II_OPLOCKS   0x0080

Definition at line 127 of file smb.h.

◆ CAP_LOCK_AND_READ

#define CAP_LOCK_AND_READ   0x0100

Definition at line 128 of file smb.h.

◆ CAP_MPX_MODE

#define CAP_MPX_MODE   0x0002

Definition at line 121 of file smb.h.

◆ CAP_NT_FIND

#define CAP_NT_FIND   0x0200

Definition at line 129 of file smb.h.

◆ CAP_NT_SMBS

#define CAP_NT_SMBS   0x0010

Definition at line 124 of file smb.h.

◆ CAP_RAW_MODE

#define CAP_RAW_MODE   0x0001

Definition at line 120 of file smb.h.

◆ CAP_RPC_REMOTE_APIS

#define CAP_RPC_REMOTE_APIS   0x0020

Definition at line 125 of file smb.h.

◆ CAP_STATUS32

#define CAP_STATUS32   0x0040

Definition at line 126 of file smb.h.

◆ CAP_UNICODE

#define CAP_UNICODE   0x0004

Definition at line 122 of file smb.h.

◆ CAP_UNIX

#define CAP_UNIX
Value:
0x800000 /* Capabilities for UNIX extensions. Created by HP. \
*/

Definition at line 134 of file smb.h.

134#define CAP_UNIX \
135 0x800000 /* Capabilities for UNIX extensions. Created by HP. \

◆ CAP_W2K_SMBS

#define CAP_W2K_SMBS   0x2000

Definition at line 131 of file smb.h.

◆ COPY_UCS2_CHAR

#define COPY_UCS2_CHAR ( dest,
src )
Value:
(((unsigned char *) (dest))[0] = ((unsigned char *) (src))[0], \
((unsigned char *) (dest))[1] = ((unsigned char *) (src))[1], (dest))

Definition at line 164 of file smb.h.

164 * smb_ucs2_tt */
165#define COPY_UCS2_CHAR(dest, src) \
166 (((unsigned char *) (dest))[0] = ((unsigned char *) (src))[0], \

Referenced by strlen_w_ntlmssp().

◆ FLAGS2_32_BIT_ERROR_CODES

#define FLAGS2_32_BIT_ERROR_CODES   0x4000

Definition at line 110 of file smb.h.

◆ FLAGS2_DFS_PATHNAMES

#define FLAGS2_DFS_PATHNAMES   0x1000

Definition at line 108 of file smb.h.

◆ FLAGS2_EXTENDED_ATTRIBUTES

#define FLAGS2_EXTENDED_ATTRIBUTES   0x0002

Definition at line 103 of file smb.h.

◆ FLAGS2_EXTENDED_SECURITY

#define FLAGS2_EXTENDED_SECURITY   0x0800

Definition at line 107 of file smb.h.

◆ FLAGS2_IS_LONG_NAME

#define FLAGS2_IS_LONG_NAME   0x0040

Definition at line 106 of file smb.h.

◆ FLAGS2_LONG_PATH_COMPONENTS

#define FLAGS2_LONG_PATH_COMPONENTS   0x0001

Definition at line 102 of file smb.h.

◆ FLAGS2_READ_PERMIT_EXECUTE

#define FLAGS2_READ_PERMIT_EXECUTE   0x2000

Definition at line 109 of file smb.h.

◆ FLAGS2_SMB_SECURITY_SIGNATURES

#define FLAGS2_SMB_SECURITY_SIGNATURES   0x0004

Definition at line 104 of file smb.h.

◆ FLAGS2_UNICODE_STRINGS

#define FLAGS2_UNICODE_STRINGS   0x8000

Definition at line 111 of file smb.h.

◆ FLAGS2_UNKNOWN_BIT4

#define FLAGS2_UNKNOWN_BIT4   0x0010

Definition at line 105 of file smb.h.

◆ FLAGS2_WIN2K_SIGNATURE

#define FLAGS2_WIN2K_SIGNATURE   0xC852 /* Hack alert ! For now... JRA. */

Definition at line 113 of file smb.h.

◆ NEGOTIATE_SECURITY_CHALLENGE_RESPONSE

#define NEGOTIATE_SECURITY_CHALLENGE_RESPONSE   0x02

Definition at line 96 of file smb.h.

◆ NEGOTIATE_SECURITY_SIGNATURES_ENABLED

#define NEGOTIATE_SECURITY_SIGNATURES_ENABLED   0x04

Definition at line 97 of file smb.h.

◆ NEGOTIATE_SECURITY_SIGNATURES_REQUIRED

#define NEGOTIATE_SECURITY_SIGNATURES_REQUIRED   0x08

Definition at line 98 of file smb.h.

◆ NEGOTIATE_SECURITY_USER_LEVEL

#define NEGOTIATE_SECURITY_USER_LEVEL   0x01

Definition at line 95 of file smb.h.

◆ smb_com

#define smb_com   8

Definition at line 40 of file smb.h.

◆ smb_err

#define smb_err   11

Definition at line 43 of file smb.h.

◆ smb_flg

#define smb_flg   13

Definition at line 44 of file smb.h.

◆ smb_flg2

#define smb_flg2   14

Definition at line 45 of file smb.h.

◆ smb_len

#define smb_len ( buf)
Value:
(PVAL (buf, 3) | (PVAL (buf, 2) << 8) | ((PVAL (buf, 1) & 1) << 16))
#define PVAL(buf, pos)
Definition byteorder.h:102

Definition at line 183 of file smb.h.

183
184#define smb_len(buf) \

Referenced by simple_packet_signature_ntlmssp().

◆ SMB_MALLOC_P

#define SMB_MALLOC_P ( type)
Value:
(type *) malloc (sizeof (type))
void * malloc(YYSIZE_T)

Definition at line 172 of file smb.h.

Referenced by smb_iconv_open_ntlmssp().

◆ smb_mid

#define smb_mid   34

Definition at line 51 of file smb.h.

◆ smb_pid

#define smb_pid   30

Definition at line 49 of file smb.h.

◆ smb_pidhigh

#define smb_pidhigh   16

Definition at line 46 of file smb.h.

◆ SMB_PORT1

#define SMB_PORT1   445

Definition at line 35 of file smb.h.

◆ SMB_PORT2

#define SMB_PORT2   139

Definition at line 36 of file smb.h.

◆ SMB_PORTS

#define SMB_PORTS   "445 139"

Definition at line 37 of file smb.h.

◆ smb_rcls

#define smb_rcls   9

Definition at line 41 of file smb.h.

◆ SMB_REALLOC

#define SMB_REALLOC ( p,
s )
Value:
Realloc ((p), (s), True) /* Always frees p on error or s == 0 */
#define True
Definition charcnv.c:64

Definition at line 174 of file smb.h.

174
175#define SMB_REALLOC(p, s) \

◆ smb_reh

#define smb_reh   10

Definition at line 42 of file smb.h.

◆ smb_ss_field

#define smb_ss_field   18

Definition at line 47 of file smb.h.

Referenced by simple_packet_signature_ntlmssp().

◆ SMB_STRDUP

#define SMB_STRDUP ( s)
Value:
strdup (s)

Definition at line 180 of file smb.h.

Referenced by smb_iconv_open_ntlmssp().

◆ SMB_STRNDUP

#define SMB_STRNDUP ( s,
n )
Value:
strndup (s, n)

Definition at line 181 of file smb.h.

◆ smb_tid

#define smb_tid   28

Definition at line 48 of file smb.h.

◆ smb_uid

#define smb_uid   32

Definition at line 50 of file smb.h.

◆ smb_vwv

#define smb_vwv   37

Definition at line 53 of file smb.h.

◆ smb_vwv0

#define smb_vwv0   37

Definition at line 54 of file smb.h.

◆ smb_vwv1

#define smb_vwv1   39

Definition at line 55 of file smb.h.

◆ smb_vwv10

#define smb_vwv10   57

Definition at line 64 of file smb.h.

◆ smb_vwv11

#define smb_vwv11   59

Definition at line 65 of file smb.h.

◆ smb_vwv12

#define smb_vwv12   61

Definition at line 66 of file smb.h.

◆ smb_vwv13

#define smb_vwv13   63

Definition at line 67 of file smb.h.

◆ smb_vwv14

#define smb_vwv14   65

Definition at line 68 of file smb.h.

◆ smb_vwv15

#define smb_vwv15   67

Definition at line 69 of file smb.h.

◆ smb_vwv16

#define smb_vwv16   69

Definition at line 70 of file smb.h.

◆ smb_vwv17

#define smb_vwv17   71

Definition at line 71 of file smb.h.

◆ smb_vwv2

#define smb_vwv2   41

Definition at line 56 of file smb.h.

◆ smb_vwv3

#define smb_vwv3   43

Definition at line 57 of file smb.h.

◆ smb_vwv4

#define smb_vwv4   45

Definition at line 58 of file smb.h.

◆ smb_vwv5

#define smb_vwv5   47

Definition at line 59 of file smb.h.

◆ smb_vwv6

#define smb_vwv6   49

Definition at line 60 of file smb.h.

◆ smb_vwv7

#define smb_vwv7   51

Definition at line 61 of file smb.h.

◆ smb_vwv8

#define smb_vwv8   53

Definition at line 62 of file smb.h.

◆ smb_vwv9

#define smb_vwv9   55

Definition at line 63 of file smb.h.

◆ smb_wct

#define smb_wct   36

Definition at line 52 of file smb.h.

◆ STR_ASCII

#define STR_ASCII   4

Definition at line 89 of file smb.h.

◆ STR_NOALIGN

#define STR_NOALIGN   16

Definition at line 91 of file smb.h.

◆ STR_TERMINATE

#define STR_TERMINATE   1

Definition at line 87 of file smb.h.

◆ STR_TERMINATE_ASCII

#define STR_TERMINATE_ASCII   128

Definition at line 92 of file smb.h.

◆ STR_UNICODE

#define STR_UNICODE   8

Definition at line 90 of file smb.h.

◆ STR_UPPER

#define STR_UPPER   2

Definition at line 88 of file smb.h.

◆ TCONX_FLAG_EXTENDED_RESPONSE

#define TCONX_FLAG_EXTENDED_RESPONSE   0x8

Definition at line 116 of file smb.h.

◆ UCS2_CHAR

#define UCS2_CHAR ( c)
Value:
((c) << UCS2_SHIFT)
#define UCS2_SHIFT
Definition hmacmd5.h:57

Definition at line 157 of file smb.h.

◆ UCS2_SHIFT

#define UCS2_SHIFT   0

Definition at line 153 of file smb.h.

◆ UCS2_TO_CHAR

#define UCS2_TO_CHAR ( c)
Value:
(((c) >> UCS2_SHIFT) & 0xff)

Definition at line 160 of file smb.h.

Typedef Documentation

◆ NTTIME

typedef uint64_t NTTIME

Definition at line 170 of file smb.h.

◆ smb_iconv_t

typedef struct _smb_iconv_t * smb_iconv_t

Enumeration Type Documentation

◆ protocol_types

Enumerator
PROTOCOL_NONE 
PROTOCOL_CORE 
PROTOCOL_COREPLUS 
PROTOCOL_LANMAN1 
PROTOCOL_LANMAN2 
PROTOCOL_NT1 

Definition at line 140 of file smb.h.

142{
@ PROTOCOL_LANMAN2
Definition smb.h:146
@ PROTOCOL_COREPLUS
Definition smb.h:144
@ PROTOCOL_CORE
Definition smb.h:143
@ PROTOCOL_LANMAN1
Definition smb.h:145
@ PROTOCOL_NT1
Definition smb.h:147
@ PROTOCOL_NONE
Definition smb.h:142