summaryrefslogtreecommitdiffstats
path: root/contrib/smbfs/smbutil
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>2002-04-22 16:15:20 +0000
committersheldonh <sheldonh@FreeBSD.org>2002-04-22 16:15:20 +0000
commitfbe39dfcc2387a913e094ebed61c7f53fe59ee38 (patch)
tree30fb08f9467b786671737c5383f47fef7a800d4e /contrib/smbfs/smbutil
parente408bb58567fc1081f8fefb21b5fc64aac4b8548 (diff)
downloadFreeBSD-src-fbe39dfcc2387a913e094ebed61c7f53fe59ee38.zip
FreeBSD-src-fbe39dfcc2387a913e094ebed61c7f53fe59ee38.tar.gz
Import smbfs-1.4.4.
Diffstat (limited to 'contrib/smbfs/smbutil')
-rw-r--r--contrib/smbfs/smbutil/smbutil.199
-rw-r--r--contrib/smbfs/smbutil/view.c18
2 files changed, 66 insertions, 51 deletions
diff --git a/contrib/smbfs/smbutil/smbutil.1 b/contrib/smbfs/smbutil/smbutil.1
index 529e4cf..eec6193 100644
--- a/contrib/smbfs/smbutil/smbutil.1
+++ b/contrib/smbfs/smbutil/smbutil.1
@@ -1,51 +1,57 @@
-.\" $Id: smbutil.1,v 1.4 2001/12/20 15:11:34 bp Exp $
-.Dd Feb 14, 2000
+.\" $Id: smbutil.1,v 1.5 2002/04/16 02:48:16 bp Exp $
+.Dd February 14, 2000
.Dt SMBUTIL 1
.Os
.Sh NAME
.Nm smbutil
-.Nd Interface to SMB requester
+.Nd "interface to the SMB requester"
.Sh SYNOPSIS
-.Nm smbutil
+.Nm
.Op Fl hv
.Ar command
-.Op Fl options
+.Op Fl Ar options
.Op Ar args
.Sh DESCRIPTION
The
.Nm
-command used to control SMB requester and issue various commands.
+command is used to control SMB requester and issue various commands.
.Pp
-There are two types of options - global and local to specified command.
+There are two types of options \(em global and local to the specified
+.Ar command .
.Pp
-The global options are:
+Global options are as follows:
.Bl -tag -width indent
.It Fl h
-Print short help message.
+Print a short help message.
.It Fl v
Verbose output.
.El
.Pp
The commands and local options are:
.Bl -tag -width indent
-.It Em crypt Op password
-Slightly encrypt clear text password to use it in the
+.It Cm crypt Op Ar password
+Encrypt clear text password for use in the
.Pa ~/.nsmbrc
-file. The encrypted password starts with '$$1' symbols.
-Warning: the encryption function is very weak and intented only to hide
+file.
+The encrypted password starts with the
+.Ql $$1
+symbols.
+Warning: the encryption function is very weak and intended only to hide
clear text password.
If
.Ar password
-is ommited from command line, program will prompt for one.
-.It Em help Ar command
+is omitted from the command line,
+.Nm
+will prompt for one.
+.It Cm help Ar command
Print usage information about
.Ar command .
-.It Em lc
+.It Cm lc
List active connections and their parameters.
.It Xo
-.Em login
-.Op Fl connection\ options
-.Ar //user@server Ns Op Ar /share
+.Cm login
+.Op Fl Ar connection_options
+.No // Ns Ar user Ns @ Ns Ar server Ns Op / Ns Ar share
.Xc
Login/attach to the specified
.Ar server
@@ -55,17 +61,17 @@ as
.Ar user .
This command will create and authenticate connection to an SMB server, and
will leave it active after exit.
-Thus, one can login only once and then
+Thus, it is possible to login only once and then
use other SMB commands without authentication procedure and additional
connections.
For the description of
-.Op Fl connection\ options
-see
+.Fl Ar connection_options
+refer to the
.Xr mount_smbfs 8
-command (all uppercase options are connection options).
+manpage (all uppercase options are connection options).
.It Xo
-.Em logout
-.Ar //user@server Ns Op Ar /share
+.Cm logout
+.No // Ns Ar user Ns @ Ns Ar server Ns Op / Ns Ar share
.Xc
Logout/detach from the specified
.Ar server
@@ -73,53 +79,56 @@ and/or
.Ar share
as
.Ar user .
-This command will destroy connection created by
-.Ar login
-command. A connection may not be closed immediately if it used by other
+This command will destroy a connection created by the
+.Cm login
+command.
+A connection may not be closed immediately if it is used by other
programs.
.It Xo
-.Em lookup
+.Cm lookup
.Op Fl w Ar host
.Ar name
.Xc
-Resolve given
+Resolve the given
.Ar name
-to IP address.
-NetBIOS name server can be directly specified via
-.Op Fl w
+to an IP address.
+The NetBIOS name server can be directly specified via the
+.Fl w
option.
.It Xo
-.Em print
-.Op Fl connection\ options
-.Ar //user@server/share
+.Cm print
+.Op Fl Ar connection_options
+.No // Ns Ar user Ns @ Ns Ar server Ns / Ns Ar share
.Ar file
.Xc
-Send given
+Send the given
.Ar file
to the specified queue on the remote server.
If
.Ar file
-is '-', then standard input will be used.
+is
+.Pa - ,
+then standard input will be used.
.It Xo
-.Em view
-.Op Fl connection\ options
-.Ar //user@server
+.Cm view
+.Op Fl Ar connection_options
+.No // Ns Ar user Ns @ Ns Ar server
.Xc
-List resources avaliable on the specified
+List resources available on the specified
.Ar server
for the user
.Ar user .
.El
.Sh FILES
-.Bl -tag -width /var/log/wtmp -compact
+.Bl -tag -width ".Pa ~/.nsmbrc" -compact
.It Pa ~/.nsmbrc
-keeps description for each connection.
+Keeps description for each connection.
See
.Pa ./examples/dot.nsmbrc
for details.
.El
.Sh AUTHORS
.An Boris Popov Aq bp@butya.kz ,
-.Aq bp@freebsd.org
+.Aq bp@FreeBSD.org
.Sh BUGS
Please report any bugs to the author.
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);
OpenPOWER on IntegriCloud