MOUNT_WEBDAV(8)

NAME
mount_webdav - mount a WebDAV filesystem

SYNOPSIS
mount_webdav [-a<fd>] [-o options] host[:port][/path] node

DESCRIPTION
The mount_webdav command mounts a WebDAV-enabled server directory at host[:port][/path] at the mount point indicated by node.

The user and group IDs for all files and directories are set to unknown, and the permissions default to read, write and execute for user, group and other.

The arguments and options are:

-a<fd>
    A file descriptor which identifies a file containing the username and the password. mount_webdav reads the username and password from the file, zeros the file's contents, and then closes the file. mount_webdav does not delete the file after closing it, so the file should be unlinked before passing it to mount_webdav. See the FILES section of this man page for more details.

-o  Options passed to mount(2) are specified with the -o option followed by a comma separated string of options. See the mount(8) man page for possible options and their meanings. If connecting to a Class 1 compliant WebDAV server, the rdonly option will be set even if it was not specified because mount_webdav will not allow files to be opened with write access on servers which do not support the DAV LOCK method.

host[:port][/path]
    The WebDAV-enabled server directory to mount as a volume. If port is not specified, then port 80 is used. If path is not specified, then the path "/" is used.

node
    Path to mount point.

EXAMPLES
The following example illustrates how to mount the WebDAV-enabled server directory idisk.mac.com/membername/ at the mount point /Volumes/mntpnt/

    mount_webdav idisk.mac.com/membername/ /Volumes/mntpnt/

FILES
The username/password file passed to the mount_webdav command as the -a<fd> option has the following format:

    u_int32_t   length of username
    char[]      username
    u_int32_t   length of password
    char[]      password

The -a<fd> option string is created with code similar to this:

    #define WEBDAV_TEMPLATE "/tmp/webdav.XXXXXX"
    int ok;
    int fd;
    u_int32_t length;
    char fd_str[20];
    char template[sizeof(WEBDAV_TEMPLATE)+1];
    ok = 0;
    strcpy(template, WEBDAV_TEMPLATE);
    fd = mkstemp(template);
    if (fd != -1) {
        if (!unlink(template)) {
            length = strlen(username);
            if (write(fd, &length, sizeof(u_int32_t)) > 0) {
                if (write(fd, username, length) > 0) {
                    length = strlen(password);
                    if (write(fd, &length, sizeof(u_int32_t)) > 0) {
                        if (write(fd, password, length) > 0) {
                            ok = 1;
                        }
                    }
                }
            }
        } else {
            (void)close(fd);
            fd = -1;
        }
    }
    if (ok) {
        (void)fsync(fd);
        sprintf(fd_str, "-a%d", fd);
    } else {
        *fd_str = 0;
        if (fd != -1) {
            (void)close(fd);
        }
    }

SEE ALSO
mount(2), unmount(2), mount(8)

HISTORY
The mount_webdav command first appeared Mac OS X Version 10.0. Support for Digest Access authentication was added in Mac OS X Version 10.1.1.

RETURN VALUES

0   mount_webdav successfully mounted the server directory.

[ENOENT]
    The server directory could not be mounted by mount_webdav because the node path is invalid.

[ENODEV]
    The server directory could not be mounted by mount_webdav because it is not WebDAV-enabled or because it does not exist, or because node does not have proper access.

[ECANCELED]
    The server directory could not be mounted by mount_webdav because the user did not provide proper authentication credentials.