Commit Graph

64 Commits

Author SHA1 Message Date
Mateusz Piotrowski
830809aea1 smbutil(1): Improve mdoc formatting.
Also, make the path to the example configuration file absolute.

Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D17985
2018-11-14 15:15:07 +00:00
Mateusz Piotrowski
8df507900a smbutil(1): Reference nsmb.conf(5) and mount_smbfs(8)
Reviewed by:	bcr
Approved by:    krion (mentor, implicit), mat (mentor, implicit)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D17809
2018-11-01 22:54:52 +00:00
Mateusz Piotrowski
62d7aab953 mount_smbfs(8): Mention /etc/nsmb.conf, smbutil(1) and nsmb.conf(5)
Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D17808
2018-11-01 22:50:50 +00:00
Mateusz Piotrowski
d5e3b0b563 mount_smbfs(8): Add the STANDARDS and HISTORY sections
- Document that mount_smbfs(8) only supports SMB1 and that SMB2 and SMB3
  are not supported at the moment. Suggest users to browse ports for
  software compatible with newer versions of the protocol.
- Copy supported servers list from README.
- Add a SEE ALSO section and reference the chapter about Samba in the
  FreeBSD Handbook.
- Add a HISTORY section.
- Style changes:
  - Use Dq instead of Em in the EXAMPLES section.
  - Mark command modifiers with Cm.

Reviewed by:	bcr
Approved by:	krion (mentor, implicit), mat (mentor, implicit)
MFC after:	1 week
Sponsored by:   Bally Wulff Games & Entertainment GmbH
Differential Revision:	https://reviews.freebsd.org/D17798
2018-11-01 11:37:19 +00:00
Brooks Davis
ccbbd187b1 Fix a stack overflow in mount_smbfs when hostname is too long.
The local hostname was blindly copied into the to the nn_name array.
When the hostname exceeded 16 bytes, it would overflow.  Truncate the
hostname to 15 bytes plus a 0 terminator which is the "workstation name"
suffix.

Use defensive strlcpy() when filling nn_name in all cases.

PR:		228354
Reported by:	donald.buchholz@intel.com
Reviewed by:	jpaetzel,  ian (prior version)
Discussed with:	Security Officer (gtetlow)
MFC after:	3 days
Security:	Stack overflow with the hostname.
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D15936
2018-06-25 16:42:49 +00:00
Josh Paetzel
f56de56355 Fix SMBFS when saved passwords are greater than 18 characters
PR:	132302
Submitted by:	dhorn2000@gmail.com guru@unixarea.de
MFC after:	1 week
2017-06-08 00:48:26 +00:00
Enji Cooper
833525a88a Add #include <string.h> to mute warning from clang/gcc about implicitly
declaring strcmp(3)

MFC after: 1 month
Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division
2016-02-01 07:09:08 +00:00
Ian Lepore
69ba629255 Avoid unaligned memory accesses when encoding netbios names in libsmb.
The current code for encoding a netbios name converts each byte to a 16-bit
value and stores the result by casting a char* to u_short*, resulting in
alignment faults on strict-alignment platforms.

This change reimplements the encoding routine using only byte accesses to
memory. There is no particular reason to work with 16-bit values just
because the encoding process creates two bytes of output for every byte of
input. Working a byte at at time also avoids endian problems for big-endian
platforms.

PR:		180438
PR:		189415
Differential Revision:	https://reviews.freebsd.org/D4622
2015-12-21 17:17:00 +00:00
Christian Brueffer
290bb03c0c Assorted grammar, spelling and punctuation fixes.
PR:		203336, 203339
Submitted by:	espeyb@rpi.edu, themesta@gmail.com
MFC after:	1 week
2015-12-15 13:04:44 +00:00
Tijl Coosemans
1243a98e38 Remove the const qualifier from iconv(3) to comply with POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/iconv.html

Adjust all code that calls iconv.

PR:		199099
Exp-run by:	antoine
MFC after:	2 weeks
2015-04-15 09:09:20 +00:00
Edward Tomasz Napierala
0dcfb96fbc Make it possible to use empty user name ("-U ''") for mount_smbfs(8).
It's just like "-U guest", except that it actually works, at least
with Samba 4, which seems to return authentication failure for "-U guest".

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-09-08 11:01:57 +00:00
Edward Tomasz Napierala
afe21afeba Make mount_smbfs(8) preserve the "automounted" mount flag.
The issue here is that we have to pass this flag as a string,
in iov, because it doesn't fit in mntflags, which is an int.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-09-08 10:57:43 +00:00
Gleb Smirnoff
ce102ac2ae Just disable recoding support in libsmb if built WITHOUT_ICONV. 2013-11-12 15:09:28 +00:00
Gleb Smirnoff
096013098a Use system libiconv, instead of trying to dlopen() it.
PR:		183153
Submitted by:	Dominic Fandrey <kamikaze bsdforen.de>
2013-11-09 14:48:50 +00:00
Davide Italiano
237abf0c56 - Trim an unused and bogus Makefile for mount_smbfs.
- Reconnect with some minor modifications, in particular now selsocket()
internals are adapted to use sbintime units after recent'ish calloutng
switch.
2013-06-28 21:00:08 +00:00
Davide Italiano
92a4d9bcc8 Completely rewrite the interface to smbdev switching from dev_clone
to cdevpriv(9). This commit changes the semantic of mount_smbfs
in userland as well, which now passes file descriptor in order to
to mount a specific filesystem istance.

Reviewed by:	attilio, ed
Tested by:	martymac
2013-05-04 14:03:18 +00:00
Xin LI
f3ae23b34b Bump .Dd date for previous revision.
Approved by:	re (follow up commit fixing trivial issue)
2011-09-17 22:53:05 +00:00
Xin LI
cdbc601be1 Change the example of using smbfs in fstab to a password-less one,
which is less likely to block a remote system from boot.

Submitted by:	Garrett Cooper <yanegomi@gmail.com>
PR:		doc/160775
MFC after:	1 month
Approved by:	re (kib)
2011-09-17 22:17:31 +00:00
Pyun YongHyeon
cd5bb726f7 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
2010-01-25 18:35:58 +00:00
Tom Rhodes
377e63ad8f Document the "-U" option. While it is not part of the
getopt(), it is accepted through smb_ctx_init() in
lib/smb/ctx.c.

PR:		117013
Submitted by:	Tom Evans <tevans.uk@googlemail.com> (original version)
2009-01-22 08:29:39 +00:00
Robert Watson
6966d7767a When encoding an smb name, truncate one byte earlier in order than we did
previously in order to ensure it fit properly in the bufer when encoded.
This prevents a debugging printf from firing if a source or destination
host name for an smb mount exceeds 15 characters.

MFC after:	3 days
Obtained from:	Apple, Inc.
2008-11-02 19:48:15 +00:00
Alexey Dokuchaev
f5442046c1 Document default values for timeout and retry count.
Approved by:	fjoe
2007-06-16 07:01:15 +00:00
Giorgos Keramidas
2f934d3e27 Spell 'connection options' correctly.
Submitted by:	  Leonidas Tsampros <ltsampros@upnet.gr>
2006-08-11 12:35:22 +00:00
Ruslan Ermilov
78ad54210f -mdoc sweep. 2005-11-18 10:56:28 +00:00
Ruslan Ermilov
1a6c5d9fac Unbreak on amd64. 2005-11-16 12:33:04 +00:00
Craig Rodrigues
c76b3c840a Convert mount_smbfs to use nmount().
Reviewed by:	bp (smbfs maintainer)
2005-11-16 02:47:12 +00:00
Tom Rhodes
6b1f5e5661 Quick kill links to the nsmb(8) manual page, there is no such
utility that I can find.
2005-11-01 21:16:39 +00:00
Boris Popov
ef29b0f6a1 Allow user to override default port numbers used by communication
protocols.  This is very useful for tunneled SMB connections.

MFC after:	4 weeks
2005-10-02 08:32:49 +00:00
R. Imura
bb6275a869 Fix get{w,d}{l,b}e, set{w,d}{l,b}e macros on big endian systems.
Obtained from:	NetBSD
2005-09-19 08:11:04 +00:00
R. Imura
4d79445aaf Remove macros
htole{s,l,q}, letoh{s,l,q},  htobe{s,l,q}, betoh{s,l,q}
and replace it with more standard byteorder macros in our system.
2005-09-19 08:07:18 +00:00
R. Imura
f373a82454 - Fix checking range of strings of struct iconv_add_in in libsmb and libkiconv,
- Add checking range of strings to iconv_sysctl_add().

Submitted by:	Rudolf Cejka
2005-08-24 12:38:26 +00:00
R. Imura
19434a77d6 Tell nls_setlocale() the very locale name from command line option,
rather than using optarg variable which would be allways NULL.
2005-08-07 08:46:56 +00:00
R. Imura
f0a446ea10 Correct argument order of kiconv_add_xlat16_cspairs().
Security:
2005-07-29 14:56:16 +00:00
R. Imura
76efe32555 Fix core dump when "smbutil lc".
OK'ed by:	bp
2005-07-28 22:35:38 +00:00
Takanori Watanabe
4ebd3ea1f6 Make smbfs capable to use 16bit char set in filenames.
PR:78110
2005-05-04 15:05:46 +00:00
David E. O'Brien
1ac62e0b31 + Get prototypes for libc functions.
+ Use the correct printf format for size_t.
2004-10-19 17:44:31 +00:00
David E. O'Brien
caef65b837 Size matters. Correctly use a size_t so 64-bit hosts can mount SMB FS's
when using character set conversions.
Also include POSIX <string.h> vs. BSD <strings.h> now that we've broken
traditional BSD behavior [and compatibility with our BSD brethren].

PR:		72445
Submitted by:	Vladimir Nechitailo <nechit@lpi.ru>
Patch by:	Stasys Smailys <ssmailys@komvista.lt>
2004-10-19 17:39:15 +00:00
Tim J. Robbins
95269a8951 Correctly check the return value of kldload() to determine whether an
error occurred.
2004-09-05 06:42:51 +00:00
Alexander Kabaev
2cc37f2ca4 Do not use casts as lvalues. 2004-07-28 05:33:58 +00:00
Boris Popov
6fd05b64b5 Use correct location for nsmb.conf file.
PR:	misc/45273
2004-07-17 14:38:42 +00:00
Maxime Henrion
56cb1e8cca Re-add the code to automatically load the smbfs.ko module if necessary.
We can't realy on the mount(2) system call to do it for us here because
smb_lib_init() needs the module and we call it before mount().  The old
code has been slightly modified to not use the getvfsent(3) API which
is now retired.

Noticed by:     many
2004-06-20 14:30:33 +00:00
Lukas Ertl
7d475e356f Fine-tune the last change even more and use the return value as error
indicator, as it is expected.

Spotted by: Christoph Mallon <christoph.mallon@gmx.de>
2004-06-19 19:03:01 +00:00
Lukas Ertl
8c0c5d04b0 Don't return NULL when the function is defined to return an integer.
OK'ed by: tjr
2004-06-19 10:09:44 +00:00
Maxime Henrion
24449958e4 Sync with other mount_*fs(8) utilities; we don't need to try to
load the smbfs module because the mount(2) syscall will do it
if it's needed.
2004-04-11 21:07:26 +00:00
Tim J. Robbins
8861f1dd53 Merge from NetBSD rev. 1.3 (drochner): Use getifaddrs(3) instead of
SIOCGIFCONF.
2004-02-26 08:49:19 +00:00
Tim J. Robbins
8299402aca Merge from NetBSD rev. 1.2 (drochner): Do the address calculations inside
the data delivered by SIOCGIFCONF correctly (this isn't a plain array!),
and sort the checks a bit to avoid duplicates in the interface list.
2004-01-28 05:55:13 +00:00
Tim J. Robbins
c69db88340 Remove the # ("stringify") operator from the printf() arguments in
the iprintf macro. It was causing the actual format string and
variable names to be written out, instead of substituting the values
of the variables into the format string.
2003-08-23 13:05:13 +00:00
Simon L. B. Nielsen
9c000261d4 - Correct the path to the dot.nsmbrc sample file.
- Add FreeBSD CVS tag.

PR:		docs/35649
Submitted by:	roam
Approved by:	ceri (mentor)
2003-07-31 11:50:01 +00:00
Tim J. Robbins
5ec3441dd2 Fix some off-by-one errors dealing with limits of server names,
usernames, workgroup names and passwords. We can now connect to
servers with 15-character NetBIOS names. (Some versions of Windows
use semi-random 15-char names by default.)

PR:		46902
2003-07-27 11:41:38 +00:00
Peter Wemm
db75019614 Fixes for 64 bit cleanliness. The length arg to sysctl is a pointer to
size_t not int.

Reviewed by:	bp
2003-07-26 04:03:18 +00:00