summaryrefslogtreecommitdiffstats
path: root/source/client/mount.cifs.c
diff options
context:
space:
mode:
authorSteve French <sfrench@samba.org>2004-04-06 12:57:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:51:07 -0500
commit69861f168c6be90b4e7f47e29006b2d60d442ffd (patch)
tree319bc1bebd6b3c211206bc47d2334dbd956898a5 /source/client/mount.cifs.c
parent738666ce0a310fae14476020fd6dac027b0e3ec5 (diff)
downloadsamba-69861f168c6be90b4e7f47e29006b2d60d442ffd.tar.gz
samba-69861f168c6be90b4e7f47e29006b2d60d442ffd.tar.xz
samba-69861f168c6be90b4e7f47e29006b2d60d442ffd.zip
r77: Fix path canonicalization of the mount target path and help text display in the cifs mount helper
Diffstat (limited to 'source/client/mount.cifs.c')
-rwxr-xr-xsource/client/mount.cifs.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/source/client/mount.cifs.c b/source/client/mount.cifs.c
index c31a9d66b34..29689243b2d 100755
--- a/source/client/mount.cifs.c
+++ b/source/client/mount.cifs.c
@@ -74,7 +74,13 @@ static void mount_cifs_usage(void)
{
printf("\nUsage: %s <remotetarget> <dir> -o <options>\n", thisprogram);
printf("\nMount the remote target, specified as a UNC name,");
- printf(" to a local directory.\n");
+ printf(" to a local directory.\n\nOptions:\n");
+ printf("\tuser=<arg>\n\tpass=<arg>\n\tdom=<arg>\n");
+ printf("\nOther less commonly used options are described in the manual page");
+ printf("\n\tman 8 mount.cifs\n");
+ printf("\nTo display the version number of the mount helper:");
+ printf("\n\t%s -V\n",thisprogram);
+
if(mountpassword) {
memset(mountpassword,0,64);
free(mountpassword);
@@ -95,7 +101,7 @@ static char * getusername(void) {
char * parse_cifs_url(char * unc_name)
{
- printf("\ncifs url %s\n",unc_name);
+ printf("\nMounting cifs URL not implemented yet. Attempt to mount %s\n",unc_name);
return NULL;
}
@@ -590,6 +596,7 @@ int main(int argc, char ** argv)
char * uuid = NULL;
char * mountpoint;
char * options;
+ char * resolved_path;
char * temp;
int rc;
int rsize = 0;
@@ -730,13 +737,22 @@ int main(int argc, char ** argv)
}
ipaddr = parse_server(share_name);
+
+ if(ipaddr == NULL)
+ return -1;
if (orgoptions && parse_options(orgoptions, &flags))
- return 1;
+ return -1;
/* BB save off path and pop after mount returns? */
- /* BB canonicalize the path in argv[1]? */
-
+ resolved_path = malloc(PATH_MAX+1);
+ if(resolved_path) {
+ /* Note that if we can not canonicalize the name, we get
+ another chance to see if it is valid when we chdir to it */
+ if (realpath(mountpoint, resolved_path)) {
+ mountpoint = resolved_path;
+ }
+ }
if(chdir(mountpoint)) {
printf("mount error: can not change directory into mount target %s\n",mountpoint);
return -1;
@@ -890,6 +906,10 @@ int main(int argc, char ** argv)
memset(orgoptions,0,orgoptlen);
free(orgoptions);
}
+ if(resolved_path) {
+ free(resolved_path);
+ }
+
return 0;
}