Changeset 134 for branches/samba-3.0/source/client/mount.cifs.c
- Timestamp:
- May 23, 2008, 6:56:41 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/client/mount.cifs.c
r124 r134 1 1 /* 2 2 Mount helper utility for Linux CIFS VFS (virtual filesystem) client 3 Copyright (C) 2003,200 5Steve French (sfrench@us.ibm.com)3 Copyright (C) 2003,2008 Steve French (sfrench@us.ibm.com) 4 4 5 5 This program is free software; you can redistribute it and/or modify … … 39 39 #include <mntent.h> 40 40 #include <fcntl.h> 41 #include <limits.h> 41 42 42 43 #define MOUNT_CIFS_VERSION_MAJOR "1" … … 153 154 memset(mountpassword,0,64); 154 155 free(mountpassword); 156 mountpassword = NULL; 155 157 } 156 158 exit(1); … … 290 292 memset(line_buf,0,4096); 291 293 free(line_buf); 294 line_buf = NULL; 292 295 } 293 296 return 0; … … 1226 1229 1227 1230 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 1229 1241 got_password = 1; 1230 1242 } … … 1250 1262 if(mountpassword) 1251 1263 optlen += strlen(mountpassword) + 6; 1252 if(options) 1264 if(options) { 1253 1265 free(options); 1266 options = NULL; 1267 } 1254 1268 options_size = optlen + 10 + 64; 1255 1269 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 */); … … 1375 1389 rc = addmntent(pmntfile,&mountent); 1376 1390 endmntent(pmntfile); 1377 if(mountent.mnt_opts) 1391 if(mountent.mnt_opts) { 1378 1392 free(mountent.mnt_opts); 1393 mountent.mnt_opts = NULL; 1394 } 1379 1395 } else { 1380 1396 printf("could not update mount table\n"); … … 1387 1403 memset(mountpassword,0,len); 1388 1404 free(mountpassword); 1405 mountpassword = NULL; 1389 1406 } 1390 1407 … … 1392 1409 memset(options,0,optlen); 1393 1410 free(options); 1411 options = NULL; 1394 1412 } 1395 1413 … … 1397 1415 memset(orgoptions,0,orgoptlen); 1398 1416 free(orgoptions); 1417 orgoptions = NULL; 1399 1418 } 1400 1419 if(resolved_path) { 1401 1420 free(resolved_path); 1421 resolved_path = NULL; 1402 1422 } 1403 1423 1404 1424 if(free_share_name) { 1405 1425 free(share_name); 1426 share_name = NULL; 1406 1427 } 1407 1428 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.