1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-05 21:57:51 +03:00

Sync up client/mount.cifs.c with v3-2-test.

Jeremy.
This commit is contained in:
Jeremy Allison 2008-04-25 09:29:11 -07:00
parent 4dd00987be
commit 7a724d78e1

View File

@ -160,9 +160,6 @@ static void mount_cifs_usage(void)
printf("\nTo display the version number of the mount helper:"); printf("\nTo display the version number of the mount helper:");
printf("\n\t%s -V\n",thisprogram); printf("\n\t%s -V\n",thisprogram);
if(mountpassword) {
memset(mountpassword,0,MOUNT_PASSWD_SIZE);
}
SAFE_FREE(mountpassword); SAFE_FREE(mountpassword);
exit(1); exit(1);
} }
@ -222,9 +219,6 @@ static int open_cred_file(char * file_name)
if(length > 4086) { if(length > 4086) {
printf("mount.cifs failed due to malformed username in credentials file"); printf("mount.cifs failed due to malformed username in credentials file");
memset(line_buf,0,4096); memset(line_buf,0,4096);
if(mountpassword) {
memset(mountpassword,0,MOUNT_PASSWD_SIZE);
}
exit(1); exit(1);
} else { } else {
got_user = 1; got_user = 1;
@ -291,9 +285,6 @@ static int open_cred_file(char * file_name)
} }
fclose(fs); fclose(fs);
if(line_buf) {
memset(line_buf,0,4096);
}
SAFE_FREE(line_buf); SAFE_FREE(line_buf);
return 0; return 0;
} }
@ -328,7 +319,6 @@ static int get_password_from_file(int file_descript, char * filename)
rc = read(file_descript,&c,1); rc = read(file_descript,&c,1);
if(rc < 0) { if(rc < 0) {
printf("mount.cifs failed. Error %s reading password file\n",strerror(errno)); printf("mount.cifs failed. Error %s reading password file\n",strerror(errno));
memset(mountpassword,0,MOUNT_PASSWD_SIZE);
if(filename != NULL) if(filename != NULL)
close(file_descript); close(file_descript);
exit(1); exit(1);
@ -526,7 +516,7 @@ static int parse_options(char ** optionsp, int * filesys_flags)
printf("CIFS: invalid domain name\n"); printf("CIFS: invalid domain name\n");
return 1; /* needs_arg; */ return 1; /* needs_arg; */
} }
if (strnlen(value, 65) < 65) { if (strnlen(value, DOMAIN_SIZE+1) < DOMAIN_SIZE+1) {
got_domain = 1; got_domain = 1;
} else { } else {
printf("domain name too long\n"); printf("domain name too long\n");
@ -1119,9 +1109,6 @@ int main(int argc, char ** argv)
MOUNT_CIFS_VERSION_MAJOR, MOUNT_CIFS_VERSION_MAJOR,
MOUNT_CIFS_VERSION_MINOR, MOUNT_CIFS_VERSION_MINOR,
MOUNT_CIFS_VENDOR_SUFFIX); MOUNT_CIFS_VENDOR_SUFFIX);
if(mountpassword) {
memset(mountpassword,0,MOUNT_PASSWD_SIZE);
}
exit (0); exit (0);
case 'w': case 'w':
flags &= ~MS_RDONLY; flags &= ~MS_RDONLY;
@ -1209,7 +1196,7 @@ int main(int argc, char ** argv)
if(mountpassword == NULL) if(mountpassword == NULL)
mountpassword = (char *)calloc(MOUNT_PASSWD_SIZE+1,1); mountpassword = (char *)calloc(MOUNT_PASSWD_SIZE+1,1);
if(mountpassword) { if(mountpassword) {
strlcpy(mountpassword,getenv("PASSWD"),MOUNT_PASSWD_SIZE); strlcpy(mountpassword,getenv("PASSWD"),MOUNT_PASSWD_SIZE+1);
got_password = 1; got_password = 1;
} }
} else if (getenv("PASSWD_FD")) { } else if (getenv("PASSWD_FD")) {
@ -1442,16 +1429,8 @@ mount_exit:
SAFE_FREE(mountpassword); SAFE_FREE(mountpassword);
} }
if(options) { SAFE_FREE(options);
memset(options,0,optlen); SAFE_FREE(orgoptions);
SAFE_FREE(options);
}
if(orgoptions) {
memset(orgoptions,0,orgoptlen);
SAFE_FREE(orgoptions);
}
SAFE_FREE(resolved_path); SAFE_FREE(resolved_path);
SAFE_FREE(share_name); SAFE_FREE(share_name);
return rc; return rc;