Ignore:
Timestamp:
May 23, 2008, 6:56:41 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.29

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/client/mount.cifs.c

    r124 r134  
    11/*
    22   Mount helper utility for Linux CIFS VFS (virtual filesystem) client
    3    Copyright (C) 2003,2005 Steve French  (sfrench@us.ibm.com)
     3   Copyright (C) 2003,2008 Steve French  (sfrench@us.ibm.com)
    44
    55   This program is free software; you can redistribute it and/or modify
     
    3939#include <mntent.h>
    4040#include <fcntl.h>
     41#include <limits.h>
    4142
    4243#define MOUNT_CIFS_VERSION_MAJOR "1"
     
    153154                memset(mountpassword,0,64);
    154155                free(mountpassword);
     156                mountpassword = NULL;
    155157        }
    156158        exit(1);
     
    290292                memset(line_buf,0,4096);
    291293                free(line_buf);
     294                line_buf = NULL;
    292295        }
    293296        return 0;
     
    12261229       
    12271230        if(got_password == 0) {
    1228                 mountpassword = getpass("Password: "); /* BB obsolete */
     1231                char *tmp_pass;
     1232                tmp_pass = getpass("Password: "); /* BB obsolete sys call but
     1233                                                     no good replacement yet */
     1234                mountpassword = (char *)calloc(65,1);
     1235                if (!tmp_pass || !mountpassword) {
     1236                        printf("Password not entered, exiting.\n");
     1237                        return -1;
     1238                }
     1239                strncpy(mountpassword, tmp_pass, 64);
     1240                                                 
    12291241                got_password = 1;
    12301242        }
     
    12501262        if(mountpassword)
    12511263                optlen += strlen(mountpassword) + 6;
    1252         if(options)
     1264        if(options) {
    12531265                free(options);
     1266                options = NULL;
     1267        }
    12541268        options_size = optlen + 10 + 64;
    12551269        options = (char *)malloc(options_size /* space for commas in password */ + 8 /* space for domain=  , domain name itself was counted as part of the length username string above */);
     
    13751389                        rc = addmntent(pmntfile,&mountent);
    13761390                        endmntent(pmntfile);
    1377                         if(mountent.mnt_opts)
     1391                        if(mountent.mnt_opts) {
    13781392                                free(mountent.mnt_opts);
     1393                                mountent.mnt_opts = NULL;
     1394                        }
    13791395                } else {
    13801396                    printf("could not update mount table\n");
     
    13871403                memset(mountpassword,0,len);
    13881404                free(mountpassword);
     1405                mountpassword = NULL;
    13891406        }
    13901407
     
    13921409                memset(options,0,optlen);
    13931410                free(options);
     1411                options = NULL;
    13941412        }
    13951413
     
    13971415                memset(orgoptions,0,orgoptlen);
    13981416                free(orgoptions);
     1417                orgoptions = NULL;
    13991418        }
    14001419        if(resolved_path) {
    14011420                free(resolved_path);
     1421                resolved_path = NULL;
    14021422        }
    14031423
    14041424        if(free_share_name) {
    14051425                free(share_name);
     1426                share_name = NULL;
    14061427                }
    14071428        return rc;
Note: See TracChangeset for help on using the changeset viewer.