#include <stdio.h>
#include <unistd.h>
#include <pwd.h>
+#include <ctype.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <fcntl.h>
#define MOUNT_CIFS_VERSION_MAJOR "1"
-#define MOUNT_CIFS_VERSION_MINOR "5"
+#define MOUNT_CIFS_VERSION_MINOR "6"
#ifndef MOUNT_CIFS_VENDOR_SUFFIX
#define MOUNT_CIFS_VENDOR_SUFFIX ""
int gid = 0;
int optlen = 0;
int orgoptlen = 0;
+ int retry = 0; /* set when we have to retry mount with uppercase */
struct stat statbuf;
struct utsname sysinfo;
struct mntent mountent;
}
/* FIXME launch daemon (handles dfs name resolution and credential change)
remember to clear parms and overwrite password field before launching */
+mount_retry:
if(orgoptions) {
optlen = strlen(orgoptions);
orgoptlen = optlen;
printf("\nmount.cifs kernel mount options %s \n",options);
if(mount(share_name, mountpoint, "cifs", flags, options)) {
/* remember to kill daemon on error */
+ char * tmp;
+
switch (errno) {
case 0:
printf("mount failed but no error number set\n");
case ENODEV:
printf("mount error: cifs filesystem not supported by the system\n");
break;
+ case ENXIO:
+ if(retry == 0) {
+ retry = 1;
+ tmp = share_name;
+ while (*tmp && !(((unsigned char)tmp[0]) & 0x80)) {
+ *tmp = toupper((unsigned char)*tmp);
+ tmp++;
+ }
+ if(!*tmp) {
+ printf("retrying with upper case share name\n");
+ goto mount_retry;
+ }
+ }
default:
+
printf("mount error %d = %s\n",errno,strerror(errno));
}
printf("Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)\n");