Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 146678 Details for
Bug 213700
automount does not mount /net
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch to check the interface address fqdn when trying to match an export
autofs-5.0.1-rc3-fqdn-match.patch (text/plain), 4.00 KB, created by
Ian Kent
on 2007-01-26 13:32:51 UTC
(
hide
)
Description:
Patch to check the interface address fqdn when trying to match an export
Filename:
MIME Type:
Creator:
Ian Kent
Created:
2007-01-26 13:32:51 UTC
Size:
4.00 KB
patch
obsolete
>diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c >index b4e9c91..b4c0c9b 100644 >--- a/lib/rpc_subs.c >+++ b/lib/rpc_subs.c >@@ -926,42 +926,118 @@ static int pattern_match(const char *s, const char *pattern) > /* NOTREACHED */ > } > >-static int string_match(const char *myname, const char *pattern) >+static int name_match(const char *name, const char *pattern) > { >- struct addrinfo hints, *ni; > int ret; > >- memset(&hints, 0, sizeof(hints)); >- hints.ai_flags = AI_CANONNAME; >- hints.ai_family = 0; >- hints.ai_socktype = 0; >+ if (strchr(pattern, '*') || strchr(pattern, '?')) >+ ret = pattern_match(name, pattern); >+ else { >+ ret = !memcmp(name, pattern, strlen(pattern)); >+ /* Name could still be a netgroup (Solaris) */ >+ if (!ret && ypdomain) >+ ret = innetgr(pattern, name, NULL, ypdomain); >+ } >+ >+ return ret; >+} >+ >+static int fqdn_match(const char *pattern) >+{ >+ char buf[MAX_ERR_BUF], *ptr; >+ struct ifconf ifc; >+ struct ifreq *ifr; >+ int sock, cl_flags, ret, i; >+ char fqdn[NI_MAXHOST + 1]; >+ >+ sock = socket(AF_INET, SOCK_DGRAM, 0); >+ if (sock < 0) { >+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); >+ error(LOGOPT_ANY, "socket creation failed: %s", estr); >+ return 0; >+ } >+ >+ if ((cl_flags = fcntl(sock, F_GETFD, 0)) != -1) { >+ cl_flags |= FD_CLOEXEC; >+ fcntl(sock, F_SETFD, cl_flags); >+ } > >- ret = getaddrinfo(myname, NULL, &hints, &ni); >- if (ret) { >- error(LOGOPT_ANY, "name lookup failed: %s", gai_strerror(ret)); >+ ifc.ifc_len = sizeof(buf); >+ ifc.ifc_req = (struct ifreq *) buf; >+ ret = ioctl(sock, SIOCGIFCONF, &ifc); >+ if (ret == -1) { >+ close(sock); >+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); >+ error(LOGOPT_ANY, "ioctl: %s", estr); > return 0; > } > >- if (strchr(pattern, '*') || strchr(pattern, '?')) { >- ret = pattern_match(myname, pattern); >- if (!ret) >- ret = pattern_match(ni->ai_canonname, pattern); >- } else { >- /* Match simple nane or FQDN */ >- ret = !memcmp(myname, pattern, strlen(pattern)); >- if (!ret) >- ret = !memcmp(ni->ai_canonname, pattern, strlen(pattern)); >+ i = 0; >+ ptr = (char *) &ifc.ifc_buf[0]; > >- /* Name could still be a netgroup (Solaris) */ >- if (!ret && ypdomain) { >- ret = innetgr(pattern, myname, NULL, ypdomain); >- if (!ret) >- ret = innetgr(pattern, >- ni->ai_canonname, NULL, ypdomain); >+ while (ptr < buf + ifc.ifc_len) { >+ ifr = (struct ifreq *) ptr; >+ >+ switch (ifr->ifr_addr.sa_family) { >+ case AF_INET: >+ { >+ socklen_t slen = sizeof(struct sockaddr); >+ >+ ret = getnameinfo(&ifr->ifr_addr, slen, fqdn, >+ NI_MAXHOST, NULL, 0, NI_NAMEREQD); >+ if (!ret) { >+ ret = name_match(fqdn, pattern); >+ if (ret) { >+ close(sock); >+ return 1; >+ } >+ } >+ break; >+ } >+ >+ /* glibc rpc only understands IPv4 atm */ >+ case AF_INET6: >+ break; >+ >+ default: >+ break; > } > >+ i++; >+ ptr = (char *) &ifc.ifc_req[i]; > } >- freeaddrinfo(ni); >+ >+ close(sock); >+ return 0; >+} >+ >+static int string_match(const char *myname, const char *pattern) >+{ >+ struct addrinfo hints, *ni; >+ int ret; >+ >+ /* Try simple name match first */ >+ ret = name_match(myname, pattern); >+ if (ret) >+ goto done; >+ >+ memset(&hints, 0, sizeof(hints)); >+ hints.ai_flags = AI_CANONNAME; >+ hints.ai_family = 0; >+ hints.ai_socktype = 0; >+ >+ /* See if our canonical name matches */ >+ if (getaddrinfo(myname, NULL, &hints, &ni) == 0) { >+ ret = name_match(ni->ai_canonname, pattern); >+ freeaddrinfo(ni); >+ } else >+ warn(LOGOPT_ANY, "name lookup failed: %s", gai_strerror(ret)); >+ if (ret) >+ goto done; >+ >+ /* Lastly see if the name of an interfaces matches */ >+ ret = fqdn_match(pattern); >+done: > return ret; > } > >diff --git a/modules/lookup_hosts.c b/modules/lookup_hosts.c >index 1a16b96..3d31a49 100644 >--- a/modules/lookup_hosts.c >+++ b/modules/lookup_hosts.c >@@ -253,13 +253,9 @@ done: > cache_update(mc, name, mapent, now); > cache_unlock(mc); > >- debug(LOGOPT_ANY, "source wait"); >- > master_source_current_wait(ap->entry); > ap->entry->current = source; > >- debug(LOGOPT_ANY, "do parse_mount"); >- > ret = ctxt->parse->parse_mount(ap, name, name_len, > mapent, ctxt->parse->context); > free(mapent);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 213700
:
143205
|
145071
| 146678