Ignore:
Timestamp:
May 27, 2009, 11:39:15 AM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Update 3.2 branch to 3.2.9

Location:
branches/samba-3.2.x/source/client
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.2.x/source/client/clitar.c

    r138 r233  
    15071507                                        if (strrchr_m(cliplist[i], '\\')) {
    15081508                                                char *p;
     1509                                                char saved_char;
    15091510                                                char *saved_dir = talloc_strdup(ctx,
    15101511                                                                        client_get_cur_dir());
     
    15251526                                                        return 1;
    15261527                                                }
     1528                                                /*
     1529                                                 * Strip off the last \\xxx
     1530                                                 * xxx element of tarmac to set
     1531                                                 * it as current directory.
     1532                                                 */
    15271533                                                p = strrchr_m(tarmac, '\\');
    15281534                                                if (!p) {
    15291535                                                        return 1;
    15301536                                                }
     1537                                                saved_char = p[1];
    15311538                                                p[1] = '\0';
     1539
    15321540                                                client_set_cur_dir(tarmac);
     1541
     1542                                                /*
     1543                                                 * Restore the character we
     1544                                                 * just replaced to
     1545                                                 * put the pathname
     1546                                                 * back as it was.
     1547                                                 */
     1548                                                p[1] = saved_char;
    15331549
    15341550                                                DEBUG(5, ("process_tar, do_list with tarmac: %s\n", tarmac));
  • branches/samba-3.2.x/source/client/mount.cifs.c

    r232 r233  
    8686const char *thisprogram;
    8787int verboseflag = 0;
     88int fakemnt = 0;
    8889static int got_password = 0;
    8990static int got_user = 0;
     
    485486                } else if (strncmp(data, "sec", 3) == 0) {
    486487                        if (value) {
    487                                 if (!strcmp(value, "none"))
     488                                if (!strncmp(value, "none", 4) ||
     489                                    !strncmp(value, "krb5", 4))
    488490                                        got_password = 1;
    489491                        }
     
    533535                                return 1;
    534536                        }
    535                 } else if ((strncmp(data, "domain", 3) == 0)
    536                            || (strncmp(data, "workgroup", 5) == 0)) {
     537                } else if ((strncmp(data, "dom" /* domain */, 3) == 0)
     538                           || (strncmp(data, "workg", 5) == 0)) {
     539                        /* note this allows for synonyms of "domain"
     540                           such as "DOM" and "dom" and "workgroup"
     541                           and "WORKGRP" etc. */
    537542                        if (!value || !*value) {
    538543                                printf("CIFS: invalid domain name\n");
     
    646651                        *filesys_flags &= ~MS_NOEXEC;
    647652                } else if (strncmp(data, "guest", 5) == 0) {
    648                         got_password=1;
     653                        user_name = (char *)calloc(1, 1);
     654                        got_user = 1;
     655                        got_password = 1;
    649656                } else if (strncmp(data, "ro", 2) == 0) {
    650657                        *filesys_flags |= MS_RDONLY;
     
    10271034        char * temp;
    10281035        char * dev_name;
    1029         int rc;
     1036        int rc = 0;
    10301037        int rsize = 0;
    10311038        int wsize = 0;
     
    10751082                mountpoint = argv[2];
    10761083        } else {
     1084                if ((strcmp (argv[1], "--version") == 0) ||
     1085                    ((strcmp (argv[1], "-V") == 0))) {
     1086                        printf ("mount.cifs version: %s.%s%s\n",
     1087                        MOUNT_CIFS_VERSION_MAJOR,
     1088                        MOUNT_CIFS_VERSION_MINOR,
     1089                        MOUNT_CIFS_VENDOR_SUFFIX);
     1090                        exit (0);
     1091                }
    10771092                mount_cifs_usage();
    10781093                exit(EX_USAGE);
     
    11001115                        exit(EX_USAGE);
    11011116                case 'n':
    1102                     ++nomtab;
    1103                     break;
     1117                        ++nomtab;
     1118                        break;
    11041119                case 'b':
    11051120#ifdef MS_BIND
     
    12051220                        break;
    12061221                case 't':
     1222                        break;
     1223                case 'f':
     1224                        ++fakemnt;
    12071225                        break;
    12081226                default:
     
    12831301
    12841302        if(got_user == 0) {
    1285                 user_name = getusername();
     1303                /* Note that the password will not be retrieved from the
     1304                   USER env variable (ie user%password form) as there is
     1305                   already a PASSWD environment varaible */
     1306                if (getenv("USER"))
     1307                        user_name = strdup(getenv("USER"));
     1308                if (user_name == NULL)
     1309                        user_name = getusername();
    12861310                got_user = 1;
    12871311        }
     
    14011425        }
    14021426
    1403         if (mount(dev_name, mountpoint, "cifs", flags, options)) {
     1427        if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) {
    14041428                switch (errno) {
    14051429                case ECONNREFUSED:
     
    14311455        }
    14321456
     1457        if (nomtab)
     1458                goto mount_exit;
    14331459        atexit(unlock_mtab);
    14341460        rc = lock_mtab();
  • branches/samba-3.2.x/source/client/umount.cifs.c

    r228 r233  
    3434#include <string.h>
    3535#include <mntent.h>
     36#include <limits.h>
    3637#include "mount.h"
    3738
     
    232233}
    233234
     235/* Make a canonical pathname from PATH.  Returns a freshly malloced string.
     236   It is up the *caller* to ensure that the PATH is sensible.  i.e.
     237   canonicalize ("/dev/fd0/.") returns "/dev/fd0" even though ``/dev/fd0/.''
     238   is not a legal pathname for ``/dev/fd0''  Anything we cannot parse
     239   we return unmodified.   */
     240static char *
     241canonicalize(char *path)
     242{
     243        char *canonical;
     244
     245        if (path == NULL) {
     246                return NULL;
     247        }
     248
     249        if (strlen(path) > PATH_MAX) {
     250                fprintf(stderr, "Mount point string too long\n");
     251                return NULL;
     252        }
     253
     254        canonical = (char *)malloc (PATH_MAX + 1);
     255
     256        if (!canonical) {
     257                fprintf(stderr, "Error! Not enough memory!\n");
     258                return NULL;
     259        }
     260
     261        if (realpath (path, canonical))
     262                return canonical;
     263
     264        strncpy (canonical, path, PATH_MAX);
     265        canonical[PATH_MAX] = '\0';
     266        return canonical;
     267}
     268
    234269int main(int argc, char ** argv)
    235270{
     
    305340        argc -= optind;
    306341
    307         mountpoint = argv[0];
     342        mountpoint = canonicalize(argv[0]);
    308343
    309344        if((argc < 1) || (argv[0] == NULL)) {
Note: See TracChangeset for help on using the changeset viewer.