aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/smbfs/smbutil/view.c
diff options
context:
space:
mode:
authorSheldon Hearn <sheldonh@FreeBSD.org>2002-04-22 16:15:20 +0000
committerSheldon Hearn <sheldonh@FreeBSD.org>2002-04-22 16:15:20 +0000
commit34ffbc80d69446c64599a878a0a950c9e66f7bf5 (patch)
tree30fb08f9467b786671737c5383f47fef7a800d4e /contrib/smbfs/smbutil/view.c
parent8d4076f0811818b9ead91e01e5aa214ef4a8d7fb (diff)
downloadsrc-34ffbc80d69446c64599a878a0a950c9e66f7bf5.tar.gz
src-34ffbc80d69446c64599a878a0a950c9e66f7bf5.zip
Import smbfs-1.4.4.vendor/smbfs/1.4.4
Notes
Notes: svn path=/vendor/smbfs/dist/; revision=95267 svn path=/vendor/smbfs/1.4.4/; revision=95269; tag=vendor/smbfs/1.4.4
Diffstat (limited to 'contrib/smbfs/smbutil/view.c')
-rw-r--r--contrib/smbfs/smbutil/view.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/contrib/smbfs/smbutil/view.c b/contrib/smbfs/smbutil/view.c
index e3e600f57e4d..42450df26593 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);