This commit was generated by cvs2svn to compensate for changes in r88282,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
2731c8aafa
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=88283
@ -1,3 +1,8 @@
|
|||||||
|
20.12.2001 1.4.2 (interim)
|
||||||
|
- Various merges (but not all) from Darwin project.
|
||||||
|
- Minor man pages corrections.
|
||||||
|
- Support builds in the FreeBSD main tree.
|
||||||
|
|
||||||
16.04.2001 1.4.1
|
16.04.2001 1.4.1
|
||||||
- Kernel side of smbfs committed in the FreeBSD-current. It controlled
|
- Kernel side of smbfs committed in the FreeBSD-current. It controlled
|
||||||
by following options: LIBMCHAIN, LIBICONV, NETSMB, NETSMBCRYPTO and SMBFS.
|
by following options: LIBMCHAIN, LIBICONV, NETSMB, NETSMBCRYPTO and SMBFS.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile.inc,v 1.9 2001/04/16 04:34:26 bp Exp $
|
# $Id: Makefile.inc,v 1.10 2001/05/03 10:05:47 bp Exp $
|
||||||
|
|
||||||
.ifmake !clean && !cleandepend
|
.ifmake !clean && !cleandepend
|
||||||
.if !defined(PREFIX)
|
.if !defined(PREFIX)
|
||||||
@ -22,6 +22,8 @@ LIBSMB = ../lib/smb/libsmb.a
|
|||||||
|
|
||||||
.if !exists(${SYSDIR}/netsmb/smb.h)
|
.if !exists(${SYSDIR}/netsmb/smb.h)
|
||||||
CFLAGS += -I../kernel
|
CFLAGS += -I../kernel
|
||||||
|
.else
|
||||||
|
CFLAGS += -I${SYSDIR}
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if defined(SMBGDB)
|
.if defined(SMBGDB)
|
||||||
|
@ -6,11 +6,14 @@
|
|||||||
This is native SMB/CIFS filesystem (smbfs for short) for FreeBSD.
|
This is native SMB/CIFS filesystem (smbfs for short) for FreeBSD.
|
||||||
It is a complete, kernel side implementation of SMB requester and filesystem.
|
It is a complete, kernel side implementation of SMB requester and filesystem.
|
||||||
|
|
||||||
Supportted platforms:
|
Supported platform Comment
|
||||||
FreeBSD 4.X
|
FreeBSD 4.X Port
|
||||||
|
|
||||||
FreeBSD-current kernel module is included in the base source
|
FreeBSD 4.5 Everything available in the base system.
|
||||||
tree.
|
|
||||||
|
FreeBSD-current Everything available in the base system.
|
||||||
|
|
||||||
|
Darwin maintained in the Darwin's tree.
|
||||||
|
|
||||||
I'm would be very grateful for any feedback, bug reports etc.
|
I'm would be very grateful for any feedback, bug reports etc.
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: smb_lib.h,v 1.22 2001/04/10 05:37:22 bp Exp $
|
* $Id: smb_lib.h,v 1.24 2001/12/20 15:19:43 bp Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef _NETSMB_SMB_LIB_H_
|
#ifndef _NETSMB_SMB_LIB_H_
|
||||||
#define _NETSMB_SMB_LIB_H_
|
#define _NETSMB_SMB_LIB_H_
|
||||||
@ -37,7 +37,9 @@
|
|||||||
#include <netsmb/smb.h>
|
#include <netsmb/smb.h>
|
||||||
#include <netsmb/smb_dev.h>
|
#include <netsmb/smb_dev.h>
|
||||||
|
|
||||||
|
#ifndef SMB_CFG_FILE
|
||||||
#define SMB_CFG_FILE "/usr/local/etc/nsmb.conf"
|
#define SMB_CFG_FILE "/usr/local/etc/nsmb.conf"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define STDPARAM_ARGS 'A':case 'B':case 'C':case 'E':case 'I': \
|
#define STDPARAM_ARGS 'A':case 'B':case 'C':case 'E':case 'I': \
|
||||||
case 'L':case 'M': \
|
case 'L':case 'M': \
|
||||||
@ -208,7 +210,7 @@ int smb_rq_dstring(struct mbdata *, const char *);
|
|||||||
int smb_t2_request(struct smb_ctx *, int, int, const char *,
|
int smb_t2_request(struct smb_ctx *, int, int, const char *,
|
||||||
int, void *, int, void *, int *, void *, int *, void *);
|
int, void *, int, void *, int *, void *, int *, void *);
|
||||||
|
|
||||||
void smb_simplecrypt(char *dst, const char *src);
|
char* smb_simplecrypt(char *dst, const char *src);
|
||||||
int smb_simpledecrypt(char *dst, const char *src);
|
int smb_simpledecrypt(char *dst, const char *src);
|
||||||
|
|
||||||
int m_getm(struct mbuf *, size_t, struct mbuf **);
|
int m_getm(struct mbuf *, size_t, struct mbuf **);
|
||||||
|
@ -6,6 +6,8 @@ CFLAGS+= -Wall ${BPCFLAGS}
|
|||||||
|
|
||||||
.if !exists(${SYSDIR}/netsmb/smb.h)
|
.if !exists(${SYSDIR}/netsmb/smb.h)
|
||||||
CFLAGS+= -I${.CURDIR}/../../kernel
|
CFLAGS+= -I${.CURDIR}/../../kernel
|
||||||
|
.else
|
||||||
|
CFLAGS+= -I${SYSDIR}
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if defined(SMBGDB)
|
.if defined(SMBGDB)
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: kiconv.c,v 1.2 2001/04/16 04:33:01 bp Exp $
|
* $Id: kiconv.c,v 1.3 2001/08/22 03:31:36 bp Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -38,6 +38,11 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#ifdef APPLE
|
||||||
|
#include <sys/types.h>
|
||||||
|
extern uid_t real_uid, eff_uid;
|
||||||
|
#endif
|
||||||
|
|
||||||
int
|
int
|
||||||
kiconv_add_xlat_table(const char *to, const char *from, const u_char *table)
|
kiconv_add_xlat_table(const char *to, const char *from, const u_char *table)
|
||||||
{
|
{
|
||||||
@ -54,8 +59,17 @@ kiconv_add_xlat_table(const char *to, const char *from, const u_char *table)
|
|||||||
din.ia_data = table;
|
din.ia_data = table;
|
||||||
din.ia_datalen = 256;
|
din.ia_datalen = 256;
|
||||||
olen = sizeof(dout);
|
olen = sizeof(dout);
|
||||||
|
#ifdef APPLE
|
||||||
|
seteuid(eff_uid); /* restore setuid root briefly */
|
||||||
|
if (sysctlbyname("net.smb.fs.iconv.add", &dout, &olen, &din, sizeof(din)) == -1) {
|
||||||
|
seteuid(real_uid); /* and back to real user */
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
seteuid(real_uid); /* and back to real user */
|
||||||
|
#else
|
||||||
if (sysctlbyname("kern.iconv.add", &dout, &olen, &din, sizeof(din)) == -1)
|
if (sysctlbyname("kern.iconv.add", &dout, &olen, &din, sizeof(din)) == -1)
|
||||||
return errno;
|
return errno;
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, Boris Popov
|
* Copyright (c) 2000-2001, Boris Popov
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -29,10 +29,11 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: nb_name.c,v 1.1 2000/07/16 01:52:07 bp Exp $
|
* $Id: nb_name.c,v 1.2 2001/08/22 03:31:36 bp Exp $
|
||||||
*/
|
*/
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/mchain.h> /* for endiand macros */
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
@ -138,8 +139,8 @@ nb_encname_len(const char *str)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NBENCODE(c) ((u_short)(((u_char)(c) >> 4) | \
|
#define NBENCODE(c) (htoles((u_short)(((u_char)(c) >> 4) | \
|
||||||
(((u_char)(c) & 0xf) << 8)) + 0x4141)
|
(((u_char)(c) & 0xf) << 8)) + 0x4141))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
memsetw(char *dst, int n, u_short word)
|
memsetw(char *dst, int n, u_short word)
|
||||||
|
@ -29,14 +29,16 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: nls.c,v 1.8 2001/04/16 12:46:46 bp Exp $
|
* $Id: nls.c,v 1.9 2001/08/22 03:31:36 bp Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/iconv.h>
|
#include <sys/iconv.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#ifndef APPLE
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
@ -80,6 +82,9 @@ nls_setlocale(const char *name)
|
|||||||
int
|
int
|
||||||
nls_setrecode(const char *local, const char *external)
|
nls_setrecode(const char *local, const char *external)
|
||||||
{
|
{
|
||||||
|
#ifdef APPLE
|
||||||
|
return ENOENT;
|
||||||
|
#else
|
||||||
iconv_t icd;
|
iconv_t icd;
|
||||||
|
|
||||||
if (iconv_loaded == 2)
|
if (iconv_loaded == 2)
|
||||||
@ -113,6 +118,7 @@ nls_setrecode(const char *local, const char *external)
|
|||||||
}
|
}
|
||||||
nls_toloc = icd;
|
nls_toloc = icd;
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: subr.c,v 1.11 2001/04/16 04:33:01 bp Exp $
|
* $Id: subr.c,v 1.12 2001/08/22 03:31:37 bp Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -50,6 +50,15 @@
|
|||||||
#include <netsmb/nb_lib.h>
|
#include <netsmb/nb_lib.h>
|
||||||
#include <cflib.h>
|
#include <cflib.h>
|
||||||
|
|
||||||
|
#ifdef APPLE
|
||||||
|
#include <sysexits.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <mach/mach.h>
|
||||||
|
#include <mach/mach_error.h>
|
||||||
|
|
||||||
|
uid_t real_uid, eff_uid;
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char *__progname;
|
extern char *__progname;
|
||||||
|
|
||||||
static int smblib_initialized;
|
static int smblib_initialized;
|
||||||
@ -174,13 +183,25 @@ smb_dumptree(void)
|
|||||||
void *p;
|
void *p;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
|
#ifdef APPLE
|
||||||
|
seteuid(eff_uid); /* restore setuid root briefly */
|
||||||
|
#endif
|
||||||
error = sysctlbyname("net.smb.treedump", NULL, &len, NULL, 0);
|
error = sysctlbyname("net.smb.treedump", NULL, &len, NULL, 0);
|
||||||
|
#ifdef APPLE
|
||||||
|
seteuid(real_uid); /* and back to real user */
|
||||||
|
#endif
|
||||||
if (error)
|
if (error)
|
||||||
return NULL;
|
return NULL;
|
||||||
p = malloc(len);
|
p = malloc(len);
|
||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
#ifdef APPLE
|
||||||
|
seteuid(eff_uid); /* restore setuid root briefly */
|
||||||
|
#endif
|
||||||
error = sysctlbyname("net.smb.treedump", p, &len, NULL, 0);
|
error = sysctlbyname("net.smb.treedump", p, &len, NULL, 0);
|
||||||
|
#ifdef APPLE
|
||||||
|
seteuid(real_uid); /* and back to real user */
|
||||||
|
#endif
|
||||||
if (error) {
|
if (error) {
|
||||||
free(p);
|
free(p);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -188,11 +209,18 @@ smb_dumptree(void)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
char *
|
||||||
smb_simplecrypt(char *dst, const char *src)
|
smb_simplecrypt(char *dst, const char *src)
|
||||||
{
|
{
|
||||||
int ch, pos;
|
int ch, pos;
|
||||||
|
char *dp;
|
||||||
|
|
||||||
|
if (dst == NULL) {
|
||||||
|
dst = malloc(4 + 2 * strlen(src));
|
||||||
|
if (dst == NULL)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
dp = dst;
|
||||||
*dst++ = '$';
|
*dst++ = '$';
|
||||||
*dst++ = '$';
|
*dst++ = '$';
|
||||||
*dst++ = '1';
|
*dst++ = '1';
|
||||||
@ -208,6 +236,7 @@ smb_simplecrypt(char *dst, const char *src)
|
|||||||
dst += 2;
|
dst += 2;
|
||||||
}
|
}
|
||||||
*dst = 0;
|
*dst = 0;
|
||||||
|
return dp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -241,3 +270,107 @@ smb_simpledecrypt(char *dst, const char *src)
|
|||||||
*dst = 0;
|
*dst = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef APPLE
|
||||||
|
static int
|
||||||
|
safe_execv(char *args[])
|
||||||
|
{
|
||||||
|
int pid;
|
||||||
|
union wait status;
|
||||||
|
|
||||||
|
pid = fork();
|
||||||
|
if (pid == 0) {
|
||||||
|
(void)execv(args[0], args);
|
||||||
|
errx(EX_OSERR, "%s: execv %s failed, %s\n", __progname,
|
||||||
|
args[0], strerror(errno));
|
||||||
|
}
|
||||||
|
if (pid == -1) {
|
||||||
|
fprintf(stderr, "%s: fork failed, %s\n", __progname,
|
||||||
|
strerror(errno));
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
if (wait4(pid, (int *)&status, 0, NULL) != pid) {
|
||||||
|
fprintf(stderr, "%s: BUG executing %s command\n", __progname,
|
||||||
|
args[0]);
|
||||||
|
return (1);
|
||||||
|
} else if (!WIFEXITED(status)) {
|
||||||
|
fprintf(stderr, "%s: %s command aborted by signal %d\n",
|
||||||
|
__progname, args[0], WTERMSIG(status));
|
||||||
|
return (1);
|
||||||
|
} else if (WEXITSTATUS(status)) {
|
||||||
|
fprintf(stderr, "%s: %s command failed, exit status %d: %s\n",
|
||||||
|
__progname, args[0], WEXITSTATUS(status),
|
||||||
|
strerror(WEXITSTATUS(status)));
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
dropsuid()
|
||||||
|
{
|
||||||
|
/* drop setuid root privs asap */
|
||||||
|
eff_uid = geteuid();
|
||||||
|
real_uid = getuid();
|
||||||
|
seteuid(real_uid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
kextisloaded(char * kextname)
|
||||||
|
{
|
||||||
|
mach_port_t kernel_port;
|
||||||
|
kmod_info_t *k, *loaded_modules = 0;
|
||||||
|
int err, loaded_count = 0;
|
||||||
|
|
||||||
|
/* on error return not loaded - to make loadsmbvfs fail */
|
||||||
|
|
||||||
|
err = task_for_pid(mach_task_self(), 0, &kernel_port);
|
||||||
|
if (err) {
|
||||||
|
fprintf(stderr, "%s: %s: %s\n", __progname,
|
||||||
|
"unable to get kernel task port",
|
||||||
|
mach_error_string(err));
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
err = kmod_get_info(kernel_port, (void *)&loaded_modules,
|
||||||
|
&loaded_count); /* never freed */
|
||||||
|
if (err) {
|
||||||
|
fprintf(stderr, "%s: %s: %s\n", __progname,
|
||||||
|
"kmod_get_info() failed",
|
||||||
|
mach_error_string(err));
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
for (k = loaded_modules; k; k = k->next ? k+1 : 0)
|
||||||
|
if (!strcmp(k->name, kextname))
|
||||||
|
return (1);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define KEXTLOAD_COMMAND "/sbin/kextload"
|
||||||
|
#define FS_KEXT_DIR "/System/Library/Extensions/smbfs.kext"
|
||||||
|
#define FULL_KEXTNAME "com.apple.filesystems.smbfs"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
loadsmbvfs()
|
||||||
|
{
|
||||||
|
const char *kextargs[] = {KEXTLOAD_COMMAND, FS_KEXT_DIR, NULL};
|
||||||
|
int error = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* temporarily revert to root (required for kextload)
|
||||||
|
*/
|
||||||
|
seteuid(eff_uid);
|
||||||
|
if (!kextisloaded(FULL_KEXTNAME)) {
|
||||||
|
error = safe_execv(kextargs);
|
||||||
|
if (!error)
|
||||||
|
error = !kextisloaded(FULL_KEXTNAME);
|
||||||
|
}
|
||||||
|
seteuid(real_uid); /* and back to real user */
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
#endif /* APPLE */
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @(#)mntopts.h 8.7 (Berkeley) 3/29/95
|
* @(#)mntopts.h 8.7 (Berkeley) 3/29/95
|
||||||
* $Id: mntopts.h,v 1.1 2000/03/29 01:26:41 bp Exp $
|
* $Id: mntopts.h,v 1.2 2001/08/22 03:32:52 bp Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct mntopt {
|
struct mntopt {
|
||||||
@ -43,19 +43,25 @@ struct mntopt {
|
|||||||
|
|
||||||
/* User-visible MNT_ flags. */
|
/* User-visible MNT_ flags. */
|
||||||
#define MOPT_ASYNC { "async", 0, MNT_ASYNC, 0 }
|
#define MOPT_ASYNC { "async", 0, MNT_ASYNC, 0 }
|
||||||
|
#ifndef APPLE
|
||||||
#define MOPT_NOATIME { "atime", 1, MNT_NOATIME, 0 }
|
#define MOPT_NOATIME { "atime", 1, MNT_NOATIME, 0 }
|
||||||
|
#endif
|
||||||
#define MOPT_NODEV { "dev", 1, MNT_NODEV, 0 }
|
#define MOPT_NODEV { "dev", 1, MNT_NODEV, 0 }
|
||||||
#define MOPT_NOEXEC { "exec", 1, MNT_NOEXEC, 0 }
|
#define MOPT_NOEXEC { "exec", 1, MNT_NOEXEC, 0 }
|
||||||
#define MOPT_NOSUID { "suid", 1, MNT_NOSUID, 0 }
|
#define MOPT_NOSUID { "suid", 1, MNT_NOSUID, 0 }
|
||||||
|
#ifndef APPLE
|
||||||
#define MOPT_NOSYMFOLLOW { "symfollow", 1, MNT_NOSYMFOLLOW, 0 }
|
#define MOPT_NOSYMFOLLOW { "symfollow", 1, MNT_NOSYMFOLLOW, 0 }
|
||||||
|
#endif
|
||||||
#define MOPT_RDONLY { "rdonly", 0, MNT_RDONLY, 0 }
|
#define MOPT_RDONLY { "rdonly", 0, MNT_RDONLY, 0 }
|
||||||
#define MOPT_SYNC { "sync", 0, MNT_SYNCHRONOUS, 0 }
|
#define MOPT_SYNC { "sync", 0, MNT_SYNCHRONOUS, 0 }
|
||||||
#define MOPT_UNION { "union", 0, MNT_UNION, 0 }
|
#define MOPT_UNION { "union", 0, MNT_UNION, 0 }
|
||||||
#define MOPT_USERQUOTA { "userquota", 0, 0, 0 }
|
#define MOPT_USERQUOTA { "userquota", 0, 0, 0 }
|
||||||
#define MOPT_GROUPQUOTA { "groupquota", 0, 0, 0 }
|
#define MOPT_GROUPQUOTA { "groupquota", 0, 0, 0 }
|
||||||
|
#ifndef APPLE
|
||||||
#define MOPT_NOCLUSTERR { "clusterr", 1, MNT_NOCLUSTERR, 0 }
|
#define MOPT_NOCLUSTERR { "clusterr", 1, MNT_NOCLUSTERR, 0 }
|
||||||
#define MOPT_NOCLUSTERW { "clusterw", 1, MNT_NOCLUSTERW, 0 }
|
#define MOPT_NOCLUSTERW { "clusterw", 1, MNT_NOCLUSTERW, 0 }
|
||||||
#define MOPT_SUIDDIR { "suiddir", 0, MNT_SUIDDIR, 0 }
|
#define MOPT_SUIDDIR { "suiddir", 0, MNT_SUIDDIR, 0 }
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Control flags. */
|
/* Control flags. */
|
||||||
#define MOPT_FORCE { "force", 0, MNT_FORCE, 0 }
|
#define MOPT_FORCE { "force", 0, MNT_FORCE, 0 }
|
||||||
@ -72,6 +78,17 @@ struct mntopt {
|
|||||||
MOPT_AUTO
|
MOPT_AUTO
|
||||||
|
|
||||||
/* Standard options which all mounts can understand. */
|
/* Standard options which all mounts can understand. */
|
||||||
|
#ifdef APPLE
|
||||||
|
#define MOPT_STDOPTS \
|
||||||
|
MOPT_USERQUOTA, \
|
||||||
|
MOPT_GROUPQUOTA, \
|
||||||
|
MOPT_FSTAB_COMPAT, \
|
||||||
|
MOPT_NODEV, \
|
||||||
|
MOPT_NOEXEC, \
|
||||||
|
MOPT_NOSUID, \
|
||||||
|
MOPT_RDONLY, \
|
||||||
|
MOPT_UNION
|
||||||
|
#else
|
||||||
#define MOPT_STDOPTS \
|
#define MOPT_STDOPTS \
|
||||||
MOPT_USERQUOTA, \
|
MOPT_USERQUOTA, \
|
||||||
MOPT_GROUPQUOTA, \
|
MOPT_GROUPQUOTA, \
|
||||||
@ -86,6 +103,7 @@ struct mntopt {
|
|||||||
MOPT_UNION, \
|
MOPT_UNION, \
|
||||||
MOPT_NOCLUSTERR, \
|
MOPT_NOCLUSTERR, \
|
||||||
MOPT_NOCLUSTERW
|
MOPT_NOCLUSTERW
|
||||||
|
#endif /* APPLE */
|
||||||
|
|
||||||
void getmntopts __P((const char *, const struct mntopt *, int *, int *));
|
void getmntopts __P((const char *, const struct mntopt *, int *, int *));
|
||||||
extern int getmnt_silent;
|
extern int getmnt_silent;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $Id: mount_smbfs.8,v 1.8 2000/06/09 13:52:56 bp Exp $
|
.\" $Id: mount_smbfs.8,v 1.9 2001/12/20 15:11:45 bp Exp $
|
||||||
.Dd Mar 10, 2000
|
.Dd Mar 10, 2000
|
||||||
.Dt MOUNT_SMBFS 8
|
.Dt MOUNT_SMBFS 8
|
||||||
.Os FreeBSD
|
.Os FreeBSD
|
||||||
@ -100,7 +100,7 @@ The values must be specified as octal numbers.
|
|||||||
Default value for the file mode
|
Default value for the file mode
|
||||||
is taken from mount point, default value for the dir mode adds execute
|
is taken from mount point, default value for the dir mode adds execute
|
||||||
permission where the file mode gives read permission.
|
permission where the file mode gives read permission.
|
||||||
|
.Pp
|
||||||
Note that these permissions can differ from the rights granted by SMB
|
Note that these permissions can differ from the rights granted by SMB
|
||||||
server.
|
server.
|
||||||
.It Fl u Ar uid , Fl g Ar gid
|
.It Fl u Ar uid , Fl g Ar gid
|
||||||
@ -128,7 +128,6 @@ See
|
|||||||
.Pa ./examples/dot.nsmbrc
|
.Pa ./examples/dot.nsmbrc
|
||||||
for details.
|
for details.
|
||||||
.El
|
.El
|
||||||
|
|
||||||
.Sh EXAMPLES
|
.Sh EXAMPLES
|
||||||
The following examples illustrate how to connect to a SMB server
|
The following examples illustrate how to connect to a SMB server
|
||||||
.Em SAMBA
|
.Em SAMBA
|
||||||
@ -149,10 +148,8 @@ for smbfs mounts:
|
|||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
//guest@samba/public /smb/public smbfs rw,noauto 0 0
|
//guest@samba/public /smb/public smbfs rw,noauto 0 0
|
||||||
.Ed
|
.Ed
|
||||||
|
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
Please report bugs to the author.
|
Please report bugs to the author.
|
||||||
|
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An Boris Popov Aq bp@butya.kz ,
|
.An Boris Popov Aq bp@butya.kz ,
|
||||||
.Aq bp@freebsd.org
|
.Aq bp@freebsd.org
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: mount_smbfs.c,v 1.13 2001/04/16 12:46:46 bp Exp $
|
* $Id: mount_smbfs.c,v 1.15 2001/12/20 15:03:41 bp Exp $
|
||||||
*/
|
*/
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@ -71,10 +71,19 @@ main(int argc, char *argv[])
|
|||||||
struct smb_ctx sctx, *ctx = &sctx;
|
struct smb_ctx sctx, *ctx = &sctx;
|
||||||
struct smbfs_args mdata;
|
struct smbfs_args mdata;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
#ifdef APPLE
|
||||||
|
extern void dropsuid();
|
||||||
|
extern int loadsmbvfs();
|
||||||
|
#else
|
||||||
struct vfsconf vfc;
|
struct vfsconf vfc;
|
||||||
|
#endif /* APPLE */
|
||||||
char *next;
|
char *next;
|
||||||
int opt, error, mntflags, caseopt;
|
int opt, error, mntflags, caseopt;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef APPLE
|
||||||
|
dropsuid();
|
||||||
|
#endif /* APPLE */
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
if (strcmp(argv[1], "-h") == 0) {
|
if (strcmp(argv[1], "-h") == 0) {
|
||||||
usage();
|
usage();
|
||||||
@ -87,6 +96,9 @@ main(int argc, char *argv[])
|
|||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
|
#ifdef APPLE
|
||||||
|
error = loadsmbvfs();
|
||||||
|
#else
|
||||||
error = getvfsbyname(SMBFS_VFSNAME, &vfc);
|
error = getvfsbyname(SMBFS_VFSNAME, &vfc);
|
||||||
if (error && vfsisloadable(SMBFS_VFSNAME)) {
|
if (error && vfsisloadable(SMBFS_VFSNAME)) {
|
||||||
if(vfsload(SMBFS_VFSNAME))
|
if(vfsload(SMBFS_VFSNAME))
|
||||||
@ -94,6 +106,7 @@ main(int argc, char *argv[])
|
|||||||
endvfsent();
|
endvfsent();
|
||||||
error = getvfsbyname(SMBFS_VFSNAME, &vfc);
|
error = getvfsbyname(SMBFS_VFSNAME, &vfc);
|
||||||
}
|
}
|
||||||
|
#endif /* APPLE */
|
||||||
if (error)
|
if (error)
|
||||||
errx(EX_OSERR, "SMB filesystem is not available");
|
errx(EX_OSERR, "SMB filesystem is not available");
|
||||||
|
|
||||||
@ -204,9 +217,9 @@ main(int argc, char *argv[])
|
|||||||
if (smb_getextattr(mount_point, &einfo) == 0)
|
if (smb_getextattr(mount_point, &einfo) == 0)
|
||||||
errx(EX_OSERR, "can't mount on %s twice", mount_point);
|
errx(EX_OSERR, "can't mount on %s twice", mount_point);
|
||||||
*/
|
*/
|
||||||
if (mdata.uid == -1)
|
if (mdata.uid == (uid_t)-1)
|
||||||
mdata.uid = st.st_uid;
|
mdata.uid = st.st_uid;
|
||||||
if (mdata.gid == -1)
|
if (mdata.gid == (gid_t)-1)
|
||||||
mdata.gid = st.st_gid;
|
mdata.gid = st.st_gid;
|
||||||
if (mdata.file_mode == 0 )
|
if (mdata.file_mode == 0 )
|
||||||
mdata.file_mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
mdata.file_mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
|
@ -15,3 +15,6 @@ void logout_usage(void);
|
|||||||
void lookup_usage(void);
|
void lookup_usage(void);
|
||||||
void print_usage(void);
|
void print_usage(void);
|
||||||
void view_usage(void);
|
void view_usage(void);
|
||||||
|
#ifdef APPLE
|
||||||
|
extern int loadsmbvfs();
|
||||||
|
#endif
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#ifdef APPLE
|
||||||
|
#include <err.h>
|
||||||
|
#include <sysexits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <netsmb/smb_lib.h>
|
#include <netsmb/smb_lib.h>
|
||||||
#include <netsmb/smb_conn.h>
|
#include <netsmb/smb_conn.h>
|
||||||
@ -102,6 +106,10 @@ cmd_dumptree(int argc, char *argv[])
|
|||||||
int *itype;
|
int *itype;
|
||||||
|
|
||||||
printf("SMB connections:\n");
|
printf("SMB connections:\n");
|
||||||
|
#ifdef APPLE
|
||||||
|
if (loadsmbvfs())
|
||||||
|
errx(EX_OSERR, "SMB filesystem is not available");
|
||||||
|
#endif
|
||||||
p = smb_dumptree();
|
p = smb_dumptree();
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
printf("None\n");
|
printf("None\n");
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: login.c,v 1.5 2001/01/28 07:35:00 bp Exp $
|
* $Id: login.c,v 1.6 2001/08/22 03:33:38 bp Exp $
|
||||||
*/
|
*/
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
@ -78,6 +78,10 @@ cmd_login(int argc, char *argv[])
|
|||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef APPLE
|
||||||
|
if (loadsmbvfs())
|
||||||
|
errx(EX_OSERR, "SMB filesystem is not available");
|
||||||
|
#endif
|
||||||
if (smb_ctx_resolve(ctx) != 0)
|
if (smb_ctx_resolve(ctx) != 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
level = ctx->ct_parsedlevel;
|
level = ctx->ct_parsedlevel;
|
||||||
@ -139,6 +143,11 @@ cmd_logout(int argc, char *argv[])
|
|||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef APPLE
|
||||||
|
error = loadsmbvfs();
|
||||||
|
if (error)
|
||||||
|
errx(EX_OSERR, "SMB filesystem is not available");
|
||||||
|
#endif
|
||||||
ctx->ct_ssn.ioc_opt &= ~SMBVOPT_CREATE;
|
ctx->ct_ssn.ioc_opt &= ~SMBVOPT_CREATE;
|
||||||
ctx->ct_sh.ioc_opt &= ~SMBSOPT_CREATE;
|
ctx->ct_sh.ioc_opt &= ~SMBSOPT_CREATE;
|
||||||
if (smb_ctx_resolve(ctx) != 0)
|
if (smb_ctx_resolve(ctx) != 0)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" $Id: smbutil.1,v 1.3 2000/07/17 01:49:27 bp Exp $
|
.\" $Id: smbutil.1,v 1.4 2001/12/20 15:11:34 bp Exp $
|
||||||
.Dd Feb 14, 2000
|
.Dd Feb 14, 2000
|
||||||
.Dt SMBUTIL 1
|
.Dt SMBUTIL 1
|
||||||
.Os
|
.Os
|
||||||
@ -117,6 +117,7 @@ keeps description for each connection.
|
|||||||
See
|
See
|
||||||
.Pa ./examples/dot.nsmbrc
|
.Pa ./examples/dot.nsmbrc
|
||||||
for details.
|
for details.
|
||||||
|
.El
|
||||||
.Sh AUTHORS
|
.Sh AUTHORS
|
||||||
.An Boris Popov Aq bp@butya.kz ,
|
.An Boris Popov Aq bp@butya.kz ,
|
||||||
.Aq bp@freebsd.org
|
.Aq bp@freebsd.org
|
||||||
|
@ -64,10 +64,9 @@ cmd_crypt(int argc, char *argv[])
|
|||||||
psw = getpass("Password:");
|
psw = getpass("Password:");
|
||||||
else
|
else
|
||||||
psw = argv[1];
|
psw = argv[1];
|
||||||
cp = malloc(strlen(psw + 4));
|
cp = smb_simplecrypt(NULL, psw);
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
errx(EX_DATAERR, "out of memory");
|
errx(EX_DATAERR, "out of memory");
|
||||||
smb_simplecrypt(cp, psw);
|
|
||||||
printf("%s\n", cp);
|
printf("%s\n", cp);
|
||||||
free(cp);
|
free(cp);
|
||||||
exit(0);
|
exit(0);
|
||||||
@ -97,6 +96,11 @@ main(int argc, char *argv[])
|
|||||||
struct commands *cmd;
|
struct commands *cmd;
|
||||||
char *cp;
|
char *cp;
|
||||||
int opt;
|
int opt;
|
||||||
|
#ifdef APPLE
|
||||||
|
extern void dropsuid();
|
||||||
|
|
||||||
|
dropsuid();
|
||||||
|
#endif /* APPLE */
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
help();
|
help();
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: view.c,v 1.7 2001/01/28 07:35:01 bp Exp $
|
* $Id: view.c,v 1.8 2001/08/22 03:33:38 bp Exp $
|
||||||
*/
|
*/
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/errno.h>
|
#include <sys/errno.h>
|
||||||
@ -86,6 +86,10 @@ cmd_view(int argc, char *argv[])
|
|||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef APPLE
|
||||||
|
if (loadsmbvfs())
|
||||||
|
errx(EX_OSERR, "SMB filesystem is not available");
|
||||||
|
#endif
|
||||||
smb_ctx_setshare(ctx, "IPC$", SMB_ST_ANY);
|
smb_ctx_setshare(ctx, "IPC$", SMB_ST_ANY);
|
||||||
if (smb_ctx_resolve(ctx) != 0)
|
if (smb_ctx_resolve(ctx) != 0)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
Loading…
Reference in New Issue
Block a user