Changeset 233 for branches/samba-3.2.x/source/client
- Timestamp:
- May 27, 2009, 11:39:15 AM (16 years ago)
- 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 1507 1507 if (strrchr_m(cliplist[i], '\\')) { 1508 1508 char *p; 1509 char saved_char; 1509 1510 char *saved_dir = talloc_strdup(ctx, 1510 1511 client_get_cur_dir()); … … 1525 1526 return 1; 1526 1527 } 1528 /* 1529 * Strip off the last \\xxx 1530 * xxx element of tarmac to set 1531 * it as current directory. 1532 */ 1527 1533 p = strrchr_m(tarmac, '\\'); 1528 1534 if (!p) { 1529 1535 return 1; 1530 1536 } 1537 saved_char = p[1]; 1531 1538 p[1] = '\0'; 1539 1532 1540 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; 1533 1549 1534 1550 DEBUG(5, ("process_tar, do_list with tarmac: %s\n", tarmac)); -
branches/samba-3.2.x/source/client/mount.cifs.c
r232 r233 86 86 const char *thisprogram; 87 87 int verboseflag = 0; 88 int fakemnt = 0; 88 89 static int got_password = 0; 89 90 static int got_user = 0; … … 485 486 } else if (strncmp(data, "sec", 3) == 0) { 486 487 if (value) { 487 if (!strcmp(value, "none")) 488 if (!strncmp(value, "none", 4) || 489 !strncmp(value, "krb5", 4)) 488 490 got_password = 1; 489 491 } … … 533 535 return 1; 534 536 } 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. */ 537 542 if (!value || !*value) { 538 543 printf("CIFS: invalid domain name\n"); … … 646 651 *filesys_flags &= ~MS_NOEXEC; 647 652 } 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; 649 656 } else if (strncmp(data, "ro", 2) == 0) { 650 657 *filesys_flags |= MS_RDONLY; … … 1027 1034 char * temp; 1028 1035 char * dev_name; 1029 int rc ;1036 int rc = 0; 1030 1037 int rsize = 0; 1031 1038 int wsize = 0; … … 1075 1082 mountpoint = argv[2]; 1076 1083 } 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 } 1077 1092 mount_cifs_usage(); 1078 1093 exit(EX_USAGE); … … 1100 1115 exit(EX_USAGE); 1101 1116 case 'n': 1102 1103 1117 ++nomtab; 1118 break; 1104 1119 case 'b': 1105 1120 #ifdef MS_BIND … … 1205 1220 break; 1206 1221 case 't': 1222 break; 1223 case 'f': 1224 ++fakemnt; 1207 1225 break; 1208 1226 default: … … 1283 1301 1284 1302 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(); 1286 1310 got_user = 1; 1287 1311 } … … 1401 1425 } 1402 1426 1403 if ( mount(dev_name, mountpoint, "cifs", flags, options)) {1427 if (!fakemnt && mount(dev_name, mountpoint, "cifs", flags, options)) { 1404 1428 switch (errno) { 1405 1429 case ECONNREFUSED: … … 1431 1455 } 1432 1456 1457 if (nomtab) 1458 goto mount_exit; 1433 1459 atexit(unlock_mtab); 1434 1460 rc = lock_mtab(); -
branches/samba-3.2.x/source/client/umount.cifs.c
r228 r233 34 34 #include <string.h> 35 35 #include <mntent.h> 36 #include <limits.h> 36 37 #include "mount.h" 37 38 … … 232 233 } 233 234 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. */ 240 static char * 241 canonicalize(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 234 269 int main(int argc, char ** argv) 235 270 { … … 305 340 argc -= optind; 306 341 307 mountpoint = argv[0];342 mountpoint = canonicalize(argv[0]); 308 343 309 344 if((argc < 1) || (argv[0] == NULL)) {
Note:
See TracChangeset
for help on using the changeset viewer.