From 7f83a080cfef6952669ee5812051ca3b7d7918a3 Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Tue, 1 May 2012 14:06:07 +0800 Subject: [PATCH] * Tue May 1 2012 Ian Kent - 1:5.0.6-15 - fix typo in libtirpc file name. - fix rework error return handling in rpc code. - allow MOUNT_WAIT to override probe. - improve UDP RPC timeout handling. - fix segfault in get_query_dn(). - use strtok_r() in linux_version_code(). - fix sss wildcard match. - fix dlopen() error handling in sss module. - fix configure string length tests for sss library. --- ...6-allow-MOUNT_WAIT-to-override-probe.patch | 38 ++ ....6-fix-configure-string-length-tests.patch | 69 ++++ ...-dlopen-error-handling-in-sss-module.patch | 36 ++ ...rk-error-return-handling-in-rpc-code.patch | 45 +++ ...s-5.0.6-fix-segfault-in-get_query_dn.patch | 58 +++ autofs-5.0.6-fix-sss-wildcard-match.patch | 41 ++ ...5.0.6-fix-typo-in-libtirpc-file-name.patch | 36 ++ ...0.6-improve-UDP_RPC-timeout-handling.patch | 372 ++++++++++++++++++ ...6-use-strtok_r-in-linux_version_code.patch | 51 +++ autofs.spec | 37 +- 10 files changed, 779 insertions(+), 4 deletions(-) create mode 100644 autofs-5.0.6-allow-MOUNT_WAIT-to-override-probe.patch create mode 100644 autofs-5.0.6-fix-configure-string-length-tests.patch create mode 100644 autofs-5.0.6-fix-dlopen-error-handling-in-sss-module.patch create mode 100644 autofs-5.0.6-fix-rework-error-return-handling-in-rpc-code.patch create mode 100644 autofs-5.0.6-fix-segfault-in-get_query_dn.patch create mode 100644 autofs-5.0.6-fix-sss-wildcard-match.patch create mode 100644 autofs-5.0.6-fix-typo-in-libtirpc-file-name.patch create mode 100644 autofs-5.0.6-improve-UDP_RPC-timeout-handling.patch create mode 100644 autofs-5.0.6-use-strtok_r-in-linux_version_code.patch diff --git a/autofs-5.0.6-allow-MOUNT_WAIT-to-override-probe.patch b/autofs-5.0.6-allow-MOUNT_WAIT-to-override-probe.patch new file mode 100644 index 0000000..7eefce3 --- /dev/null +++ b/autofs-5.0.6-allow-MOUNT_WAIT-to-override-probe.patch @@ -0,0 +1,38 @@ +autofs-5.0.6 - allow MOUNT_WAIT to override probe + +From: Ian Kent + +Allow the use of MOUNT_WAIT to override the probe of singleton +map entries. This can allow for quicker fails to hosts that are +not reachable. +--- + + CHANGELOG | 1 + + modules/replicated.c | 3 +++ + 2 files changed, 4 insertions(+) + + +--- autofs-5.0.6.orig/CHANGELOG ++++ autofs-5.0.6/CHANGELOG +@@ -34,6 +34,7 @@ + - fix function to check mount.nfs version. + - fix typo in libtirpc file name. + - fix rework error return handling in rpc code. ++- allow MOUNT_WAIT to override probe. + + 28/06/2011 autofs-5.0.6 + ----------------------- +--- autofs-5.0.6.orig/modules/replicated.c ++++ autofs-5.0.6/modules/replicated.c +@@ -953,8 +953,11 @@ int prune_host_list(unsigned logopt, str + * are not available so check the kernel version and mount.nfs + * version and probe singleton mounts if the kernel version is + * greater than 2.6.22 and mount.nfs version is greater than 1.1.1. ++ * But also allow the MOUNT_WAIT configuration parameter to override ++ * the probing. + */ + if (nfs_mount_uses_string_options && ++ defaults_get_mount_wait() == -1 && + (kern_vers = linux_version_code()) > KERNEL_VERSION(2, 6, 22)) { + if (!this) + return 1; diff --git a/autofs-5.0.6-fix-configure-string-length-tests.patch b/autofs-5.0.6-fix-configure-string-length-tests.patch new file mode 100644 index 0000000..53cb6e3 --- /dev/null +++ b/autofs-5.0.6-fix-configure-string-length-tests.patch @@ -0,0 +1,69 @@ +autofs-5.0.6 - fix configure string length tests + +From: Ian Kent + +Checks for sss library directory were missing quotes around +the library variable. +--- + + CHANGELOG | 1 + + aclocal.m4 | 6 +++--- + configure | 6 +++--- + 3 files changed, 7 insertions(+), 6 deletions(-) + + +--- autofs-5.0.6.orig/CHANGELOG ++++ autofs-5.0.6/CHANGELOG +@@ -39,6 +39,7 @@ + - use strtok_r() in linux_version_code(). + - fix sss wildcard match. + - fix dlopen() error handling in sss module. ++- fix configure string length tests for sss library. + + 28/06/2011 autofs-5.0.6 + ----------------------- +--- autofs-5.0.6.orig/aclocal.m4 ++++ autofs-5.0.6/aclocal.m4 +@@ -37,16 +37,16 @@ dnl + dnl Check if a sss autofs library exists. + dnl -------------------------------------------------------------------------- + AC_DEFUN(AF_CHECK_SSS_LIB, +-[if test -z $sssldir; then ++[if test -z "$sssldir"; then + AC_MSG_CHECKING(for sssd autofs library) + for libd in /usr/lib64 /usr/lib; do +- if test -z $sssldir; then ++ if test -z "$sssldir"; then + if test -e "$libd/sssd/modules/$2"; then + sssldir=$libd/sssd/modules + fi + fi + done +- if test -n $sssldir; then ++ if test -n "$sssldir"; then + HAVE_$1=1 + AC_MSG_RESULT(yes) + else +--- autofs-5.0.6.orig/configure ++++ autofs-5.0.6/configure +@@ -3832,17 +3832,17 @@ else + fi + + +-if test -z $sssldir; then ++if test -z "$sssldir"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sssd autofs library" >&5 + $as_echo_n "checking for sssd autofs library... " >&6; } + for libd in /usr/lib64 /usr/lib; do +- if test -z $sssldir; then ++ if test -z "$sssldir"; then + if test -e "$libd/sssd/modules/libsss_autofs.so"; then + sssldir=$libd/sssd/modules + fi + fi + done +- if test -n $sssldir; then ++ if test -n "$sssldir"; then + HAVE_SSS_AUTOFS=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; } diff --git a/autofs-5.0.6-fix-dlopen-error-handling-in-sss-module.patch b/autofs-5.0.6-fix-dlopen-error-handling-in-sss-module.patch new file mode 100644 index 0000000..5054f7c --- /dev/null +++ b/autofs-5.0.6-fix-dlopen-error-handling-in-sss-module.patch @@ -0,0 +1,36 @@ +autofs-5.0.6 - fix dlopen() error handling in sss module + +From: Ian Kent + +If dlopen(3) fails during initialization of the sss module the +error message is incorrect since dlerror(3) must be used, not +errno. +--- + + CHANGELOG | 1 + + modules/lookup_sss.c | 3 +-- + 2 files changed, 2 insertions(+), 2 deletions(-) + + +--- autofs-5.0.6.orig/CHANGELOG ++++ autofs-5.0.6/CHANGELOG +@@ -38,6 +38,7 @@ + - improve UDP RPC timeout handling. + - use strtok_r() in linux_version_code(). + - fix sss wildcard match. ++- fix dlopen() error handling in sss module. + + 28/06/2011 autofs-5.0.6 + ----------------------- +--- autofs-5.0.6.orig/modules/lookup_sss.c ++++ autofs-5.0.6/modules/lookup_sss.c +@@ -94,8 +94,7 @@ int lookup_init(const char *mapfmt, int + + dh = dlopen(dlbuf, RTLD_LAZY); + if (!dh) { +- estr = strerror_r(errno, buf, MAX_ERR_BUF); +- logerr(MODPREFIX "dlopen: %s", estr); ++ logerr(MODPREFIX "failed to open %s: %s", dlbuf, dlerror()); + free(ctxt); + return 1; + } diff --git a/autofs-5.0.6-fix-rework-error-return-handling-in-rpc-code.patch b/autofs-5.0.6-fix-rework-error-return-handling-in-rpc-code.patch new file mode 100644 index 0000000..c2eba23 --- /dev/null +++ b/autofs-5.0.6-fix-rework-error-return-handling-in-rpc-code.patch @@ -0,0 +1,45 @@ +autofs-5.0.6 - fix rework error return handling in rpc code + +From: Dustin Polke + +This fixes the following error: +rpc_subs.c: In function ‘rpc_do_create_client’: +rpc_subs.c:203:3: error: a label can only be part of a statement and a +declaration is not a statement +--- + + CHANGELOG | 1 + + lib/rpc_subs.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + + +--- autofs-5.0.6.orig/CHANGELOG ++++ autofs-5.0.6/CHANGELOG +@@ -33,6 +33,7 @@ + - check scandir() return value. + - fix function to check mount.nfs version. + - fix typo in libtirpc file name. ++- fix rework error return handling in rpc code. + + 28/06/2011 autofs-5.0.6 + ----------------------- +--- autofs-5.0.6.orig/lib/rpc_subs.c ++++ autofs-5.0.6/lib/rpc_subs.c +@@ -155,7 +155,7 @@ static int rpc_do_create_client(struct s + CLIENT *clnt = NULL; + struct sockaddr_in in4_laddr; + struct sockaddr_in *in4_raddr; +- int type, proto; ++ int type, proto, ret; + socklen_t slen; + + *client = NULL; +@@ -200,7 +200,7 @@ static int rpc_do_create_client(struct s + break; + + case IPPROTO_TCP: +- int ret = connect_nb(*fd, addr, slen, &info->timeout); ++ ret = connect_nb(*fd, addr, slen, &info->timeout); + if (ret < 0) + return ret; + diff --git a/autofs-5.0.6-fix-segfault-in-get_query_dn.patch b/autofs-5.0.6-fix-segfault-in-get_query_dn.patch new file mode 100644 index 0000000..7f49038 --- /dev/null +++ b/autofs-5.0.6-fix-segfault-in-get_query_dn.patch @@ -0,0 +1,58 @@ +autofs-5.0.6 - fix segfault in get_query_dn() + +From: Leonardo Chiquitto + +Automount will segfault when two threads run get_query_dn() +simultaneously and $SEARCH_BASE is defined in sysconfig. +This happens because a thread tries to dereference ctxt->sdns +while another thread running the same function frees the +memory. + +I believe we don't need to reread $SEARCH_BASE every time +get_query_dn() is called. + +edit: Ian Kent +move the read of configured search dns to lookup_init(). +edit end +--- + + modules/lookup_ldap.c | 13 +++---------- + 1 file changed, 3 insertions(+), 10 deletions(-) + + +--- autofs-5.0.6.orig/modules/lookup_ldap.c ++++ autofs-5.0.6/modules/lookup_ldap.c +@@ -281,7 +281,6 @@ static int get_query_dn(unsigned logopt, + char buf[MAX_ERR_BUF]; + char *query, *dn, *qdn; + LDAPMessage *result, *e; +- struct ldap_searchdn *sdns = NULL; + char *attrs[2]; + struct berval **value; + int scope; +@@ -330,15 +329,6 @@ static int get_query_dn(unsigned logopt, + scope = LDAP_SCOPE_SUBTREE; + } + +- if (!ctxt->base) { +- sdns = defaults_get_searchdns(); +- if (sdns) { +- if (ctxt->sdns) +- defaults_free_searchdns(ctxt->sdns); +- ctxt->sdns = sdns; +- } +- } +- + dn = NULL; + if (!ctxt->sdns) { + rv = ldap_search_s(ldap, ctxt->base, +@@ -1467,6 +1457,9 @@ int lookup_init(const char *mapfmt, int + return 1; + } + ++ if (!ctxt->base) ++ ctxt->sdns = defaults_get_searchdns(); ++ + ctxt->timeout = defaults_get_ldap_timeout(); + ctxt->network_timeout = defaults_get_ldap_network_timeout(); + diff --git a/autofs-5.0.6-fix-sss-wildcard-match.patch b/autofs-5.0.6-fix-sss-wildcard-match.patch new file mode 100644 index 0000000..4669304 --- /dev/null +++ b/autofs-5.0.6-fix-sss-wildcard-match.patch @@ -0,0 +1,41 @@ +autofs-5.0.6 - fix sss wildcard match + +From: Ian Kent + +Check for a wildcard map entry on sss map read and convert to +the usual '*' befone adding to the map entry cache. +--- + + CHANGELOG | 1 + + modules/lookup_sss.c | 9 +++++++++ + 2 files changed, 10 insertions(+) + + +--- autofs-5.0.6.orig/CHANGELOG ++++ autofs-5.0.6/CHANGELOG +@@ -37,6 +37,7 @@ + - allow MOUNT_WAIT to override probe. + - improve UDP RPC timeout handling. + - use strtok_r() in linux_version_code(). ++- fix sss wildcard match. + + 28/06/2011 autofs-5.0.6 + ----------------------- +--- autofs-5.0.6.orig/modules/lookup_sss.c ++++ autofs-5.0.6/modules/lookup_sss.c +@@ -325,6 +325,15 @@ int lookup_read_map(struct autofs_point + continue; + } + ++ if (*key == '/' && strlen(key) == 1) { ++ if (ap->type == LKP_DIRECT) { ++ free(key); ++ free(value); ++ continue; ++ } ++ *key = '*'; ++ } ++ + /* + * TODO: implement sun % hack for key translation for + * mixed case keys in schema that are single case only. diff --git a/autofs-5.0.6-fix-typo-in-libtirpc-file-name.patch b/autofs-5.0.6-fix-typo-in-libtirpc-file-name.patch new file mode 100644 index 0000000..e871db1 --- /dev/null +++ b/autofs-5.0.6-fix-typo-in-libtirpc-file-name.patch @@ -0,0 +1,36 @@ +autofs-5.0.6 - fix typo in libtirpc file name + +From: Leonardo Chiquitto + +The library file name was misspelled as libitirpc.so. +--- + + CHANGELOG | 1 + + daemon/automount.c | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + + +--- autofs-5.0.6.orig/CHANGELOG ++++ autofs-5.0.6/CHANGELOG +@@ -32,6 +32,7 @@ + - systemd support fixes. + - check scandir() return value. + - fix function to check mount.nfs version. ++- fix typo in libtirpc file name. + + 28/06/2011 autofs-5.0.6 + ----------------------- +--- autofs-5.0.6.orig/daemon/automount.c ++++ autofs-5.0.6/daemon/automount.c +@@ -2232,9 +2232,9 @@ int main(int argc, char *argv[]) + xmlInitParser(); + #endif + #ifdef TIRPC_WORKAROUND +- void *dh_tirpc = dlopen("libitirpc.so", RTLD_NOW); ++ void *dh_tirpc = dlopen("libtirpc.so", RTLD_NOW); + if (!dh_tirpc) +- dh_tirpc = dlopen("libitirpc.so.1", RTLD_NOW); ++ dh_tirpc = dlopen("libtirpc.so.1", RTLD_NOW); + #endif + + if (!master_read_master(master_list, age, 0)) { diff --git a/autofs-5.0.6-improve-UDP_RPC-timeout-handling.patch b/autofs-5.0.6-improve-UDP_RPC-timeout-handling.patch new file mode 100644 index 0000000..c6899ec --- /dev/null +++ b/autofs-5.0.6-improve-UDP_RPC-timeout-handling.patch @@ -0,0 +1,372 @@ +autofs-5.0.6 - improve UDP RPC timeout handling + +From: Ian Kent + +The RPC code still doesn't control timeout quite right. Change that +to take control of the UDP timeout too. +--- + + CHANGELOG | 1 + include/rpc_subs.h | 5 ++ + lib/rpc_subs.c | 93 +++++++++++++++++++-------------------------------- + modules/replicated.c | 36 ++++++++++++------- + 4 files changed, 63 insertions(+), 72 deletions(-) + + +--- autofs-5.0.6.orig/CHANGELOG ++++ autofs-5.0.6/CHANGELOG +@@ -35,6 +35,7 @@ + - fix typo in libtirpc file name. + - fix rework error return handling in rpc code. + - allow MOUNT_WAIT to override probe. ++- improve UDP RPC timeout handling. + + 28/06/2011 autofs-5.0.6 + ----------------------- +--- autofs-5.0.6.orig/include/rpc_subs.h ++++ autofs-5.0.6/include/rpc_subs.h +@@ -42,6 +42,9 @@ + #define PMAP_TOUT_UDP 3 + #define PMAP_TOUT_TCP 5 + ++#define RPC_TOUT_UDP PMAP_TOUT_UDP ++#define RPC_TOUT_TCP PMAP_TOUT_TCP ++ + #define HOST_ENT_BUF_SIZE 2048 + + struct conn_info { +@@ -64,7 +67,7 @@ void rpc_destroy_udp_client(struct conn_ + int rpc_tcp_getclient(struct conn_info *, unsigned int, unsigned int); + void rpc_destroy_tcp_client(struct conn_info *); + int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, const char *, unsigned int); +-unsigned short rpc_portmap_getport(struct conn_info *, struct pmap *); ++int rpc_portmap_getport(struct conn_info *, struct pmap *, unsigned short *); + int rpc_ping_proto(struct conn_info *); + int rpc_ping(const char *, long, long, unsigned int); + double elapsed(struct timeval, struct timeval); +--- autofs-5.0.6.orig/lib/rpc_subs.c ++++ autofs-5.0.6/lib/rpc_subs.c +@@ -218,43 +218,24 @@ static int rpc_do_create_client(struct s + return 0; + } + #else +-struct netconfig *find_netconf(void *handle, char *family, char *proto) +-{ +- struct netconfig *nconf; +- +- while ((nconf = getnetconfig(handle))) { +- if ((strcmp(nconf->nc_protofmly, family) == 0) && +- (strcmp(nconf->nc_proto, proto) == 0)) +- break; +- } +- +- return nconf; +-} +- + static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd, CLIENT **client) + { + CLIENT *clnt = NULL; + struct sockaddr_in in4_laddr; + struct sockaddr_in6 in6_laddr; + struct sockaddr *laddr = NULL; +- struct netconfig *nconf; + struct netbuf nb_addr; + int type, proto; +- char *nc_family, *nc_proto; +- void *handle; + size_t slen; + int ret; + + *client = NULL; + + proto = info->proto->p_proto; +- if (proto == IPPROTO_UDP) { ++ if (proto == IPPROTO_UDP) + type = SOCK_DGRAM; +- nc_proto = NC_UDP; +- } else { ++ else + type = SOCK_STREAM; +- nc_proto = NC_TCP; +- } + + /* + * bind to any unused port. If we left this up to the rpc +@@ -269,7 +250,6 @@ static int rpc_do_create_client(struct s + laddr = (struct sockaddr *) &in4_laddr; + in4_raddr->sin_port = htons(info->port); + slen = sizeof(struct sockaddr_in); +- nc_family = NC_INET; + } else if (addr->sa_family == AF_INET6) { + struct sockaddr_in6 *in6_raddr = (struct sockaddr_in6 *) addr; + in6_laddr.sin6_family = AF_INET6; +@@ -278,20 +258,9 @@ static int rpc_do_create_client(struct s + laddr = (struct sockaddr *) &in6_laddr; + in6_raddr->sin6_port = htons(info->port); + slen = sizeof(struct sockaddr_in6); +- nc_family = NC_INET6; + } else + return -EINVAL; + +- handle = setnetconfig(); +- if (!handle) +- return -EINVAL; +- +- nconf = find_netconf(handle, nc_family, nc_proto); +- if (!nconf) { +- endnetconfig(handle); +- return -EINVAL; +- } +- + /* + * bind to any unused port. If we left this up to the rpc layer, + * it would bind to a reserved port, which has been shown to +@@ -301,13 +270,11 @@ static int rpc_do_create_client(struct s + *fd = open_sock(addr->sa_family, type, proto); + if (*fd < 0) { + ret = -errno; +- endnetconfig(handle); + return ret; + } + + if (bind(*fd, laddr, slen) < 0) { + ret = -errno; +- endnetconfig(handle); + return ret; + } + } +@@ -315,19 +282,23 @@ static int rpc_do_create_client(struct s + nb_addr.maxlen = nb_addr.len = slen; + nb_addr.buf = addr; + +- if (info->proto->p_proto == IPPROTO_TCP) { ++ if (info->proto->p_proto == IPPROTO_UDP) ++ clnt = clnt_dg_create(*fd, &nb_addr, ++ info->program, info->version, ++ info->send_sz, info->recv_sz); ++ else if (info->proto->p_proto == IPPROTO_TCP) { + ret = connect_nb(*fd, addr, slen, &info->timeout); +- if (ret < 0) { +- endnetconfig(handle); ++ if (ret < 0) + return ret; +- } +- } +- +- clnt = clnt_tli_create(*fd, nconf, &nb_addr, +- info->program, info->version, +- info->send_sz, info->recv_sz); ++ clnt = clnt_vc_create(*fd, &nb_addr, ++ info->program, info->version, ++ info->send_sz, info->recv_sz); ++ } else ++ return -EINVAL; + +- endnetconfig(handle); ++ /* Our timeout is in seconds */ ++ if (clnt && info->timeout.tv_sec) ++ clnt_control(clnt, CLSET_TIMEOUT, (void *) &info->timeout); + + *client = clnt; + +@@ -441,6 +412,8 @@ int rpc_udp_getclient(struct conn_info * + return -ENOENT; + + info->proto = pe_proto; ++ info->timeout.tv_sec = RPC_TOUT_UDP; ++ info->timeout.tv_usec = 0; + info->send_sz = UDPMSGSIZE; + info->recv_sz = UDPMSGSIZE; + } +@@ -480,6 +453,8 @@ int rpc_tcp_getclient(struct conn_info * + return -ENOENT; + + info->proto = pe_proto; ++ info->timeout.tv_sec = RPC_TOUT_TCP; ++ info->timeout.tv_usec = 0; + info->send_sz = 0; + info->recv_sz = 0; + } +@@ -559,10 +534,10 @@ int rpc_portmap_getclient(struct conn_in + return 0; + } + +-unsigned short rpc_portmap_getport(struct conn_info *info, struct pmap *parms) ++int rpc_portmap_getport(struct conn_info *info, ++ struct pmap *parms, unsigned short *port) + { + struct conn_info pmap_info; +- unsigned short port = 0; + CLIENT *client; + enum clnt_stat status; + int proto = info->proto->p_proto; +@@ -604,7 +579,7 @@ unsigned short rpc_portmap_getport(struc + if (status == RPC_SUCCESS) { + status = clnt_call(client, PMAPPROC_GETPORT, + (xdrproc_t) xdr_pmap, (caddr_t) parms, +- (xdrproc_t) xdr_u_short, (caddr_t) &port, ++ (xdrproc_t) xdr_u_short, (caddr_t) port, + pmap_info.timeout); + } + +@@ -631,10 +606,12 @@ unsigned short rpc_portmap_getport(struc + clnt_destroy(client); + } + +- if (status != RPC_SUCCESS) ++ if (status == RPC_TIMEDOUT) ++ return -ETIMEDOUT; ++ else if (status != RPC_SUCCESS) + return -EIO; + +- return port; ++ return 0; + } + + int rpc_ping_proto(struct conn_info *info) +@@ -686,7 +663,9 @@ int rpc_ping_proto(struct conn_info *inf + clnt_destroy(client); + } + +- if (status != RPC_SUCCESS) ++ if (status == RPC_TIMEDOUT) ++ return -ETIMEDOUT; ++ else if (status != RPC_SUCCESS) + return -EIO; + + return 1; +@@ -725,8 +704,8 @@ static unsigned int __rpc_ping(const cha + parms.pm_prot = info.proto->p_proto; + parms.pm_port = 0; + +- info.port = rpc_portmap_getport(&info, &parms); +- if (info.port < 0) ++ status = rpc_portmap_getport(&info, &parms, &info.port); ++ if (status < 0) + return status; + + status = rpc_ping_proto(&info); +@@ -915,8 +894,8 @@ exports rpc_get_exports(const char *host + + parms.pm_prot = info.proto->p_proto; + +- info.port = rpc_portmap_getport(&info, &parms); +- if (info.port < 0) ++ status = rpc_portmap_getport(&info, &parms, &info.port); ++ if (status < 0) + goto try_tcp; + + memset(&exportlist, '\0', sizeof(exportlist)); +@@ -932,8 +911,8 @@ try_tcp: + + parms.pm_prot = info.proto->p_proto; + +- info.port = rpc_portmap_getport(&info, &parms); +- if (info.port < 0) ++ status = rpc_portmap_getport(&info, &parms, &info.port); ++ if (status < 0) + return NULL; + + memset(&exportlist, '\0', sizeof(exportlist)); +--- autofs-5.0.6.orig/modules/replicated.c ++++ autofs-5.0.6/modules/replicated.c +@@ -569,7 +569,9 @@ static unsigned int get_nfs_info(unsigne + gettimeofday(&start, &tz); + status = rpc_ping_proto(rpc_info); + gettimeofday(&end, &tz); +- if (status > 0) { ++ if (status == -ETIMEDOUT) ++ return (unsigned int) status; ++ else if (status > 0) { + double reply; + if (random_selection) { + /* Random value between 0 and 1 */ +@@ -607,13 +609,12 @@ v3_ver: + } else { + parms.pm_prot = rpc_info->proto->p_proto; + parms.pm_vers = NFS3_VERSION; +- status = rpc_portmap_getport(pm_info, &parms); +- if (status == -EHOSTUNREACH) { ++ status = rpc_portmap_getport(pm_info, &parms, &rpc_info->port); ++ if (status == -EHOSTUNREACH || status == -ETIMEDOUT) { + supported = status; + goto done_ver; + } else if (status < 0) + goto v2_ver; +- rpc_info->port = status; + } + + if (rpc_info->proto->p_proto == IPPROTO_UDP) +@@ -627,7 +628,10 @@ v3_ver: + gettimeofday(&start, &tz); + status = rpc_ping_proto(rpc_info); + gettimeofday(&end, &tz); +- if (status > 0) { ++ if (status == -ETIMEDOUT) { ++ supported = status; ++ goto done_ver; ++ } else if (status > 0) { + double reply; + if (random_selection) { + /* Random value between 0 and 1 */ +@@ -654,14 +658,12 @@ v2_ver: + } else { + parms.pm_prot = rpc_info->proto->p_proto; + parms.pm_vers = NFS2_VERSION; +- rpc_info->port = rpc_portmap_getport(pm_info, &parms); +- status = rpc_portmap_getport(pm_info, &parms); +- if (status == -EHOSTUNREACH) { ++ status = rpc_portmap_getport(pm_info, &parms, &rpc_info->port); ++ if (status == -EHOSTUNREACH || status == -ETIMEDOUT) { + supported = status; + goto done_ver; + } else if (status < 0) + goto done_ver; +- rpc_info->port = status; + } + + if (rpc_info->proto->p_proto == IPPROTO_UDP) +@@ -675,7 +677,9 @@ v2_ver: + gettimeofday(&start, &tz); + status = rpc_ping_proto(rpc_info); + gettimeofday(&end, &tz); +- if (status > 0) { ++ if (status == -ETIMEDOUT) ++ supported = status; ++ else if (status > 0) { + double reply; + if (random_selection) { + /* Random value between 0 and 1 */ +@@ -752,7 +756,8 @@ static int get_vers_and_cost(unsigned lo + supported = get_nfs_info(logopt, host, + &pm_info, &rpc_info, "tcp", vers, options); + if (IS_ERR(supported)) { +- if (ERR(supported) == EHOSTUNREACH) ++ if (ERR(supported) == EHOSTUNREACH || ++ ERR(supported) == ETIMEDOUT) + return ret; + } else if (supported) { + ret = 1; +@@ -763,7 +768,10 @@ static int get_vers_and_cost(unsigned lo + if (version & UDP_REQUESTED) { + supported = get_nfs_info(logopt, host, + &pm_info, &rpc_info, "udp", vers, options); +- if (supported) { ++ if (IS_ERR(supported)) { ++ if (ERR(supported) == ETIMEDOUT) ++ return ret; ++ } else if (supported) { + ret = 1; + host->version |= (supported << 8); + } +@@ -862,8 +870,8 @@ static int get_supported_ver_and_cost(un + return 0; + + parms.pm_prot = rpc_info.proto->p_proto; +- rpc_info.port = rpc_portmap_getport(&pm_info, &parms); +- if (rpc_info.port < 0) ++ ret = rpc_portmap_getport(&pm_info, &parms, &rpc_info.port); ++ if (ret < 0) + goto done; + } + diff --git a/autofs-5.0.6-use-strtok_r-in-linux_version_code.patch b/autofs-5.0.6-use-strtok_r-in-linux_version_code.patch new file mode 100644 index 0000000..d05dd75 --- /dev/null +++ b/autofs-5.0.6-use-strtok_r-in-linux_version_code.patch @@ -0,0 +1,51 @@ +autofs-5.0.6 - use strtok_r() in linux_version_code() + +From: Ian Kent + +Use re-entrant version of strtok() in linux_version_code() function. +Also fix tab formatting. +--- + + CHANGELOG | 1 + + include/mounts.h | 17 +++++++++-------- + 2 files changed, 10 insertions(+), 8 deletions(-) + + +--- autofs-5.0.6.orig/CHANGELOG ++++ autofs-5.0.6/CHANGELOG +@@ -36,6 +36,7 @@ + - fix rework error return handling in rpc code. + - allow MOUNT_WAIT to override probe. + - improve UDP RPC timeout handling. ++- use strtok_r() in linux_version_code(). + + 28/06/2011 autofs-5.0.6 + ----------------------- +--- autofs-5.0.6.orig/include/mounts.h ++++ autofs-5.0.6/include/mounts.h +@@ -77,16 +77,17 @@ struct mnt_list { + + static inline unsigned int linux_version_code(void) + { +- struct utsname my_utsname; +- unsigned int p, q, r; ++ struct utsname my_utsname; ++ unsigned int p, q, r; ++ char *save; + +- if (uname(&my_utsname)) +- return 0; ++ if (uname(&my_utsname)) ++ return 0; + +- p = (unsigned int)atoi(strtok(my_utsname.release, ".")); +- q = (unsigned int)atoi(strtok(NULL, ".")); +- r = (unsigned int)atoi(strtok(NULL, ".")); +- return KERNEL_VERSION(p, q, r); ++ p = (unsigned int) atoi(strtok_r(my_utsname.release, ".", &save)); ++ q = (unsigned int) atoi(strtok_r(NULL, ".", &save)); ++ r = (unsigned int) atoi(strtok_r(NULL, ".", &save)); ++ return KERNEL_VERSION(p, q, r); + } + + struct nfs_mount_vers { diff --git a/autofs.spec b/autofs.spec index 3960814..b5dfb65 100644 --- a/autofs.spec +++ b/autofs.spec @@ -8,7 +8,7 @@ Summary: A tool for automatically mounting and unmounting filesystems Name: autofs Version: 5.0.6 -Release: 14%{?dist} +Release: 15%{?dist} Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -48,6 +48,15 @@ Patch32: autofs-5.0.6-catch-EHOSTUNREACH-and-bail-out-early.patch Patch33: autofs-5.0.6-systemd-support-fixes.patch Patch34: autofs-5.0.6-fix-segmentation-fault-in-do-remount-indirect.patch Patch35: autofs-5.0.6-fix-function-to-check-mount_nfs-version.patch +Patch36: autofs-5.0.6-fix-typo-in-libtirpc-file-name.patch +Patch37: autofs-5.0.6-fix-rework-error-return-handling-in-rpc-code.patch +Patch38: autofs-5.0.6-allow-MOUNT_WAIT-to-override-probe.patch +Patch39: autofs-5.0.6-improve-UDP_RPC-timeout-handling.patch +Patch40: autofs-5.0.6-use-strtok_r-in-linux_version_code.patch +Patch41: autofs-5.0.6-fix-segfault-in-get_query_dn.patch +Patch42: autofs-5.0.6-fix-sss-wildcard-match.patch +Patch43: autofs-5.0.6-fix-dlopen-error-handling-in-sss-module.patch +Patch44: autofs-5.0.6-fix-configure-string-length-tests.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %if %{with_systemd} BuildRequires: systemd-units @@ -138,6 +147,15 @@ echo %{version}-%{release} > .version %patch33 -p1 %patch34 -p1 %patch35 -p1 +%patch36 -p1 +%patch37 -p1 +%patch38 -p1 +%patch39 -p1 +%patch40 -p1 +%patch41 -p1 +%patch42 -p1 +%patch43 -p1 +%patch44 -p1 %build #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir} @@ -240,6 +258,17 @@ fi %dir /etc/auto.master.d %changelog +* Tue May 1 2012 Ian Kent - 1:5.0.6-15 +- fix typo in libtirpc file name. +- fix rework error return handling in rpc code. +- allow MOUNT_WAIT to override probe. +- improve UDP RPC timeout handling. +- fix segfault in get_query_dn(). +- use strtok_r() in linux_version_code(). +- fix sss wildcard match. +- fix dlopen() error handling in sss module. +- fix configure string length tests for sss library. + * Wed Feb 29 2012 Ian Kent - 1:5.0.6-14 - fix function to check mount.nfs version. @@ -259,16 +288,16 @@ fi * Thu Feb 9 2012 Ian Kent - 1:5.0.6-11 - fix fuzz in CHANGELOG hunk when applying patch26. -* Tue Feb 7 2012 Ian Kent - 1:5.0.6-10 +* Tue Feb 7 2012 Ian Kent - 1:5.0.6-10 - fix rpc build error. - add sss lookup module. - teach automount about sss source. -* Mon Jan 23 2012 Ian Kent - 1:5.0.6-9 +* Mon Jan 23 2012 Ian Kent - 1:5.0.6-9 - add correct patch for "fix improve mount location error reporting". - add correct patch for "fix fix wait for master source mutex". -* Mon Jan 23 2012 Ian Kent - 1:5.0.6-8 +* Mon Jan 23 2012 Ian Kent - 1:5.0.6-8 - fix fix wait for master source mutex. - fix improve mount location error reporting (bz783496).