diff options
author | sheldonh <sheldonh@FreeBSD.org> | 2002-04-22 16:15:20 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 2002-04-22 16:15:20 +0000 |
commit | 6bdbff33ba0411eb7e6ae8f91ab436ba63e49744 (patch) | |
tree | db380eefd4cafbf632007e7503267c0cc9eba194 /contrib/smbfs/smbutil/view.c | |
parent | 6fa3be308b0b40789e197b572254a3d7e7407953 (diff) | |
parent | fbe39dfcc2387a913e094ebed61c7f53fe59ee38 (diff) | |
download | FreeBSD-src-6bdbff33ba0411eb7e6ae8f91ab436ba63e49744.zip FreeBSD-src-6bdbff33ba0411eb7e6ae8f91ab436ba63e49744.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r95267,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/smbfs/smbutil/view.c')
-rw-r--r-- | contrib/smbfs/smbutil/view.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/contrib/smbfs/smbutil/view.c b/contrib/smbfs/smbutil/view.c index e3e600f..42450df 100644 --- a/contrib/smbfs/smbutil/view.c +++ b/contrib/smbfs/smbutil/view.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Boris Popov + * Copyright (c) 2000-2002, Boris Popov * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: view.c,v 1.8 2001/08/22 03:33:38 bp Exp $ + * $Id: view.c,v 1.9 2002/02/20 09:26:42 bp Exp $ */ #include <sys/param.h> #include <sys/errno.h> @@ -44,6 +44,8 @@ #include <cflib.h> +#include <sys/mchain.h> + #include <netsmb/smb_lib.h> #include <netsmb/smb_conn.h> #include <netsmb/smb_rap.h> @@ -53,8 +55,8 @@ static char *shtype[] = { "disk", "printer", - "pipe", - "comm", + "comm", /* Communications device */ + "pipe", /* IPC Inter process communication */ "unknown" }; @@ -64,7 +66,9 @@ cmd_view(int argc, char *argv[]) struct smb_ctx sctx, *ctx = &sctx; struct smb_share_info_1 *rpbuf, *ep; char *cp; + u_int16_t type; int error, opt, bufsize, i, entries, total; + if (argc < 2) view_usage(); @@ -100,7 +104,7 @@ cmd_view(int argc, char *argv[]) } printf("Share Type Comment\n"); printf("-------------------------------\n"); - bufsize = 65535; + bufsize = 0xffe0; /* samba notes win2k bug with 65535 */ rpbuf = malloc(bufsize); error = smb_rap_NetShareEnum(ctx, 1, rpbuf, bufsize, &entries, &total); if (error && @@ -109,9 +113,11 @@ cmd_view(int argc, char *argv[]) exit(1); } for (ep = rpbuf, i = 0; i < entries; i++, ep++) { + type = letohs(ep->shi1_type); + cp = (char*)rpbuf + ep->shi1_remark; printf("%-12s %-10s %s\n", ep->shi1_netname, - shtype[ep->shi1_type], + shtype[min(type, sizeof shtype / sizeof(char *) - 1)], ep->shi1_remark ? nls_str_toloc(cp, cp) : ""); } printf("\n%d shares listed from %d available\n", entries, total); |