From 48de1f540d9fce8ad29e667bb998732ab193d516 Mon Sep 17 00:00:00 2001 From: sheldonh Date: Thu, 20 Dec 2001 16:16:25 +0000 Subject: Import smbfs-1.4.2. --- contrib/smbfs/HISTORY | 5 ++ contrib/smbfs/Makefile.inc | 4 +- contrib/smbfs/README | 11 ++- contrib/smbfs/include/netsmb/smb_lib.h | 6 +- contrib/smbfs/lib/Makefile.inc | 2 + contrib/smbfs/lib/smb/kiconv.c | 16 +++- contrib/smbfs/lib/smb/nb_name.c | 9 ++- contrib/smbfs/lib/smb/nls.c | 8 +- contrib/smbfs/lib/smb/subr.c | 137 +++++++++++++++++++++++++++++++- contrib/smbfs/mount_smbfs/mntopts.h | 20 ++++- contrib/smbfs/mount_smbfs/mount_smbfs.8 | 7 +- contrib/smbfs/mount_smbfs/mount_smbfs.c | 19 ++++- contrib/smbfs/smbutil/common.h | 3 + contrib/smbfs/smbutil/dumptree.c | 8 ++ contrib/smbfs/smbutil/login.c | 11 ++- contrib/smbfs/smbutil/smbutil.1 | 3 +- contrib/smbfs/smbutil/smbutil.c | 8 +- contrib/smbfs/smbutil/view.c | 6 +- 18 files changed, 254 insertions(+), 29 deletions(-) (limited to 'contrib/smbfs') diff --git a/contrib/smbfs/HISTORY b/contrib/smbfs/HISTORY index 888c814..844dd36 100644 --- a/contrib/smbfs/HISTORY +++ b/contrib/smbfs/HISTORY @@ -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 - Kernel side of smbfs committed in the FreeBSD-current. It controlled by following options: LIBMCHAIN, LIBICONV, NETSMB, NETSMBCRYPTO and SMBFS. diff --git a/contrib/smbfs/Makefile.inc b/contrib/smbfs/Makefile.inc index 0e7173c..d83356e 100644 --- a/contrib/smbfs/Makefile.inc +++ b/contrib/smbfs/Makefile.inc @@ -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 .if !defined(PREFIX) @@ -22,6 +22,8 @@ LIBSMB = ../lib/smb/libsmb.a .if !exists(${SYSDIR}/netsmb/smb.h) CFLAGS += -I../kernel +.else +CFLAGS += -I${SYSDIR} .endif .if defined(SMBGDB) diff --git a/contrib/smbfs/README b/contrib/smbfs/README index a85b435..b63e16c 100644 --- a/contrib/smbfs/README +++ b/contrib/smbfs/README @@ -6,11 +6,14 @@ This is native SMB/CIFS filesystem (smbfs for short) for FreeBSD. It is a complete, kernel side implementation of SMB requester and filesystem. - Supportted platforms: - FreeBSD 4.X + Supported platform Comment + FreeBSD 4.X Port - FreeBSD-current kernel module is included in the base source - tree. + FreeBSD 4.5 Everything available in the base system. + + 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. diff --git a/contrib/smbfs/include/netsmb/smb_lib.h b/contrib/smbfs/include/netsmb/smb_lib.h index 24fccb8..ecf4518 100644 --- a/contrib/smbfs/include/netsmb/smb_lib.h +++ b/contrib/smbfs/include/netsmb/smb_lib.h @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * 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_ #define _NETSMB_SMB_LIB_H_ @@ -37,7 +37,9 @@ #include #include +#ifndef SMB_CFG_FILE #define SMB_CFG_FILE "/usr/local/etc/nsmb.conf" +#endif #define STDPARAM_ARGS 'A':case 'B':case 'C':case 'E':case 'I': \ 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, 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 m_getm(struct mbuf *, size_t, struct mbuf **); diff --git a/contrib/smbfs/lib/Makefile.inc b/contrib/smbfs/lib/Makefile.inc index 43bd23e..3319727 100644 --- a/contrib/smbfs/lib/Makefile.inc +++ b/contrib/smbfs/lib/Makefile.inc @@ -6,6 +6,8 @@ CFLAGS+= -Wall ${BPCFLAGS} .if !exists(${SYSDIR}/netsmb/smb.h) CFLAGS+= -I${.CURDIR}/../../kernel +.else +CFLAGS+= -I${SYSDIR} .endif .if defined(SMBGDB) diff --git a/contrib/smbfs/lib/smb/kiconv.c b/contrib/smbfs/lib/smb/kiconv.c index ce69c84..e75f664 100644 --- a/contrib/smbfs/lib/smb/kiconv.c +++ b/contrib/smbfs/lib/smb/kiconv.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * 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 @@ -38,6 +38,11 @@ #include #include +#ifdef APPLE +#include +extern uid_t real_uid, eff_uid; +#endif + int 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_datalen = 256; 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) return errno; +#endif return 0; } diff --git a/contrib/smbfs/lib/smb/nb_name.c b/contrib/smbfs/lib/smb/nb_name.c index 24b1a80..01500c3 100644 --- a/contrib/smbfs/lib/smb/nb_name.c +++ b/contrib/smbfs/lib/smb/nb_name.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Boris Popov + * Copyright (c) 2000-2001, Boris Popov * All rights reserved. * * 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 * 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 #include +#include /* for endiand macros */ #include #include @@ -138,8 +139,8 @@ nb_encname_len(const char *str) return len; } -#define NBENCODE(c) ((u_short)(((u_char)(c) >> 4) | \ - (((u_char)(c) & 0xf) << 8)) + 0x4141) +#define NBENCODE(c) (htoles((u_short)(((u_char)(c) >> 4) | \ + (((u_char)(c) & 0xf) << 8)) + 0x4141)) static void memsetw(char *dst, int n, u_short word) diff --git a/contrib/smbfs/lib/smb/nls.c b/contrib/smbfs/lib/smb/nls.c index 7517c6e..38db2e1 100644 --- a/contrib/smbfs/lib/smb/nls.c +++ b/contrib/smbfs/lib/smb/nls.c @@ -29,14 +29,16 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * 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 #include #include #include +#ifndef APPLE #include +#endif #include #include #include @@ -80,6 +82,9 @@ nls_setlocale(const char *name) int nls_setrecode(const char *local, const char *external) { +#ifdef APPLE + return ENOENT; +#else iconv_t icd; if (iconv_loaded == 2) @@ -113,6 +118,7 @@ nls_setrecode(const char *local, const char *external) } nls_toloc = icd; return 0; +#endif } char * diff --git a/contrib/smbfs/lib/smb/subr.c b/contrib/smbfs/lib/smb/subr.c index 9541b62..cd65315 100644 --- a/contrib/smbfs/lib/smb/subr.c +++ b/contrib/smbfs/lib/smb/subr.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * 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 @@ -50,6 +50,15 @@ #include #include +#ifdef APPLE +#include +#include +#include +#include + +uid_t real_uid, eff_uid; +#endif + extern char *__progname; static int smblib_initialized; @@ -174,13 +183,25 @@ smb_dumptree(void) void *p; int error; +#ifdef APPLE + seteuid(eff_uid); /* restore setuid root briefly */ +#endif error = sysctlbyname("net.smb.treedump", NULL, &len, NULL, 0); +#ifdef APPLE + seteuid(real_uid); /* and back to real user */ +#endif if (error) return NULL; p = malloc(len); if (p == NULL) return NULL; +#ifdef APPLE + seteuid(eff_uid); /* restore setuid root briefly */ +#endif error = sysctlbyname("net.smb.treedump", p, &len, NULL, 0); +#ifdef APPLE + seteuid(real_uid); /* and back to real user */ +#endif if (error) { free(p); return NULL; @@ -188,11 +209,18 @@ smb_dumptree(void) return p; } -void +char * smb_simplecrypt(char *dst, const char *src) { int ch, pos; + char *dp; + if (dst == NULL) { + dst = malloc(4 + 2 * strlen(src)); + if (dst == NULL) + return NULL; + } + dp = dst; *dst++ = '$'; *dst++ = '$'; *dst++ = '1'; @@ -208,6 +236,7 @@ smb_simplecrypt(char *dst, const char *src) dst += 2; } *dst = 0; + return dp; } int @@ -241,3 +270,107 @@ smb_simpledecrypt(char *dst, const char *src) *dst = 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 */ diff --git a/contrib/smbfs/mount_smbfs/mntopts.h b/contrib/smbfs/mount_smbfs/mntopts.h index 5b6d52e..c14b27c 100644 --- a/contrib/smbfs/mount_smbfs/mntopts.h +++ b/contrib/smbfs/mount_smbfs/mntopts.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)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 { @@ -43,19 +43,25 @@ struct mntopt { /* User-visible MNT_ flags. */ #define MOPT_ASYNC { "async", 0, MNT_ASYNC, 0 } +#ifndef APPLE #define MOPT_NOATIME { "atime", 1, MNT_NOATIME, 0 } +#endif #define MOPT_NODEV { "dev", 1, MNT_NODEV, 0 } #define MOPT_NOEXEC { "exec", 1, MNT_NOEXEC, 0 } #define MOPT_NOSUID { "suid", 1, MNT_NOSUID, 0 } +#ifndef APPLE #define MOPT_NOSYMFOLLOW { "symfollow", 1, MNT_NOSYMFOLLOW, 0 } +#endif #define MOPT_RDONLY { "rdonly", 0, MNT_RDONLY, 0 } #define MOPT_SYNC { "sync", 0, MNT_SYNCHRONOUS, 0 } #define MOPT_UNION { "union", 0, MNT_UNION, 0 } #define MOPT_USERQUOTA { "userquota", 0, 0, 0 } #define MOPT_GROUPQUOTA { "groupquota", 0, 0, 0 } +#ifndef APPLE #define MOPT_NOCLUSTERR { "clusterr", 1, MNT_NOCLUSTERR, 0 } #define MOPT_NOCLUSTERW { "clusterw", 1, MNT_NOCLUSTERW, 0 } #define MOPT_SUIDDIR { "suiddir", 0, MNT_SUIDDIR, 0 } +#endif /* Control flags. */ #define MOPT_FORCE { "force", 0, MNT_FORCE, 0 } @@ -72,6 +78,17 @@ struct mntopt { MOPT_AUTO /* 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 \ MOPT_USERQUOTA, \ MOPT_GROUPQUOTA, \ @@ -86,6 +103,7 @@ struct mntopt { MOPT_UNION, \ MOPT_NOCLUSTERR, \ MOPT_NOCLUSTERW +#endif /* APPLE */ void getmntopts __P((const char *, const struct mntopt *, int *, int *)); extern int getmnt_silent; diff --git a/contrib/smbfs/mount_smbfs/mount_smbfs.8 b/contrib/smbfs/mount_smbfs/mount_smbfs.8 index b2c68d2..4a52259 100644 --- a/contrib/smbfs/mount_smbfs/mount_smbfs.8 +++ b/contrib/smbfs/mount_smbfs/mount_smbfs.8 @@ -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 .Dt MOUNT_SMBFS 8 .Os FreeBSD @@ -100,7 +100,7 @@ The values must be specified as octal numbers. Default value for the file mode is taken from mount point, default value for the dir mode adds execute permission where the file mode gives read permission. - +.Pp Note that these permissions can differ from the rights granted by SMB server. .It Fl u Ar uid , Fl g Ar gid @@ -128,7 +128,6 @@ See .Pa ./examples/dot.nsmbrc for details. .El - .Sh EXAMPLES The following examples illustrate how to connect to a SMB server .Em SAMBA @@ -149,10 +148,8 @@ for smbfs mounts: .Bd -literal -offset indent //guest@samba/public /smb/public smbfs rw,noauto 0 0 .Ed - .Sh BUGS Please report bugs to the author. - .Sh AUTHORS .An Boris Popov Aq bp@butya.kz , .Aq bp@freebsd.org diff --git a/contrib/smbfs/mount_smbfs/mount_smbfs.c b/contrib/smbfs/mount_smbfs/mount_smbfs.c index 3122bc4..9b90c30 100644 --- a/contrib/smbfs/mount_smbfs/mount_smbfs.c +++ b/contrib/smbfs/mount_smbfs/mount_smbfs.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * 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 #include @@ -71,10 +71,19 @@ main(int argc, char *argv[]) struct smb_ctx sctx, *ctx = &sctx; struct smbfs_args mdata; struct stat st; +#ifdef APPLE + extern void dropsuid(); + extern int loadsmbvfs(); +#else struct vfsconf vfc; +#endif /* APPLE */ char *next; int opt, error, mntflags, caseopt; + +#ifdef APPLE + dropsuid(); +#endif /* APPLE */ if (argc == 2) { if (strcmp(argv[1], "-h") == 0) { usage(); @@ -87,6 +96,9 @@ main(int argc, char *argv[]) if (argc < 3) usage(); +#ifdef APPLE + error = loadsmbvfs(); +#else error = getvfsbyname(SMBFS_VFSNAME, &vfc); if (error && vfsisloadable(SMBFS_VFSNAME)) { if(vfsload(SMBFS_VFSNAME)) @@ -94,6 +106,7 @@ main(int argc, char *argv[]) endvfsent(); error = getvfsbyname(SMBFS_VFSNAME, &vfc); } +#endif /* APPLE */ if (error) errx(EX_OSERR, "SMB filesystem is not available"); @@ -204,9 +217,9 @@ main(int argc, char *argv[]) if (smb_getextattr(mount_point, &einfo) == 0) 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; - if (mdata.gid == -1) + if (mdata.gid == (gid_t)-1) mdata.gid = st.st_gid; if (mdata.file_mode == 0 ) mdata.file_mode = st.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); diff --git a/contrib/smbfs/smbutil/common.h b/contrib/smbfs/smbutil/common.h index 8cca846..ceee9fe 100644 --- a/contrib/smbfs/smbutil/common.h +++ b/contrib/smbfs/smbutil/common.h @@ -15,3 +15,6 @@ void logout_usage(void); void lookup_usage(void); void print_usage(void); void view_usage(void); +#ifdef APPLE +extern int loadsmbvfs(); +#endif diff --git a/contrib/smbfs/smbutil/dumptree.c b/contrib/smbfs/smbutil/dumptree.c index 3bf86ff..7d06142 100644 --- a/contrib/smbfs/smbutil/dumptree.c +++ b/contrib/smbfs/smbutil/dumptree.c @@ -4,6 +4,10 @@ #include #include #include +#ifdef APPLE +#include +#include +#endif #include #include @@ -102,6 +106,10 @@ cmd_dumptree(int argc, char *argv[]) int *itype; printf("SMB connections:\n"); +#ifdef APPLE + if (loadsmbvfs()) + errx(EX_OSERR, "SMB filesystem is not available"); +#endif p = smb_dumptree(); if (p == NULL) { printf("None\n"); diff --git a/contrib/smbfs/smbutil/login.c b/contrib/smbfs/smbutil/login.c index 2b3a452..e1c856f 100644 --- a/contrib/smbfs/smbutil/login.c +++ b/contrib/smbfs/smbutil/login.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * 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 #include @@ -78,6 +78,10 @@ cmd_login(int argc, char *argv[]) /*NOTREACHED*/ } } +#ifdef APPLE + if (loadsmbvfs()) + errx(EX_OSERR, "SMB filesystem is not available"); +#endif if (smb_ctx_resolve(ctx) != 0) exit(1); level = ctx->ct_parsedlevel; @@ -139,6 +143,11 @@ cmd_logout(int argc, char *argv[]) /*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_sh.ioc_opt &= ~SMBSOPT_CREATE; if (smb_ctx_resolve(ctx) != 0) diff --git a/contrib/smbfs/smbutil/smbutil.1 b/contrib/smbfs/smbutil/smbutil.1 index 11ee0f0..529e4cf 100644 --- a/contrib/smbfs/smbutil/smbutil.1 +++ b/contrib/smbfs/smbutil/smbutil.1 @@ -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 .Dt SMBUTIL 1 .Os @@ -117,6 +117,7 @@ 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 diff --git a/contrib/smbfs/smbutil/smbutil.c b/contrib/smbfs/smbutil/smbutil.c index d66003f..4d14f9e 100644 --- a/contrib/smbfs/smbutil/smbutil.c +++ b/contrib/smbfs/smbutil/smbutil.c @@ -64,10 +64,9 @@ cmd_crypt(int argc, char *argv[]) psw = getpass("Password:"); else psw = argv[1]; - cp = malloc(strlen(psw + 4)); + cp = smb_simplecrypt(NULL, psw); if (cp == NULL) errx(EX_DATAERR, "out of memory"); - smb_simplecrypt(cp, psw); printf("%s\n", cp); free(cp); exit(0); @@ -97,6 +96,11 @@ main(int argc, char *argv[]) struct commands *cmd; char *cp; int opt; +#ifdef APPLE + extern void dropsuid(); + + dropsuid(); +#endif /* APPLE */ if (argc < 2) help(); diff --git a/contrib/smbfs/smbutil/view.c b/contrib/smbfs/smbutil/view.c index d69928a..e3e600f 100644 --- a/contrib/smbfs/smbutil/view.c +++ b/contrib/smbfs/smbutil/view.c @@ -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.7 2001/01/28 07:35:01 bp Exp $ + * $Id: view.c,v 1.8 2001/08/22 03:33:38 bp Exp $ */ #include #include @@ -86,6 +86,10 @@ cmd_view(int argc, char *argv[]) /*NOTREACHED*/ } } +#ifdef APPLE + if (loadsmbvfs()) + errx(EX_OSERR, "SMB filesystem is not available"); +#endif smb_ctx_setshare(ctx, "IPC$", SMB_ST_ANY); if (smb_ctx_resolve(ctx) != 0) exit(1); -- cgit v1.1