From 4650055e248bb24fa28802c303a9d9af06e02256 Mon Sep 17 00:00:00 2001 From: ume Date: Thu, 4 Feb 2010 15:17:49 +0000 Subject: Introduce '[ipaddr]:path' notation. Since the existing implementation searches ':' backward, a path which includes ':' could not be mounted. You can now mount such path by enclosing an IP address by '[]'. Though we should change to search ':' forward, it will break 'ipv6addr:path' which is currently working. So, it still searches ':' backward, at least for now. MFC after: 2 weeks --- sbin/umount/umount.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sbin/umount') diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c index eb51f2a..c42b4bb 100644 --- a/sbin/umount/umount.c +++ b/sbin/umount/umount.c @@ -325,14 +325,21 @@ umountfs(struct statfs *sfs) if ((nfsdirname = strdup(sfs->f_mntfromname)) == NULL) err(1, "strdup"); orignfsdirname = nfsdirname; - if ((delimp = strrchr(nfsdirname, ':')) != NULL) { - *delimp = '\0'; + if (*nfsdirname == '[' && + (delimp = strchr(nfsdirname + 1, ']')) != NULL && + *(delimp + 1) == ':') { + hostp = nfsdirname + 1; + nfsdirname = delimp + 2; + } else if ((delimp = strrchr(nfsdirname, ':')) != NULL) { hostp = nfsdirname; + nfsdirname = delimp + 1; + } + if (hostp != NULL) { + *delimp = '\0'; getaddrinfo(hostp, NULL, &hints, &ai); if (ai == NULL) { warnx("can't get net id for host"); } - nfsdirname = delimp + 1; } /* -- cgit v1.1