[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1873-ga2e72ac

Andrew Bartlett abartlet at samba.org
Fri May 29 01:57:21 GMT 2009


The branch, master has been updated
       via  a2e72ac5562d69fa40c7389a9d9d7e6551e39b41 (commit)
       via  a3f619f9d9f0e6425c453a9e8dc97794e74c4a42 (commit)
       via  98ff29291b26abe35efc6cc2552b9e49c4330983 (commit)
       via  10f076a77de87c036a083533cb34d65eb5f7044a (commit)
       via  e8ea854f0262ea2a1449695a0c70bea40bfbb872 (commit)
       via  37e09f26dc8acc47d4ea201923b05c24610d0060 (commit)
      from  340c690d1731fe638bd6afe1fe38c7a7977b9687 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a2e72ac5562d69fa40c7389a9d9d7e6551e39b41
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri May 29 08:35:59 2009 +1000

    s4:torture Don't run QueryDisplayInfo test for SAMR-USERS-PRIVILEGES

commit a3f619f9d9f0e6425c453a9e8dc97794e74c4a42
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Fri May 29 08:35:41 2009 +1000

    s4:torture Clean up users and groups added in RPC-SAMR-LARGE-DC

commit 98ff29291b26abe35efc6cc2552b9e49c4330983
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu May 28 14:49:29 2009 +1000

    s4:torture Half the repeditive tests run by RPC-SAMR-PASSWORDS-PWDLASTSET

commit 10f076a77de87c036a083533cb34d65eb5f7044a
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu May 28 14:13:11 2009 +1000

    Explicitly list RPC-SAMR-PASSWORDS-PWDLASTSET and RPC-SAMR-USERS-PRIVILAGES as slow

commit e8ea854f0262ea2a1449695a0c70bea40bfbb872
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu May 28 11:44:44 2009 +1000

    s4:client Match Samba3 and remove smbmount from the distribution

commit 37e09f26dc8acc47d4ea201923b05c24610d0060
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu May 28 10:42:28 2009 +1000

    s4:torture Make the RPC-SAMR-PWDLASTET more efficient
    
    By using SamLogonEx we avoid setting up the credentials chain for each
    request.
    
    (Needs to be pushed further up the stack, to only connect to NETLOGON once).
    
    Andrew Bartlett

-----------------------------------------------------------------------

Summary of changes:
 source4/client/smbmnt.c    |  306 --------------
 source4/client/smbmount.c  |  942 --------------------------------------------
 source4/client/smbumount.c |  186 ---------
 source4/selftest/tests.sh  |    2 +-
 source4/torture/rpc/samr.c |  156 +++++---
 5 files changed, 94 insertions(+), 1498 deletions(-)
 delete mode 100644 source4/client/smbmnt.c
 delete mode 100644 source4/client/smbmount.c
 delete mode 100644 source4/client/smbumount.c


Changeset truncated at 500 lines:

diff --git a/source4/client/smbmnt.c b/source4/client/smbmnt.c
deleted file mode 100644
index 0d619a8..0000000
--- a/source4/client/smbmnt.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- *  smbmnt.c
- *
- *  Copyright (C) 1995-1998 by Paal-Kr. Engstad and Volker Lendecke
- *  extensively modified by Tridge
- *
- */
-
-#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 uint_t mount_fmask;
-static uint_t 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",VERSION);
-        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[MAXPATHLEN];
-
-	if (strlen(p) > MAXPATHLEN-1) {
-		return NULL;
-	}
-
-        if (realpath(p, path) == NULL) {
-		fprintf(stderr,"Failed to find real path for mount point\n");
-		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, uint_t flags, struct smb_mount_data *data)
-{
-	pstring opts;
-	struct utsname uts;
-	char *release, *major, *minor;
-	char *data1, *data2;
-
-	uname(&uts);
-	release = uts.release;
-	major = strtok(release, ".");
-	minor = strtok(NULL, ".");
-	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;
-	}
-
-	slprintf(opts, sizeof(opts)-1,
-		 "version=7,uid=%d,gid=%d,file_mode=0%o,dir_mode=0%o,%s",
-		 data->uid, data->gid, data->file_mode, data->dir_mode,options);
-	if (mount(share_name, ".", "smbfs", flags, data1) == 0)
-		return 0;
-	return mount(share_name, ".", "smbfs", flags, data2);
-}
-
- int main(int argc, char *argv[])
-{
-	char *mount_point, *share_name = NULL;
-	FILE *mtab;
-	int fd;
-	uint_t 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;
-        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;
-
-	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;
-	}
-
-        ment.mnt_fsname = share_name ? share_name : "none";
-        ment.mnt_dir = mount_point;
-        ment.mnt_type = "smbfs";
-        ment.mnt_opts = "";
-        ment.mnt_freq = 0;
-        ment.mnt_passno= 0;
-
-        mount_point = ment.mnt_dir;
-
-	if (mount_point == NULL)
-	{
-		fprintf(stderr, "Mount point too long\n");
-		return -1;
-	}
-	
-        if ((fd = open(MOUNTED"~", O_RDWR|O_CREAT|O_EXCL, 0600)) == -1)
-        {
-                fprintf(stderr, "Can't get "MOUNTED"~ lock file");
-                return 1;
-        }
-        close(fd);
-	
-        if ((mtab = setmntent(MOUNTED, "a+")) == NULL)
-        {
-                fprintf(stderr, "Can't open " MOUNTED);
-                return 1;
-        }
-
-        if (addmntent(mtab, &ment) == 1)
-        {
-                fprintf(stderr, "Can't write mount entry");
-                return 1;
-        }
-        if (fchmod(fileno(mtab), 0644) == -1)
-        {
-                fprintf(stderr, "Can't set perms on "MOUNTED);
-                return 1;
-        }
-        endmntent(mtab);
-
-        if (unlink(MOUNTED"~") == -1)
-        {
-                fprintf(stderr, "Can't remove "MOUNTED"~");
-                return 1;
-        }
-
-	return 0;
-}	
diff --git a/source4/client/smbmount.c b/source4/client/smbmount.c
deleted file mode 100644
index c219a42..0000000
--- a/source4/client/smbmount.c
+++ /dev/null
@@ -1,942 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   SMBFS mount program
-   Copyright (C) Andrew Tridgell 1999
-   
-   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/>.
-*/
-
-#include "includes.h"
-#include "system/passwd.h"
-
-#include <mntent.h>
-#include <asm/types.h>
-#include <linux/smb_fs.h>
-
-#define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
-#define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
-
-static pstring credentials;
-static pstring my_netbios_name;
-static pstring password;
-static pstring username;
-static pstring workgroup;
-static pstring mpoint;
-static pstring service;
-static pstring options;
-
-static struct in_addr dest_ip;
-static bool have_ip;
-static int smb_port = 0;
-static bool got_user;
-static bool got_pass;
-static uid_t mount_uid;
-static gid_t mount_gid;
-static int mount_ro;
-static uint_t mount_fmask;
-static uint_t mount_dmask;
-static bool use_kerberos;
-/* TODO: Add code to detect smbfs version in kernel */
-static bool status32_smbfs = false;
-
-static void usage(void);
-
-static void exit_parent(int sig)
-{
-	/* parent simply exits when child says go... */
-	exit(0);
-}
-
-static void daemonize(void)
-{
-	int j, status;
-	pid_t child_pid;
-
-	signal( SIGTERM, exit_parent );
-
-	if ((child_pid = sys_fork()) < 0) {
-		DEBUG(0,("could not fork\n"));
-	}
-
-	if (child_pid > 0) {
-		while( 1 ) {
-			j = waitpid( child_pid, &status, 0 );
-			if( j < 0 ) {
-				if( EINTR == errno ) {
-					continue;
-				}
-				status = errno;
-			}
-			break;
-		}
-
-		/* If we get here - the child exited with some error status */
-		if (WIFSIGNALED(status))
-			exit(128 + WTERMSIG(status));
-		else
-			exit(WEXITSTATUS(status));
-	}
-
-	signal( SIGTERM, SIG_DFL );
-	chdir("/");
-}
-
-static void close_our_files(int client_fd)
-{
-	int i;
-	struct rlimit limits;
-
-	getrlimit(RLIMIT_NOFILE,&limits);
-	for (i = 0; i< limits.rlim_max; i++) {
-		if (i == client_fd)
-			continue;
-		close(i);
-	}
-}
-
-static void usr1_handler(int x)
-{
-	return;
-}
-
-
-/***************************************************** 
-return a connection to a server
-*******************************************************/
-static struct smbcli_state *do_connection(const char *the_service, bool unicode, int maxprotocol,
-					  struct smbcli_session_options session_options)
-{
-	struct smbcli_state *c;
-	struct nmb_name called, calling;
-	char *server_n;
-	struct in_addr ip;
-	pstring server;
-	char *share;
-
-	if (the_service[0] != '\\' || the_service[1] != '\\') {
-		usage();
-		exit(1);
-	}
-
-	pstrcpy(server, the_service+2);
-	share = strchr_m(server,'\\');
-	if (!share) {
-		usage();
-		exit(1);
-	}
-	*share = 0;
-	share++;
-
-	server_n = server;
-
-	make_nmb_name(&calling, my_netbios_name, 0x0);
-	choose_called_name(&called, server, 0x20);
-
- again:
-        zero_ip(&ip);
-	if (have_ip) ip = dest_ip;
-
-	/* have to open a new connection */
-	if (!(c=smbcli_initialise(NULL)) || (smbcli_set_port(c, smb_port) != smb_port) ||
-	    !smbcli_connect(c, server_n, &ip)) {
-		DEBUG(0,("%d: Connection to %s failed\n", sys_getpid(), server_n));
-		if (c) {
-			talloc_free(c);
-		}
-		return NULL;
-	}
-
-	/* SPNEGO doesn't work till we get NTSTATUS error support */
-	/* But it is REQUIRED for kerberos authentication */
-	if(!use_kerberos) c->use_spnego = false;
-
-	/* The kernel doesn't yet know how to sign it's packets */
-	c->sign_info.allow_smb_signing = false;
-
-	/* Use kerberos authentication if specified */
-	c->use_kerberos = use_kerberos;
-
-	if (!smbcli_session_request(c, &calling, &called)) {
-		char *p;
-		DEBUG(0,("%d: session request to %s failed (%s)\n", 
-			 sys_getpid(), called.name, smbcli_errstr(c)));
-		talloc_free(c);
-		if ((p=strchr_m(called.name, '.'))) {
-			*p = 0;
-			goto again;
-		}
-		if (strcmp(called.name, "*SMBSERVER")) {
-			make_nmb_name(&called , "*SMBSERVER", 0x20);
-			goto again;
-		}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list