Hello community, here is the log from the commit of package autofs for openSUSE:11.4 checked in at Wed Feb 8 00:57:17 CET 2012. -------- --- old-versions/11.4/UPDATES/all/autofs/autofs.changes 2011-08-26 15:29:05.000000000 +0200 +++ 11.4/autofs/autofs.changes 2012-02-02 23:22:10.000000000 +0100 @@ -1,0 +2,45 @@ +Thu Feb 2 22:22:20 UTC 2012 - lchiquitto@suse.com + +- second AutoFS maintenance update for openSUSE 11.4 (bnc#744873) + +------------------------------------------------------------------- +Thu Feb 2 19:24:21 UTC 2012 - lchiquitto@suse.com + +- fix segfault caused by an use after free in st_queue_handler() + (bnc#727392) + +------------------------------------------------------------------- +Thu Feb 2 19:21:26 UTC 2012 - lchiquitto@suse.com + +- disable "--as-needed" to make sure automount will be linked + against libtirpc (bnc#742846) +- fix typo in libtirpc file name + +------------------------------------------------------------------- +Thu Feb 2 19:18:24 UTC 2012 - lchiquitto@suse.com + +- import bug fixes from the upstream repository: + * fix ipv6 name for lookup + * fix libtirpc ipv6 check + * fix ipv6 name for lookup fix + * fix paged query more results check + * fix dumpmaps not reading maps + * fix result null check in read_one_map() (bnc#707715) + * fix LDAP result leaks on error paths + * fix fix LDAP result leaks on error paths (bnc#730245) + * code analysis fixes part 1 + * fix wait for master source mutex + * fix submount shutdown race + * fix fix map source check in file lookup + * fix ipv6 name lookup check + * fix ipv6 rpc calls + * fix ipv6 configure check + * fix rpc build error + +------------------------------------------------------------------- +Thu Feb 2 18:52:26 UTC 2012 - lchiquitto@suse.com + +- add autoconf as buildrequire to avoid implicit dependency +- build against libtirpc since glibc's rpc code is deprecated + +------------------------------------------------------------------- calling whatdependson for 11.4-i586 New: ---- autofs-5.0.5-fix-ipv6-name-for-lookup.patch autofs-5.0.5-fix-libtirpc-ipv6-check.patch autofs-5.0.6-code-analysis-fixes-1.patch autofs-5.0.6-fix-dumpmaps-not-reading-maps.patch autofs-5.0.6-fix-fix-ldap-result-leaks-on-error-paths.patch autofs-5.0.6-fix-fix-map-source-check-in-file-lookup.patch autofs-5.0.6-fix-ipv6-configure-check.patch autofs-5.0.6-fix-ipv6-name-for-lookup-fix.patch autofs-5.0.6-fix-ipv6-name-lookup-check.patch autofs-5.0.6-fix-ipv6-rpc-calls.patch autofs-5.0.6-fix-ldap-result-leaks-on-error-paths.patch autofs-5.0.6-fix-libtirpc-name-typo.patch autofs-5.0.6-fix-paged-query-more-results-check.patch autofs-5.0.6-fix-result-null-check-in-read_one_map.patch autofs-5.0.6-fix-rpc-build-error.patch autofs-5.0.6-fix-submount-shutdown-race.patch autofs-5.0.6-fix-wait-for-master-source-mutex.patch autofs-5.0.6-task-use-after-free.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ autofs.spec ++++++ --- /var/tmp/diff_new_pack.WPbYiM/_old 2012-02-08 00:56:44.000000000 +0100 +++ /var/tmp/diff_new_pack.WPbYiM/_new 2012-02-08 00:56:44.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package autofs # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,19 +15,25 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild Name: autofs Url: http://www.kernel.org/pub/linux/daemons/autofs/v5/ -BuildRequires: bison e2fsprogs flex module-init-tools nfs-client -BuildRequires: krb5-devel libxml2-devel openldap2-devel -License: GPLv2+ -Group: System/Daemons -AutoReqProv: on +BuildRequires: autoconf +BuildRequires: bison +BuildRequires: e2fsprogs +BuildRequires: flex +BuildRequires: krb5-devel +BuildRequires: libtirpc-devel +BuildRequires: libxml2-devel +BuildRequires: module-init-tools +BuildRequires: nfs-client +BuildRequires: openldap2-devel Version: 5.0.5 -Release: 14.<RELEASE19> +Release: 14.<RELEASE21> Summary: A Kernel-Based Automounter +License: GPL-2.0+ +Group: System/Daemons BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5/%{name}-%{version}.tar.bz2 Source1: sysconfig.autofs @@ -40,9 +46,27 @@ Patch0: autofs-%{version}-upstream-patches-%{patchdate}.bz2 Patch1: autofs-5.0.5-invalid-ghost-dirs.patch Patch2: autofs-5.0.5-fix-null-cache-deadlock.patch -Patch10: autofs-suse-auto_master_default.patch -Patch11: autofs-suse-autofs_init.patch -Patch12: autofs-suse-build.patch +Patch3: autofs-5.0.5-fix-ipv6-name-for-lookup.patch +Patch4: autofs-5.0.5-fix-libtirpc-ipv6-check.patch +Patch5: autofs-5.0.6-fix-ipv6-name-for-lookup-fix.patch +Patch6: autofs-5.0.6-fix-paged-query-more-results-check.patch +Patch7: autofs-5.0.6-fix-dumpmaps-not-reading-maps.patch +Patch8: autofs-5.0.6-fix-result-null-check-in-read_one_map.patch +Patch9: autofs-5.0.6-fix-ldap-result-leaks-on-error-paths.patch +Patch10: autofs-5.0.6-fix-fix-ldap-result-leaks-on-error-paths.patch +Patch11: autofs-5.0.6-code-analysis-fixes-1.patch +Patch12: autofs-5.0.6-fix-wait-for-master-source-mutex.patch +Patch13: autofs-5.0.6-fix-submount-shutdown-race.patch +Patch14: autofs-5.0.6-fix-fix-map-source-check-in-file-lookup.patch +Patch15: autofs-5.0.6-fix-ipv6-name-lookup-check.patch +Patch16: autofs-5.0.6-fix-ipv6-rpc-calls.patch +Patch17: autofs-5.0.6-fix-ipv6-configure-check.patch +Patch18: autofs-5.0.6-fix-rpc-build-error.patch +Patch19: autofs-5.0.6-fix-libtirpc-name-typo.patch +Patch20: autofs-5.0.6-task-use-after-free.patch +Patch100: autofs-suse-auto_master_default.patch +Patch101: autofs-suse-autofs_init.patch +Patch102: autofs-suse-build.patch PreReq: %fillup_prereq %insserv_prereq aaa_base Recommends: nfs-client @@ -68,11 +92,30 @@ %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 %patch10 -p1 %patch11 -p1 %patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch100 -p1 +%patch101 -p1 +%patch102 -p1 %build +SUSE_ASNEEDED=0 rm -f configure autoconf -f ./configure %{_target_cpu}-suse-linux \ @@ -81,6 +124,7 @@ --disable-mount-locking \ --enable-forced-shutdown \ --enable-ignore-busy \ + --with-libtirpc \ --with-hesiod=no \ --with-sasl make all DONTSTRIP=1 LOCAL_CFLAGS="$RPM_OPT_FLAGS %(getconf LFS_CFLAGS)" ++++++ autofs-5.0.5-fix-ipv6-name-for-lookup.patch ++++++ commit 5b083026ae08c91a0b01b309d44d278c7eb87ada Author: Ian Kent <ikent@redhat.com> Date: Tue Jun 28 14:45:14 2011 +0800 autofs-5.0.5 - fix ipv6 name for lookup When an IPv6 name is given in a map entry the convention is to surround the name with square brackets if it is an address. When trying to translate such a name autofs did not first remove the brackets so the name lookup failed. Index: autofs-5.0.5/modules/replicated.c =================================================================== --- autofs-5.0.5.orig/modules/replicated.c +++ autofs-5.0.5/modules/replicated.c @@ -217,10 +217,8 @@ static unsigned int get_proximity(struct switch (ifr->ifr_addr.sa_family) { case AF_INET: -#ifndef INET6 if (host_addr->sa_family == AF_INET6) break; -#endif if_addr = (struct sockaddr_in *) &ifr->ifr_addr; ret = memcmp(&if_addr->sin_addr, hst_addr, addr_len); if (!ret) { @@ -270,10 +268,8 @@ static unsigned int get_proximity(struct switch (ifr->ifr_addr.sa_family) { case AF_INET: -#ifndef INET6 if (host_addr->sa_family == AF_INET6) break; -#endif if_addr = (struct sockaddr_in *) &ifr->ifr_addr; ia = ntohl((uint32_t) if_addr->sin_addr.s_addr); @@ -1115,15 +1111,29 @@ static int add_host_addrs(struct host ** unsigned int weight, unsigned int options) { struct addrinfo hints, *ni, *this; + char *name = strdup(host); + int len; + char buf[MAX_ERR_BUF]; int rr = 0; int ret; + if (!name) { + char *estr = strerror_r(errno, buf, MAX_ERR_BUF); + error(LOGOPT_ANY, "strdup: %s", estr); + error(LOGOPT_ANY, "failed to add host %s", host); + return 0; + } + len = strlen(name); + + if (name[0] == '[' && name[--len] == ']') + name[len] = '\0'; + memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_NUMERICHOST; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; - ret = getaddrinfo(host, NULL, &hints, &ni); + ret = getaddrinfo(name + 1, NULL, &hints, &ni); if (ret) goto try_name; @@ -1143,10 +1153,11 @@ try_name: hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; - ret = getaddrinfo(host, NULL, &hints, &ni); + ret = getaddrinfo(name + 1, NULL, &hints, &ni); if (ret) { error(LOGOPT_ANY, "hostname lookup failed: %s", gai_strerror(ret)); + free(name); return 0; } @@ -1161,6 +1172,7 @@ try_name: } freeaddrinfo(ni); done: + free(name); return ret; } Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -77,6 +77,7 @@ - fix map source check in file lookup. - fix simple bind without SASL support. - fix sasl bind host name selection. +- fix ipv6 name for lookup. 03/09/2009 autofs-5.0.5 ----------------------- ++++++ autofs-5.0.5-fix-libtirpc-ipv6-check.patch ++++++ ++++ 6713 lines (skipped) ++++++ autofs-5.0.6-code-analysis-fixes-1.patch ++++++ commit 715030c02051817b41139b87d8a13a71e55e5018 Author: Ian Kent <ikent@redhat.com> Date: Thu Dec 1 15:25:17 2011 +0800 autofs-5.0.6 - code analysis fixes 1 Code analysis defect fixes, installment 1. - fix signed usage of unsigned variable in do_srv_query(). - make NULL check handling of variable dcs explicit in get_dc_list(). - adding an explicit NULL check for variable dcs gaurds against future changes in get_srv_rrs() returning success while not clearing the dcs variable. - makes it explict for readers why we don't need to check for NULL before free later in the loop. - fix typo in do_reconnect() - uri is never set now and, at this point, we need to try to connect to the last server uri (ctxt->uri->uri) which is set in find_server() when ctxt->uri is NULL. Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -85,6 +85,7 @@ - fix result null check in read_one_map(). - fix LDAP result leaks on error paths. - fix fix LDAP result leaks on error paths. +- code analysis fixes part 1. 03/09/2009 autofs-5.0.5 ----------------------- Index: autofs-5.0.5/modules/dclist.c =================================================================== --- autofs-5.0.5.orig/modules/dclist.c +++ autofs-5.0.5/modules/dclist.c @@ -69,7 +69,7 @@ static void dclist_mutex_unlock(void) static int do_srv_query(unsigned int logopt, char *name, u_char **packet) { - unsigned int len = PACKETSZ; + int len = PACKETSZ; unsigned int last_len = len; char ebuf[MAX_ERR_BUF]; u_char *buf; @@ -500,7 +500,8 @@ struct dclist *get_dc_list(unsigned int } dclist_mutex_lock(); - if (!get_srv_rrs(logopt, request, &dcs, &numdcs)) { + ret = get_srv_rrs(logopt, request, &dcs, &numdcs); + if (!ret | !dcs) { error(logopt, "DNS SRV query failed for domain %s", domain); dclist_mutex_unlock(); @@ -526,8 +527,7 @@ struct dclist *get_dc_list(unsigned int if (!tmp) { char *estr = strerror_r(errno, buf, MAX_ERR_BUF); error(logopt, "realloc: %s", estr); - if (dcs) - free_srv_rrs(dcs, numdcs); + free_srv_rrs(dcs, numdcs); goto out_error; } @@ -548,8 +548,7 @@ struct dclist *get_dc_list(unsigned int if (ret > 6) { error(logopt, "invalid port: %u", dcs[i].port); - if (dcs) - free_srv_rrs(dcs, numdcs); + free_srv_rrs(dcs, numdcs); goto out_error; } strcat(tmp, port); Index: autofs-5.0.5/modules/lookup_ldap.c =================================================================== --- autofs-5.0.5.orig/modules/lookup_ldap.c +++ autofs-5.0.5/modules/lookup_ldap.c @@ -735,7 +735,6 @@ static LDAP *find_server(unsigned logopt static LDAP *do_reconnect(unsigned logopt, struct lookup_context *ctxt) { LDAP *ldap = NULL; - char *uri; if (ctxt->server || !ctxt->uris) { ldap = do_connect(logopt, ctxt->server, ctxt); @@ -779,7 +778,7 @@ static LDAP *do_reconnect(unsigned logop */ if (!ldap) { autofs_sasl_dispose(ctxt); - ldap = connect_to_server(logopt, uri, ctxt); + ldap = connect_to_server(logopt, ctxt->uri->uri, ctxt); } #endif if (ldap) ++++++ autofs-5.0.6-fix-dumpmaps-not-reading-maps.patch ++++++ commit 597702e403533dc546b8d4bca126fe7f1b6f3c08 Author: Ian Kent <raven@themaw.net> Date: Thu Dec 1 14:54:13 2011 +0800 autofs-5.0.6 - fix dumpmaps not reading maps The lookup modules won't read any indirect map entries (other than those in a file map) unless unless the browse option is set. In order to list the entries when tyhe dumpmap option is given the browse option needs to be set. Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -81,6 +81,7 @@ - fix libtirpc ipv6 check. - fix ipv6 name for lookup fix. - fix paged query more results check. +- fix dumpmaps not reading maps. 03/09/2009 autofs-5.0.5 ----------------------- Index: autofs-5.0.5/lib/master.c =================================================================== --- autofs-5.0.5.orig/lib/master.c +++ autofs-5.0.5/lib/master.c @@ -1279,6 +1279,15 @@ int master_show_mounts(struct master *ma printf("\nMount point: %s\n", ap->path); printf("\nsource(s):\n"); + /* + * Ensure we actually read indirect map entries so we can + * list them. The map reads won't read any indirect map + * entries (other than those in a file map) unless the + * browse option is set. + */ + if (ap->type == LKP_INDIRECT) + ap->flags |= MOUNT_FLAG_GHOST; + /* Read the map content into the cache */ if (lookup_nss_read_map(ap, NULL, now)) lookup_prune_cache(ap, now); ++++++ autofs-5.0.6-fix-fix-ldap-result-leaks-on-error-paths.patch ++++++ commit e2178565b79d5f84e99d60e668f66979a54a0ac7 Author: Ian Kent <raven@themaw.net> Date: Thu Dec 1 15:24:45 2011 +0800 autofs-5.0.6 - fix fix LDAP result leaks on error paths The previous patch with which ensured that the result struture returned from ldap_search_s(3) was freed could sometimes lead to a segmentation fault because the local variable used was not initialized before use. Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -84,6 +84,7 @@ - fix dumpmaps not reading maps. - fix result null check in read_one_map(). - fix LDAP result leaks on error paths. +- fix fix LDAP result leaks on error paths. 03/09/2009 autofs-5.0.5 ----------------------- Index: autofs-5.0.5/modules/lookup_ldap.c =================================================================== --- autofs-5.0.5.orig/modules/lookup_ldap.c +++ autofs-5.0.5/modules/lookup_ldap.c @@ -279,7 +279,7 @@ static int get_query_dn(unsigned logopt, { char buf[MAX_ERR_BUF]; char *query, *dn, *qdn; - LDAPMessage *result, *e; + LDAPMessage *result = NULL, *e; struct ldap_searchdn *sdns = NULL; char *attrs[2]; struct berval **value; @@ -1508,7 +1508,7 @@ int lookup_read_master(struct master *ma char buf[MAX_ERR_BUF]; char parse_buf[PARSE_MAX_BUF]; char *query; - LDAPMessage *result, *e; + LDAPMessage *result = NULL, *e; char *class, *info, *entry; char **keyValue = NULL; char **values = NULL; @@ -2454,7 +2454,7 @@ static int lookup_one(struct autofs_poin char buf[MAX_ERR_BUF]; time_t age = time(NULL); char *query; - LDAPMessage *result, *e; + LDAPMessage *result = NULL, *e; char *class, *info, *entry; char *enc_key1, *enc_key2; int enc_len1 = 0, enc_len2 = 0; ++++++ autofs-5.0.6-fix-fix-map-source-check-in-file-lookup.patch ++++++ commit 939b1e8973becb8497645fd5af75511004fd96d8 Author: Ian Kent <raven@themaw.net> Date: Thu Dec 1 15:28:08 2011 +0800 autofs-5.0.6 - fix fix map source check in file lookup A recent change to correct a problem with included map entry removal has broken a different case of included map key lookup. The check in previous patch was too broad and caused map key lookup for keys in an included multi-mount map entrys to not be found. Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -88,6 +88,7 @@ - code analysis fixes part 1. - fix wait for master source mutex. - fix submount shutdown race. +- fix fix map source check in file lookup. 03/09/2009 autofs-5.0.5 ----------------------- Index: autofs-5.0.5/modules/lookup_file.c =================================================================== --- autofs-5.0.5.orig/modules/lookup_file.c +++ autofs-5.0.5/modules/lookup_file.c @@ -1046,7 +1046,7 @@ do_cache_lookup: * instance (same map entry cache), not in a distinct source. */ if (me && (!me->mapent || - (ap->type == LKP_INDIRECT && me->source != source))) { + (me->source != source && *me->key != '/'))) { while ((me = cache_lookup_key_next(me))) if (me->source == source) break; ++++++ autofs-5.0.6-fix-ipv6-configure-check.patch ++++++ commit 4ab414f80b9e82ff5043bff5ad79c0c720f64430 Author: Ian Kent <ikent@redhat.com> Date: Thu Dec 1 18:35:43 2011 +0800 autofs-5.0.6 - fix ipv6 configure check Since the functions clntudp6_bufcreate() and clnttcp6_create() of libtirpc were never actually included in the library our reference to clntudp6_bufcreate() in configure needs to be removed. Having redone the libtirpc interface (after realizing these functions were defined but not actually included in the library) checking for IPv6 support can't be done now and we need to rely on the transport independent nature of libtirpc to take care of this. So the INET6 checks have been replaced with WITH_LIBTIRPC checks instead. Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -91,6 +91,7 @@ - fix fix map source check in file lookup. - fix ipv6 name lookup check. - fix ipv6 rpc calls. +- fix ipv6 configure check. 03/09/2009 autofs-5.0.5 ----------------------- Index: autofs-5.0.5/aclocal.m4 =================================================================== --- autofs-5.0.5.orig/aclocal.m4 +++ autofs-5.0.5/aclocal.m4 @@ -324,41 +324,6 @@ LIBS="$af_check_ldap_parse_page_control_ ]) dnl -------------------------------------------------------------------------- -dnl AF_CHECK_LIBTIRPC_IPV6 -dnl -dnl Use libtirpc for rpc transport -dnl -------------------------------------------------------------------------- -AC_DEFUN([AF_CHECK_LIBTIRPC_IPV6], -[AC_MSG_CHECKING(if libtirpc has IPv6 support) - -# save current flags -af_check_libtirpc_ipv6_save_cflags="$CFLAGS" -af_check_libtirpc_ipv6_save_ldflags="$LDFLAGS" -CFLAGS="$CFLAGS -I/usr/include/tirpc" -LDFLAGS="$LDFLAGS -ltirpc" - -AC_TRY_LINK( - [ #define INET6 - #include <rpc/rpc.h> ], - [ CLIENT *cl; - struct sockaddr_in6 addr; - int fd; - unsigned long ul; struct timeval t; unsigned int ui; - cl = clntudp6_bufcreate(&addr,ul,ul,t,&fd,ui,ui); ], - [ af_have_libtirpc_ipv6=yes - AC_MSG_RESULT(yes) ], - [ AC_MSG_RESULT(no) ]) - -if test "$af_have_libtirpc_ipv6" = "yes"; then - AC_DEFINE(INET6,1, [Use IPv6 with libtirpc]) -fi - -# restore flags -CFLAGS="$af_check_libtirpc_ipv6_save_cflags" -LDFLAGS="$af_check_libtirpc_ipv6_save_ldflags" -]) - -dnl -------------------------------------------------------------------------- dnl AF_CHECK_LIBTIRPC dnl dnl Use libtirpc for rpc transport @@ -399,7 +364,6 @@ AC_ARG_WITH(libtirpc, [ --with-libtirpc use libtirpc if available], [if test "$withval" = yes; then AF_CHECK_LIBTIRPC() - AF_CHECK_LIBTIRPC_IPV6() else AC_MSG_RESULT(no) fi], [AC_MSG_RESULT(no)]) Index: autofs-5.0.5/configure =================================================================== --- autofs-5.0.5.orig/configure +++ autofs-5.0.5/configure @@ -3085,52 +3085,6 @@ fi CFLAGS="$af_check_libtirpc_save_cflags" LDFLAGS="$af_check_libtirpc_save_ldflags" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtirpc has IPv6 support" >&5 -$as_echo_n "checking if libtirpc has IPv6 support... " >&6; } - -# save current flags -af_check_libtirpc_ipv6_save_cflags="$CFLAGS" -af_check_libtirpc_ipv6_save_ldflags="$LDFLAGS" -CFLAGS="$CFLAGS -I/usr/include/tirpc" -LDFLAGS="$LDFLAGS -ltirpc" - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - #define INET6 - #include <rpc/rpc.h> -int -main () -{ - CLIENT *cl; - struct sockaddr_in6 addr; - int fd; - unsigned long ul; struct timeval t; unsigned int ui; - cl = clntudp6_bufcreate(&addr,ul,ul,t,&fd,ui,ui); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - af_have_libtirpc_ipv6=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -if test "$af_have_libtirpc_ipv6" = "yes"; then - -$as_echo "#define INET6 1" >>confdefs.h - -fi - -# restore flags -CFLAGS="$af_check_libtirpc_ipv6_save_cflags" -LDFLAGS="$af_check_libtirpc_ipv6_save_ldflags" - else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } Index: autofs-5.0.5/include/config.h.in =================================================================== --- autofs-5.0.5.orig/include/config.h.in +++ autofs-5.0.5/include/config.h.in @@ -69,9 +69,6 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* Use IPv6 with libtirpc */ -#undef INET6 - /* Use libxml2 tsd usage workaround */ #undef LIBXML2_WORKAROUND Index: autofs-5.0.5/modules/replicated.c =================================================================== --- autofs-5.0.5.orig/modules/replicated.c +++ autofs-5.0.5/modules/replicated.c @@ -180,7 +180,7 @@ static unsigned int get_proximity(struct break; case AF_INET6: -#ifndef INET6 +#ifndef WITH_LIBTIRPC return PROXIMITY_UNSUPPORTED; #else addr6 = (struct sockaddr_in6 *) host_addr; @@ -229,7 +229,9 @@ static unsigned int get_proximity(struct break; case AF_INET6: -#ifdef INET6 +#ifndef WITH_LIBTIRPC + return PROXIMITY_UNSUPPORTED; +#else if (host_addr->sa_family == AF_INET) break; @@ -309,7 +311,9 @@ static unsigned int get_proximity(struct break; case AF_INET6: -#ifdef INET6 +#ifndef WITH_LIBTIRPC + return PROXIMITY_UNSUPPORTED; +#else if (host_addr->sa_family == AF_INET) break; ++++++ autofs-5.0.6-fix-ipv6-name-for-lookup-fix.patch ++++++ commit 2c6f2625bd6bdccad6a77f15c5066c7c325d4590 Author: Ian Kent <ikent@redhat.com> Date: Mon Jul 4 10:04:45 2011 +0800 autofs-5.0.6 - fix ipv6 name for lookup fix Fix an error in the recent ipv6 name for lookup patch. Reported by Leonardo Chiquitto who provided a patch to resolve the problem. The patch below is a slightly modified version of his patch. Index: autofs-5.0.5/modules/replicated.c =================================================================== --- autofs-5.0.5.orig/modules/replicated.c +++ autofs-5.0.5/modules/replicated.c @@ -1111,7 +1111,8 @@ static int add_host_addrs(struct host ** unsigned int weight, unsigned int options) { struct addrinfo hints, *ni, *this; - char *name = strdup(host); + char *n_ptr; + char *name = n_ptr = strdup(host); int len; char buf[MAX_ERR_BUF]; int rr = 0; @@ -1125,15 +1126,17 @@ static int add_host_addrs(struct host ** } len = strlen(name); - if (name[0] == '[' && name[--len] == ']') + if (name[0] == '[' && name[--len] == ']') { name[len] = '\0'; + name++; + } memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_NUMERICHOST; hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; - ret = getaddrinfo(name + 1, NULL, &hints, &ni); + ret = getaddrinfo(name, NULL, &hints, &ni); if (ret) goto try_name; @@ -1153,7 +1156,7 @@ try_name: hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; - ret = getaddrinfo(name + 1, NULL, &hints, &ni); + ret = getaddrinfo(name, NULL, &hints, &ni); if (ret) { error(LOGOPT_ANY, "hostname lookup failed: %s", gai_strerror(ret)); @@ -1172,7 +1175,7 @@ try_name: } freeaddrinfo(ni); done: - free(name); + free(n_ptr); return ret; } Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -79,6 +79,7 @@ - fix sasl bind host name selection. - fix ipv6 name for lookup. - fix libtirpc ipv6 check. +- fix ipv6 name for lookup fix. 03/09/2009 autofs-5.0.5 ----------------------- ++++++ autofs-5.0.6-fix-ipv6-name-lookup-check.patch ++++++ commit fd0d9f0355b181ff0e5fec8e93512642a2e9152e Author: Ian Kent <raven@themaw.net> Date: Thu Dec 1 18:34:49 2011 +0800 autofs-5.0.6 - fix ipv6 name lookup check The host address must be used when the host name has multiple addresses since we need to mount the specific host and so that it is known what host log entries refer to. But the check for multiple addresses can be wrong because there is no distinction between ipv4 and ipv6 addresses. Change the check to use the host name when mounting if neither the ipv4 or the ipv6 addresses have more than one record. Index: autofs-5.0.5/modules/replicated.c =================================================================== --- autofs-5.0.5.orig/modules/replicated.c +++ autofs-5.0.5/modules/replicated.c @@ -1115,7 +1115,7 @@ static int add_host_addrs(struct host ** char *name = n_ptr = strdup(host); int len; char buf[MAX_ERR_BUF]; - int rr = 0; + int rr = 0, rr4 = 0, rr6 = 0; int ret; if (!name) { @@ -1165,8 +1165,21 @@ try_name: } this = ni; - if (this->ai_next) + while (this->ai_next) { + if (this->ai_family == AF_INET) { + struct sockaddr_in *addr = (struct sockaddr_in *) this->ai_addr; + if (addr->sin_addr.s_addr != INADDR_LOOPBACK) + rr4++; + } else if (this->ai_family == AF_INET6) { + struct sockaddr_in6 *addr = (struct sockaddr_in6 *) this->ai_addr; + if (!IN6_IS_ADDR_LOOPBACK(addr->sin6_addr.__in6_u.__u6_addr32)) + rr6++; + } + this = this->ai_next; + } + if (rr4 > 1 || rr6 > 1) rr++; + this = ni; while (this) { ret = add_new_host(list, host, weight, this, rr, options); if (!ret) Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -89,6 +89,7 @@ - fix wait for master source mutex. - fix submount shutdown race. - fix fix map source check in file lookup. +- fix ipv6 name lookup check. 03/09/2009 autofs-5.0.5 ----------------------- ++++++ autofs-5.0.6-fix-ipv6-rpc-calls.patch ++++++ commit f8ea2a5762f65b1e45c21aa3676bf18bb5e37680 Author: Ian Kent <ikent@redhat.com> Date: Thu Dec 1 18:35:12 2011 +0800 autofs-5.0.6 - fix ipv6 rpc calls There is a mistake in the way autofs uses libtirpc. Two IPv6 compatibiliy functions were thought to be included when in fact they were not and would not actually work with IPv6 anyway. To fix that the libtirpc interface code needed to be re-written. Portmap (using libtirpc calls) is still used to get service port numbers, rather than rpcbind. Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -90,6 +90,7 @@ - fix submount shutdown race. - fix fix map source check in file lookup. - fix ipv6 name lookup check. +- fix ipv6 rpc calls. 03/09/2009 autofs-5.0.5 ----------------------- Index: autofs-5.0.5/lib/rpc_subs.c =================================================================== --- autofs-5.0.5.orig/lib/rpc_subs.c +++ autofs-5.0.5/lib/rpc_subs.c @@ -62,89 +62,6 @@ static const rpcvers_t mount_vers[] = { static int connect_nb(int, struct sockaddr *, socklen_t, struct timeval *); inline void dump_core(void); -static CLIENT *rpc_clntudp_create(struct sockaddr *addr, struct conn_info *info, int *fd) -{ - struct sockaddr_in *in4_raddr; - struct sockaddr_in6 *in6_raddr; - CLIENT *client = NULL; - - switch (addr->sa_family) { - case AF_INET: - in4_raddr = (struct sockaddr_in *) addr; - in4_raddr->sin_port = htons(info->port); - client = clntudp_bufcreate(in4_raddr, - info->program, info->version, - info->timeout, fd, - info->send_sz, info->recv_sz); - break; - - case AF_INET6: -#ifndef INET6 - /* Quiet compile warning */ - in6_raddr = NULL; -#else - in6_raddr = (struct sockaddr_in6 *) addr; - in6_raddr->sin6_port = htons(info->port); - client = clntudp6_bufcreate(in6_raddr, - info->program, info->version, - info->timeout, fd, - info->send_sz, info->recv_sz); -#endif - break; - - default: - break; - } - - return client; -} - -static CLIENT *rpc_clnttcp_create(struct sockaddr *addr, struct conn_info *info, int *fd) -{ - struct sockaddr_in *in4_raddr; - struct sockaddr_in6 *in6_raddr; - CLIENT *client = NULL; - socklen_t slen; - - switch (addr->sa_family) { - case AF_INET: - in4_raddr = (struct sockaddr_in *) addr; - in4_raddr->sin_port = htons(info->port); - slen = sizeof(struct sockaddr_in); - - if (connect_nb(*fd, addr, slen, &info->timeout) < 0) - break; - - client = clnttcp_create(in4_raddr, - info->program, info->version, fd, - info->send_sz, info->recv_sz); - break; - - case AF_INET6: -#ifndef INET6 - /* Quiet compile warning */ - in6_raddr = NULL; -#else - in6_raddr = (struct sockaddr_in6 *) addr; - in6_raddr->sin6_port = htons(info->port); - slen = sizeof(struct sockaddr_in6); - - if (connect_nb(*fd, addr, slen, &info->timeout) < 0) - break; - - client = clnttcp6_create(in6_raddr, - info->program, info->version, fd, - info->send_sz, info->recv_sz); -#endif - break; - - default: - break; - } - - return client; -} - /* * Perform a non-blocking connect on the socket fd. * @@ -232,12 +149,12 @@ done: return ret; } +#ifndef WITH_LIBTIRPC static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd) { CLIENT *client = NULL; - struct sockaddr *laddr; struct sockaddr_in in4_laddr; - struct sockaddr_in6 in6_laddr; + struct sockaddr_in in4_raddr; int type, proto; socklen_t slen; @@ -252,48 +169,41 @@ static CLIENT *rpc_do_create_client(stru * layer, it would bind to a reserved port, which has been shown * to exhaust the reserved port range in some situations. */ - switch (addr->sa_family) { - case AF_INET: - in4_laddr.sin_family = AF_INET; - in4_laddr.sin_port = htons(0); - in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY); - slen = sizeof(struct sockaddr_in); - laddr = (struct sockaddr *) &in4_laddr; - break; - - case AF_INET6: -#ifndef INET6 - /* Quiet compiler */ - in6_laddr.sin6_family = AF_INET6; - return NULL; -#else - in6_laddr.sin6_family = AF_INET6; - in6_laddr.sin6_port = htons(0); - in6_laddr.sin6_addr = in6addr_any; - slen = sizeof(struct sockaddr_in6); - laddr = (struct sockaddr *) &in6_laddr; - break; -#endif - default: - return NULL; - } + in4_laddr.sin_family = AF_INET; + in4_laddr.sin_port = htons(0); + in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY); + slen = sizeof(struct sockaddr_in); if (!info->client) { + struct sockaddr *laddr; + *fd = open_sock(addr->sa_family, type, proto); if (*fd < 0) return NULL; + laddr = (struct sockaddr *) &in4_laddr; if (bind(*fd, laddr, slen) < 0) return NULL; } + in4_raddr = (struct sockaddr_in *) addr; + in4_raddr->sin_port = htons(info->port); + switch (info->proto->p_proto) { case IPPROTO_UDP: - client = rpc_clntudp_create(addr, info, fd); + client = clntudp_bufcreate(in4_raddr, + info->program, info->version, + info->timeout, fd, + info->send_sz, info->recv_sz); break; case IPPROTO_TCP: - client = rpc_clnttcp_create(addr, info, fd); + if (connect_nb(*fd, addr, slen, &info->timeout) < 0) + break; + + client = clnttcp_create(in4_raddr, + info->program, info->version, fd, + info->send_sz, info->recv_sz); break; default: @@ -302,20 +212,126 @@ static CLIENT *rpc_do_create_client(stru return client; } +#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 CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd) +{ + CLIENT *client = 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; + + proto = info->proto->p_proto; + if (proto == IPPROTO_UDP) { + type = SOCK_DGRAM; + nc_proto = NC_UDP; + } else { + type = SOCK_STREAM; + nc_proto = NC_TCP; + } + + /* + * 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 exhaust the reserved port range in some situations. + */ + if (addr->sa_family == AF_INET) { + struct sockaddr_in *in4_raddr = (struct sockaddr_in *) addr; + in4_laddr.sin_family = AF_INET; + in4_laddr.sin_port = htons(0); + in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY); + 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; + in6_laddr.sin6_port = htons(0); + in6_laddr.sin6_addr = in6addr_any; + laddr = (struct sockaddr *) &in6_laddr; + in6_raddr->sin6_port = htons(info->port); + slen = sizeof(struct sockaddr_in6); + nc_family = NC_INET6; + } else + return NULL; + + handle = setnetconfig(); + if (!handle) + return NULL; + + nconf = find_netconf(handle, nc_family, nc_proto); + if (!nconf) { + endnetconfig(handle); + return NULL; + } + + /* + * 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 + * exhaust the reserved port range in some situations. + */ + if (!info->client) { + *fd = open_sock(addr->sa_family, type, proto); + if (*fd < 0) { + endnetconfig(handle); + return NULL; + } + + if (bind(*fd, laddr, slen) < 0) { + endnetconfig(handle); + return NULL; + } + } + + nb_addr.maxlen = nb_addr.len = slen; + nb_addr.buf = addr; + + if (info->proto->p_proto == IPPROTO_TCP) { + if (connect_nb(*fd, addr, slen, &info->timeout) < 0) { + endnetconfig(handle); + return NULL; + } + } + + client = clnt_tli_create(*fd, nconf, &nb_addr, + info->program, info->version, + info->send_sz, info->recv_sz); + + endnetconfig(handle); + + return client; +} +#endif /* - * Create a UDP RPC client + * Create an RPC client */ -static CLIENT *create_udp_client(struct conn_info *info) +static CLIENT *create_client(struct conn_info *info) { CLIENT *client = NULL; struct addrinfo *ai, *haddr; struct addrinfo hints; int fd, ret; - if (info->proto->p_proto != IPPROTO_UDP) - return NULL; - fd = RPC_ANYSOCK; if (info->client) { @@ -355,6 +371,11 @@ static CLIENT *create_udp_client(struct haddr = ai; while (haddr) { + if (haddr->ai_protocol != info->proto->p_proto) { + haddr = haddr->ai_next; + continue; + } + client = rpc_do_create_client(haddr->ai_addr, info, &fd); if (client) break; @@ -408,7 +429,7 @@ int rpc_udp_getclient(struct conn_info * info->program = program; info->version = version; - client = create_udp_client(info); + client = create_client(info); if (!client) return 0; @@ -428,92 +449,6 @@ void rpc_destroy_udp_client(struct conn_ return; } -/* - * Create a TCP RPC client using non-blocking connect - */ -static CLIENT *create_tcp_client(struct conn_info *info) -{ - CLIENT *client = NULL; - struct addrinfo *ai, *haddr; - struct addrinfo hints; - int fd, ret; - - if (info->proto->p_proto != IPPROTO_TCP) - return NULL; - - fd = RPC_ANYSOCK; - - if (info->client) { - if (!clnt_control(info->client, CLGET_FD, (char *) &fd)) { - fd = RPC_ANYSOCK; - clnt_destroy(info->client); - info->client = NULL; - } else { - clnt_control(info->client, CLSET_FD_NCLOSE, NULL); - clnt_destroy(info->client); - } - } - - if (info->addr) { - client = rpc_do_create_client(info->addr, info, &fd); - if (client) - goto done; - - if (!info->client) { - close(fd); - fd = RPC_ANYSOCK; - } - } - - memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_ADDRCONFIG; - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - - ret = getaddrinfo(info->host, NULL, &hints, &ai); - if (ret) { - error(LOGOPT_ANY, - "hostname lookup failed: %s", gai_strerror(ret)); - info->client = NULL; - goto out_close; - } - - haddr = ai; - while (haddr) { - client = rpc_do_create_client(haddr->ai_addr, info, &fd); - if (client) - break; - - if (!info->client && fd != RPC_ANYSOCK) { - close(fd); - fd = RPC_ANYSOCK; - } - - haddr = haddr->ai_next; - } - - freeaddrinfo(ai); - - if (!client) { - info->client = NULL; - goto out_close; - } -done: - /* Close socket fd on destroy, as is default for rpcowned fds */ - if (!clnt_control(client, CLSET_FD_CLOSE, NULL)) { - clnt_destroy(client); - info->client = NULL; - goto out_close; - } - - return client; - -out_close: - if (fd != -1) - close(fd); - return NULL; -} - int rpc_tcp_getclient(struct conn_info *info, unsigned int program, unsigned int version) { @@ -533,7 +468,7 @@ int rpc_tcp_getclient(struct conn_info * info->program = program; info->version = version; - client = create_tcp_client(info); + client = create_client(info); if (!client) return 0; @@ -593,12 +528,9 @@ int rpc_portmap_getclient(struct conn_in info->close_option = option; info->client = NULL; - if (pe_proto->p_proto == IPPROTO_TCP) { + if (pe_proto->p_proto == IPPROTO_TCP) info->timeout.tv_sec = PMAP_TOUT_TCP; - client = create_tcp_client(info); - } else - client = create_udp_client(info); - + client = create_client(info); if (!client) return 0; @@ -635,11 +567,7 @@ unsigned short rpc_portmap_getport(struc pmap_info.send_sz = RPCSMALLMSGSIZE; pmap_info.recv_sz = RPCSMALLMSGSIZE; - if (proto == IPPROTO_TCP) - client = create_tcp_client(&pmap_info); - else - client = create_udp_client(&pmap_info); - + client = create_client(&pmap_info); if (!client) return 0; } @@ -700,10 +628,8 @@ int rpc_ping_proto(struct conn_info *inf if (info->proto->p_proto == IPPROTO_UDP) { info->send_sz = UDPMSGSIZE; info->recv_sz = UDPMSGSIZE; - client = create_udp_client(info); - } else - client = create_tcp_client(info); - + } + client = create_client(info); if (!client) return 0; } @@ -857,10 +783,8 @@ static int rpc_get_exports_proto(struct if (info->proto->p_proto == IPPROTO_UDP) { info->send_sz = UDPMSGSIZE; info->recv_sz = UDPMSGSIZE; - client = create_udp_client(info); - } else - client = create_tcp_client(info); - + } + client = create_client(info); if (!client) return 0; Index: autofs-5.0.5/modules/replicated.c =================================================================== --- autofs-5.0.5.orig/modules/replicated.c +++ autofs-5.0.5/modules/replicated.c @@ -1093,7 +1093,13 @@ static int add_new_host(struct host **li if (prx == PROXIMITY_ERROR) return 0; - addr_len = sizeof(struct sockaddr); + if (host_addr->ai_addr->sa_family == AF_INET) + addr_len = INET_ADDRSTRLEN; + else if (host_addr->ai_addr->sa_family == AF_INET6) + addr_len = INET6_ADDRSTRLEN; + else + return 0; + new = new_host(host, host_addr->ai_addr, addr_len, prx, weight, options); if (!new) return 0; ++++++ autofs-5.0.6-fix-ldap-result-leaks-on-error-paths.patch ++++++ commit 841023c590621a5794945b3ab16a3d1e24653432 Author: Leonardo Chiquitto <leonardo.lists@gmail.com> Date: Thu Dec 1 15:22:51 2011 +0800 autofs-5.0.6 - Fix LDAP result leaks on error paths According to ldap_search_s(3), the result structure must be freed with ldap_msgfree() even when the search function returned failure. Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -83,6 +83,7 @@ - fix paged query more results check. - fix dumpmaps not reading maps. - fix result null check in read_one_map(). +- fix LDAP result leaks on error paths. 03/09/2009 autofs-5.0.5 ----------------------- Index: autofs-5.0.5/modules/lookup_ldap.c =================================================================== --- autofs-5.0.5.orig/modules/lookup_ldap.c +++ autofs-5.0.5/modules/lookup_ldap.c @@ -346,6 +346,8 @@ static int get_query_dn(unsigned logopt, error(logopt, MODPREFIX "query failed for %s: %s", query, ldap_err2string(rv)); + if (result) + ldap_msgfree(result); free(query); return 0; } @@ -1552,6 +1554,8 @@ int lookup_read_master(struct master *ma error(logopt, MODPREFIX "query failed for %s: %s", query, ldap_err2string(rv)); unbind_ldap_connection(logging, ldap, ctxt); + if (result) + ldap_msgfree(result); free(query); return NSS_STATUS_NOTFOUND; } @@ -2565,6 +2569,8 @@ static int lookup_one(struct autofs_poin if ((rv != LDAP_SUCCESS) || !result) { crit(ap->logopt, MODPREFIX "query failed for %s", query); unbind_ldap_connection(ap->logopt, ldap, ctxt); + if (result) + ldap_msgfree(result); free(query); return CHE_FAIL; } ++++++ autofs-5.0.6-fix-libtirpc-name-typo.patch ++++++ Fix typo in libtirpc file name The library file name was misspelled as libitirpc.so. Index: autofs-5.0.5/daemon/automount.c =================================================================== --- autofs-5.0.5.orig/daemon/automount.c +++ autofs-5.0.5/daemon/automount.c @@ -2180,9 +2180,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)) { Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -93,6 +93,7 @@ - fix ipv6 rpc calls. - fix ipv6 configure check. - fix rpc build error. +- fix typo in libtirpc file name. 03/09/2009 autofs-5.0.5 ----------------------- ++++++ autofs-5.0.6-fix-paged-query-more-results-check.patch ++++++ commit 95ac4259a12f549913c965d2d914ce7d1ec9e325 Author: Ian Kent <raven@themaw.net> Date: Thu Dec 1 14:52:48 2011 +0800 autofs-5.0.6 - fix paged query more results check When getting paged results from an LDAP server the server returns an opaque cookie (of type berval) that is used to retrieve the next page. The criteria for deciding if there are more pages is that the berval value is non-null and has a non-zero length. To determine if the berval value has non-zero length autofs checks the strlen() of the value but on ppc64 and s390x this can return 0 even if the value has non-zero length causing a premature termination of the query. Fix this by also checking the berval length field. Also make sure we free the opaque cookie when the query is finished. Index: autofs-5.0.5/modules/lookup_ldap.c =================================================================== --- autofs-5.0.5.orig/modules/lookup_ldap.c +++ autofs-5.0.5/modules/lookup_ldap.c @@ -2020,7 +2020,8 @@ do_paged: rv = ldap_parse_page_control(sp->ldap, returnedControls, &sp->totalCount, &sp->cookie); - if (sp->cookie && sp->cookie->bv_val && strlen(sp->cookie->bv_val)) + if (sp->cookie && sp->cookie->bv_val && + (strlen(sp->cookie->bv_val) || sp->cookie->bv_len)) sp->morePages = TRUE; else sp->morePages = FALSE; @@ -2361,6 +2362,10 @@ static int read_one_map(struct autofs_po rv == LDAP_SIZELIMIT_EXCEEDED) { if (sp.result) ldap_msgfree(sp.result); + if (sp.cookie) { + ber_bvfree(sp.cookie); + sp.cookie = NULL; + } sp.pageSize = sp.pageSize / 2; if (sp.pageSize < 5) { debug(ap->logopt, MODPREFIX @@ -2376,6 +2381,8 @@ static int read_one_map(struct autofs_po if (rv != LDAP_SUCCESS || !sp.result) { unbind_ldap_connection(ap->logopt, sp.ldap, ctxt); *result_ldap = rv; + if (sp.cookie) + ber_bvfree(sp.cookie); free(sp.query); return NSS_STATUS_UNAVAIL; } @@ -2385,6 +2392,8 @@ static int read_one_map(struct autofs_po ldap_msgfree(sp.result); unbind_ldap_connection(ap->logopt, sp.ldap, ctxt); *result_ldap = rv; + if (sp.cookie) + ber_bvfree(sp.cookie); free(sp.query); return NSS_STATUS_NOTFOUND; } @@ -2396,6 +2405,8 @@ static int read_one_map(struct autofs_po unbind_ldap_connection(ap->logopt, sp.ldap, ctxt); source->age = age; + if (sp.cookie) + ber_bvfree(sp.cookie); free(sp.query); return NSS_STATUS_SUCCESS; Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -80,6 +80,7 @@ - fix ipv6 name for lookup. - fix libtirpc ipv6 check. - fix ipv6 name for lookup fix. +- fix paged query more results check. 03/09/2009 autofs-5.0.5 ----------------------- ++++++ autofs-5.0.6-fix-result-null-check-in-read_one_map.patch ++++++ commit 9f19db35bd9ee9a96728c61da2bb20f6354035ec Author: Ian Kent <ikent@redhat.com> Date: Thu Dec 1 14:54:24 2011 +0800 autofs-5.0.6 - fix result null check in read_one_map() Fix the check and reset to NULL of the LDAP library allocated result within the loop to fetch paged query values. Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -82,6 +82,7 @@ - fix ipv6 name for lookup fix. - fix paged query more results check. - fix dumpmaps not reading maps. +- fix result null check in read_one_map(). 03/09/2009 autofs-5.0.5 ----------------------- Index: autofs-5.0.5/modules/lookup_ldap.c =================================================================== --- autofs-5.0.5.orig/modules/lookup_ldap.c +++ autofs-5.0.5/modules/lookup_ldap.c @@ -2360,8 +2360,10 @@ static int read_one_map(struct autofs_po if (rv == LDAP_ADMINLIMIT_EXCEEDED || rv == LDAP_SIZELIMIT_EXCEEDED) { - if (sp.result) + if (sp.result) { ldap_msgfree(sp.result); + sp.result = NULL; + } if (sp.cookie) { ber_bvfree(sp.cookie); sp.cookie = NULL; @@ -2381,6 +2383,8 @@ static int read_one_map(struct autofs_po if (rv != LDAP_SUCCESS || !sp.result) { unbind_ldap_connection(ap->logopt, sp.ldap, ctxt); *result_ldap = rv; + if (sp.result) + ldap_msgfree(sp.result); if (sp.cookie) ber_bvfree(sp.cookie); free(sp.query); @@ -2398,6 +2402,7 @@ static int read_one_map(struct autofs_po return NSS_STATUS_NOTFOUND; } ldap_msgfree(sp.result); + sp.result = NULL; } while (sp.morePages == TRUE); debug(ap->logopt, MODPREFIX "done updating map"); ++++++ autofs-5.0.6-fix-rpc-build-error.patch ++++++ commit 67404f4928fec6dd18f3e6d0b8e4e3f8286bdb20 Author: Leonardo Chiquitto <leonardo.lists@gmail.com> Date: Sat Dec 10 09:55:26 2011 +0800 autofs-5.0.6 - fix rpc build error The compile error looks like a problem in the libtirpc interface code rewrite (commit f8ea2a5762 - autofs-5.0.6 - fix ipv6 rpc calls). The following patch should fix it. Index: autofs-5.0.5/lib/rpc_subs.c =================================================================== --- autofs-5.0.5.orig/lib/rpc_subs.c +++ autofs-5.0.5/lib/rpc_subs.c @@ -154,7 +154,7 @@ static CLIENT *rpc_do_create_client(stru { CLIENT *client = NULL; struct sockaddr_in in4_laddr; - struct sockaddr_in in4_raddr; + struct sockaddr_in *in4_raddr; int type, proto; socklen_t slen; Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -92,6 +92,7 @@ - fix ipv6 name lookup check. - fix ipv6 rpc calls. - fix ipv6 configure check. +- fix rpc build error. 03/09/2009 autofs-5.0.5 ----------------------- ++++++ autofs-5.0.6-fix-submount-shutdown-race.patch ++++++ commit 96bdf5342ffbdb5c62daa6095f0d9ae7f4b37a58 Author: Ian Kent <ikent@redhat.com> Date: Thu Dec 1 15:27:17 2011 +0800 autofs-5.0.6 - fix submount shutdown race Shutdown of submounts is problematic because the kernel doesn't know when they are going away and so cannot block path walks while they shut down. After aquiring the locks that cause mount requests to wait, the daemon checks if the submount is active before finally umounting it. If the mount is found to be busy the shutdown is abandoned and the submount returned to a ready state. But, if a mount request arrives at the same time as the daemon is attempting to aquire these locks pthreads appears to become confused and blocks. So change to using the try version of the lock call and handling the return appropriately. Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -87,6 +87,7 @@ - fix fix LDAP result leaks on error paths. - code analysis fixes part 1. - fix wait for master source mutex. +- fix submount shutdown race. 03/09/2009 autofs-5.0.5 ----------------------- Index: autofs-5.0.5/daemon/automount.c =================================================================== --- autofs-5.0.5.orig/daemon/automount.c +++ autofs-5.0.5/daemon/automount.c @@ -1495,6 +1495,41 @@ static void handle_mounts_cleanup(void * return; } +static int submount_source_writelock_nested(struct autofs_point *ap) +{ + struct autofs_point *parent = ap->parent; + int status; + + status = pthread_rwlock_trywrlock(&parent->entry->source_lock); + if (status) + goto done; + + mounts_mutex_lock(parent); + + status = pthread_rwlock_trywrlock(&ap->entry->source_lock); + if (status) { + mounts_mutex_unlock(parent); + master_source_unlock(parent->entry); + } + +done: + if (status && status != EBUSY) { + logmsg("submount nested master_mapent source write lock failed"); + fatal(status); + } + + return status; +} + +static void submount_source_unlock_nested(struct autofs_point *ap) +{ + struct autofs_point *parent = ap->parent; + + master_source_unlock(ap->entry); + mounts_mutex_unlock(parent); + master_source_unlock(parent->entry); +} + void *handle_mounts(void *arg) { struct startup_cond *suc; @@ -1562,23 +1597,32 @@ void *handle_mounts(void *arg) master_mutex_lock(); if (ap->submount) { - master_source_writelock(ap->parent->entry); - mounts_mutex_lock(ap->parent); - } - - master_source_writelock(ap->entry); + /* + * If a mount request arrives before the locks are + * aquired just return to ready state. + */ + ret = submount_source_writelock_nested(ap); + if (ret) { + warn(ap->logopt, + "can't shutdown submount: mount in progress"); + /* Return to ST_READY is done immediately */ + st_add_task(ap, ST_READY); + master_mutex_unlock(); + pthread_setcancelstate(cur_state, NULL); + continue; + } + } else + master_source_writelock(ap->entry); if (ap->state != ST_SHUTDOWN) { if (!ap->submount) alarm_add(ap, ap->exp_runfreq); /* Return to ST_READY is done immediately */ st_add_task(ap, ST_READY); - master_source_unlock(ap->entry); - if (ap->submount) { - mounts_mutex_unlock(ap->parent); - master_source_unlock(ap->parent->entry); - } - + if (ap->submount) + submount_source_unlock_nested(ap); + else + master_source_unlock(ap->entry); master_mutex_unlock(); pthread_setcancelstate(cur_state, NULL); @@ -1618,12 +1662,10 @@ void *handle_mounts(void *arg) alarm_add(ap, ap->exp_runfreq); /* Return to ST_READY is done immediately */ st_add_task(ap, ST_READY); - master_source_unlock(ap->entry); - if (ap->submount) { - mounts_mutex_unlock(ap->parent); - master_source_unlock(ap->parent->entry); - } - + if (ap->submount) + submount_source_unlock_nested(ap); + else + master_source_unlock(ap->entry); master_mutex_unlock(); pthread_setcancelstate(cur_state, NULL); ++++++ autofs-5.0.6-fix-wait-for-master-source-mutex.patch ++++++ commit 752a866e55a047b2967de84d028a7fc111b60006 Author: Ian Kent <ikent@redhat.com> Date: Thu Dec 1 15:26:47 2011 +0800 autofs-5.0.6 - fix wait for master source mutex A previous change that was meant to handle the case where the master map source mutex read lock count was exceeded was incorrectly done for the write lock case instead of the read lock case. Index: autofs-5.0.5/lib/master.c =================================================================== --- autofs-5.0.5.orig/lib/master.c +++ autofs-5.0.5/lib/master.c @@ -536,38 +536,38 @@ void send_map_update_request(struct auto void master_source_writelock(struct master_mapent *entry) { - int retries = 5; /* 1 second maximum */ int status; - while (retries--) { - status = pthread_rwlock_wrlock(&entry->source_lock); - if (status != EAGAIN) - break; - else { - struct timespec t = { 0, 200000000 }; - struct timespec r; - while (nanosleep(&t, &r) == -1 && errno == EINTR) - memcpy(&t, &r, sizeof(struct timespec)); - } - } - + status = pthread_rwlock_wrlock(&entry->source_lock); if (status) { logmsg("master_mapent source write lock failed"); fatal(status); } - return; } void master_source_readlock(struct master_mapent *entry) { + int retries = 5; /* 1 second maximum */ int status; - status = pthread_rwlock_rdlock(&entry->source_lock); + while (retries--) { + status = pthread_rwlock_tryrdlock(&entry->source_lock); + if (status != EAGAIN && status != EBUSY) + break; + else { + struct timespec t = { 0, 200000000 }; + struct timespec r; + while (nanosleep(&t, &r) == -1 && errno == EINTR) + memcpy(&t, &r, sizeof(struct timespec)); + } + } + if (status) { logmsg("master_mapent source read lock failed"); fatal(status); } + return; } Index: autofs-5.0.5/CHANGELOG =================================================================== --- autofs-5.0.5.orig/CHANGELOG +++ autofs-5.0.5/CHANGELOG @@ -86,6 +86,7 @@ - fix LDAP result leaks on error paths. - fix fix LDAP result leaks on error paths. - code analysis fixes part 1. +- fix wait for master source mutex. 03/09/2009 autofs-5.0.5 ----------------------- ++++++ autofs-5.0.6-task-use-after-free.patch ++++++ From: Leonardo Chiquitto <lchiquitto@suse.com> Subject: fix segmentation fault in st_queue_handler() References: bnc#727392 Index: autofs-5.0.5/daemon/state.c =================================================================== --- autofs-5.0.5.orig/daemon/state.c +++ autofs-5.0.5/daemon/state.c @@ -1150,12 +1150,12 @@ remove: struct state_queue, pending); list_del(&task->list); - free(task); list_del_init(&next->pending); list_add_tail(&next->list, head); if (p == head) p = head->next; + free(task); } if (list_empty(head)) continue with "q"... Remember to have fun... -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org