12 #include <netsmb/smb_lib.h>
13 #include <netsmb/smb_conn.h>
17 #define DEFBIT(bit) {bit, #bit}
19 static struct smb_bitname conn_caps
[] = {
20 DEFBIT(SMB_CAP_RAW_MODE
),
21 DEFBIT(SMB_CAP_MPX_MODE
),
22 DEFBIT(SMB_CAP_UNICODE
),
23 DEFBIT(SMB_CAP_LARGE_FILES
),
24 DEFBIT(SMB_CAP_NT_SMBS
),
25 DEFBIT(SMB_CAP_NT_FIND
),
26 DEFBIT(SMB_CAP_EXT_SECURITY
),
30 static struct smb_bitname vc_flags
[] = {
31 DEFBIT(SMBV_PERMANENT
),
32 {SMBV_PRIVATE
, "private"},
33 {SMBV_SINGLESHARE
, "singleshare"},
34 {SMBV_ENCRYPT
, "encpwd"},
35 {SMBV_WIN95
, "win95"},
36 {SMBV_LONGNAMES
,"longnames"},
40 static struct smb_bitname ss_flags
[] = {
41 DEFBIT(SMBS_PERMANENT
),
45 static char *conn_proto
[] = {
47 "PC NETWORK PROGRAM 1.0, PCLAN1.0",
48 "MICROSOFT NETWORKS 1.03",
49 "MICROSOFT NETWORKS 3.0, LANMAN1.0",
50 "LM1.2X002, DOS LM1.2X002",
51 "DOS LANMAN2.1, LANMAN2.1",
52 "NT LM 0.12, Windows for Workgroups 3.1a, NT LANMAN 1.0"
55 static char *iod_state
[] = {
58 "Transport activated",
64 print_vcinfo(struct smb_vc_info
*vip
)
68 printf("VC: \\\\%s\\%s\n", vip
->srvname
, vip
->vcname
);
69 printf("(%s:%s) %o", user_from_uid(vip
->uid
, 0),
70 group_from_gid(vip
->gid
, 0), vip
->mode
);
74 iprintf(4, "state: %s\n", iod_state
[vip
->iodstate
]);
75 iprintf(4, "flags: 0x%04x %s\n", vip
->flags
,
76 smb_printb(buf
, vip
->flags
, vc_flags
));
77 iprintf(4, "usecount: %d\n", vip
->usecount
);
78 iprintf(4, "dialect: %d (%s)\n", vip
->sopt
.sv_proto
, conn_proto
[vip
->sopt
.sv_proto
]);
79 iprintf(4, "smode: %d\n", vip
->sopt
.sv_sm
);
80 iprintf(4, "caps: 0x%04x %s\n", vip
->sopt
.sv_caps
,
81 smb_printb(buf
, vip
->sopt
.sv_caps
, conn_caps
));
82 iprintf(4, "maxmux: %d\n", vip
->sopt
.sv_maxmux
);
83 iprintf(4, "maxvcs: %d\n", vip
->sopt
.sv_maxvcs
);
87 print_shareinfo(struct smb_share_info
*sip
)
91 iprintf(4, "Share: %s", sip
->sname
);
92 printf("(%s:%s) %o", user_from_uid(sip
->uid
, 0),
93 group_from_gid(sip
->gid
, 0), sip
->mode
);
97 iprintf(8, "flags: 0x%04x %s\n", sip
->flags
,
98 smb_printb(buf
, sip
->flags
, ss_flags
));
99 iprintf(8, "usecount: %d\n", sip
->usecount
);
103 cmd_dumptree(int argc
, char *argv
[])
108 printf("SMB connections:\n");
111 errx(EX_OSERR
, "SMB filesystem is not available");
121 if (*itype
== SMB_INFO_NONE
)
126 p
= (struct smb_vc_info
*)p
+ 1;
130 p
= (struct smb_share_info
*)p
+ 1;
133 printf("Out of sync\n");