From dd8c67b33fb3d422afebc83c70e51e736669b0ad Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 26 Apr 2006 20:18:18 +0000 Subject: Updated to fedora-glibc-20060426T2000 --- ChangeLog | 73 ++++++++++++++- config.make.in | 1 + configure | 83 ++++++++++++++++- configure.in | 7 ++ fedora/branch.mk | 4 +- iconv/gconv_db.c | 4 +- iconvdata/Makefile | 3 +- iconvdata/tst-iconv6.c | 35 ++++++++ include/features.h | 2 +- locale/iso-4217.def | 15 ++-- localedata/ChangeLog | 14 +++ localedata/Makefile | 4 +- localedata/locales/bg_BG | 2 +- localedata/locales/bs_BA | 2 +- localedata/locales/es_MX | 2 +- localedata/locales/es_UY | 2 +- localedata/locales/ru_RU | 2 +- localedata/locales/tg_TJ | 2 +- localedata/locales/tt_RU | 2 +- localedata/tst-strfmon1.c | 42 +++++++++ nscd/Makefile | 5 +- nscd/connections.c | 13 +++ nscd/grpcache.c | 18 ++-- nscd/nscd-client.h | 4 +- nscd/nscd.conf | 5 +- nscd/nscd.h | 3 +- nscd/nscd_conf.c | 13 ++- nscd/nscd_helper.c | 10 ++- nscd/pwdcache.c | 17 ++-- nscd/selinux.c | 87 +++++++++++++++++- nscd/selinux.h | 12 ++- resolv/res_hconf.c | 165 +++++++--------------------------- resolv/res_hconf.h | 13 +-- stdio-common/printf_fp.c | 34 +++++-- stdlib/strfmon_l.c | 41 +++++---- sysdeps/posix/getaddrinfo.c | 2 +- sysdeps/unix/sysv/linux/Makefile | 2 + sysdeps/unix/sysv/linux/ia64/clone2.S | 6 +- sysdeps/unix/sysv/linux/tst-clone.c | 56 ++++++++++++ 39 files changed, 586 insertions(+), 221 deletions(-) create mode 100644 iconvdata/tst-iconv6.c create mode 100644 localedata/tst-strfmon1.c create mode 100644 sysdeps/unix/sysv/linux/tst-clone.c diff --git a/ChangeLog b/ChangeLog index 66ed5061c4..b62b22536b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,74 @@ +2006-04-26 Ulrich Drepper + + * sysdeps/posix/getaddrinfo.c (getaddrinfo): Fix typo which caused + bugs not to be reported. + + * nscd/nscd.h (struct database_dyn): Add propagate field. + * nscd/nscd_conf.c (nscd_parse_file): Parse auto-propagate lines. + * nscd/nscd.conf: Add auto-propagate lines. + * nscd/connections.c (dbs): Initialize .propagate fields. + * nscd/grpcache.c (cache_addgr): Do not add ID entry for name lookups + and vice versa if propagation is disabled for the database. + * nscd/pwdcache.c (cache_addpw): Likewise. + +2006-04-26 James Antill + Ulrich Drepper + + * config.make.in: Add have-libcap. + * configure.in: Check for libcap. + * nscd/Makefile (selinux-LIBS): Add -lcap if possible. + * nscd/connections.c (finish_drop_privileges): When libcap is available + call preserve_capabilities and install_real_capabilities. + * nscd/selinux.c: Define preserve_capabilities and + install_real_capabilities. + * nscd/selinux.h: Declare preserve_capabilities and + install_real_capabilities. + +2006-04-26 Ulrich Drepper + + * locale/iso-4217.def: Update. + +2006-04-25 Ulrich Drepper + + [BZ #2420] + * stdlib/strfmon_l.c (__vstrfmon_l): Fix handling of ! modifier. + * localedata/Makefile: Add rules to build and run tst-strfmon1. + * localedata/tst-strfmon1.c: New file. + + [BZ #2571] + * nscd/nscd_helper.c (__nscd_get_map_ref): Make mapptr argument a + volatile pointer so that the mapptr->mapped value is re-read after + the lock is retrieved. + * nscd/nscd-client.h: Update __nscd_get_map_ref prototype. + + * include/features.h [_GNU_SOURCE] (_POSIX_C_SOURCE): Define to + 200112L. + + * resolv/res_hconf.c: Minor surgery to 'cmd' and the referenced + functions to avoid relocations. + + [BZ #2389] + * resolv/res_hconf.c: Remove 'order' parsing. Just ignore the line. + * resolv/res_hconf.h: Remove Name_Service definition. + (struct hconf): Replace service related fields with placeholders. + + [BZ #2386] + * sysdeps/unix/sysv/linux/ia64/clone2.S: Check for NULL stack + pointers to match other architectures. + * sysdeps/unix/sysv/linux/Makefile [subdirs=misc] (tests): Add + tst-clone. + * sysdeps/unix/sysv/linux/tst-clone.c: New file. + + [BZ #2072] + * stdio-common/printf_fp.c: Fix potential memory leaks for + malloc'ed wbuffer which isn't freed in error conditions. + + [BZ #2569] + * iconv/gconv_db.c (__gconv_release_step): Fix condition of assert + call. + * iconvdata/Makefile (tests): Add tst-iconv6. + * iconvdata/tst-iconv6.c: New file. + 2006-04-24 Ulrich Drepper * posix/tst-rfc3484.c (do_test): Also initialize source_addr_flags @@ -7,7 +78,7 @@ * posix/tst-rfc3484.c: Include early. * posix/tst-rfc3484-2.c: Likewise. - * version.h (VERSION): Bunp to 2.4.90 for the trunk. + * version.h (VERSION): Bump to 2.4.90 for the trunk. 2006-04-24 Jakub Jelinek diff --git a/config.make.in b/config.make.in index 292dea667b..bc8998cd1f 100644 --- a/config.make.in +++ b/config.make.in @@ -61,6 +61,7 @@ have-fpie = @libc_cv_fpie@ have-ssp = @libc_cv_ssp@ have-selinux = @have_selinux@ have-libaudit = @have_libaudit@ +have-libcap = @have_libcap@ have-cc-with-libunwind = @libc_cv_cc_with_libunwind@ fno-unit-at-a-time = @fno_unit_at_a_time@ bind-now = @bindnow@ diff --git a/configure b/configure index 82188b299b..b9c8ee8c39 100755 --- a/configure +++ b/configure @@ -313,7 +313,7 @@ ac_includes_default="\ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_libcap have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -6831,6 +6831,86 @@ _ACEOF fi + + # See if we have the libcap library + echo "$as_me:$LINENO: checking for cap_init in -lcap" >&5 +echo $ECHO_N "checking for cap_init in -lcap... $ECHO_C" >&6 +if test "${ac_cv_lib_cap_cap_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcap $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char cap_init (); +int +main () +{ +cap_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_cap_cap_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_cap_cap_init=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_cap_cap_init" >&5 +echo "${ECHO_T}$ac_cv_lib_cap_cap_init" >&6 +if test $ac_cv_lib_cap_cap_init = yes; then + have_libcap=yes +else + have_libcap=no +fi + + if test "x$have_libcap" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBCAP 1 +_ACEOF + + fi + fi @@ -8423,6 +8503,7 @@ s,@no_whole_archive@,$no_whole_archive,;t t s,@exceptions@,$exceptions,;t t s,@LIBGD@,$LIBGD,;t t s,@have_libaudit@,$have_libaudit,;t t +s,@have_libcap@,$have_libcap,;t t s,@have_selinux@,$have_selinux,;t t s,@EGREP@,$EGREP,;t t s,@sizeof_long_double@,$sizeof_long_double,;t t diff --git a/configure.in b/configure.in index 83f09de805..79fa32ec2b 100644 --- a/configure.in +++ b/configure.in @@ -1982,6 +1982,13 @@ if test "x$have_selinux" = xyes; then AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support]) fi AC_SUBST(have_libaudit) + + # See if we have the libcap library + AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no) + if test "x$have_libcap" = xyes; then + AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support]) + fi + AC_SUBST(have_libcap) fi AC_SUBST(have_selinux) diff --git a/fedora/branch.mk b/fedora/branch.mk index 09345d02cc..3c74097cd1 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -3,5 +3,5 @@ glibc-branch := fedora glibc-base := HEAD DIST_BRANCH := devel COLLECTION := dist-fc4 -fedora-sync-date := 2006-04-25 09:03 UTC -fedora-sync-tag := fedora-glibc-20060425T0903 +fedora-sync-date := 2006-04-26 20:00 UTC +fedora-sync-tag := fedora-glibc-20060426T2000 diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c index 3431ce0812..6540cc393c 100644 --- a/iconv/gconv_db.c +++ b/iconv/gconv_db.c @@ -1,5 +1,5 @@ /* Provide access to the collection of available transformation modules. - Copyright (C) 1997-2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1997-2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -227,7 +227,7 @@ __gconv_release_step (struct __gconv_step *step) step->__shlib_handle = NULL; #endif } - else + else if (step->__shlib_handle == NULL) /* Builtin modules should not have end functions. */ assert (step->__end_fct == NULL); } diff --git a/iconvdata/Makefile b/iconvdata/Makefile index 1c80df16cf..1d3259179a 100644 --- a/iconvdata/Makefile +++ b/iconvdata/Makefile @@ -65,7 +65,8 @@ modules.so := $(addsuffix .so, $(modules)) include ../Makeconfig ifeq (yes,$(build-shared)) -tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 +tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \ + tst-iconv6 ifeq ($(have-thread-library),yes) tests += bug-iconv3 endif diff --git a/iconvdata/tst-iconv6.c b/iconvdata/tst-iconv6.c new file mode 100644 index 0000000000..accb21b113 --- /dev/null +++ b/iconvdata/tst-iconv6.c @@ -0,0 +1,35 @@ +/* BZ #2569 */ + +#include +#include + +static int +do_test (void) +{ + iconv_t cd0 = iconv_open ("ISO-8859-7", "UTF-16LE"); + if (cd0 == (iconv_t) -1) + { + puts ("first iconv_open failed"); + return 1; + } + iconv_t cd1 = iconv_open ("ISO-8859-7", "UTF-16LE"); + if (cd1 == (iconv_t) -1) + { + puts ("second iconv_open failed"); + return 1; + } + if (iconv_close (cd0) != 0) + { + puts ("first iconv_close failed"); + return 1; + } + if (iconv_close (cd1) != 0) + { + puts ("second iconv_close failed"); + return 1; + } + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/include/features.h b/include/features.h index 656caaf639..2428e08038 100644 --- a/include/features.h +++ b/include/features.h @@ -151,7 +151,7 @@ # undef _POSIX_SOURCE # define _POSIX_SOURCE 1 # undef _POSIX_C_SOURCE -# define _POSIX_C_SOURCE 199506L +# define _POSIX_C_SOURCE 200112L # undef _XOPEN_SOURCE # define _XOPEN_SOURCE 600 # undef _XOPEN_SOURCE_EXTENDED diff --git a/locale/iso-4217.def b/locale/iso-4217.def index fff5e40584..a40813271a 100644 --- a/locale/iso-4217.def +++ b/locale/iso-4217.def @@ -10,7 +10,7 @@ */ DEFINE_INT_CURR("ADP") /* Andorran Peseta -> EUR */ DEFINE_INT_CURR("AED") /* United Arab Emirates Dirham */ -DEFINE_INT_CURR("AFA") /* Afghanistan Afgani */ +DEFINE_INT_CURR("AFN") /* Afghanistan Afgani */ DEFINE_INT_CURR("ALL") /* Albanian Lek */ DEFINE_INT_CURR("AMD") /* Armenia Dram */ DEFINE_INT_CURR("ANG") /* Netherlands Antilles */ @@ -20,11 +20,11 @@ DEFINE_INT_CURR("ATS") /* Austrian Schilling -> EUR */ DEFINE_INT_CURR("AUD") /* Australian Dollar */ DEFINE_INT_CURR("AWG") /* Aruba Guilder */ DEFINE_INT_CURR("AZM") /* Azerbaijan Manat */ -DEFINE_INT_CURR("BAK") /* Bosnian and Herzegovina Convertible Mark */ +DEFINE_INT_CURR("BAM") /* Bosnian and Herzegovina Convertible Mark */ DEFINE_INT_CURR("BBD") /* Barbados Dollar */ DEFINE_INT_CURR("BDT") /* Bangladesh Taka */ DEFINE_INT_CURR("BEF") /* Belgian Franc -> EUR */ -DEFINE_INT_CURR("BGL") /* Bulgarian Lev */ +DEFINE_INT_CURR("BGN") /* Bulgarian Lev */ DEFINE_INT_CURR("BHD") /* Bahraini Dinar */ DEFINE_INT_CURR("BIF") /* Burundi Franc */ DEFINE_INT_CURR("BMD") /* Burmudian Dollar */ @@ -86,6 +86,7 @@ DEFINE_INT_CURR("IQD") /* Iraqi Dinar */ DEFINE_INT_CURR("IRR") /* Iranian Rial */ DEFINE_INT_CURR("ISK") /* Iceland Krona */ DEFINE_INT_CURR("ITL") /* Italian Lira -> EUR */ +DEFINE_INT_CURR("JEP") /* Jersey Pound */ DEFINE_INT_CURR("JMD") /* Jamaican Dollar */ DEFINE_INT_CURR("JOD") /* Jordanian Dinar */ DEFINE_INT_CURR("JPY") /* Japanese Yen */ @@ -119,7 +120,7 @@ DEFINE_INT_CURR("MTL") /* Maltese Lira */ DEFINE_INT_CURR("MUR") /* Mauritius Rupee */ DEFINE_INT_CURR("MVR") /* Maldives Rupee */ DEFINE_INT_CURR("MWK") /* Malawi Kwacha */ -DEFINE_INT_CURR("MXP") /* Mexican Peso */ +DEFINE_INT_CURR("MXN") /* Mexican Peso */ DEFINE_INT_CURR("MYR") /* Malaysian Ringgit */ DEFINE_INT_CURR("MZM") /* Mozambique Metical */ DEFINE_INT_CURR("NAD") /* Namibia Dollar */ @@ -140,7 +141,8 @@ DEFINE_INT_CURR("PTE") /* Portugese Escudo -> EUR */ DEFINE_INT_CURR("PYG") /* Paraguay Guarani */ DEFINE_INT_CURR("QAR") /* Qatar Rial */ DEFINE_INT_CURR("ROL") /* Romanian Leu */ -DEFINE_INT_CURR("RUR") /* Russian Ruble */ +DEFINE_INT_CURR("RON") /* Romanian New Leu */ +DEFINE_INT_CURR("RUB") /* Russian Ruble */ DEFINE_INT_CURR("RWF") /* Rwanda Franc */ DEFINE_INT_CURR("SAR") /* Saudi Arabia Riyal */ DEFINE_INT_CURR("SBD") /* Solomon Islands Dollar */ @@ -160,7 +162,7 @@ DEFINE_INT_CURR("SVC") /* El Salvador Colon */ DEFINE_INT_CURR("SYP") /* Syrian Arab Republic Pound */ DEFINE_INT_CURR("SZL") /* Swaziland Lilangeni */ DEFINE_INT_CURR("THB") /* Thai Baht */ -DEFINE_INT_CURR("TJR") /* Tajikistani Ruble */ +DEFINE_INT_CURR("TJS") /* Tajikistani Somoni */ DEFINE_INT_CURR("TMM") /* Turkmenistan Manet */ DEFINE_INT_CURR("TND") /* Tunisian Dinar */ DEFINE_INT_CURR("TOP") /* Tonga Pa'Anga */ @@ -184,7 +186,6 @@ DEFINE_INT_CURR("XDR") /* International Monetary Fund */ DEFINE_INT_CURR("XOF") /* West African Franc (Benin, Ivory Coast, Niger, Senegal, Togo, Upper Volta) */ DEFINE_INT_CURR("XPF") /* French polynesia, New Caledonia, Wallis and Futuna Islands */ DEFINE_INT_CURR("YER") /* Yemeni Rial */ -DEFINE_INT_CURR("YUM") /* Yugoslavian New Dinar */ DEFINE_INT_CURR("ZAR") /* South Africa Rand (Lesotho, Namibia) */ DEFINE_INT_CURR("ZMK") /* Zambian Kwacha */ DEFINE_INT_CURR("ZWD") /* Zimbabwe Dollar */ diff --git a/localedata/ChangeLog b/localedata/ChangeLog index de23e123e3..addfec9c9d 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,17 @@ +2006-04-26 Ulrich Drepper + + * bg_BG: Update after iso-4217.def update. + * bs_BA: Likewise. + * es_MX: Likewise. + * ru_RU: Likewise. + * tg_TJ: Likewise. + * tt_RU: Likewise. + +2006-04-25 Ulrich Drepper + + [BZ #2376] + * locales/es_UY: Change curreny_symbol. + 2006-04-24 Ulrich Drepper [BZ #2349] diff --git a/localedata/Makefile b/localedata/Makefile index ed76a897d0..278cd71081 100644 --- a/localedata/Makefile +++ b/localedata/Makefile @@ -92,7 +92,8 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \ tst_wctype tst_wcwidth tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \ - tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale + tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \ + tst-strfmon1 ifeq (yes,$(build-shared)) ifneq (no,$(PERL)) tests: $(objpfx)mtrace-tst-leaks @@ -283,6 +284,7 @@ tst-digits-ENV = $(TEST_MBWC_ENV) tst-mbswcs6-ENV = $(TEST_MBWC_ENV) tst-xlocale1-ENV = $(TEST_MBWC_ENV) tst-xlocale2-ENV = $(TEST_MBWC_ENV) +tst-strfmon1-ENV = $(TEST_MBWC_ENV) tst-setlocale-ENV = LOCPATH=$(common-objpfx)localedata LC_ALL=ja_JP.EUC-JP diff --git a/localedata/locales/bg_BG b/localedata/locales/bg_BG index 2736174c4a..bb15588f84 100644 --- a/localedata/locales/bg_BG +++ b/localedata/locales/bg_BG @@ -155,7 +155,7 @@ reorder-end END LC_COLLATE LC_MONETARY -int_curr_symbol "" +int_curr_symbol "" currency_symbol "" mon_decimal_point "" mon_thousands_sep "" diff --git a/localedata/locales/bs_BA b/localedata/locales/bs_BA index 80cc49ffda..9d0a0e6376 100644 --- a/localedata/locales/bs_BA +++ b/localedata/locales/bs_BA @@ -149,7 +149,7 @@ noexpr "" END LC_MESSAGES LC_MONETARY -int_curr_symbol "" +int_curr_symbol "" currency_symbol "" mon_decimal_point "" mon_thousands_sep "" diff --git a/localedata/locales/es_MX b/localedata/locales/es_MX index 70e5ae7abb..d090008da6 100644 --- a/localedata/locales/es_MX +++ b/localedata/locales/es_MX @@ -61,7 +61,7 @@ noexpr "" END LC_MESSAGES LC_MONETARY -int_curr_symbol "" +int_curr_symbol "" currency_symbol "" mon_decimal_point "" mon_thousands_sep "" diff --git a/localedata/locales/es_UY b/localedata/locales/es_UY index 36d18b1af2..50f8019da2 100644 --- a/localedata/locales/es_UY +++ b/localedata/locales/es_UY @@ -62,7 +62,7 @@ END LC_MESSAGES LC_MONETARY int_curr_symbol "" -currency_symbol "" +currency_symbol "" mon_decimal_point "" mon_thousands_sep "" mon_grouping 3;3 diff --git a/localedata/locales/ru_RU b/localedata/locales/ru_RU index 2fdffb12cb..0308c5b79a 100644 --- a/localedata/locales/ru_RU +++ b/localedata/locales/ru_RU @@ -74,7 +74,7 @@ noexpr "" END LC_MESSAGES LC_MONETARY -int_curr_symbol "" +int_curr_symbol "" currency_symbol "" mon_decimal_point "" mon_thousands_sep "" diff --git a/localedata/locales/tg_TJ b/localedata/locales/tg_TJ index 3f9b58a1fb..5cd8422259 100644 --- a/localedata/locales/tg_TJ +++ b/localedata/locales/tg_TJ @@ -126,7 +126,7 @@ noexpr "" END LC_MESSAGES LC_MONETARY -int_curr_symbol "" +int_curr_symbol "" currency_symbol "" mon_decimal_point "" mon_thousands_sep "" diff --git a/localedata/locales/tt_RU b/localedata/locales/tt_RU index 31a3de1c2b..858cfb8f4f 100644 --- a/localedata/locales/tt_RU +++ b/localedata/locales/tt_RU @@ -227,7 +227,7 @@ noexpr "" END LC_MESSAGES LC_MONETARY -int_curr_symbol "" +int_curr_symbol "" currency_symbol "" mon_decimal_point "" mon_thousands_sep "" diff --git a/localedata/tst-strfmon1.c b/localedata/tst-strfmon1.c new file mode 100644 index 0000000000..e30aa1b204 --- /dev/null +++ b/localedata/tst-strfmon1.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include + +static const struct +{ + const char *locale; + const char *expected; +} tests[] = + { + { "de_DE.ISO-8859-1", "|-12,34 EUR|-12,34|" }, + { "da_DK.ISO-8859-1", "|kr -12,34|-12,34|" }, + { "zh_TW.EUC-TW", "|-NT$12.34|-12.34|" }, + { "sv_SE.ISO-8859-1", "|-12,34 kr|-12,34|" } + }; +#define ntests (sizeof (tests) / sizeof (tests[0])) + + +static int +do_test (void) +{ + int res = 0; + for (int i = 0; i < ntests; ++i) + { + char buf[500]; + if (setlocale (LC_ALL, tests[i].locale) == NULL) + { + printf ("failed to set locale %s\n", tests[i].locale); + res = 1; + continue; + } + strfmon (buf, sizeof (buf), "|%n|%!n|", -12.34, -12.34); + int fail = strcmp (buf, tests[i].expected) != 0; + printf ("%s%s\n", buf, fail ? " *** FAIL ***" : ""); + res |= fail; + } + return res; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/nscd/Makefile b/nscd/Makefile index 0b35964e7b..9c98018217 100644 --- a/nscd/Makefile +++ b/nscd/Makefile @@ -55,10 +55,13 @@ all-nscd-modules := $(nscd-modules) selinux ifeq (yes,$(have-selinux)) ifeq (yes,$(have-libaudit)) libaudit = -laudit +ifeq (yes,$(have-libcap)) +libcap = -lcap +endif endif nscd-modules += selinux -selinux-LIBS := -lselinux $(libaudit) +selinux-LIBS := -lselinux $(libaudit) $(libcap) # The configure.in check for libselinux and its headers did not use # $SYSINCLUDES. The directory specified by --with-headers usually diff --git a/nscd/connections.c b/nscd/connections.c index 0426e6346f..a52082cba3 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -103,6 +103,7 @@ struct database_dyn dbs[lastdb] = .enabled = 0, .check_file = 1, .persistent = 0, + .propagate = 1, .shared = 0, .max_db_size = DEFAULT_MAX_DB_SIZE, .filename = "/etc/passwd", @@ -119,6 +120,7 @@ struct database_dyn dbs[lastdb] = .enabled = 0, .check_file = 1, .persistent = 0, + .propagate = 1, .shared = 0, .max_db_size = DEFAULT_MAX_DB_SIZE, .filename = "/etc/group", @@ -135,6 +137,7 @@ struct database_dyn dbs[lastdb] = .enabled = 0, .check_file = 1, .persistent = 0, + .propagate = 0, /* Not used. */ .shared = 0, .max_db_size = DEFAULT_MAX_DB_SIZE, .filename = "/etc/hosts", @@ -1859,6 +1862,11 @@ begin_drop_privileges (void) static void finish_drop_privileges (void) { +#if defined HAVE_LIBAUDIT && defined HAVE_LIBCAP + /* We need to preserve the capabilities to connect to the audit daemon. */ + cap_t new_caps = preserve_capabilities (); +#endif + if (setgroups (server_ngroups, server_groups) == -1) { dbg_log (_("Failed to run nscd as user '%s'"), server_user); @@ -1878,6 +1886,11 @@ finish_drop_privileges (void) perror ("setuid"); exit (4); } + +#if defined HAVE_LIBAUDIT && defined HAVE_LIBCAP + /* Remove the temporary capabilities. */ + install_real_capabilities (new_caps); +#endif } /* Handle the HUP signal which will force a dump of the cache */ diff --git a/nscd/grpcache.c b/nscd/grpcache.c index 4bc9977bc4..5a8fba4759 100644 --- a/nscd/grpcache.c +++ b/nscd/grpcache.c @@ -342,10 +342,10 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, marked with FIRST first. Otherwise we end up with dangling "pointers" in case a latter hash entry cannot be added. */ - bool first = req->type == GETGRBYNAME; + bool first = true; /* If the request was by GID, add that entry first. */ - if (req->type != GETGRBYNAME) + if (req->type == GETGRBYGID) { if (cache_add (GETGRBYGID, cp, key_offset, &dataset->head, true, db, owner) < 0) @@ -355,12 +355,14 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = false; goto out; } + + first = false; } /* If the key is different from the name add a separate entry. */ else if (strcmp (key_copy, gr_name) != 0) { if (cache_add (GETGRBYNAME, key_copy, key_len + 1, - &dataset->head, first, db, owner) < 0) + &dataset->head, true, db, owner) < 0) { /* Could not allocate memory. Make sure the data gets discarded. */ @@ -372,11 +374,13 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, } /* We have to add the value for both, byname and byuid. */ - if (__builtin_expect (cache_add (GETGRBYNAME, gr_name, gr_name_len, - &dataset->head, first, db, owner) - == 0, 1)) + if ((req->type == GETGRBYNAME || db->propagate) + && __builtin_expect (cache_add (GETGRBYNAME, gr_name, + gr_name_len, + &dataset->head, first, db, owner) + == 0, 1)) { - if (req->type == GETGRBYNAME) + if (req->type == GETGRBYNAME && db->propagate) (void) cache_add (GETGRBYGID, cp, key_offset, &dataset->head, req->type != GETGRBYNAME, db, owner); } diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h index 98c167eb62..440697f1be 100644 --- a/nscd/nscd-client.h +++ b/nscd/nscd-client.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1998, 1999, 2000, 2003, 2004, 2005 +/* Copyright (c) 1998, 1999, 2000, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1998. @@ -277,7 +277,7 @@ extern int __nscd_open_socket (const char *key, size_t keylen, /* Get reference of mapping. */ extern struct mapped_database *__nscd_get_map_ref (request_type type, const char *name, - struct locked_map_ptr *mapptr, + volatile struct locked_map_ptr *mapptr, int *gc_cyclep); /* Unmap database. */ diff --git a/nscd/nscd.conf b/nscd/nscd.conf index bde8e36219..4cdcb7dc9e 100644 --- a/nscd/nscd.conf +++ b/nscd/nscd.conf @@ -23,7 +23,8 @@ # check-files # persistent # shared -# max-db-szie +# max-db-size +* auto-propagate # # Currently supported cache names (services): passwd, group, hosts # @@ -47,6 +48,7 @@ persistent passwd yes shared passwd yes max-db-size passwd 33554432 + auto-propagate passwd yes enable-cache group yes positive-time-to-live group 3600 @@ -56,6 +58,7 @@ persistent group yes shared group yes max-db-size group 33554432 + auto-propagate group yes enable-cache hosts yes positive-time-to-live hosts 3600 diff --git a/nscd/nscd.h b/nscd/nscd.h index ed686bea7e..f826c7ada4 100644 --- a/nscd/nscd.h +++ b/nscd/nscd.h @@ -1,4 +1,4 @@ -/* Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004, 2005 +/* Copyright (c) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1998. @@ -63,6 +63,7 @@ struct database_dyn int check_file; int persistent; int shared; + int propagate; size_t max_db_size; const char *filename; const char *db_filename; diff --git a/nscd/nscd_conf.c b/nscd/nscd_conf.c index 579ddd402f..2048eca886 100644 --- a/nscd/nscd_conf.c +++ b/nscd/nscd_conf.c @@ -1,4 +1,4 @@ -/* Copyright (c) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (c) 1998,2000,2003,2004,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk , 1998. @@ -256,6 +256,17 @@ nscd_parse_file (const char *fname, struct database_dyn dbs[lastdb]) else error (0, 0, _("Must specify value for restart-interval option")); } + else if (strcmp (entry, "auto-propagate") == 0) + { + int idx = find_db (arg1); + if (idx >= 0) + { + if (strcmp (arg2, "no") == 0) + dbs[idx].propagate = 0; + else if (strcmp (arg2, "yes") == 0) + dbs[idx].propagate = 1; + } + } else error (0, 0, _("Unknown option: %s %s %s"), entry, arg1, arg2); } diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c index fd749446be..1dfe746d7a 100644 --- a/nscd/nscd_helper.c +++ b/nscd/nscd_helper.c @@ -316,17 +316,18 @@ get_mapping (request_type type, const char *key, struct mapped_database * __nscd_get_map_ref (request_type type, const char *name, - struct locked_map_ptr *mapptr, int *gc_cyclep) + volatile struct locked_map_ptr *mapptr, int *gc_cyclep) { struct mapped_database *cur = mapptr->mapped; if (cur == NO_MAPPING) return cur; int cnt = 0; - while (atomic_compare_and_exchange_val_acq (&mapptr->lock, 1, 0) != 0) + while (__builtin_expect (atomic_compare_and_exchange_val_acq (&mapptr->lock, + 1, 0) != 0, 0)) { // XXX Best number of rounds? - if (++cnt > 5) + if (__builtin_expect (++cnt > 5, 0)) return NO_MAPPING; atomic_delay (); @@ -340,7 +341,8 @@ __nscd_get_map_ref (request_type type, const char *name, if (cur == NULL || (cur->head->nscd_certainly_running == 0 && cur->head->timestamp + MAPPING_TIMEOUT < time (NULL))) - cur = get_mapping (type, name, &mapptr->mapped); + cur = get_mapping (type, name, + (struct mapped_database **) &mapptr->mapped); if (__builtin_expect (cur != NO_MAPPING, 1)) { diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c index 2daff79d78..01c223add5 100644 --- a/nscd/pwdcache.c +++ b/nscd/pwdcache.c @@ -338,10 +338,10 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, marked with FIRST first. Otherwise we end up with dangling "pointers" in case a latter hash entry cannot be added. */ - bool first = req->type == GETPWBYNAME; + bool first = true; /* If the request was by UID, add that entry first. */ - if (req->type != GETPWBYNAME) + if (req->type == GETPWBYUID) { if (cache_add (GETPWBYUID, cp, key_offset, &dataset->head, true, db, owner) < 0) @@ -351,12 +351,14 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, dataset->head.usable = false; goto out; } + + first = false; } /* If the key is different from the name add a separate entry. */ else if (strcmp (key_copy, dataset->strdata) != 0) { if (cache_add (GETPWBYNAME, key_copy, key_len + 1, - &dataset->head, first, db, owner) < 0) + &dataset->head, true, db, owner) < 0) { /* Could not allocate memory. Make sure the data gets discarded. */ @@ -368,11 +370,12 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, } /* We have to add the value for both, byname and byuid. */ - if (__builtin_expect (cache_add (GETPWBYNAME, dataset->strdata, - pw_name_len, &dataset->head, first, - db, owner) == 0, 1)) + if ((req->type == GETPWBYNAME || db->propagate) + && __builtin_expect (cache_add (GETPWBYNAME, dataset->strdata, + pw_name_len, &dataset->head, + first, db, owner) == 0, 1)) { - if (req->type == GETPWBYNAME) + if (req->type == GETPWBYNAME && db->propagate) (void) cache_add (GETPWBYUID, cp, key_offset, &dataset->head, req->type != GETPWBYNAME, db, owner); } diff --git a/nscd/selinux.c b/nscd/selinux.c index c59251f1b5..f123d68b93 100644 --- a/nscd/selinux.c +++ b/nscd/selinux.c @@ -28,12 +28,13 @@ #include #include #include +#include #include #include #include #include #ifdef HAVE_LIBAUDIT -#include +# include #endif #include "dbg_log.h" @@ -149,6 +150,90 @@ audit_init (void) && errno != EINVAL && errno != EPROTONOSUPPORT && errno != EAFNOSUPPORT) dbg_log (_("Failed opening connection to the audit subsystem: %m")); } + + +# ifdef HAVE_LIBCAP +static const cap_value_t new_cap_list[] = + { CAP_AUDIT_WRITE }; +# define nnew_cap_list (sizeof (new_cap_list) / sizeof (new_cap_list[0])) +static const cap_value_t tmp_cap_list[] = + { CAP_AUDIT_WRITE, CAP_SETUID, CAP_SETGID }; +# define ntmp_cap_list (sizeof (tmp_cap_list) / sizeof (tmp_cap_list[0])) + +cap_t +preserve_capabilities (void) +{ + if (getuid () != 0) + /* Not root, then we cannot preserve anything. */ + return NULL; + + if (prctl (PR_SET_KEEPCAPS, 1) == -1) + { + dbg_log (_("Failed to set keep-capabilities")); + error (EXIT_FAILURE, errno, _("prctl(KEEPCAPS) failed")); + /* NOTREACHED */ + } + + cap_t tmp_caps = cap_init (); + cap_t new_caps; + if (tmp_caps != NULL) + new_caps = cap_init (); + + if (tmp_caps == NULL || new_caps == NULL) + { + if (tmp_caps != NULL) + free_caps (tmp_caps); + + dbg_log (_("Failed to initialize drop of capabilities")); + error (EXIT_FAILURE, 0, _("cap_init failed")); + } + + /* There is no reason why these should not work. */ + cap_set_flag (new_caps, CAP_PERMITTED, nnew_cap_list, new_cap_list, CAP_SET); + cap_set_flag (new_caps, CAP_EFFECTIVE, nnew_cap_list, new_cap_list, CAP_SET); + + cap_set_flag (tmp_caps, CAP_PERMITTED, ntmp_cap_list, tmp_cap_list, CAP_SET); + cap_set_flag (tmp_caps, CAP_EFFECTIVE, ntmp_cap_list, tmp_cap_list, CAP_SET); + + int res = cap_set_proc (tmp_caps); + + cap_free (tmp_caps); + + if (__builtin_expect (res != 0, 0)) + { + cap_free (new_caps); + dbg_log (_("Failed to drop capabilities\n")); + error (EXIT_FAILURE, 0, _("cap_set_proc failed")); + } + + return new_caps; +} + +void +install_real_capabilities (cap_t new_caps) +{ + /* If we have no capabilities there is nothing to do here. */ + if (new_caps == NULL) + return; + + if (cap_set_proc (new_caps)) + { + cap_free (new_caps); + dbg_log (_("Failed to drop capabilities")); + error (EXIT_FAILURE, 0, _("cap_set_proc failed")); + /* NOTREACHED */ + } + + cap_free (new_caps); + + if (prctl (PR_SET_KEEPCAPS, 0) == -1) + { + dbg_log (_("Failed to unset keep-capabilities")); + error (EXIT_FAILURE, errno, _("prctl(KEEPCAPS) failed")); + /* NOTREACHED */ + } +} +# endif /* HAVE_LIBCAP */ #endif /* HAVE_LIBAUDIT */ /* Determine if we are running on an SELinux kernel. Set selinux_enabled diff --git a/nscd/selinux.h b/nscd/selinux.h index b9eb053aa0..9ce0628486 100644 --- a/nscd/selinux.h +++ b/nscd/selinux.h @@ -1,5 +1,5 @@ /* Header for nscd SELinux access controls. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Matthew Rickard , 2004. @@ -22,6 +22,9 @@ #define _SELINUX_H 1 #include "nscd.h" +#ifdef HAVE_LIBCAP +# include +#endif #ifdef HAVE_SELINUX /* Global variable to tell if the kernel has SELinux support. */ @@ -42,6 +45,13 @@ extern int nscd_request_avc_has_perm (int fd, request_type req); extern void nscd_avc_cache_stats (struct avc_cache_stats *cstats); /* Display statistics on AVC usage. */ extern void nscd_avc_print_stats (struct avc_cache_stats *cstats); + +# ifdef HAVE_LIBCAP +/* Preserve capabilities to connect to connnect to the audit daemon. */ +extern cap_t preserve_capabilities (void); +/* Install final capabilities. */ +extern void install_real_capabilities (cap_t new_caps); +# endif #else # define selinux_enabled 0 # define nscd_avc_init() (void) 0 diff --git a/resolv/res_hconf.c b/resolv/res_hconf.c index c54b28dadd..f45888933f 100644 --- a/resolv/res_hconf.c +++ b/resolv/res_hconf.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995-2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger (davidm@azstarnet.com). @@ -53,35 +53,34 @@ /* Environment vars that all user to override default behavior: */ #define ENV_HOSTCONF "RESOLV_HOST_CONF" -#define ENV_SERVORDER "RESOLV_SERV_ORDER" #define ENV_SPOOF "RESOLV_SPOOF_CHECK" #define ENV_TRIM_OVERR "RESOLV_OVERRIDE_TRIM_DOMAINS" #define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS" #define ENV_MULTI "RESOLV_MULTI" #define ENV_REORDER "RESOLV_REORDER" -static const char *arg_service_list (const char *, int, const char *, - unsigned int); -static const char *arg_trimdomain_list (const char *, int, const char *, - unsigned int); -static const char *arg_spoof (const char *, int, const char *, unsigned int); -static const char *arg_bool (const char *, int, const char *, unsigned int); +enum parse_cbs + { + CB_none, + CB_arg_trimdomain_list, + CB_arg_spoof, + CB_arg_bool + }; static const struct cmd { - const char *name; - const char *(*parse_args) (const char * filename, int line_num, - const char * args, unsigned int arg); + const char name[11]; + uint8_t cb; unsigned int arg; } cmd[] = { - {"order", arg_service_list, 0}, - {"trim", arg_trimdomain_list, 0}, - {"spoof", arg_spoof, 0}, - {"multi", arg_bool, HCONF_FLAG_MULTI}, - {"nospoof", arg_bool, HCONF_FLAG_SPOOF}, - {"spoofalert", arg_bool, HCONF_FLAG_SPOOFALERT}, - {"reorder", arg_bool, HCONF_FLAG_REORDER} + {"order", CB_none, 0}, + {"trim", CB_arg_trimdomain_list, 0}, + {"spoof", CB_arg_spoof, 0}, + {"multi", CB_arg_bool, HCONF_FLAG_MULTI}, + {"nospoof", CB_arg_bool, HCONF_FLAG_SPOOF}, + {"spoofalert", CB_arg_bool, HCONF_FLAG_SPOOFALERT}, + {"reorder", CB_arg_bool, HCONF_FLAG_REORDER} }; /* Structure containing the state. */ @@ -107,103 +106,7 @@ skip_string (const char *str) static const char * -arg_service_list (const char *fname, int line_num, const char *args, - unsigned int arg) -{ - enum Name_Service service; - const char *start; - size_t len; - size_t i; - static const struct - { - const char name[6]; - int16_t service; - } svcs[] = - { - {"bind", SERVICE_BIND}, - {"hosts", SERVICE_HOSTS}, - {"nis", SERVICE_NIS}, - }; - - do - { - start = args; - args = skip_string (args); - len = args - start; - - service = SERVICE_NONE; - for (i = 0; i < sizeof (svcs) / sizeof (svcs[0]); ++i) - { - if (__strncasecmp (start, svcs[i].name, len) == 0 - && len == strlen (svcs[i].name)) - { - service = svcs[i].service; - break; - } - } - if (service == SERVICE_NONE) - { - char *buf; - - if (__asprintf (&buf, - _("%s: line %d: expected service, found `%s'\n"), - fname, line_num, start) < 0) - return 0; - - __fxprintf (NULL, "%s", buf); - - free (buf); - return 0; - } - if (_res_hconf.num_services >= SERVICE_MAX) - { - char *buf; - - if (__asprintf (&buf, _("\ -%s: line %d: cannot specify more than %d services"), - fname, line_num, SERVICE_MAX) < 0) - return 0; - - __fxprintf (NULL, "%s", buf); - - free (buf); - return 0; - } - _res_hconf.service[_res_hconf.num_services++] = service; - - args = skip_ws (args); - switch (*args) - { - case ',': - case ';': - case ':': - args = skip_ws (++args); - if (!*args || *args == '#') - { - char *buf; - - if (__asprintf (&buf, _("\ -%s: line %d: list delimiter not followed by keyword"), - fname, line_num) < 0) - return 0; - - __fxprintf (NULL, "%s", buf); - - free (buf); - return 0; - } - default: - break; - } - } - while (*args && *args != '#'); - return args; -} - - -static const char * -arg_trimdomain_list (const char *fname, int line_num, const char *args, - unsigned int flag) +arg_trimdomain_list (const char *fname, int line_num, const char *args) { const char * start; size_t len; @@ -259,7 +162,7 @@ arg_trimdomain_list (const char *fname, int line_num, const char *args, static const char * -arg_spoof (const char *fname, int line_num, const char *args, unsigned flag) +arg_spoof (const char *fname, int line_num, const char *args) { const char *start = args; size_t len; @@ -353,7 +256,17 @@ parse_line (const char *fname, int line_num, const char *str) /* process args: */ str = skip_ws (str); - str = (*c->parse_args) (fname, line_num, str, c->arg); + + if (c->cb == CB_arg_trimdomain_list) + str = arg_trimdomain_list (fname, line_num, str); + else if (c->cb == CB_arg_spoof) + str = arg_spoof (fname, line_num, str); + else if (c->cb == CB_arg_bool) + str = arg_bool (fname, line_num, str, c->arg); + else + /* Ignore the line. */ + return; + if (!str) return; @@ -396,10 +309,7 @@ do_init (void) hconf_name = _PATH_HOSTCONF; fp = fopen (hconf_name, "rc"); - if (!fp) - /* make up something reasonable: */ - _res_hconf.service[_res_hconf.num_services++] = SERVICE_BIND; - else + if (fp) { /* No threads using this stream. */ __fsetlocking (fp, FSETLOCKING_BYCALLER); @@ -413,16 +323,9 @@ do_init (void) fclose (fp); } - envval = getenv (ENV_SERVORDER); - if (envval) - { - _res_hconf.num_services = 0; - arg_service_list (ENV_SERVORDER, 1, envval, 0); - } - envval = getenv (ENV_SPOOF); if (envval) - arg_spoof (ENV_SPOOF, 1, envval, 0); + arg_spoof (ENV_SPOOF, 1, envval); envval = getenv (ENV_MULTI); if (envval) @@ -434,13 +337,13 @@ do_init (void) envval = getenv (ENV_TRIM_ADD); if (envval) - arg_trimdomain_list (ENV_TRIM_ADD, 1, envval, 0); + arg_trimdomain_list (ENV_TRIM_ADD, 1, envval); envval = getenv (ENV_TRIM_OVERR); if (envval) { _res_hconf.num_trimdomains = 0; - arg_trimdomain_list (ENV_TRIM_OVERR, 1, envval, 0); + arg_trimdomain_list (ENV_TRIM_OVERR, 1, envval); } _res_hconf.initialized = 1; diff --git a/resolv/res_hconf.h b/resolv/res_hconf.h index 77eeca4dea..b40da0df74 100644 --- a/resolv/res_hconf.h +++ b/resolv/res_hconf.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995-1998, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger (davidm@azstarnet.com). @@ -24,18 +24,11 @@ #define TRIMDOMAINS_MAX 4 -enum Name_Service -{ - SERVICE_NONE = 0, - SERVICE_BIND, SERVICE_HOSTS, SERVICE_NIS, - SERVICE_MAX -}; - struct hconf { int initialized; - int num_services; - enum Name_Service service[SERVICE_MAX]; + int unused1; + int unused2[4]; int num_trimdomains; const char *trimdomain[TRIMDOMAINS_MAX]; unsigned int flags; diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index 8a68f1948d..e4e32f9c28 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -72,7 +72,11 @@ { \ register const int outc = (ch); \ if (putc (outc, fp) == EOF) \ - return -1; \ + { \ + if (buffer_malloced) \ + free (wbuffer); \ + return -1; \ + } \ ++done; \ } while (0) @@ -83,7 +87,11 @@ if (len > 20) \ { \ if (PUT (fp, wide ? (const char *) wptr : ptr, outlen) != outlen) \ - return -1; \ + { \ + if (buffer_malloced) \ + free (wbuffer); \ + return -1; \ + } \ ptr += outlen; \ done += outlen; \ } \ @@ -102,7 +110,11 @@ do \ { \ if (PAD (fp, ch, len) != len) \ - return -1; \ + { \ + if (buffer_malloced) \ + free (wbuffer); \ + return -1; \ + } \ done += len; \ } \ while (0) @@ -200,6 +212,11 @@ ___printf_fp (FILE *fp, /* Nonzero if this is output on a wide character stream. */ int wide = info->wide; + /* Buffer in which we produce the output. */ + wchar_t *wbuffer = NULL; + /* Flag whether wbuffer is malloc'ed or not. */ + int buffer_malloced = 0; + auto wchar_t hack_digit (void); wchar_t hack_digit (void) @@ -790,8 +807,7 @@ ___printf_fp (FILE *fp, { int width = info->width; - wchar_t *wbuffer, *wstartp, *wcp; - int buffer_malloced; + wchar_t *wstartp, *wcp; int chars_needed; int expscale; int intdig_max, intdig_no = 0; @@ -1109,8 +1125,12 @@ ___printf_fp (FILE *fp, buffer = (char *) malloc (2 + chars_needed + decimal_len + ngroups * thousands_sep_len); if (buffer == NULL) - /* Signal an error to the caller. */ - return -1; + { + /* Signal an error to the caller. */ + if (buffer_malloced) + free (wbuffer); + return -1; + } } else buffer = (char *) alloca (2 + chars_needed + decimal_len diff --git a/stdlib/strfmon_l.c b/stdlib/strfmon_l.c index f6d52e0b56..c9f3a47b41 100644 --- a/stdlib/strfmon_l.c +++ b/stdlib/strfmon_l.c @@ -486,23 +486,21 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, } if (print_curr_symbol) - { - out_string (currency_symbol); + out_string (currency_symbol); - if (sign_posn == 4) - { - if (sep_by_space == 2) - out_char (space_char); - out_string (sign_string); - if (sep_by_space == 1) - /* POSIX.2 and SUS are not clear on this case, but C99 - says a space follows the adjacent-symbol-and-sign */ - out_char (' '); - } - else - if (sep_by_space == 1) - out_char (space_char); + if (sign_posn == 4) + { + if (print_curr_symbol && sep_by_space == 2) + out_char (space_char); + out_string (sign_string); + if (sep_by_space == 1) + /* POSIX.2 and SUS are not clear on this case, but C99 + says a space follows the adjacent-symbol-and-sign */ + out_char (' '); } + else + if (print_curr_symbol && sep_by_space == 1) + out_char (space_char); } else if (sign_posn != 0 && sign_posn != 2 && sign_posn != 3 @@ -561,12 +559,13 @@ __vstrfmon_l (char *s, size_t maxsize, __locale_t loc, const char *format, || (sign_posn == 0 && sep_by_space == 1)) out_char (space_char); out_nstring (currency_symbol, currency_symbol_len); - if (sign_posn == 4) - { - if (sep_by_space == 2) - out_char (' '); - out_string (sign_string); - } + } + + if (sign_posn == 4) + { + if (sep_by_space == 2) + out_char (' '); + out_string (sign_string); } } diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index e4fea334ca..03d26086ac 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -1643,7 +1643,7 @@ getaddrinfo (const char *name, const char *service, freeaddrinfo (p); free (in6ai); - return -(i & GAIH_EAI); + return -(last_i & GAIH_EAI); } if (end) while (*end) diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 812cd97c80..8bec6cdb85 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -28,6 +28,8 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \ install-others += $(inst_includedir)/bits/syscall.h +tests += tst-clone + # Generate the list of SYS_* macros for the system calls (__NR_* macros). # For bi-arch platforms, the CPU/Makefile defines {32,64}bit-predefine and # we generate a file that uses . diff --git a/sysdeps/unix/sysv/linux/ia64/clone2.S b/sysdeps/unix/sysv/linux/ia64/clone2.S index 69c9e05044..d38eb201ad 100644 --- a/sysdeps/unix/sysv/linux/ia64/clone2.S +++ b/sysdeps/unix/sysv/linux/ia64/clone2.S @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2003, 2004, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -32,10 +32,12 @@ ENTRY(__clone2) .prologue alloc r2=ar.pfs,8,1,6,0 cmp.eq p6,p0=0,in0 + cmp.eq p7,p0=0,in1 mov r8=EINVAL mov out0=in3 /* Flags are first syscall argument. */ mov out1=in1 /* Stack address. */ -(p6) br.cond.spnt.many __syscall_error +(p6) br.cond.spnt.many __syscall_error /* no NULL function pointers */ +(p7) br.cond.spnt.many __syscall_error /* no NULL stack pointers */ ;; mov out2=in2 /* Stack size. */ mov out3=in5 /* Parent TID Pointer */ diff --git a/sysdeps/unix/sysv/linux/tst-clone.c b/sysdeps/unix/sysv/linux/tst-clone.c new file mode 100644 index 0000000000..8e249c2f04 --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-clone.c @@ -0,0 +1,56 @@ +/* Test for proper error/errno handling in clone. + Copyright (C) 2006 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* BZ #2386 */ +#include +#include +#include +#include +#include + +int child_fn(void *arg) +{ + puts ("FAIL: in child_fn(); should not be here"); + exit(1); +} + +static int +do_test (void) +{ + int result; + +#ifdef __ia64__ + result = __clone2(child_fn, NULL, 0, 0, NULL, NULL, NULL); +#else + result = clone(child_fn, NULL, (int) NULL, NULL); +#endif + + if (errno != EINVAL || result != -1) + { + printf ("FAIL: clone()=%d (wanted -1) errno=%d (wanted %d)\n", + result, errno, EINVAL); + return 1; + } + + puts ("All OK"); + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" -- cgit v1.2.3