9 tnthdr(Session *s, Share *sp, int cmd)
13 p = cifshdr(s, sp, SMB_COM_NT_TRANSACT);
14 p->tbase = p8(p, 0); /* 0 Max setup count to return */
15 pl16(p, 0); /* 1 reserved */
16 pl32(p, 0); /* 3 Total parameter count */
17 pl32(p, 0); /* 7 Total data count */
18 pl32(p, 64); /* 11 Max parameter count to return */
19 pl32(p, (MTU - T2HDRLEN)-64); /* 15 Max data count to return */
20 pl32(p, 0); /* 19 Parameter count (in this buffer) */
21 pl32(p, 0); /* 23 Offset to parameters (in this buffer) */
22 pl32(p, 0); /* 27 Count of data in this buffer */
23 pl32(p, 0); /* 31 Offset to data in this buffer */
24 p8(p, 1); /* 35 Count of setup words */
25 pl16(p, cmd); /* 37 setup[0] */
26 pl16(p, 0); /* padding ??!?!? */
35 assert(p->tbase != 0);
37 p->pos = p->tbase +23;
38 pl32(p, (pos - p->buf) - NBHDRLEN); /* param offset */
40 p->tparam = p->pos = pos;
47 assert(p->tbase != 0);
48 assert(p->tparam != 0);
51 pl32(p, pos - p->tparam); /* total param count */
53 p->pos = p->tbase +19;
54 pl32(p, pos - p->tparam); /* param count */
56 p->pos = p->tbase +31;
57 pl32(p, (pos - p->buf) - NBHDRLEN); /* data offset */
58 p->tdata = p->pos = pos;
66 assert(p->tbase != 0);
67 assert(p->tdata != 0);
72 pl32(p, pos - p->tdata); /* total data count */
74 p->pos = p->tbase +27;
75 pl32(p, pos - p->tdata); /* data count */
78 if((got = cifsrpc(p)) == -1)
84 gl32(p); /* Total parameter count */
85 gl32(p); /* Total data count */
86 gl32(p); /* Parameter count in this buffer */
87 p->tparam = p->buf +NBHDRLEN +gl32(p); /* Parameter offset */
88 gl32(p); /* Parameter displacement */
89 gl32(p); /* Data count (this buffer); */
90 p->tdata = p->buf +NBHDRLEN +gl32(p); /* Data offset */
91 gl32(p); /* Data displacement */
92 g8(p); /* Setup count */
93 gl16(p); /* padding ??? */
106 TNTquerysecurity(Session *s, Share *sp, int fh, char **usid, char **gsid)
111 int n, i, off2owner, off2group;
113 p = tnthdr(s, sp, NT_TRANSACT_QUERY_SECURITY_DESC);
116 pl16(p, fh); /* File handle */
117 pl16(p, 0); /* Reserved */
118 pl32(p, QUERY_OWNER_SECURITY_INFORMATION |
119 QUERY_GROUP_SECURITY_INFORMATION);
131 gl16(p); /* revision */
133 off2owner = gl32(p); /* offset to owner */
134 off2group = gl32(p); /* offset to group */
139 p->pos = base + off2owner;
141 fmtprint(f, "S-%ud", g8(p)); /* revision */
142 n = g8(p); /* num auth */
143 fmtprint(f, "-%llud", gb48(p)); /* authority */
144 for(i = 0; i < n; i++)
145 fmtprint(f, "-%ud", gl32(p)); /* sub-authorities */
146 *usid = fmtstrflush(f);
150 p->pos = base + off2group;
152 fmtprint(f, "S-%ud", g8(p)); /* revision */
153 n = g8(p); /* num auth */
154 fmtprint(f, "-%llud", gb48(p)); /* authority */
155 for(i = 0; i < n; i++)
156 fmtprint(f, "-%ud", gl32(p)); /* sub-authorities */
157 *gsid = fmtstrflush(f);