14 #include <netsmb/smb_lib.h>
15 #include <netsmb/smb_conn.h>
19 #define DEFBIT(bit) {bit, #bit}
21 static struct smb_bitname conn_caps[] = {
22 DEFBIT(SMB_CAP_RAW_MODE),
23 DEFBIT(SMB_CAP_MPX_MODE),
24 DEFBIT(SMB_CAP_UNICODE),
25 DEFBIT(SMB_CAP_LARGE_FILES),
26 DEFBIT(SMB_CAP_NT_SMBS),
27 DEFBIT(SMB_CAP_NT_FIND),
28 DEFBIT(SMB_CAP_EXT_SECURITY),
32 static struct smb_bitname vc_flags[] = {
33 DEFBIT(SMBV_PERMANENT),
34 {SMBV_PRIVATE, "private"},
35 {SMBV_SINGLESHARE, "singleshare"},
36 {SMBV_ENCRYPT, "encpwd"},
37 {SMBV_WIN95, "win95"},
38 {SMBV_LONGNAMES,"longnames"},
42 static struct smb_bitname ss_flags[] = {
43 DEFBIT(SMBS_PERMANENT),
47 static char *conn_proto[] = {
49 "PC NETWORK PROGRAM 1.0, PCLAN1.0",
50 "MICROSOFT NETWORKS 1.03",
51 "MICROSOFT NETWORKS 3.0, LANMAN1.0",
52 "LM1.2X002, DOS LM1.2X002",
53 "DOS LANMAN2.1, LANMAN2.1",
54 "NT LM 0.12, Windows for Workgroups 3.1a, NT LANMAN 1.0"
57 static char *iod_state[] = {
60 "Transport activated",
66 print_vcinfo(struct smb_vc_info *vip)
70 printf("VC: \\\\%s\\%s\n", vip->srvname, vip->vcname);
71 printf("(%s:%s) %o", user_from_uid(vip->uid, 0),
72 group_from_gid(vip->gid, 0), vip->mode);
76 iprintf(4, "state: %s\n", iod_state[vip->iodstate]);
77 iprintf(4, "flags: 0x%04x %s\n", vip->flags,
78 smb_printb(buf, vip->flags, vc_flags));
79 iprintf(4, "usecount: %d\n", vip->usecount);
80 iprintf(4, "dialect: %d (%s)\n", vip->sopt.sv_proto, conn_proto[vip->sopt.sv_proto]);
81 iprintf(4, "smode: %d\n", vip->sopt.sv_sm);
82 iprintf(4, "caps: 0x%04x %s\n", vip->sopt.sv_caps,
83 smb_printb(buf, vip->sopt.sv_caps, conn_caps));
84 iprintf(4, "maxmux: %d\n", vip->sopt.sv_maxmux);
85 iprintf(4, "maxvcs: %d\n", vip->sopt.sv_maxvcs);
89 print_shareinfo(struct smb_share_info *sip)
93 iprintf(4, "Share: %s", sip->sname);
94 printf("(%s:%s) %o", user_from_uid(sip->uid, 0),
95 group_from_gid(sip->gid, 0), sip->mode);
99 iprintf(8, "flags: 0x%04x %s\n", sip->flags,
100 smb_printb(buf, sip->flags, ss_flags));
101 iprintf(8, "usecount: %d\n", sip->usecount);
105 cmd_dumptree(int argc, char *argv[])
110 printf("SMB connections:\n");
113 errx(EX_OSERR, "SMB filesystem is not available");
123 if (*itype == SMB_INFO_NONE)
128 p = (struct smb_vc_info*)p + 1;
132 p = (struct smb_share_info*)p + 1;
135 printf("Out of sync\n");