The branch, v3-2-test has been updated
via 01596c9335f0e7f2fd618e79fe313caf97dbb2f4 (commit)
via 5fbd98f7065268ae134108310119078ad8f62322 (commit)
via be5ee4999ee8708ec06c1563a62c565a890df622 (commit)
from 719527f55e88f0c5fdceda5c807475aba299c79f (commit)
http://gitweb.samba.org/?samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 01596c9335f0e7f2fd618e79fe313caf97dbb2f4
Author: Karolin Seeger <[EMAIL PROTECTED]>
Date: Thu Feb 28 15:52:06 2008 +0100
Update WHATSNEW.
Karolin
commit 5fbd98f7065268ae134108310119078ad8f62322
Author: Karolin Seeger <[EMAIL PROTECTED]>
Date: Thu Feb 28 15:49:57 2008 +0100
Remove smbmount.
Karolin
commit be5ee4999ee8708ec06c1563a62c565a890df622
Author: Karolin Seeger <[EMAIL PROTECTED]>
Date: Thu Feb 28 15:45:28 2008 +0100
Add mount.cifs as a wrapper for mount.cifs.
Karolin
-----------------------------------------------------------------------
Summary of changes:
WHATSNEW.txt | 7 +-
examples/scripts/mount/mount.smbfs | 115 ++++
source/Makefile.in | 25 +-
source/client/smbmnt.c | 332 ------------
source/client/smbmount.c | 1047 ------------------------------------
source/client/smbumount.c | 196 -------
source/configure.in | 26 -
source/include/smb_macros.h | 5 +-
source/script/installbin.sh.in | 9 -
source/script/installman.sh | 1 -
source/script/uninstallbin.sh.in | 6 -
11 files changed, 125 insertions(+), 1644 deletions(-)
create mode 100644 examples/scripts/mount/mount.smbfs
delete mode 100644 source/client/smbmnt.c
delete mode 100644 source/client/smbmount.c
delete mode 100644 source/client/smbumount.c
Changeset truncated at 500 lines:
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 16e0275..8c32d9a 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -75,7 +75,6 @@ to the "Changes" section for details on the exact parameters
that were
updated.
-
Registry Configuration Backend
==============================
@@ -94,6 +93,11 @@ Removed Features
Both the Python bindings and the libmsrpc shared library have been
removed from the tree due to lack of an official maintainer.
+As smbfs is no longer supported in current kernel versions, smbmount has
+been removed in this Samba version. Please use cifs (mount.cifs) instead.
+See examples/scripts/mount/mount.smbfs as an example for a wrapper which
+calls mount.cifs instead of smbmount/mount.smbfs.
+
######################################################################
@@ -242,6 +246,7 @@ o Karolin Seeger <[EMAIL PROTECTED]>
* Add 'net rap file user'.
* Change LDAP search filter to find machine accounts which
are not located in the user suffix.
+ * Remove smbmount.
o David Shaw <[EMAIL PROTECTED]>
diff --git a/examples/scripts/mount/mount.smbfs
b/examples/scripts/mount/mount.smbfs
new file mode 100644
index 0000000..3b57bc5
--- /dev/null
+++ b/examples/scripts/mount/mount.smbfs
@@ -0,0 +1,115 @@
+#!/bin/bash
+# Debian mount.smbfs compatibility wrapper
+# Copyright 2007, Steve Langasek <vorlon at debian.org>
+# Licensed under the GNU General Public License, version 2. See the
+# file /usr/share/common-licenses/GPL or <http://www.gnu.org/copyleft/gpl.txt>.
+
+# This script accepts all documented mount options for mount.smbfs,
+# passing through those that are also recognized by mount.cifs,
+# converting those that are not recognized but map to available cifs
+# options, and warning about the use of options for which no equivalent
+# exists.
+
+# known bugs: quoted spaces in arguments are not passed intact
+
+set -e
+
+# reverse the order of username and password in a "username" parameter,
+# taking care to leave any "%password" bit intact
+
+reverse_username_workgroup() {
+ local workgroup password username
+
+ username="$1"
+ case "$username" in
+ *%*) password="${username#*%}"
+ username="${username%%%*}"
+ ;;
+ *) ;;
+ esac
+ case "$username" in
+ */*) workgroup="${username#*/}"
+ username="${username%%/*}"
+ ;;
+ *) ;;
+ esac
+ if [ -n "$workgroup" ]; then
+ username="$workgroup\\$username"
+ fi
+ if [ -n "$password" ]; then
+ username="$username%$password"
+ fi
+ echo "$username"
+}
+
+
+# parse out the mount options that have been specified using -o, and if
+# necessary, convert them for use by mount.cifs
+
+parse_mount_options () {
+ local OLD_IFS IFS options option username
+ OLD_IFS="$IFS"
+ IFS=","
+ options=""
+ workgroup=""
+ password=""
+
+ for option in $@; do
+ case "$option" in
+ sockopt=* | scope=* | codepage=* | ttl=* | debug=*)
+ echo "Warning: ignoring deprecated smbfs option
'$option'" >&2
+ ;;
+
+ krb)
+ options="$options${options:+,}sec=krb5"
+ ;;
+
+ guest)
+ echo "Warning: mapping 'guest' to 'guest,sec=none'" >&2
+ options="$options${options:+,}guest,sec=none"
+ ;;
+
+ # username and workgroup are reversed in username= arguments,
+ # so need to be parsed out
+ username=*/*)
+ IFS="$OLD_IFS"
+ username="${option#username=}"
+ username="$(reverse_username_workgroup "$username")"
+ IFS=","
+ options="$options${options:+,}username=$username"
+ ;;
+
+ *)
+ options="$options${options:+,}$option"
+ ;;
+ esac
+ done
+ IFS="$OLD_IFS"
+ echo $options
+}
+
+args=()
+while [ "$#" -gt 0 ]; do
+ case "$1" in
+ -o*)
+ arg=${1#-o}
+ shift
+ if [ -z "$arg" ]; then
+ arg=$1
+ shift
+ fi
+ arg="$(parse_mount_options "$arg")"
+ if [ -n "$arg" ]; then
+ args=("[EMAIL PROTECTED]" "-o" "$arg")
+ fi
+ ;;
+ *)
+ args=("[EMAIL PROTECTED]" "$1")
+ shift
+ ;;
+ esac
+done
+
+USER="$(reverse_username_workgroup "$USER")"
+
+exec /sbin/mount.cifs "[EMAIL PROTECTED]"
diff --git a/source/Makefile.in b/source/Makefile.in
index e0068ba..d20cea2 100644
--- a/source/Makefile.in
+++ b/source/Makefile.in
@@ -208,7 +208,7 @@ TORTURE_PROGS = bin/[EMAIL PROTECTED]@ bin/[EMAIL
PROTECTED]@ \
bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ \
bin/[EMAIL PROTECTED]@
-BIN_PROGS = @EXTRA_BIN_PROGS@ @SMBMOUNT_PROGS@ \
+BIN_PROGS = @EXTRA_BIN_PROGS@ \
$(BIN_PROGS1) $(BIN_PROGS2) $(BIN_PROGS3) $(BIN_PROGS4)
EVERYTHING_PROGS = bin/[EMAIL PROTECTED]@ bin/[EMAIL PROTECTED]@ \
@@ -831,14 +831,6 @@ NET_OBJ = $(NET_OBJ1) $(PARAM_WITHOUT_REG_OBJ)
$(SECRETS_OBJ) $(LIBSMB_OBJ) \
CUPS_OBJ = client/smbspool.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
$(LIB_NONSMBD_OBJ) $(KRBCLIENT_OBJ) $(SECRETS_OBJ) $(POPT_LIB_OBJ)
-MOUNT_OBJ = client/smbmount.o \
- $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ)
$(SECRETS_OBJ)
-
-MNT_OBJ = client/smbmnt.o $(VERSION_OBJ) $(LIBREPLACE_OBJ)
$(SOCKET_WRAPPER_OBJ)
-
-UMOUNT_OBJ = client/smbumount.o $(PARAM_OBJ) $(LIBSMB_OBJ) \
- $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) $(SECRETS_OBJ)
-
CIFS_MOUNT_OBJ = client/mount.cifs.o
CIFS_UMOUNT_OBJ = client/umount.cifs.o
@@ -1294,18 +1286,6 @@ bin/[EMAIL PROTECTED]@: $(BINARY_PREREQS) $(CUPS_OBJ)
@BUILD_POPT@ @LIBTDB_SHARED@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(CUPS_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS)
$(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@ @LIBTDB_LIBS@
-bin/[EMAIL PROTECTED]@: $(BINARY_PREREQS) $(MOUNT_OBJ) @BUILD_POPT@
@LIBTDB_SHARED@
- @echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(MOUNT_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS)
$(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@ @LIBTDB_LIBS@
-
-bin/[EMAIL PROTECTED]@: $(BINARY_PREREQS) $(MNT_OBJ) @BUILD_POPT@
- @echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(MNT_OBJ) $(DYNEXP) $(LDFLAGS) @POPTLIBS@
-
-bin/[EMAIL PROTECTED]@: $(BINARY_PREREQS) $(UMOUNT_OBJ) @BUILD_POPT@
@LIBTDB_SHARED@
- @echo Linking $@
- @$(CC) $(FLAGS) -o $@ $(UMOUNT_OBJ) $(DYNEXP) $(LDFLAGS) $(LIBS)
$(KRB5LIBS) $(LDAP_LIBS) @POPTLIBS@ @LIBTDB_LIBS@
-
bin/[EMAIL PROTECTED]@: $(BINARY_PREREQS) $(CIFS_MOUNT_OBJ) @BUILD_POPT@
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(CIFS_MOUNT_OBJ) $(DYNEXP) $(LDFLAGS) @POPTLIBS@
@@ -2051,8 +2031,7 @@ revert:
@$(SHELL) $(srcdir)/script/revert.sh $(BINDIR) $(BIN_PROGS) $(SCRIPTS)
installman: installdirs
- @SMBMOUNT_PROGS="@SMBMOUNT_PROGS@" $(SHELL) \
- $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(srcdir) C
"@ROFF@"
+ @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(srcdir)
C "@ROFF@"
.PHONY: showlayout
diff --git a/source/client/smbmnt.c b/source/client/smbmnt.c
deleted file mode 100644
index 3d7de1b..0000000
--- a/source/client/smbmnt.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/*
- * smbmnt.c
- *
- * Copyright (C) 1995-1998 by Paal-Kr. Engstad and Volker Lendecke
- * extensively modified by Tridge
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-#define SMBMOUNT_MALLOC 1
-
-#include "includes.h"
-
-#include <mntent.h>
-#include <sys/utsname.h>
-
-#include <asm/types.h>
-#include <asm/posix_types.h>
-#include <linux/smb.h>
-#include <linux/smb_mount.h>
-#include <asm/unistd.h>
-
-#ifndef MS_MGC_VAL
-/* This may look strange but MS_MGC_VAL is what we are looking for and
- is what we need from <linux/fs.h> under libc systems and is
- provided in standard includes on glibc systems. So... We
- switch on what we need... */
-#include <linux/fs.h>
-#endif
-
-static uid_t mount_uid;
-static gid_t mount_gid;
-static int mount_ro;
-static unsigned mount_fmask;
-static unsigned mount_dmask;
-static int user_mount;
-static char *options;
-
-static void
-help(void)
-{
- printf("\n");
- printf("Usage: smbmnt mount-point [options]\n");
- printf("Version %s\n\n",SAMBA_VERSION_STRING);
- printf("-s share share name on server\n"
- "-r mount read-only\n"
- "-u uid mount as uid\n"
- "-g gid mount as gid\n"
- "-f mask permission mask for files\n"
- "-d mask permission mask for directories\n"
- "-o options name=value, list of options\n"
- "-h print this help text\n");
-}
-
-static int
-parse_args(int argc, char *argv[], struct smb_mount_data *data, char **share)
-{
- int opt;
-
- while ((opt = getopt (argc, argv, "s:u:g:rf:d:o:")) != EOF)
- {
- switch (opt)
- {
- case 's':
- *share = optarg;
- break;
- case 'u':
- if (!user_mount) {
- mount_uid = strtol(optarg, NULL, 0);
- }
- break;
- case 'g':
- if (!user_mount) {
- mount_gid = strtol(optarg, NULL, 0);
- }
- break;
- case 'r':
- mount_ro = 1;
- break;
- case 'f':
- mount_fmask = strtol(optarg, NULL, 8);
- break;
- case 'd':
- mount_dmask = strtol(optarg, NULL, 8);
- break;
- case 'o':
- options = optarg;
- break;
- default:
- return -1;
- }
- }
- return 0;
-
-}
-
-static char *
-fullpath(const char *p)
-{
- char path[PATH_MAX+1];
-
- if (strlen(p) > PATH_MAX) {
- return NULL;
- }
-
- if (realpath(p, path) == NULL) {
- fprintf(stderr,"Failed to find real path for mount point %s:
%s\n",
- p, strerror(errno));
- exit(1);
- }
- return strdup(path);
-}
-
-/* Check whether user is allowed to mount on the specified mount point. If it's
- OK then we change into that directory - this prevents race conditions */
-static int mount_ok(char *mount_point)
-{
- struct stat st;
-
- if (chdir(mount_point) != 0) {
- return -1;
- }
-
- if (stat(".", &st) != 0) {
- return -1;
- }
-
- if (!S_ISDIR(st.st_mode)) {
- errno = ENOTDIR;
- return -1;
- }
-
- if ((getuid() != 0) &&
- ((getuid() != st.st_uid) ||
- ((st.st_mode & S_IRWXU) != S_IRWXU))) {
- errno = EPERM;
- return -1;
- }
-
- return 0;
-}
-
-/* Tries to mount using the appropriate format. For 2.2 the struct,
- for 2.4 the ascii version. */
-static int
-do_mount(char *share_name, unsigned int flags, struct smb_mount_data *data)
-{
- char *opts;
- struct utsname uts;
- char *release, *major, *minor;
- char *data1, *data2;
- int ret;
- char *saveptr = NULL;
-
- if (asprintf(&opts,
- "version=7,uid=%d,gid=%d,file_mode=0%o,dir_mode=0%o,%s",
- mount_uid, mount_gid, data->file_mode,
- data->dir_mode,options) < 0) {
- return -1;
- }
-
- uname(&uts);
- release = uts.release;
- major = strtok_r(release, ".", &saveptr);
- minor = strtok_r(NULL, ".", &saveptr);
- if (major && minor && atoi(major) == 2 && atoi(minor) < 4) {
- /* < 2.4, assume struct */
- data1 = (char *) data;
- data2 = opts;
- } else {
- /* >= 2.4, assume ascii but fall back on struct */
- data1 = opts;
- data2 = (char *) data;
- }
-
- if (mount(share_name, ".", "smbfs", flags, data1) == 0) {
- SAFE_FREE(opts);
- return 0;
- }
- ret = mount(share_name, ".", "smbfs", flags, data2);
- SAFE_FREE(opts);
- return ret;
-}
-
- int main(int argc, char *argv[])
-{
- char *mount_point, *share_name = NULL;
- FILE *mtab;
- int fd;
- unsigned int flags;
- struct smb_mount_data data;
- struct mntent ment;
-
- memset(&data, 0, sizeof(struct smb_mount_data));
-
- if (argc < 2) {
- help();
- exit(1);
- }
-
- if (argv[1][0] == '-') {
- help();
- exit(1);
- }
-
- if (getuid() != 0) {
- user_mount = 1;
- }
-
- if (geteuid() != 0) {
- fprintf(stderr, "smbmnt must be installed suid root for direct
user mounts (%d,%d)\n", getuid(), geteuid());
- exit(1);
- }
-
- mount_uid = getuid();
- mount_gid = getgid();
- mount_fmask = umask(0);
- umask(mount_fmask);
- mount_fmask = ~mount_fmask;
-
- mount_point = fullpath(argv[1]);
-
- argv += 1;
- argc -= 1;
-
- if (mount_ok(mount_point) != 0) {
- fprintf(stderr, "cannot mount on %s: %s\n",
- mount_point, strerror(errno));
- exit(1);
- }
-
- data.version = SMB_MOUNT_VERSION;
-
- /* getuid() gives us the real uid, who may umount the fs */
- data.mounted_uid = getuid();
-
- if (parse_args(argc, argv, &data, &share_name) != 0) {
- help();
- return -1;
- }
-
- data.uid = mount_uid; /* truncates to 16-bits here!!! */
- data.gid = mount_gid;
- data.file_mode = (S_IRWXU|S_IRWXG|S_IRWXO) & mount_fmask;
- data.dir_mode = (S_IRWXU|S_IRWXG|S_IRWXO) & mount_dmask;
-
- if (mount_dmask == 0) {
- data.dir_mode = data.file_mode;
- if ((data.dir_mode & S_IRUSR) != 0)
- data.dir_mode |= S_IXUSR;
- if ((data.dir_mode & S_IRGRP) != 0)
- data.dir_mode |= S_IXGRP;
- if ((data.dir_mode & S_IROTH) != 0)
- data.dir_mode |= S_IXOTH;
- }
-
- flags = MS_MGC_VAL | MS_NOSUID | MS_NODEV;
-
- if (mount_ro) flags |= MS_RDONLY;
-
- if (do_mount(share_name, flags, &data) < 0) {
- switch (errno) {
- case ENODEV:
- fprintf(stderr, "ERROR: smbfs filesystem not supported
by the kernel\n");
- break;
- default:
- perror("mount error");
- }
- fprintf(stderr, "Please refer to the smbmnt(8) manual page\n");
- return -1;
- }
-
--
Samba Shared Repository