#include <fcntl.h>
#define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "7"
+#define MOUNT_CIFS_VERSION_MINOR "8"
#ifndef MOUNT_CIFS_VENDOR_SUFFIX
#define MOUNT_CIFS_VENDOR_SUFFIX ""
static int free_share_name = 0;
static char * user_name = NULL;
static char * mountpassword = NULL;
-static char * domain_name = NULL;
+char * domain_name = NULL;
/* BB finish BB
printf(" to a local directory.\n\nOptions:\n");
printf("\tuser=<arg>\n\tpass=<arg>\n\tdom=<arg>\n");
printf("\nLess commonly used options:");
- printf("\n\tcredentials=<filename>,guest,perm,noperm,setuids,nosetuids,\n\trw,ro,sep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec,directio");
- printf("\n\nOptions not needed for servers supporting CIFS Unix extensions (e.g. most Samba versions):");
+ printf("\n\tcredentials=<filename>,guest,perm,noperm,setuids,nosetuids,rw,ro,\n\tsep=<char>,iocharset=<codepage>,suid,nosuid,exec,noexec,serverino,\n\tdirectio,mapchars,nomapchars");
+ printf("\n\nOptions not needed for servers supporting CIFS Unix extensions\n\t(e.g. most Samba versions):");
printf("\n\tuid=<uid>,gid=<gid>,dir_mode=<mode>,file_mode=<mode>");
printf("\n\nRarely used options:");
- printf("\n\tport=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,dev,nodev");
+ printf("\n\tport=<tcpport>,rsize=<size>,wsize=<size>,unc=<unc_name>,ip=<ip_address>,\n\tdev,nodev,nouser_xattr,netbiosname,hard,soft,intr,nointr,noacl");
printf("\n\nOptions are described in more detail in the manual page");
printf("\n\tman 8 mount.cifs\n");
printf("\nTo display the version number of the mount helper:");
} else
memset(mountpassword,0,64);
if(mountpassword) {
- /* BB add handling for commas in password here */
strncpy(mountpassword,temp_val,length);
got_password = 1;
}
}
}
- }
+ } else if (strncasecmp("domain",line_buf+i,6) == 0) {
+ temp_val = strchr(line_buf+i,'=');
+ if(temp_val) {
+ /* go past equals sign */
+ temp_val++;
+ if(verboseflag)
+ printf("\nDomain %s\n",temp_val);
+ for(length = 0;length<65;length++) {
+ if(temp_val[length] == '\n')
+ break;
+ }
+ if(length > 64) {
+ printf("mount.cifs failed: domain in credentials file too long\n");
+ if(mountpassword) {
+ memset(mountpassword,0,64);
+ }
+ exit(1);
+ } else {
+ if(domain_name == NULL) {
+ domain_name = calloc(65,1);
+ } else
+ memset(domain_name,0,64);
+ if(domain_name) {
+ strncpy(domain_name,temp_val,length);
+ got_domain = 1;
+ }
+ }
+ }
+ }
+
}
fclose(fs);
if(line_buf) {
*filesys_flags |= MS_RDONLY;
} else if (strncmp(data, "rw", 2) == 0) {
*filesys_flags &= ~MS_RDONLY;
+ } else if (strncmp(data, "remount", 7) == 0) {
+ *filesys_flags |= MS_REMOUNT;
} /* else if (strnicmp(data, "port", 4) == 0) {
if (value && *value) {
vol->port =
/* move_string(*ppuser, usernm+1) */
len = strlen(usernm+1);
- printf("\nlen %d original_len %d\n",len, original_len);
if(len >= original_len) {
/* should not happen */
int length = strnlen(unc_name,1024);
char * share;
char * ipaddress_string = NULL;
- struct hostent * host_entry;
+ struct hostent * host_entry = NULL;
struct in_addr server_ipaddr;
int rc;
int flags = MS_MANDLOCK; /* no need to set legacy MS_MGC_VAL */
char * orgoptions = NULL;
char * share_name = NULL;
- char * domain_name = NULL;
char * ipaddr = NULL;
char * uuid = NULL;
char * mountpoint;
break;
case 'd':
domain_name = optarg; /* BB fix this - currently ignored */
+ got_domain = 1;
break;
case 'p':
if(mountpassword == NULL)
if (orgoptions && parse_options(orgoptions, &flags))
return -1;
-
ipaddr = parse_server(&share_name);
if((ipaddr == NULL) && (got_ip == 0)) {
printf("No ip address specified and hostname not found\n");
return -1;
}
-
/* BB save off path and pop after mount returns? */
resolved_path = malloc(PATH_MAX+1);
if(resolved_path) {
if(user_name) {
/* check for syntax like user=domain\user */
- domain_name = check_for_domain(&user_name);
+ if(got_domain == 0)
+ domain_name = check_for_domain(&user_name);
strncat(options,",user=",6);
strcat(options,user_name);
- }
- if(retry == 0)
+ }
+ if(retry == 0) {
if(domain_name) {
/* extra length accounted for in option string above */
strncat(options,",domain=",8);
strcat(options,domain_name);
}
+ }
if(mountpassword) {
/* Commas have to be doubled, or else they will
look like the parameter separator */