/*
* Mount helper utility for Linux CIFS VFS (virtual filesystem) client
* Copyright (C) 2003,2008 Steve French (sfrench@us.ibm.com)
* Copyright (C) 2008 Jeremy Allison (jra@samba.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <pwd.h>
#include <grp.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <getopt.h>
#include <errno.h>
#include <netdb.h>
#include <string.h>
#include <mntent.h>
#include <fcntl.h>
#include <limits.h>
#include <fstab.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include "mount.h"
#include "util.h"
#ifndef MS_MOVE
#define MS_MOVE 8192
#endif
#ifndef MS_BIND
#define MS_BIND 4096
#endif
/* private flags - clear these before passing to kernel */
#define MS_USERS 0x40000000
#define MS_USER 0x80000000
#define MAX_UNC_LEN 1024
/* I believe that the kernel limits options data to a page */
#define MAX_OPTIONS_LEN 4096
/* max length of mtab options */
#define MTAB_OPTIONS_LEN 220
/*
* Maximum length of "share" portion of a UNC. I have no idea if this is at
* all valid. According to MSDN, the typical max length of any component is
* 255, so