shi1_remark is in little endian format, convert it to host ordering.

Also remove upper 16bits which always seem to be 0xFFFF. We don't
allocate more than 64KB buffer anyway.
This change make smbutil work on sparc64.

Reviewed by:	marius, bp
Approved by:	bp
This commit is contained in:
Pyun YongHyeon 2010-01-25 18:35:58 +00:00
parent fdf64c5752
commit cd5bb726f7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=202980

View file

@ -69,6 +69,7 @@ cmd_view(int argc, char *argv[])
struct smb_ctx sctx, *ctx = &sctx;
struct smb_share_info_1 *rpbuf, *ep;
char *cp;
u_int32_t remark;
u_int16_t type;
int error, opt, bufsize, i, entries, total;
@ -117,11 +118,13 @@ cmd_view(int argc, char *argv[])
}
for (ep = rpbuf, i = 0; i < entries; i++, ep++) {
type = le16toh(ep->shi1_type);
remark = le32toh(ep->shi1_remark);
remark &= 0xFFFF;
cp = (char*)rpbuf + ep->shi1_remark;
cp = (char*)rpbuf + remark;
printf("%-12s %-10s %s\n", ep->shi1_netname,
shtype[min(type, sizeof shtype / sizeof(char *) - 1)],
ep->shi1_remark ? nls_str_toloc(cp, cp) : "");
remark ? nls_str_toloc(cp, cp) : "");
}
printf("\n%d shares listed from %d available\n", entries, total);
free(rpbuf);