From: Ben Hutchings Date: Wed, 14 Jul 2010 01:57:29 +0000 (+0100) Subject: Merge branch 'upstream' X-Git-Tag: debian/1%1.1.1_git-20070929-1~1 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=6826dcf4e9e00f466ecaeeb8369dc7308df36a86;hp=9a5812b2f70c7fca4e862d11b9f567339389c534 Merge branch 'upstream' Conflicts: Makefile.in autom4te.cache/output.0 autom4te.cache/output.1 autom4te.cache/traces.0 autom4te.cache/traces.1 config.guess config.sub configure linux-nfs/Makefile.in support/Makefile.in support/export/Makefile.in support/include/Makefile.in support/include/nfs/Makefile.in support/include/rpcsvc/Makefile.in support/include/sys/Makefile.in support/include/sys/fs/Makefile.in support/misc/Makefile.in support/nfs/Makefile.in tools/Makefile.in tools/locktest/Makefile.in tools/nlmtest/Makefile.in tools/rpcdebug/Makefile.in tools/rpcgen/Makefile.in utils/Makefile.in utils/exportfs/Makefile.in utils/gssd/Makefile.in utils/idmapd/Makefile.in utils/mount/Makefile.in utils/mountd/Makefile.in utils/nfsd/Makefile.in utils/nfsstat/Makefile.in utils/showmount/Makefile.in utils/statd/Makefile.in --- diff --git a/Makefile.in b/Makefile.in index 2e69faa..2d4c4f3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -122,9 +122,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/autom4te.cache/output.0 b/autom4te.cache/output.0 index 6fc7732..fd2267a 100644 --- a/autom4te.cache/output.0 +++ b/autom4te.cache/output.0 @@ -904,8 +904,8 @@ LIBNSL PKG_CONFIG RPCSECGSS_CFLAGS RPCSECGSS_LIBS -GSSAPI_CFLAGS -GSSAPI_LIBS +GSSGLUE_CFLAGS +GSSGLUE_LIBS LIBSOCKET LIBCRYPT LIBBSD @@ -944,8 +944,8 @@ FFLAGS PKG_CONFIG RPCSECGSS_CFLAGS RPCSECGSS_LIBS -GSSAPI_CFLAGS -GSSAPI_LIBS' +GSSGLUE_CFLAGS +GSSGLUE_LIBS' # Initialize some variables set by options. @@ -1583,9 +1583,10 @@ Some influential environment variables: C compiler flags for RPCSECGSS, overriding pkg-config RPCSECGSS_LIBS linker flags for RPCSECGSS, overriding pkg-config - GSSAPI_CFLAGS - C compiler flags for GSSAPI, overriding pkg-config - GSSAPI_LIBS linker flags for GSSAPI, overriding pkg-config + GSSGLUE_CFLAGS + C compiler flags for GSSGLUE, overriding pkg-config + GSSGLUE_LIBS + linker flags for GSSGLUE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -22643,12 +22644,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_RPCSECGSS_CFLAGS="$RPCSECGSS_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.10\"") >&5 - ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.10") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.16\"") >&5 + ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.16") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_RPCSECGSS_CFLAGS=`$PKG_CONFIG --cflags "librpcsecgss >= 0.10" 2>/dev/null` + pkg_cv_RPCSECGSS_CFLAGS=`$PKG_CONFIG --cflags "librpcsecgss >= 0.16" 2>/dev/null` else pkg_failed=yes fi @@ -22661,12 +22662,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_RPCSECGSS_LIBS="$RPCSECGSS_LIBS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.10\"") >&5 - ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.10") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.16\"") >&5 + ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.16") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_RPCSECGSS_LIBS=`$PKG_CONFIG --libs "librpcsecgss >= 0.10" 2>/dev/null` + pkg_cv_RPCSECGSS_LIBS=`$PKG_CONFIG --libs "librpcsecgss >= 0.16" 2>/dev/null` else pkg_failed=yes fi @@ -22685,9 +22686,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "librpcsecgss >= 0.10"` + RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "librpcsecgss >= 0.16"` else - RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "librpcsecgss >= 0.10"` + RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "librpcsecgss >= 0.16"` fi # Put the nasty error message in config.log where it belongs echo "$RPCSECGSS_PKG_ERRORS" >&5 @@ -22714,20 +22715,20 @@ echo "${ECHO_T}yes" >&6; } fi pkg_failed=no -{ echo "$as_me:$LINENO: checking for GSSAPI" >&5 -echo $ECHO_N "checking for GSSAPI... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: checking for GSSGLUE" >&5 +echo $ECHO_N "checking for GSSGLUE... $ECHO_C" >&6; } if test -n "$PKG_CONFIG"; then - if test -n "$GSSAPI_CFLAGS"; then - pkg_cv_GSSAPI_CFLAGS="$GSSAPI_CFLAGS" + if test -n "$GSSGLUE_CFLAGS"; then + pkg_cv_GSSGLUE_CFLAGS="$GSSGLUE_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssapi >= 0.11\"") >&5 - ($PKG_CONFIG --exists --print-errors "libgssapi >= 0.11") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssglue >= 0.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgssglue >= 0.1") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_GSSAPI_CFLAGS=`$PKG_CONFIG --cflags "libgssapi >= 0.11" 2>/dev/null` + pkg_cv_GSSGLUE_CFLAGS=`$PKG_CONFIG --cflags "libgssglue >= 0.1" 2>/dev/null` else pkg_failed=yes fi @@ -22736,16 +22737,16 @@ else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then - if test -n "$GSSAPI_LIBS"; then - pkg_cv_GSSAPI_LIBS="$GSSAPI_LIBS" + if test -n "$GSSGLUE_LIBS"; then + pkg_cv_GSSGLUE_LIBS="$GSSGLUE_LIBS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssapi >= 0.11\"") >&5 - ($PKG_CONFIG --exists --print-errors "libgssapi >= 0.11") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssglue >= 0.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgssglue >= 0.1") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_GSSAPI_LIBS=`$PKG_CONFIG --libs "libgssapi >= 0.11" 2>/dev/null` + pkg_cv_GSSGLUE_LIBS=`$PKG_CONFIG --libs "libgssglue >= 0.1" 2>/dev/null` else pkg_failed=yes fi @@ -22764,33 +22765,33 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GSSAPI_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libgssapi >= 0.11"` + GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libgssglue >= 0.1"` else - GSSAPI_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libgssapi >= 0.11"` + GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libgssglue >= 0.1"` fi # Put the nasty error message in config.log where it belongs - echo "$GSSAPI_PKG_ERRORS" >&5 + echo "$GSSGLUE_PKG_ERRORS" >&5 - { { echo "$as_me:$LINENO: error: Package requirements (libgssapi >= 0.11) were not met: + { { echo "$as_me:$LINENO: error: Package requirements (libgssglue >= 0.1) were not met: -$GSSAPI_PKG_ERRORS +$GSSGLUE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 -echo "$as_me: error: Package requirements (libgssapi >= 0.11) were not met: +echo "$as_me: error: Package requirements (libgssglue >= 0.1) were not met: -$GSSAPI_PKG_ERRORS +$GSSGLUE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&2;} { (exit 1); exit 1; }; } @@ -22799,8 +22800,8 @@ elif test $pkg_failed = untried; then is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . @@ -22809,16 +22810,16 @@ echo "$as_me: error: The pkg-config script could not be found or is too old. Ma is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else - GSSAPI_CFLAGS=$pkg_cv_GSSAPI_CFLAGS - GSSAPI_LIBS=$pkg_cv_GSSAPI_LIBS + GSSGLUE_CFLAGS=$pkg_cv_GSSGLUE_CFLAGS + GSSGLUE_LIBS=$pkg_cv_GSSGLUE_LIBS { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } : @@ -24032,7 +24033,7 @@ if test "${ac_cv_lib_rpcsecgss_authgss_create_default+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lrpcsecgss -lgssapi -ldl $LIBS" +LIBS="-lrpcsecgss -lgssglue -ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -24101,7 +24102,7 @@ if test "${ac_cv_lib_rpcsecgss_authgss_set_debug_level+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lrpcsecgss -lgssapi -ldl $LIBS" +LIBS="-lrpcsecgss -lgssglue -ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -30881,8 +30882,8 @@ LIBNSL!$LIBNSL$ac_delim PKG_CONFIG!$PKG_CONFIG$ac_delim RPCSECGSS_CFLAGS!$RPCSECGSS_CFLAGS$ac_delim RPCSECGSS_LIBS!$RPCSECGSS_LIBS$ac_delim -GSSAPI_CFLAGS!$GSSAPI_CFLAGS$ac_delim -GSSAPI_LIBS!$GSSAPI_LIBS$ac_delim +GSSGLUE_CFLAGS!$GSSGLUE_CFLAGS$ac_delim +GSSGLUE_LIBS!$GSSGLUE_LIBS$ac_delim LIBSOCKET!$LIBSOCKET$ac_delim LIBCRYPT!$LIBCRYPT$ac_delim LIBBSD!$LIBBSD$ac_delim diff --git a/autom4te.cache/output.1 b/autom4te.cache/output.1 index 91167b9..98bdfe8 100644 --- a/autom4te.cache/output.1 +++ b/autom4te.cache/output.1 @@ -904,8 +904,8 @@ LIBNSL PKG_CONFIG RPCSECGSS_CFLAGS RPCSECGSS_LIBS -GSSAPI_CFLAGS -GSSAPI_LIBS +GSSGLUE_CFLAGS +GSSGLUE_LIBS LIBSOCKET LIBCRYPT LIBBSD @@ -944,8 +944,8 @@ FFLAGS PKG_CONFIG RPCSECGSS_CFLAGS RPCSECGSS_LIBS -GSSAPI_CFLAGS -GSSAPI_LIBS' +GSSGLUE_CFLAGS +GSSGLUE_LIBS' # Initialize some variables set by options. @@ -1583,9 +1583,10 @@ Some influential environment variables: C compiler flags for RPCSECGSS, overriding pkg-config RPCSECGSS_LIBS linker flags for RPCSECGSS, overriding pkg-config - GSSAPI_CFLAGS - C compiler flags for GSSAPI, overriding pkg-config - GSSAPI_LIBS linker flags for GSSAPI, overriding pkg-config + GSSGLUE_CFLAGS + C compiler flags for GSSGLUE, overriding pkg-config + GSSGLUE_LIBS + linker flags for GSSGLUE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -22631,12 +22632,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_RPCSECGSS_CFLAGS="$RPCSECGSS_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.10\"") >&5 - ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.10") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.16\"") >&5 + ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.16") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_RPCSECGSS_CFLAGS=`$PKG_CONFIG --cflags "librpcsecgss >= 0.10" 2>/dev/null` + pkg_cv_RPCSECGSS_CFLAGS=`$PKG_CONFIG --cflags "librpcsecgss >= 0.16" 2>/dev/null` else pkg_failed=yes fi @@ -22649,12 +22650,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_RPCSECGSS_LIBS="$RPCSECGSS_LIBS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.10\"") >&5 - ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.10") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.16\"") >&5 + ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.16") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_RPCSECGSS_LIBS=`$PKG_CONFIG --libs "librpcsecgss >= 0.10" 2>/dev/null` + pkg_cv_RPCSECGSS_LIBS=`$PKG_CONFIG --libs "librpcsecgss >= 0.16" 2>/dev/null` else pkg_failed=yes fi @@ -22673,9 +22674,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "librpcsecgss >= 0.10"` + RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "librpcsecgss >= 0.16"` else - RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "librpcsecgss >= 0.10"` + RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "librpcsecgss >= 0.16"` fi # Put the nasty error message in config.log where it belongs echo "$RPCSECGSS_PKG_ERRORS" >&5 @@ -22702,20 +22703,20 @@ echo "${ECHO_T}yes" >&6; } fi pkg_failed=no -{ echo "$as_me:$LINENO: checking for GSSAPI" >&5 -echo $ECHO_N "checking for GSSAPI... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: checking for GSSGLUE" >&5 +echo $ECHO_N "checking for GSSGLUE... $ECHO_C" >&6; } if test -n "$PKG_CONFIG"; then - if test -n "$GSSAPI_CFLAGS"; then - pkg_cv_GSSAPI_CFLAGS="$GSSAPI_CFLAGS" + if test -n "$GSSGLUE_CFLAGS"; then + pkg_cv_GSSGLUE_CFLAGS="$GSSGLUE_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssapi >= 0.11\"") >&5 - ($PKG_CONFIG --exists --print-errors "libgssapi >= 0.11") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssglue >= 0.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgssglue >= 0.1") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_GSSAPI_CFLAGS=`$PKG_CONFIG --cflags "libgssapi >= 0.11" 2>/dev/null` + pkg_cv_GSSGLUE_CFLAGS=`$PKG_CONFIG --cflags "libgssglue >= 0.1" 2>/dev/null` else pkg_failed=yes fi @@ -22724,16 +22725,16 @@ else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then - if test -n "$GSSAPI_LIBS"; then - pkg_cv_GSSAPI_LIBS="$GSSAPI_LIBS" + if test -n "$GSSGLUE_LIBS"; then + pkg_cv_GSSGLUE_LIBS="$GSSGLUE_LIBS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssapi >= 0.11\"") >&5 - ($PKG_CONFIG --exists --print-errors "libgssapi >= 0.11") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssglue >= 0.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgssglue >= 0.1") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_GSSAPI_LIBS=`$PKG_CONFIG --libs "libgssapi >= 0.11" 2>/dev/null` + pkg_cv_GSSGLUE_LIBS=`$PKG_CONFIG --libs "libgssglue >= 0.1" 2>/dev/null` else pkg_failed=yes fi @@ -22752,33 +22753,33 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GSSAPI_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libgssapi >= 0.11"` + GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libgssglue >= 0.1"` else - GSSAPI_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libgssapi >= 0.11"` + GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libgssglue >= 0.1"` fi # Put the nasty error message in config.log where it belongs - echo "$GSSAPI_PKG_ERRORS" >&5 + echo "$GSSGLUE_PKG_ERRORS" >&5 - { { echo "$as_me:$LINENO: error: Package requirements (libgssapi >= 0.11) were not met: + { { echo "$as_me:$LINENO: error: Package requirements (libgssglue >= 0.1) were not met: -$GSSAPI_PKG_ERRORS +$GSSGLUE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 -echo "$as_me: error: Package requirements (libgssapi >= 0.11) were not met: +echo "$as_me: error: Package requirements (libgssglue >= 0.1) were not met: -$GSSAPI_PKG_ERRORS +$GSSGLUE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&2;} { (exit 1); exit 1; }; } @@ -22787,8 +22788,8 @@ elif test $pkg_failed = untried; then is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . @@ -22797,16 +22798,16 @@ echo "$as_me: error: The pkg-config script could not be found or is too old. Ma is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else - GSSAPI_CFLAGS=$pkg_cv_GSSAPI_CFLAGS - GSSAPI_LIBS=$pkg_cv_GSSAPI_LIBS + GSSGLUE_CFLAGS=$pkg_cv_GSSGLUE_CFLAGS + GSSGLUE_LIBS=$pkg_cv_GSSGLUE_LIBS { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } : @@ -24020,7 +24021,7 @@ if test "${ac_cv_lib_rpcsecgss_authgss_create_default+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lrpcsecgss -lgssapi -ldl $LIBS" +LIBS="-lrpcsecgss -lgssglue -ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -24089,7 +24090,7 @@ if test "${ac_cv_lib_rpcsecgss_authgss_set_debug_level+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lrpcsecgss -lgssapi -ldl $LIBS" +LIBS="-lrpcsecgss -lgssglue -ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -30869,8 +30870,8 @@ LIBNSL!$LIBNSL$ac_delim PKG_CONFIG!$PKG_CONFIG$ac_delim RPCSECGSS_CFLAGS!$RPCSECGSS_CFLAGS$ac_delim RPCSECGSS_LIBS!$RPCSECGSS_LIBS$ac_delim -GSSAPI_CFLAGS!$GSSAPI_CFLAGS$ac_delim -GSSAPI_LIBS!$GSSAPI_LIBS$ac_delim +GSSGLUE_CFLAGS!$GSSGLUE_CFLAGS$ac_delim +GSSGLUE_LIBS!$GSSGLUE_LIBS$ac_delim LIBSOCKET!$LIBSOCKET$ac_delim LIBCRYPT!$LIBCRYPT$ac_delim LIBBSD!$LIBBSD$ac_delim diff --git a/autom4te.cache/traces.0 b/autom4te.cache/traces.0 index f4a3acd..79a7fc2 100644 --- a/autom4te.cache/traces.0 +++ b/autom4te.cache/traces.0 @@ -9721,7 +9721,7 @@ aclocal/bsdsignals.m4:2: AC_BSD_SIGNALS is expanded from... configure.ac:163: the top level]) m4trace:configure.ac:163: -1- m4_pattern_allow([^HAVE_BSD_SIGNALS$]) m4trace:configure.ac:169: -1- m4_pattern_allow([^LIBNSL$]) -m4trace:configure.ac:184: -1- PKG_CHECK_MODULES([RPCSECGSS], [librpcsecgss >= 0.10], [], [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss. If you have pkgconfig installed, you might try setting environment variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig]) +m4trace:configure.ac:184: -1- PKG_CHECK_MODULES([RPCSECGSS], [librpcsecgss >= 0.16], [], [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss. If you have pkgconfig installed, you might try setting environment variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig]) ]) m4trace:configure.ac:184: -1- PKG_PROG_PKG_CONFIG @@ -9731,14 +9731,14 @@ m4trace:configure.ac:184: -1- m4_pattern_allow([^PKG_CONFIG$]) m4trace:configure.ac:184: -1- m4_pattern_allow([^PKG_CONFIG$]) m4trace:configure.ac:184: -1- m4_pattern_allow([^RPCSECGSS_CFLAGS$]) m4trace:configure.ac:184: -1- m4_pattern_allow([^RPCSECGSS_LIBS$]) -m4trace:configure.ac:184: -1- PKG_CHECK_EXISTS([librpcsecgss >= 0.10], [pkg_cv_[]RPCSECGSS_CFLAGS=`$PKG_CONFIG --[]cflags "librpcsecgss >= 0.10" 2>/dev/null`], [pkg_failed=yes]) -m4trace:configure.ac:184: -1- PKG_CHECK_EXISTS([librpcsecgss >= 0.10], [pkg_cv_[]RPCSECGSS_LIBS=`$PKG_CONFIG --[]libs "librpcsecgss >= 0.10" 2>/dev/null`], [pkg_failed=yes]) +m4trace:configure.ac:184: -1- PKG_CHECK_EXISTS([librpcsecgss >= 0.16], [pkg_cv_[]RPCSECGSS_CFLAGS=`$PKG_CONFIG --[]cflags "librpcsecgss >= 0.16" 2>/dev/null`], [pkg_failed=yes]) +m4trace:configure.ac:184: -1- PKG_CHECK_EXISTS([librpcsecgss >= 0.16], [pkg_cv_[]RPCSECGSS_LIBS=`$PKG_CONFIG --[]libs "librpcsecgss >= 0.16" 2>/dev/null`], [pkg_failed=yes]) m4trace:configure.ac:184: -1- _PKG_SHORT_ERRORS_SUPPORTED -m4trace:configure.ac:188: -1- PKG_CHECK_MODULES([GSSAPI], [libgssapi >= 0.11]) -m4trace:configure.ac:188: -1- m4_pattern_allow([^GSSAPI_CFLAGS$]) -m4trace:configure.ac:188: -1- m4_pattern_allow([^GSSAPI_LIBS$]) -m4trace:configure.ac:188: -1- PKG_CHECK_EXISTS([libgssapi >= 0.11], [pkg_cv_[]GSSAPI_CFLAGS=`$PKG_CONFIG --[]cflags "libgssapi >= 0.11" 2>/dev/null`], [pkg_failed=yes]) -m4trace:configure.ac:188: -1- PKG_CHECK_EXISTS([libgssapi >= 0.11], [pkg_cv_[]GSSAPI_LIBS=`$PKG_CONFIG --[]libs "libgssapi >= 0.11" 2>/dev/null`], [pkg_failed=yes]) +m4trace:configure.ac:188: -1- PKG_CHECK_MODULES([GSSGLUE], [libgssglue >= 0.1]) +m4trace:configure.ac:188: -1- m4_pattern_allow([^GSSGLUE_CFLAGS$]) +m4trace:configure.ac:188: -1- m4_pattern_allow([^GSSGLUE_LIBS$]) +m4trace:configure.ac:188: -1- PKG_CHECK_EXISTS([libgssglue >= 0.1], [pkg_cv_[]GSSGLUE_CFLAGS=`$PKG_CONFIG --[]cflags "libgssglue >= 0.1" 2>/dev/null`], [pkg_failed=yes]) +m4trace:configure.ac:188: -1- PKG_CHECK_EXISTS([libgssglue >= 0.1], [pkg_cv_[]GSSGLUE_LIBS=`$PKG_CONFIG --[]libs "libgssglue >= 0.1" 2>/dev/null`], [pkg_failed=yes]) m4trace:configure.ac:188: -1- _PKG_SHORT_ERRORS_SUPPORTED m4trace:configure.ac:199: -1- AC_BLKID_VERS m4trace:configure.ac:199: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. diff --git a/autom4te.cache/traces.1 b/autom4te.cache/traces.1 index bd95e99..9aea8fa 100644 --- a/autom4te.cache/traces.1 +++ b/autom4te.cache/traces.1 @@ -846,12 +846,12 @@ m4trace:configure.ac:184: -1- m4_pattern_allow([^RPCSECGSS_CFLAGS$]) m4trace:configure.ac:184: -1- AC_SUBST([RPCSECGSS_LIBS]) m4trace:configure.ac:184: -1- AC_SUBST_TRACE([RPCSECGSS_LIBS]) m4trace:configure.ac:184: -1- m4_pattern_allow([^RPCSECGSS_LIBS$]) -m4trace:configure.ac:188: -1- AC_SUBST([GSSAPI_CFLAGS]) -m4trace:configure.ac:188: -1- AC_SUBST_TRACE([GSSAPI_CFLAGS]) -m4trace:configure.ac:188: -1- m4_pattern_allow([^GSSAPI_CFLAGS$]) -m4trace:configure.ac:188: -1- AC_SUBST([GSSAPI_LIBS]) -m4trace:configure.ac:188: -1- AC_SUBST_TRACE([GSSAPI_LIBS]) -m4trace:configure.ac:188: -1- m4_pattern_allow([^GSSAPI_LIBS$]) +m4trace:configure.ac:188: -1- AC_SUBST([GSSGLUE_CFLAGS]) +m4trace:configure.ac:188: -1- AC_SUBST_TRACE([GSSGLUE_CFLAGS]) +m4trace:configure.ac:188: -1- m4_pattern_allow([^GSSGLUE_CFLAGS$]) +m4trace:configure.ac:188: -1- AC_SUBST([GSSGLUE_LIBS]) +m4trace:configure.ac:188: -1- AC_SUBST_TRACE([GSSGLUE_LIBS]) +m4trace:configure.ac:188: -1- m4_pattern_allow([^GSSGLUE_LIBS$]) m4trace:configure.ac:199: -1- _m4_warn([obsolete], [The macro `AC_TRY_RUN' is obsolete. You should run autoupdate.], [../../lib/autoconf/general.m4:2478: AC_TRY_RUN is expanded from... ../../lib/m4sugar/m4sh.m4:516: AS_IF is expanded from... diff --git a/config.guess b/config.guess index 0f0fe71..278f9e9 100755 --- a/config.guess +++ b/config.guess @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2007-03-06' +timestamp='2007-07-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -330,7 +330,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; - i86pc:SunOS:5.*:*) + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) @@ -793,7 +793,7 @@ EOF exit ;; *:Interix*:[3456]*) case ${UNAME_MACHINE} in - x86) + x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; EM64T | authenticamd) diff --git a/config.sub b/config.sub index 5defff6..1761d8b 100755 --- a/config.sub +++ b/config.sub @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, # Inc. -timestamp='2007-01-18' +timestamp='2007-06-28' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -475,8 +475,8 @@ case $basic_machine in basic_machine=craynv-cray os=-unicosmp ;; - cr16c) - basic_machine=cr16c-unknown + cr16) + basic_machine=cr16-unknown os=-elf ;; crds | unos) @@ -683,6 +683,10 @@ case $basic_machine in basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; diff --git a/configure b/configure index 6d95818..aec6431 100755 --- a/configure +++ b/configure @@ -904,8 +904,8 @@ LIBNSL PKG_CONFIG RPCSECGSS_CFLAGS RPCSECGSS_LIBS -GSSAPI_CFLAGS -GSSAPI_LIBS +GSSGLUE_CFLAGS +GSSGLUE_LIBS LIBSOCKET LIBCRYPT LIBBSD @@ -944,8 +944,8 @@ FFLAGS PKG_CONFIG RPCSECGSS_CFLAGS RPCSECGSS_LIBS -GSSAPI_CFLAGS -GSSAPI_LIBS' +GSSGLUE_CFLAGS +GSSGLUE_LIBS' # Initialize some variables set by options. @@ -1583,9 +1583,10 @@ Some influential environment variables: C compiler flags for RPCSECGSS, overriding pkg-config RPCSECGSS_LIBS linker flags for RPCSECGSS, overriding pkg-config - GSSAPI_CFLAGS - C compiler flags for GSSAPI, overriding pkg-config - GSSAPI_LIBS linker flags for GSSAPI, overriding pkg-config + GSSGLUE_CFLAGS + C compiler flags for GSSGLUE, overriding pkg-config + GSSGLUE_LIBS + linker flags for GSSGLUE, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -6686,7 +6687,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 6689 "configure"' > conftest.$ac_ext + echo '#line 6690 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -8726,11 +8727,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8729: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8730: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8733: \$? = $ac_status" >&5 + echo "$as_me:8734: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9016,11 +9017,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9019: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9020: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9023: \$? = $ac_status" >&5 + echo "$as_me:9024: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9120,11 +9121,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9123: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9124: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9127: \$? = $ac_status" >&5 + echo "$as_me:9128: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -11482,7 +11483,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:14006: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14009: \$? = $ac_status" >&5 + echo "$as_me:14010: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14106,11 +14107,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14109: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14110: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14113: \$? = $ac_status" >&5 + echo "$as_me:14114: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15683,11 +15684,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15686: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15687: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15690: \$? = $ac_status" >&5 + echo "$as_me:15691: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -15787,11 +15788,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15790: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15791: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15794: \$? = $ac_status" >&5 + echo "$as_me:15795: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17987,11 +17988,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:17990: $lt_compile\"" >&5) + (eval echo "\"\$as_me:17991: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:17994: \$? = $ac_status" >&5 + echo "$as_me:17995: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -18277,11 +18278,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18280: $lt_compile\"" >&5) + (eval echo "\"\$as_me:18281: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:18284: \$? = $ac_status" >&5 + echo "$as_me:18285: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -18381,11 +18382,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18384: $lt_compile\"" >&5) + (eval echo "\"\$as_me:18385: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:18388: \$? = $ac_status" >&5 + echo "$as_me:18389: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -22631,12 +22632,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_RPCSECGSS_CFLAGS="$RPCSECGSS_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.10\"") >&5 - ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.10") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.16\"") >&5 + ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.16") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_RPCSECGSS_CFLAGS=`$PKG_CONFIG --cflags "librpcsecgss >= 0.10" 2>/dev/null` + pkg_cv_RPCSECGSS_CFLAGS=`$PKG_CONFIG --cflags "librpcsecgss >= 0.16" 2>/dev/null` else pkg_failed=yes fi @@ -22649,12 +22650,12 @@ if test -n "$PKG_CONFIG"; then pkg_cv_RPCSECGSS_LIBS="$RPCSECGSS_LIBS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.10\"") >&5 - ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.10") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"librpcsecgss >= 0.16\"") >&5 + ($PKG_CONFIG --exists --print-errors "librpcsecgss >= 0.16") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_RPCSECGSS_LIBS=`$PKG_CONFIG --libs "librpcsecgss >= 0.10" 2>/dev/null` + pkg_cv_RPCSECGSS_LIBS=`$PKG_CONFIG --libs "librpcsecgss >= 0.16" 2>/dev/null` else pkg_failed=yes fi @@ -22673,9 +22674,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "librpcsecgss >= 0.10"` + RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "librpcsecgss >= 0.16"` else - RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "librpcsecgss >= 0.10"` + RPCSECGSS_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "librpcsecgss >= 0.16"` fi # Put the nasty error message in config.log where it belongs echo "$RPCSECGSS_PKG_ERRORS" >&5 @@ -22702,20 +22703,20 @@ echo "${ECHO_T}yes" >&6; } fi pkg_failed=no -{ echo "$as_me:$LINENO: checking for GSSAPI" >&5 -echo $ECHO_N "checking for GSSAPI... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: checking for GSSGLUE" >&5 +echo $ECHO_N "checking for GSSGLUE... $ECHO_C" >&6; } if test -n "$PKG_CONFIG"; then - if test -n "$GSSAPI_CFLAGS"; then - pkg_cv_GSSAPI_CFLAGS="$GSSAPI_CFLAGS" + if test -n "$GSSGLUE_CFLAGS"; then + pkg_cv_GSSGLUE_CFLAGS="$GSSGLUE_CFLAGS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssapi >= 0.11\"") >&5 - ($PKG_CONFIG --exists --print-errors "libgssapi >= 0.11") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssglue >= 0.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgssglue >= 0.1") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_GSSAPI_CFLAGS=`$PKG_CONFIG --cflags "libgssapi >= 0.11" 2>/dev/null` + pkg_cv_GSSGLUE_CFLAGS=`$PKG_CONFIG --cflags "libgssglue >= 0.1" 2>/dev/null` else pkg_failed=yes fi @@ -22724,16 +22725,16 @@ else pkg_failed=untried fi if test -n "$PKG_CONFIG"; then - if test -n "$GSSAPI_LIBS"; then - pkg_cv_GSSAPI_LIBS="$GSSAPI_LIBS" + if test -n "$GSSGLUE_LIBS"; then + pkg_cv_GSSGLUE_LIBS="$GSSGLUE_LIBS" else if test -n "$PKG_CONFIG" && \ - { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssapi >= 0.11\"") >&5 - ($PKG_CONFIG --exists --print-errors "libgssapi >= 0.11") 2>&5 + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgssglue >= 0.1\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgssglue >= 0.1") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then - pkg_cv_GSSAPI_LIBS=`$PKG_CONFIG --libs "libgssapi >= 0.11" 2>/dev/null` + pkg_cv_GSSGLUE_LIBS=`$PKG_CONFIG --libs "libgssglue >= 0.1" 2>/dev/null` else pkg_failed=yes fi @@ -22752,33 +22753,33 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - GSSAPI_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libgssapi >= 0.11"` + GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libgssglue >= 0.1"` else - GSSAPI_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libgssapi >= 0.11"` + GSSGLUE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libgssglue >= 0.1"` fi # Put the nasty error message in config.log where it belongs - echo "$GSSAPI_PKG_ERRORS" >&5 + echo "$GSSGLUE_PKG_ERRORS" >&5 - { { echo "$as_me:$LINENO: error: Package requirements (libgssapi >= 0.11) were not met: + { { echo "$as_me:$LINENO: error: Package requirements (libgssglue >= 0.1) were not met: -$GSSAPI_PKG_ERRORS +$GSSGLUE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&5 -echo "$as_me: error: Package requirements (libgssapi >= 0.11) were not met: +echo "$as_me: error: Package requirements (libgssglue >= 0.1) were not met: -$GSSAPI_PKG_ERRORS +$GSSGLUE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " >&2;} { (exit 1); exit 1; }; } @@ -22787,8 +22788,8 @@ elif test $pkg_failed = untried; then is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . @@ -22797,16 +22798,16 @@ echo "$as_me: error: The pkg-config script could not be found or is too old. Ma is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -Alternatively, you may set the environment variables GSSAPI_CFLAGS -and GSSAPI_LIBS to avoid the need to call pkg-config. +Alternatively, you may set the environment variables GSSGLUE_CFLAGS +and GSSGLUE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } else - GSSAPI_CFLAGS=$pkg_cv_GSSAPI_CFLAGS - GSSAPI_LIBS=$pkg_cv_GSSAPI_LIBS + GSSGLUE_CFLAGS=$pkg_cv_GSSGLUE_CFLAGS + GSSGLUE_LIBS=$pkg_cv_GSSGLUE_LIBS { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } : @@ -24020,7 +24021,7 @@ if test "${ac_cv_lib_rpcsecgss_authgss_create_default+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lrpcsecgss -lgssapi -ldl $LIBS" +LIBS="-lrpcsecgss -lgssglue -ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -24089,7 +24090,7 @@ if test "${ac_cv_lib_rpcsecgss_authgss_set_debug_level+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS -LIBS="-lrpcsecgss -lgssapi -ldl $LIBS" +LIBS="-lrpcsecgss -lgssglue -ldl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -30869,8 +30870,8 @@ LIBNSL!$LIBNSL$ac_delim PKG_CONFIG!$PKG_CONFIG$ac_delim RPCSECGSS_CFLAGS!$RPCSECGSS_CFLAGS$ac_delim RPCSECGSS_LIBS!$RPCSECGSS_LIBS$ac_delim -GSSAPI_CFLAGS!$GSSAPI_CFLAGS$ac_delim -GSSAPI_LIBS!$GSSAPI_LIBS$ac_delim +GSSGLUE_CFLAGS!$GSSGLUE_CFLAGS$ac_delim +GSSGLUE_LIBS!$GSSGLUE_LIBS$ac_delim LIBSOCKET!$LIBSOCKET$ac_delim LIBCRYPT!$LIBCRYPT$ac_delim LIBBSD!$LIBBSD$ac_delim diff --git a/configure.ac b/configure.ac index 1d07cd7..a378953 100644 --- a/configure.ac +++ b/configure.ac @@ -181,11 +181,11 @@ if test "$enable_nfsv4" = yes; then dnl librpcsecgss already has a dependency on libgssapi, dnl but we need to make sure we get the right version if test "$enable_gss" = yes; then - PKG_CHECK_MODULES(RPCSECGSS, librpcsecgss >= 0.10, , + PKG_CHECK_MODULES(RPCSECGSS, librpcsecgss >= 0.16, , [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss. If you have pkgconfig installed, you might try setting environment variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig]) ] ) - PKG_CHECK_MODULES(GSSAPI, libgssapi >= 0.11) + PKG_CHECK_MODULES(GSSGLUE, libgssglue >= 0.1) fi fi @@ -228,9 +228,9 @@ if test "$enable_gss" = yes; then dnl This is not done until here because we need to have KRBLIBS set dnl ("librpcsecgss=1" is so that it doesn't get added to LIBS) - AC_CHECK_LIB(rpcsecgss, authgss_create_default, [librpcsecgss=1], AC_MSG_ERROR([librpcsecgss needed for nfsv4 support]), -lgssapi -ldl) + AC_CHECK_LIB(rpcsecgss, authgss_create_default, [librpcsecgss=1], AC_MSG_ERROR([librpcsecgss needed for nfsv4 support]), -lgssglue -ldl) AC_CHECK_LIB(rpcsecgss, authgss_set_debug_level, - AC_DEFINE(HAVE_AUTHGSS_SET_DEBUG_LEVEL, 1, [Define this if the rpcsec_gss library has the function authgss_set_debug_level]),, -lgssapi -ldl) + AC_DEFINE(HAVE_AUTHGSS_SET_DEBUG_LEVEL, 1, [Define this if the rpcsec_gss library has the function authgss_set_debug_level]),, -lgssglue -ldl) fi @@ -284,7 +284,7 @@ AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \ dnl ************************************************************* -dnl Check for data sizes (XXX These should go away with libgssapi pkg-config) +dnl Check for data sizes dnl ************************************************************* AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) diff --git a/linux-nfs/Makefile.in b/linux-nfs/Makefile.in index 50c2bc8..6306c27 100644 --- a/linux-nfs/Makefile.in +++ b/linux-nfs/Makefile.in @@ -99,9 +99,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/Makefile.in b/support/Makefile.in index 89ef221..9797edf 100644 --- a/support/Makefile.in +++ b/support/Makefile.in @@ -107,9 +107,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/export/Makefile.in b/support/export/Makefile.in index 36c5607..cc54087 100644 --- a/support/export/Makefile.in +++ b/support/export/Makefile.in @@ -123,9 +123,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/export/client.c b/support/export/client.c index 19b53aa..1cb242f 100644 --- a/support/export/client.c +++ b/support/export/client.c @@ -118,6 +118,7 @@ client_dup(nfs_client *clp, struct hostent *hp) new = (nfs_client *) xmalloc(sizeof(*new)); memcpy(new, clp, sizeof(*new)); new->m_type = MCL_FQDN; + new->m_hostname = NULL; client_init(new, (char *) hp->h_name, hp); client_add(new); @@ -127,14 +128,11 @@ client_dup(nfs_client *clp, struct hostent *hp) static void client_init(nfs_client *clp, const char *hname, struct hostent *hp) { - if (hp) { - strncpy(clp->m_hostname, hp->h_name, - sizeof (clp->m_hostname) - 1); - } else { - strncpy(clp->m_hostname, hname, - sizeof (clp->m_hostname) - 1); - } - clp->m_hostname[sizeof (clp->m_hostname) - 1] = '\0'; + xfree(clp->m_hostname); + if (hp) + clp->m_hostname = xstrdup(hp->h_name); + else + clp->m_hostname = xstrdup(hname); clp->m_exported = 0; clp->m_count = 0; @@ -207,6 +205,7 @@ client_freeall(void) head = clientlist + i; while (*head) { *head = (clp = *head)->m_next; + xfree(clp->m_hostname); xfree(clp); } } @@ -234,6 +233,19 @@ client_find(struct hostent *hp) return NULL; } +struct hostent * +client_resolve(struct in_addr addr) +{ + struct hostent *he = NULL; + + if (clientlist[MCL_WILDCARD] || clientlist[MCL_NETGROUP]) + he = get_reliable_hostbyaddr((const char*)&addr, sizeof(addr), AF_INET); + if (he == NULL) + he = get_hostent((const char*)&addr, sizeof(addr), AF_INET); + + return he; +} + /* * Find client name given an IP address * This is found by gathering all known names that match that IP address, @@ -243,17 +255,11 @@ client_find(struct hostent *hp) static char *add_name(char *old, char *add); char * -client_compose(struct in_addr addr) +client_compose(struct hostent *he) { - struct hostent *he = NULL; char *name = NULL; int i; - if (clientlist[MCL_WILDCARD] || clientlist[MCL_NETGROUP]) - he = get_reliable_hostbyaddr((const char*)&addr, sizeof(addr), AF_INET); - if (he == NULL) - he = get_hostent((const char*)&addr, sizeof(addr), AF_INET); - for (i = 0 ; i < MCL_MAXTYPES; i++) { nfs_client *clp; for (clp = clientlist[i]; clp ; clp = clp->m_next) { @@ -262,7 +268,6 @@ client_compose(struct in_addr addr) name = add_name(name, clp->m_hostname); } } - free(he); return name; } diff --git a/support/export/export.c b/support/export/export.c index 74e1d1b..93c58b6 100644 --- a/support/export/export.c +++ b/support/export/export.c @@ -85,6 +85,8 @@ export_init(nfs_export *exp, nfs_client *clp, struct exportent *nep) struct exportent *e = &exp->m_export; dupexportent(e, nep); + if (nep->e_hostname) + e->e_hostname = xstrdup(nep->e_hostname); exp->m_exported = 0; exp->m_xtabent = 0; @@ -109,6 +111,8 @@ export_dup(nfs_export *exp, struct hostent *hp) new = (nfs_export *) xmalloc(sizeof(*new)); memcpy(new, exp, sizeof(*new)); dupexportent(&new->m_export, &exp->m_export); + if (exp->m_export.e_hostname) + new->m_export.e_hostname = xstrdup(exp->m_export.e_hostname); clp = client_dup(exp->m_client, hp); clp->m_count++; new->m_client = clp; @@ -244,6 +248,7 @@ export_freeall(void) free(exp->m_export.e_mountpoint); if (exp->m_export.e_fslocdata) xfree(exp->m_export.e_fslocdata); + xfree(exp->m_export.e_hostname); xfree(exp); } exportlist[i] = NULL; diff --git a/support/export/rmtab.c b/support/export/rmtab.c index 15aab15..2a882aa 100644 --- a/support/export/rmtab.c +++ b/support/export/rmtab.c @@ -43,9 +43,7 @@ rmtab_read(void) if (!exp2) { struct exportent ee; dupexportent(&ee, &exp->m_export); - strncpy (ee.e_hostname, rep->r_client, - sizeof (ee.e_hostname) - 1); - ee.e_hostname[sizeof (ee.e_hostname) -1] = '\0'; + ee.e_hostname = rep->r_client; exp2 = export_create(&ee, 0); exp2->m_changed = exp->m_changed; } diff --git a/support/export/xtab.c b/support/export/xtab.c index 292087b..990113e 100644 --- a/support/export/xtab.c +++ b/support/export/xtab.c @@ -108,10 +108,7 @@ xtab_write(char *xtab, char *xtabtmp, int is_export) /* write out the export entry using the FQDN */ xe = exp->m_export; - strncpy(xe.e_hostname, - exp->m_client->m_hostname, - sizeof (xe.e_hostname) - 1); - xe.e_hostname[sizeof (xe.e_hostname) - 1] = '\0'; + xe.e_hostname = exp->m_client->m_hostname; putexportent(&xe); } } @@ -146,9 +143,7 @@ xtab_append(nfs_export *exp) return; setexportent(_PATH_XTAB, "a"); xe = exp->m_export; - strncpy(xe.e_hostname, exp->m_client->m_hostname, - sizeof (xe.e_hostname) - 1); - xe.e_hostname[sizeof (xe.e_hostname) - 1] = '\0'; + xe.e_hostname = exp->m_client->m_hostname; putexportent(&xe); endexportent(); xfunlock(lockid); diff --git a/support/include/Makefile.in b/support/include/Makefile.in index 4a9892b..ad30305 100644 --- a/support/include/Makefile.in +++ b/support/include/Makefile.in @@ -110,9 +110,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/include/exportfs.h b/support/include/exportfs.h index 431b5ce..c1ba543 100644 --- a/support/include/exportfs.h +++ b/support/include/exportfs.h @@ -32,7 +32,7 @@ enum { typedef struct mclient { struct mclient * m_next; - char m_hostname[NFSCLNT_IDMAX+1]; + char * m_hostname; int m_type; int m_naddr; struct in_addr m_addrlist[NFSCLNT_ADDRMAX]; @@ -64,7 +64,8 @@ int client_check(nfs_client *, struct hostent *); int client_match(nfs_client *, char *hname); void client_release(nfs_client *); void client_freeall(void); -char * client_compose(struct in_addr addr); +char * client_compose(struct hostent *he); +struct hostent * client_resolve(struct in_addr addr); int client_member(char *client, char *name); int export_read(char *fname); diff --git a/support/include/nfs/Makefile.in b/support/include/nfs/Makefile.in index d9c71cf..5c23c48 100644 --- a/support/include/nfs/Makefile.in +++ b/support/include/nfs/Makefile.in @@ -103,9 +103,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/include/nfslib.h b/support/include/nfslib.h index 5af9c30..ffa2440 100644 --- a/support/include/nfslib.h +++ b/support/include/nfslib.h @@ -65,7 +65,7 @@ struct sec_entry { * allow overrides when using exportfs. */ struct exportent { - char e_hostname[NFSCLNT_IDMAX+1]; + char * e_hostname; char e_path[NFS_MAXPATHLEN+1]; /* The mount path may be different from the exported path due to submount. It may change for every mount. The idea is we diff --git a/support/include/rpcsvc/Makefile.in b/support/include/rpcsvc/Makefile.in index 12356da..49a956b 100644 --- a/support/include/rpcsvc/Makefile.in +++ b/support/include/rpcsvc/Makefile.in @@ -103,9 +103,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/include/sys/Makefile.in b/support/include/sys/Makefile.in index f86258d..4ffe5c4 100644 --- a/support/include/sys/Makefile.in +++ b/support/include/sys/Makefile.in @@ -107,9 +107,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/include/sys/fs/Makefile.in b/support/include/sys/fs/Makefile.in index bcf9090..66ea7ce 100644 --- a/support/include/sys/fs/Makefile.in +++ b/support/include/sys/fs/Makefile.in @@ -103,9 +103,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/include/xcommon.h b/support/include/xcommon.h index 9e23d12..d1a4b18 100644 --- a/support/include/xcommon.h +++ b/support/include/xcommon.h @@ -36,6 +36,7 @@ extern void die(int err, const char *fmt, ...); extern void (*at_die)(void); /* exit status - bits below are ORed */ +#define EX_SUCCESS 0 /* no failure occurred */ #define EX_USAGE 1 /* incorrect invocation or permission */ #define EX_SYSERR 2 /* out of memory, cannot fork, ... */ #define EX_SOFTWARE 4 /* internal mount bug or wrong version */ diff --git a/support/misc/Makefile.in b/support/misc/Makefile.in index 52e7a2c..df28366 100644 --- a/support/misc/Makefile.in +++ b/support/misc/Makefile.in @@ -119,9 +119,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/nfs/Makefile.in b/support/nfs/Makefile.in index 87fb41d..8a0a46e 100644 --- a/support/nfs/Makefile.in +++ b/support/nfs/Makefile.in @@ -123,9 +123,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/support/nfs/exports.c b/support/nfs/exports.c index c82bb0e..6b56708 100644 --- a/support/nfs/exports.c +++ b/support/nfs/exports.c @@ -176,13 +176,8 @@ getexportent(int fromkernel, int fromexports) if (!has_default_opts) xlog(L_WARNING, "No options for %s %s: suggest %s(sync) to avoid warning", ee.e_path, exp, exp); } - if (strlen(hostname) >= sizeof(ee.e_hostname)) { - syntaxerr("client name too long"); - export_errno = EINVAL; - return NULL; - } - strncpy(ee.e_hostname, hostname, sizeof (ee.e_hostname) - 1); - ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0'; + xfree(ee.e_hostname); + ee.e_hostname = xstrdup(hostname); if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0) return NULL; @@ -335,6 +330,7 @@ dupexportent(struct exportent *dst, struct exportent *src) dst->e_mountpoint = strdup(src->e_mountpoint); if (src->e_fslocdata) dst->e_fslocdata = strdup(src->e_fslocdata); + dst->e_hostname = NULL; } struct exportent * @@ -355,12 +351,9 @@ mkexportent(char *hname, char *path, char *options) ee.e_nsqgids = 0; ee.e_uuid = NULL; - if (strlen(hname) >= sizeof(ee.e_hostname)) { - xlog(L_WARNING, "client name %s too long", hname); - return NULL; - } - strncpy(ee.e_hostname, hname, sizeof (ee.e_hostname) - 1); - ee.e_hostname[sizeof (ee.e_hostname) - 1] = '\0'; + xfree(ee.e_hostname); + ee.e_hostname = xstrdup(hname); + if (strlen(path) >= sizeof(ee.e_path)) { xlog(L_WARNING, "path name %s too long", path); return NULL; diff --git a/tools/Makefile.in b/tools/Makefile.in index 7760ee8..5e22fef 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -108,9 +108,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/tools/locktest/Makefile.in b/tools/locktest/Makefile.in index 63e3cf7..59e3060 100644 --- a/tools/locktest/Makefile.in +++ b/tools/locktest/Makefile.in @@ -117,9 +117,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/tools/nlmtest/Makefile.in b/tools/nlmtest/Makefile.in index 599ab63..8b719e5 100644 --- a/tools/nlmtest/Makefile.in +++ b/tools/nlmtest/Makefile.in @@ -98,9 +98,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/tools/rpcdebug/Makefile.in b/tools/rpcdebug/Makefile.in index a5c6bad..8685660 100644 --- a/tools/rpcdebug/Makefile.in +++ b/tools/rpcdebug/Makefile.in @@ -122,9 +122,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/tools/rpcgen/Makefile.in b/tools/rpcgen/Makefile.in index 3e86193..7439cd0 100644 --- a/tools/rpcgen/Makefile.in +++ b/tools/rpcgen/Makefile.in @@ -122,9 +122,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/utils/Makefile.in b/utils/Makefile.in index c3cfd28..e2027d6 100644 --- a/utils/Makefile.in +++ b/utils/Makefile.in @@ -111,9 +111,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/utils/exportfs/Makefile.in b/utils/exportfs/Makefile.in index 05dd2ae..90812c6 100644 --- a/utils/exportfs/Makefile.in +++ b/utils/exportfs/Makefile.in @@ -128,9 +128,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/utils/gssd/Makefile.in b/utils/gssd/Makefile.in index 3873dba..d7c32d9 100644 --- a/utils/gssd/Makefile.in +++ b/utils/gssd/Makefile.in @@ -153,9 +153,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c index b6c4ee4..bbcad20 100644 --- a/utils/gssd/gssd.c +++ b/utils/gssd/gssd.c @@ -81,7 +81,7 @@ sig_hup(int signal) static void usage(char *progname) { - fprintf(stderr, "usage: %s [-f] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir]\n", + fprintf(stderr, "usage: %s [-f] [-M] [-n] [-v] [-r] [-p pipefsdir] [-k keytab] [-d ccachedir]\n", progname); exit(1); } diff --git a/utils/idmapd/Makefile.in b/utils/idmapd/Makefile.in index 5a4ccc4..dfba091 100644 --- a/utils/idmapd/Makefile.in +++ b/utils/idmapd/Makefile.in @@ -125,9 +125,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/utils/mount/Makefile.am b/utils/mount/Makefile.am index a5d7292..27a01de 100644 --- a/utils/mount/Makefile.am +++ b/utils/mount/Makefile.am @@ -9,11 +9,11 @@ man5_MANS = nfs.man sbin_PROGRAMS = mount.nfs EXTRA_DIST = nfsmount.x $(man8_MANS) $(man5_MANS) -mount_nfs_SOURCES = mount.c error.c network.c fstab.c \ - nfsmount.c nfs4mount.c \ +mount_nfs_SOURCES = mount.c error.c network.c fstab.c token.c parse_opt.c \ + nfsmount.c nfs4mount.c stropts.c\ nfsumount.c \ - mount_constants.h error.h network.h fstab.h \ - nfs4_mount.h nfs_mount4.h + mount_constants.h error.h network.h fstab.h token.h parse_opt.h \ + nfs4_mount.h nfs_mount4.h stropts.h mount_nfs_LDADD = ../../support/nfs/libnfs.a \ ../../support/export/libexport.a diff --git a/utils/mount/Makefile.in b/utils/mount/Makefile.in index 244a787..50eafa6 100644 --- a/utils/mount/Makefile.in +++ b/utils/mount/Makefile.in @@ -56,8 +56,9 @@ am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" \ sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(sbin_PROGRAMS) am_mount_nfs_OBJECTS = mount.$(OBJEXT) error.$(OBJEXT) \ - network.$(OBJEXT) fstab.$(OBJEXT) nfsmount.$(OBJEXT) \ - nfs4mount.$(OBJEXT) nfsumount.$(OBJEXT) + network.$(OBJEXT) fstab.$(OBJEXT) token.$(OBJEXT) \ + parse_opt.$(OBJEXT) nfsmount.$(OBJEXT) nfs4mount.$(OBJEXT) \ + stropts.$(OBJEXT) nfsumount.$(OBJEXT) mount_nfs_OBJECTS = $(am_mount_nfs_OBJECTS) mount_nfs_DEPENDENCIES = ../../support/nfs/libnfs.a \ ../../support/export/libexport.a @@ -127,9 +128,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ @@ -241,11 +242,11 @@ target_alias = @target_alias@ man8_MANS = mount.nfs.man umount.nfs.man man5_MANS = nfs.man EXTRA_DIST = nfsmount.x $(man8_MANS) $(man5_MANS) -mount_nfs_SOURCES = mount.c error.c network.c fstab.c \ - nfsmount.c nfs4mount.c \ +mount_nfs_SOURCES = mount.c error.c network.c fstab.c token.c parse_opt.c \ + nfsmount.c nfs4mount.c stropts.c\ nfsumount.c \ - mount_constants.h error.h network.h fstab.h \ - nfs4_mount.h nfs_mount4.h + mount_constants.h error.h network.h fstab.h token.h parse_opt.h \ + nfs4_mount.h nfs_mount4.h stropts.h mount_nfs_LDADD = ../../support/nfs/libnfs.a \ ../../support/export/libexport.a @@ -329,6 +330,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nfs4mount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nfsmount.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nfsumount.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse_opt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stropts.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/token.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ diff --git a/utils/mount/error.c b/utils/mount/error.c index cab84c9..10d4ed2 100644 --- a/utils/mount/error.c +++ b/utils/mount/error.c @@ -76,7 +76,16 @@ static int rpc_strerror(int spos) return pos; } -void mount_errors(char *server, int will_retry, int bg) +/** + * rpc_mount_errors - log an RPC error that occurred during a user-space mount + * @server: C string containing name of server we are attempting to mount + * @will_retry: one indicates mount will retry at some later point + * @bg: one indicates this is a background mount + * + * Extracts the error code from the user-space RPC library, and reports it + * on stderr (fg mount) or in the system log (bg mount). + */ +void rpc_mount_errors(char *server, int will_retry, int bg) { int pos = 0; char *tmp; @@ -121,15 +130,89 @@ void mount_errors(char *server, int will_retry, int bg) fprintf(stderr, "%s\n", errbuf); } +/** + * sys_mount_errors - log an error that occurred during a mount system call + * @server: C string containing name of server we are attempting to mount + * @error: errno value to report + * @will_retry: one indicates mount will retry at some later point + * @bg: one indicates this is a background mount + * + * Passed an errno value generated by a mount system call, and reports it + * on stderr (fg mount) or in the system log (bg mount). + */ +void sys_mount_errors(char *server, int error, int will_retry, int bg) +{ + int pos = 0; + char *tmp; + static int onlyonce = 0; + + tmp = &errbuf[pos]; + if (bg) + pos = snprintf(tmp, (erreob - tmp), + _("mount to NFS server '%s' failed: "), + server); + else + pos = snprintf(tmp, (erreob - tmp), + _("%s: mount to NFS server '%s' failed: "), + progname, server); + + tmp = &errbuf[pos]; + if (error == ETIMEDOUT) { + if (will_retry) + pos = snprintf(tmp, (erreob - tmp), + _("timed out, retrying")); + else + pos = snprintf(tmp, (erreob - tmp), + _("timed out, giving up")); + } else { + if (bg) { + if (will_retry) + pos = snprintf(tmp, (erreob - tmp), + _("%s, retrying"), + strerror(error)); + else + pos = snprintf(tmp, (erreob - tmp), + _("%s, giving up"), + strerror(error)); + } + } + + if (bg) { + if (onlyonce++ < 1) + openlog("mount", LOG_CONS|LOG_PID, LOG_AUTH); + syslog(LOG_ERR, "%s", errbuf); + } else + fprintf(stderr, "%s\n", errbuf); +} + +/** + * mount_error - report a foreground mount error + * @spec: C string containing the device name being mounted + * @mount_point: C string containing the pathname of the local mounted on dir + * @error: errno value to report + * + */ void mount_error(const char *spec, const char *mount_point, int error) { switch(error) { + case EACCES: + nfs_error(_("%s: access denied by server while mounting %s"), + progname, spec); + break; + case EINVAL: + nfs_error(_("%s: an incorrect mount option was specified"), progname); + break; + case EOPNOTSUPP: + nfs_error(_("%s: requested NFS version or transport" + " protocol is not supported"), + progname); + break; case ENOTDIR: nfs_error(_("%s: mount point %s is not a directory"), progname, mount_point); break; case EBUSY: - nfs_error(_("%s: %s is already mounted or busy"), + nfs_error(_("%s: %s is busy or already mounted"), progname, mount_point); break; case ENOENT: @@ -141,6 +224,10 @@ void mount_error(const char *spec, const char *mount_point, int error) nfs_error(_("%s: mount point %s does not exist"), progname, mount_point); break; + case EIO: + case EFAULT: + nfs_error(_("%s: internal error"), progname); + break; default: nfs_error(_("%s: %s"), progname, strerror(error)); @@ -148,7 +235,10 @@ void mount_error(const char *spec, const char *mount_point, int error) } /* - * Report a failed umount + * umount_error - report a failed umount request + * @err: errno value to report + * @dev: C string containing the pathname of the local mounted on dir + * */ void umount_error(int err, const char *dev) { diff --git a/utils/mount/error.h b/utils/mount/error.h index 5e4b01b..8b8e9ae 100644 --- a/utils/mount/error.h +++ b/utils/mount/error.h @@ -24,5 +24,7 @@ char *nfs_strerror(int); void mount_error(const char *, const char *, int); -void mount_errors(char *, int, int); +void rpc_mount_errors(char *, int, int); +void sys_mount_errors(char *, int, int, int); + void umount_error(int, const char *); diff --git a/utils/mount/mount.c b/utils/mount/mount.c index a232519..e622231 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -42,12 +42,14 @@ #include "mount.h" #include "error.h" #include "network.h" +#include "stropts.h" char *progname; int nfs_mount_data_version; int nomtab; int verbose; int sloppy; +int string; #define FOREGROUND (0) #define BACKGROUND (1) @@ -62,6 +64,7 @@ static struct option longopts[] = { { "version", 0, 0, 'V' }, { "read-write", 0, 0, 'w' }, { "rw", 0, 0, 'w' }, + { "string", 0, 0, 'i' }, { "options", 1, 0, 'o' }, { NULL, 0, 0, 0 } }; @@ -234,7 +237,8 @@ static int add_mtab(char *spec, char *mount_point, char *fstype, if (flags & MS_REMOUNT) { update_mtab(ment.mnt_dir, &ment); - return 0; + free(ment.mnt_opts); + return EX_SUCCESS; } lock_mtab(); @@ -258,19 +262,20 @@ static int add_mtab(char *spec, char *mount_point, char *fstype, goto fail_close; } - result = 0; + result = EX_SUCCESS; fail_close: endmntent(mtab); fail_unlock: unlock_mtab(); + free(ment.mnt_opts); return result; } void mount_usage(void) { - printf(_("usage: %s remotetarget dir [-rvVwfnh] [-o nfsoptions]\n"), + printf(_("usage: %s remotetarget dir [-rvVwfnsih] [-o nfsoptions]\n"), progname); printf(_("options:\n")); printf(_("\t-r\t\tMount file system readonly\n")); @@ -279,7 +284,8 @@ void mount_usage(void) printf(_("\t-w\t\tMount file system read-write\n")); printf(_("\t-f\t\tFake mount, do not actually mount\n")); printf(_("\t-n\t\tDo not update /etc/mtab\n")); - printf(_("\t-s\t\tTolerate sloppy mount options rather than failing.\n")); + printf(_("\t-s\t\tTolerate sloppy mount options rather than fail\n")); + printf(_("\t-i\t\tPass mount options to the kernel via a string\n")); printf(_("\t-h\t\tPrint this help\n")); printf(_("\tnfsoptions\tRefer to mount.nfs(8) or nfs(5)\n\n")); } @@ -370,12 +376,21 @@ static int try_mount(char *spec, char *mount_point, int flags, { int ret; - if (strcmp(fs_type, "nfs4") == 0) - ret = nfs4mount(spec, mount_point, flags, - extra_opts, fake, bg); - else - ret = nfsmount(spec, mount_point, flags, - extra_opts, fake, bg); + if (string) { + if (strcmp(fs_type, "nfs4") == 0) + ret = nfs4mount_s(spec, mount_point, flags, + extra_opts, fake, bg); + else + ret = nfsmount_s(spec, mount_point, flags, + extra_opts, fake, bg); + } else { + if (strcmp(fs_type, "nfs4") == 0) + ret = nfs4mount(spec, mount_point, flags, + extra_opts, fake, bg); + else + ret = nfsmount(spec, mount_point, flags, + extra_opts, fake, bg); + } if (ret) return ret; @@ -408,7 +423,7 @@ int main(int argc, char *argv[]) printf("%s ("PACKAGE_STRING")\n", progname); else mount_usage(); - exit(0); + exit(EX_SUCCESS); } if ((argc < 3)) { @@ -420,7 +435,7 @@ int main(int argc, char *argv[]) mount_point = argv[2]; argv[2] = argv[0]; /* so that getopt error messages are correct */ - while ((c = getopt_long(argc - 2, argv + 2, "rvVwfno:hs", + while ((c = getopt_long(argc - 2, argv + 2, "rvVwfno:hsi", longopts, NULL)) != -1) { switch (c) { case 'r': @@ -431,7 +446,7 @@ int main(int argc, char *argv[]) break; case 'V': printf("%s: ("PACKAGE_STRING")\n", progname); - return 0; + exit(EX_SUCCESS); case 'w': flags &= ~MS_RDONLY; break; @@ -450,10 +465,24 @@ int main(int argc, char *argv[]) case 's': ++sloppy; break; + case 'i': + if (linux_version_code() < MAKE_VERSION(2, 6, 23)) { + nfs_error(_("%s: Passing mount options via a" + " string is unsupported by this" + " kernel\n"), progname); + goto out_usage; + } + if (uid != 0) { + nfs_error(_("%s: -i option is restricted to 'root'\n"), + progname); + goto out_usage; + } + ++string; + break; case 'h': default: mount_usage(); - exit(EX_USAGE); + goto out_usage; } } @@ -462,7 +491,7 @@ int main(int argc, char *argv[]) */ if (optind != argc - 2) { mount_usage(); - exit(EX_USAGE); + goto out_usage; } if (strcmp(progname, "mount.nfs4") == 0) @@ -481,7 +510,7 @@ int main(int argc, char *argv[]) strcmp(mc->m.mnt_type, fs_type) != 0) { nfs_error(_("%s: permission denied: no match for %s " "found in /etc/fstab"), progname, mount_point); - exit(EX_USAGE); + goto out_usage; } /* @@ -496,7 +525,7 @@ int main(int argc, char *argv[]) mount_point = canonicalize(mount_point); if (!mount_point) { nfs_error(_("%s: no mount point provided"), progname); - exit(EX_USAGE); + goto out_usage; } if (mount_point[0] != '/') { nfs_error(_("%s: unrecognized mount point %s"), @@ -523,15 +552,19 @@ int main(int argc, char *argv[]) mnt_err = try_mount(spec, mount_point, flags, fs_type, &extra_opts, mount_opts, fake, nomtab, FOREGROUND); if (mnt_err == EX_BG) { - printf(_("mount: backgrounding \"%s\"\n"), spec); + printf(_("%s: backgrounding \"%s\"\n"), + progname, spec); fflush(stdout); /* - * Parent exits immediately with success. Make - * sure not to free "mount_point" + * Parent exits immediately with success. */ - if (fork() > 0) - exit(0); + if (daemon(0, 0)) { + nfs_error(_("%s: failed to start " + "background process: %s\n"), + progname, strerror(errno)); + exit(EX_FAIL); + } mnt_err = try_mount(spec, mount_point, flags, fs_type, &extra_opts, mount_opts, fake, @@ -539,10 +572,15 @@ int main(int argc, char *argv[]) if (verbose && mnt_err) printf(_("%s: giving up \"%s\"\n"), progname, spec); - exit(0); } out: + free(mount_opts); + free(extra_opts); free(mount_point); exit(mnt_err); + +out_usage: + free(mount_opts); + exit(EX_USAGE); } diff --git a/utils/mount/mount.nfs.man b/utils/mount/mount.nfs.man index 231e04f..624358c 100644 --- a/utils/mount/mount.nfs.man +++ b/utils/mount/mount.nfs.man @@ -3,7 +3,7 @@ .SH NAME mount.nfs, mount.nfs4 \- mount a Network File System .SH SYNOPSIS -.BI "mount.nfs" " remotetarget dir" " [\-rvVwfnh ] [\-t " version "] [\-o " options "] +.BI "mount.nfs" " remotetarget dir" " [\-rvVwfnsh ] [\-o " options "] .SH DESCRIPTION .BR mount.nfs is a part of @@ -49,27 +49,17 @@ By default, an entry is created in .I /etc/mtab for every mounted file system. Use this option to skip making an entry. .TP +.BI "\-s" +Tolerate sloppy mount options rather than fail. +.TP .BI "\-h" Print help message. .TP -.BI "version" -Specify NFS file system version. Either -.BR nfs4 -or -.BR nfs. -If the command is -.BR mount.nfs4 -or the -.I vfstype -option of -.BR mount(8) -command is nfs4, then version 4 is used, else version 3 or 2 is used. -.TP .BI "nfsoptions" Refer to -.BR nfs(5) +.BR nfs (5) or -.BR mount(8) +.BR mount (8) manual pages. .SH NOTE @@ -92,9 +82,8 @@ table of mounted file systems .BR nfs (5), .BR mount (8), -.SH BUGS -Please notify current developers of NFS of any bugs in the current software or mail nfs@lists.sourceforge.net +.SH "BUGS" +Please notify nfs@lists.sourceforge.net of any bugs found in this software. .SH "AUTHOR" Amit Gud - diff --git a/utils/mount/network.c b/utils/mount/network.c index 5a56c23..49d3c6b 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -139,6 +139,13 @@ static const unsigned long probe_mnt3_first[] = { 0, }; +/** + * nfs_gethostbyname - resolve a hostname to an IPv4 address + * @hostname: pointer to a C string containing a DNS hostname + * @saddr: returns an IPv4 address + * + * Returns 1 if successful, otherwise zero. + */ int nfs_gethostbyname(const char *hostname, struct sockaddr_in *saddr) { struct hostent *hp; @@ -303,14 +310,16 @@ static unsigned short getport(struct sockaddr_in *saddr, unsigned long version, unsigned int proto) { + struct sockaddr_in bind_saddr; unsigned short port = 0; int socket; CLIENT *clnt = NULL; enum clnt_stat stat; + + bind_saddr = *saddr; + bind_saddr.sin_port = htons(PMAPPORT); - saddr->sin_port = htons(PMAPPORT); - - socket = get_socket(saddr, proto, PMAP_TIMEOUT, FALSE, FALSE); + socket = get_socket(&bind_saddr, proto, PMAP_TIMEOUT, FALSE, FALSE); if (socket == RPC_ANYSOCK) { if (proto == IPPROTO_TCP && rpc_createerr.cf_error.re_errno == ETIMEDOUT) @@ -320,14 +329,16 @@ static unsigned short getport(struct sockaddr_in *saddr, switch (proto) { case IPPROTO_UDP: - clnt = clntudp_bufcreate(saddr, + clnt = clntudp_bufcreate(&bind_saddr, PMAPPROG, PMAPVERS, RETRY_TIMEOUT, &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); break; case IPPROTO_TCP: - clnt = clnttcp_create(saddr, PMAPPROG, PMAPVERS, &socket, + clnt = clnttcp_create(&bind_saddr, + PMAPPROG, PMAPVERS, + &socket, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE); break; } @@ -388,7 +399,7 @@ static int probe_port(clnt_addr_t *server, const unsigned long *versions, inet_ntoa(saddr->sin_addr), prog, *p_vers, *p_prot == IPPROTO_UDP ? - "udp" : "tcp", + _("UDP") : _("TCP"), p_port); } if (clnt_ping(saddr, prog, *p_vers, *p_prot, NULL)) @@ -453,6 +464,16 @@ static int probe_mntport(clnt_addr_t *mnt_server) return probe_port(mnt_server, probe_mnt1_first, probe_udp_only); } +/** + * probe_bothports - discover the RPC endpoints of mountd and NFS server + * @mnt_server: pointer to address and pmap argument for mountd results + * @nfs_server: pointer to address and pmap argument for NFS server + * + * Returns 1 if successful, otherwise zero if some error occurred. + * Note that the arguments are both input and output arguments. + * + * A side effect of calling this function is that rpccreateerr is set. + */ int probe_bothports(clnt_addr_t *mnt_server, clnt_addr_t *nfs_server) { struct pmap *nfs_pmap = &nfs_server->pmap; @@ -520,8 +541,10 @@ static int probe_statd(void) return 1; } -/* - * Attempt to start rpc.statd +/** + * start_statd - attempt to start rpc.statd + * + * Returns 1 if statd is running; otherwise zero. */ int start_statd(void) { @@ -545,7 +568,7 @@ int start_statd(void) return 0; } -/* +/** * nfs_call_umount - ask the server to remove a share from it's rmtab * @mnt_server: address of RPC MNT program server * @argp: directory path of share to "unmount" @@ -589,6 +612,13 @@ int nfs_call_umount(clnt_addr_t *mnt_server, dirpath *argp) return 0; } +/** + * mnt_openclnt - get a handle for a remote mountd service + * @mnt_server: address and pmap arguments of mountd service + * @msock: returns a file descriptor of the underlying transport socket + * + * Returns an active handle for the remote's mountd service + */ CLIENT *mnt_openclnt(clnt_addr_t *mnt_server, int *msock) { struct sockaddr_in *mnt_saddr = &mnt_server->saddr; @@ -630,6 +660,12 @@ CLIENT *mnt_openclnt(clnt_addr_t *mnt_server, int *msock) return NULL; } +/** + * mnt_closeclnt - terminate a handle for a remote mountd service + * @clnt: pointer to an active handle for a remote mountd service + * @msock: file descriptor of the underlying transport socket + * + */ void mnt_closeclnt(CLIENT *clnt, int msock) { auth_destroy(clnt->cl_auth); @@ -637,11 +673,24 @@ void mnt_closeclnt(CLIENT *clnt, int msock) close(msock); } -/* +/** + * clnt_ping - send an RPC ping to the remote RPC service endpoint + * @saddr: server's address + * @prog: target RPC program number + * @vers: target RPC version number + * @prot: target RPC protocol + * @caddr: filled in with our network address + * * Sigh... getport() doesn't actually check the version number. * In order to make sure that the server actually supports the service * we're requesting, we open and RPC client, and fire off a NULL * RPC call. + * + * caddr is the network address that the server will use to call us back. + * On multi-homed clients, this address depends on which NIC we use to + * route requests to the server. + * + * Returns one if successful, otherwise zero. */ int clnt_ping(struct sockaddr_in *saddr, const unsigned long prog, const unsigned long vers, const unsigned int prot, @@ -711,3 +760,36 @@ int clnt_ping(struct sockaddr_in *saddr, const unsigned long prog, else return 0; } + +/** + * get_client_address - acquire our local network address + * @saddr: server's address + * @caddr: filled in with our network address + * + * Discover a network address that the server will use to call us back. + * On multi-homed clients, this address depends on which NIC we use to + * route requests to the server. + * + * Use a connected datagram socket so as not to leave a socket in TIME_WAIT. + * + * Returns one if successful, otherwise zero. + */ +int get_client_address(struct sockaddr_in *saddr, struct sockaddr_in *caddr) +{ + socklen_t len = sizeof(*caddr); + int socket, err; + + socket = get_socket(saddr, IPPROTO_UDP, CONNECT_TIMEOUT, FALSE, TRUE); + if (socket == RPC_ANYSOCK) + return 0; + + err = getsockname(socket, caddr, &len); + close(socket); + + if (err && verbose) { + nfs_error(_("%s: getsockname failed: %s"), + progname, strerror(errno)); + return 0; + } + return 1; +} diff --git a/utils/mount/network.h b/utils/mount/network.h index 2e4dbbc..99ecc1e 100644 --- a/utils/mount/network.h +++ b/utils/mount/network.h @@ -48,6 +48,7 @@ static const struct timeval RETRY_TIMEOUT = { 3, 0 }; int probe_bothports(clnt_addr_t *, clnt_addr_t *); int nfs_gethostbyname(const char *, struct sockaddr_in *); +int get_client_address(struct sockaddr_in *, struct sockaddr_in *); int nfs_call_umount(clnt_addr_t *, dirpath *); int clnt_ping(struct sockaddr_in *, const unsigned long, const unsigned long, const unsigned int, diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man index e66daba..d92da19 100644 --- a/utils/mount/nfs.man +++ b/utils/mount/nfs.man @@ -411,11 +411,23 @@ Valid protocol types are and .IR tcp . .TP 1.5i -.I clientaddr=n -On a multi-homed client, this -causes the client to use a specific callback address when -communicating with an NFS version 4 server. -This option is currently ignored. +.I clientaddr=n.n.n.n +Specifies a single IPv4 address in dotted-quad form that +the NFS client advertises to allow servers to perform +NFSv4 callback requests against files on this mount point. +If the server is not able to establish callback connections +to clients, performance may degrade, or accesses to +files may temporarily hang. +.IP +If this option is not specified, the +.BR mount (8) +command attempts to discover an appropriate callback +address automatically. +The automatic discovery process is not perfect, however. +In the presence of multiple client network interfaces, special +routing policies, or atypical network topologies, the exact +address to use for callbacks may be nontrivial to determine, +and should be explicitly set using this mount option. .TP 1.5i .I sec=mode Same as \f3sec=mode\f1 for the nfs filesystem type (see above). diff --git a/utils/mount/nfs4mount.c b/utils/mount/nfs4mount.c index c4e8bfb..0a32c3c 100644 --- a/utils/mount/nfs4mount.c +++ b/utils/mount/nfs4mount.c @@ -428,15 +428,15 @@ int nfs4mount(const char *spec, const char *node, int flags, if (errno == ETIMEDOUT) break; default: - mount_errors(hostname, 0, bg); + rpc_mount_errors(hostname, 0, bg); goto fail; } t = time(NULL); if (t >= timeout) { - mount_errors(hostname, 0, bg); + rpc_mount_errors(hostname, 0, bg); goto fail; } - mount_errors(hostname, 1, bg); + rpc_mount_errors(hostname, 1, bg); continue; } @@ -448,7 +448,7 @@ int nfs4mount(const char *spec, const char *node, int flags, } } - return 0; + return EX_SUCCESS; fail: return retval; diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c index 5839482..23dd2f6 100644 --- a/utils/mount/nfsmount.c +++ b/utils/mount/nfsmount.c @@ -688,15 +688,15 @@ nfsmount(const char *spec, const char *node, int flags, if (errno == ETIMEDOUT) break; default: - mount_errors(*nfs_server.hostname, 0, bg); + rpc_mount_errors(*nfs_server.hostname, 0, bg); goto fail; } t = time(NULL); if (t >= timeout) { - mount_errors(*nfs_server.hostname, 0, bg); + rpc_mount_errors(*nfs_server.hostname, 0, bg); goto fail; } - mount_errors(*nfs_server.hostname, 1, bg); + rpc_mount_errors(*nfs_server.hostname, 1, bg); continue; } if (!running_bg) { @@ -707,11 +707,11 @@ nfsmount(const char *spec, const char *node, int flags, } t = time(NULL); if (t >= timeout) { - mount_errors(*nfs_server.hostname, 0, bg); + rpc_mount_errors(*nfs_server.hostname, 0, bg); goto fail; } if (doonce++ < 1) - mount_errors(*nfs_server.hostname, 1, bg); + rpc_mount_errors(*nfs_server.hostname, 1, bg); } if (nfs_pmap->pm_vers == 2) { @@ -863,7 +863,7 @@ noauth_flavors: } } - return 0; + return EX_SUCCESS; /* abort */ fail: diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c index a78ab26..8902f00 100644 --- a/utils/mount/nfsumount.c +++ b/utils/mount/nfsumount.c @@ -51,72 +51,85 @@ int force; int lazy; int remount; + +static int try_remount(const char *spec, const char *node) +{ + int res; + + res = mount(spec, node, NULL, + MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); + if (res == 0) { + struct mntent remnt; + nfs_error(_("%s: %s busy - remounted read-only"), + progname, spec); + remnt.mnt_type = remnt.mnt_fsname = NULL; + remnt.mnt_dir = xstrdup(node); + remnt.mnt_opts = xstrdup("ro"); + if (!nomtab) + update_mtab(node, &remnt); + } else if (errno != EBUSY) { /* hmm ... */ + perror(_("remount")); + nfs_error(_("%s: could not remount %s read-only"), + progname, spec); + } + return res; +} + static int del_mtab(const char *spec, const char *node) { int umnt_err, res; - umnt_err = 0; - if (lazy) { - res = umount2 (node, MNT_DETACH); - if (res < 0) - umnt_err = errno; - goto writemtab; - } - - if (force) { - res = umount2 (node, MNT_FORCE); - if (res == -1) { - int errsv = errno; - perror(_("umount2")); - errno = errsv; - if (errno == ENOSYS) { - if (verbose) - printf(_("no umount2, trying umount...\n")); - res = umount (node); - } - } - } else - res = umount (node); - - if (res < 0 && remount && errno == EBUSY && spec) { - /* Umount failed - let us try a remount */ - res = mount(spec, node, NULL, - MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL); - if (res == 0) { - struct mntent remnt; - nfs_error(_("%s: %s busy - remounted read-only"), - progname, spec); - remnt.mnt_type = remnt.mnt_fsname = NULL; - remnt.mnt_dir = xstrdup(node); - remnt.mnt_opts = xstrdup("ro"); - if (!nomtab) - update_mtab(node, &remnt); - return 0; - } else if (errno != EBUSY) { /* hmm ... */ - perror(_("remount")); - nfs_error(_("%s: could not remount %s read-only"), - progname, spec); - } - } - - if (res >= 0) { - /* Umount succeeded */ - if (verbose) - printf(_("%s umounted\n"), spec ? spec : node); - } + umnt_err = 0; + if (lazy) { + res = umount2 (node, MNT_DETACH); + if (res < 0) + umnt_err = errno; + goto writemtab; + } + + if (force) { + res = umount2 (node, MNT_FORCE); + if (res == -1) { + int errsv = errno; + perror(_("umount2")); + errno = errsv; + if (errno == ENOSYS) { + if (verbose) + printf(_("no umount2, trying umount...\n")); + res = umount (node); + } + } + } else + res = umount (node); + + if (res < 0) { + if (remount && errno == EBUSY && spec) { + res = try_remount(spec, node); + if (res) + goto writemtab; + return 0; + } else + umnt_err = errno; + } + + if (res >= 0) { + /* Umount succeeded */ + if (verbose) + printf(_("%s umounted\n"), spec ? spec : node); + } writemtab: - if (!nomtab && - (umnt_err == 0 || umnt_err == EINVAL || umnt_err == ENOENT)) { - update_mtab(node, NULL); - } + if (!nomtab && + (umnt_err == 0 || umnt_err == EINVAL || umnt_err == ENOENT)) { + update_mtab(node, NULL); + } - if (res >= 0) - return 0; + if (res >= 0) + return 0; - if (umnt_err) - umount_error(umnt_err, node); - return EX_FILEIO; + if (umnt_err) + umount_error(umnt_err, node); + return EX_FILEIO; } /* @@ -209,7 +222,7 @@ static int do_nfs_umount(const char *spec, char *opts) return EX_USAGE; } - return 0; + return EX_SUCCESS; } static struct option umount_longopts[] = @@ -305,7 +318,7 @@ int nfsumount(int argc, char *argv[]) /* umount might call us twice. The second time there will * be no entry in mtab and we should just exit quietly */ - return 0; + return EX_SUCCESS; only_root: nfs_error(_("%s: You are not permitted to unmount %s"), @@ -335,7 +348,7 @@ int nfsumount(int argc, char *argv[]) ret = 0; if (mc) { - if (!lazy) + if (!lazy && strcmp(mc->m.mnt_type, "nfs4") != 0) ret = do_nfs_umount(mc->m.mnt_fsname, mc->m.mnt_opts); if (!ret || force) ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir); diff --git a/utils/mount/parse_opt.c b/utils/mount/parse_opt.c new file mode 100644 index 0000000..fb4a0e4 --- /dev/null +++ b/utils/mount/parse_opt.c @@ -0,0 +1,430 @@ +/* + * parse_opt.c -- mount option string parsing helpers + * + * Copyright (C) 2007 Oracle. All rights reserved. + * Copyright (C) 2007 Chuck Lever + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + */ + +/* + * Converting a C string containing mount options to a data object + * and manipulating that object is cleaner in C than manipulating + * the C string itself. This is similar to the way Python handles + * string manipulation. + * + * The current implementation uses a linked list as the data object + * since lists are simple, and we don't need to worry about more + * than ten or twenty options at a time. + * + * Hopefully the interface is abstract enough that the underlying + * data structure can be replaced if needed without changing the API. + */ + + +#include +#include +#include +#include +#include +#include + +#include "parse_opt.h" +#include "token.h" + + +struct mount_option { + struct mount_option *next, *prev; + char *keyword; + char *value; +}; + +struct mount_options { + struct mount_option *head, *tail; + unsigned int count; +}; + +static struct mount_option *option_create(char *str) +{ + struct mount_option *option; + char *opteq; + + if (!str) + return NULL; + + option = malloc(sizeof(*option)); + if (!option) + return NULL; + + option->next = NULL; + option->prev = NULL; + + opteq = strchr(str, '='); + if (opteq) { + option->keyword = strndup(str, opteq - str); + if (!option->keyword) + goto fail; + option->value = strdup(opteq + 1); + if (!option->value) { + free(option->keyword); + goto fail; + } + } else { + option->keyword = strdup(str); + if (!option->keyword) + goto fail; + option->value = NULL; + } + + return option; + +fail: + free(option); + return NULL; +} + +static void option_destroy(struct mount_option *option) +{ + free(option->keyword); + free(option->value); + free(option); +} + +static void options_init(struct mount_options *options) +{ + options->head = options->tail = NULL; + options->count = 0; +} + +static struct mount_options *options_create(void) +{ + struct mount_options *options; + + options = malloc(sizeof(*options)); + if (options) + options_init(options); + + return options; +} + +static int options_empty(struct mount_options *options) +{ + return options->count == 0; +} + +static void options_tail_insert(struct mount_options *options, + struct mount_option *option) +{ + struct mount_option *prev = options->tail; + + option->next = NULL; + option->prev = prev; + + if (prev) + prev->next = option; + else + options->head = option; + options->tail = option; + + options->count++; +} + +static void options_delete(struct mount_options *options, + struct mount_option *option) +{ + struct mount_option *prev = option->prev; + struct mount_option *next = option->next; + + if (!options_empty(options)) { + if (prev) + prev->next = option->next; + if (next) + next->prev = option->prev; + + if (options->head == option) + options->head = option->next; + if (options->tail == option) + options->tail = prev; + + options->count--; + + option_destroy(option); + } +} + + +/** + * po_destroy - deallocate a group of mount options + * @options: pointer to mount options to free + * + */ +void po_destroy(struct mount_options *options) +{ + if (options) { + while (!options_empty(options)) + options_delete(options, options->head); + free(options); + } +} + +/** + * po_split - split options string into group of options + * @options: pointer to C string containing zero or more comma-delimited options + * + * Convert our mount options string to a list to make it easier + * to adjust the options as we go. This is just an exercise in + * lexical parsing -- this function doesn't pay attention to the + * meaning of the options themselves. + * + * Returns a new group of mount options if successful; otherwise NULL + * is returned if some failure occurred. + */ +struct mount_options *po_split(char *str) +{ + struct mount_options *options; + struct tokenizer_state *tstate; + char *opt; + + if (!str) + return options_create(); + + options = options_create(); + if (options) { + tstate = init_tokenizer(str, ','); + for (opt = next_token(tstate); opt; opt = next_token(tstate)) { + struct mount_option *option = option_create(opt); + free(opt); + if (!option) + goto fail; + options_tail_insert(options, option); + } + if (tokenizer_error(tstate)) + goto fail; + end_tokenizer(tstate); + } + return options; + +fail: + end_tokenizer(tstate); + po_destroy(options); + return NULL; +} + +/** + * po_replace - replace mount options in one mount_options object with another + * @target: pointer to previously instantiated object to replace + * @source: pointer to object containing source mount options + * + * Side effect: the object referred to by source is emptied. + */ +void po_replace(struct mount_options *target, struct mount_options *source) +{ + if (target) { + while (!options_empty(target)) + options_delete(target, target->head); + + if (source) { + target->head = source->head; + target->tail = source->tail; + target->count = source->count; + + options_init(source); + } + } +} + +/** + * po_join - recombine group of mount options into a C string + * @options: pointer to mount options to recombine + * @str: handle on string to replace (input and output) + * + * Convert our mount options object back into a string that the + * rest of the world can use. + * + * Returns 1 if the string was successfully created; otherwise + * zero. Upon return, @string contains the address of a + * replacement C string containing a comma-delimited list of + * mount options and values; or the passed-in string is freed + * and NULL is returned if some failure occurred. + */ +int po_join(struct mount_options *options, char **str) +{ + size_t len = 0; + struct mount_option *option; + + if (!str || !options) + return PO_FAILED; + + free(*str); + *str = NULL; + + if (options_empty(options)) { + *str = strdup(""); + return *str ? PO_SUCCEEDED : PO_FAILED; + } + + for (option = options->head; option; option = option->next) { + len += strlen(option->keyword); + if (option->value) + len +=strlen(option->value) + 1; /* equals sign */ + if (option->next) + len++; /* comma */ + } + + len++; /* NULL on the end */ + + *str = malloc(len); + if (!*str) + return PO_FAILED; + *str[0] = '\0'; + + for (option = options->head; option; option = option->next) { + strcat(*str, option->keyword); + if (option->value) { + strcat(*str, "="); + strcat(*str, option->value); + } + if (option->next) + strcat(*str, ","); + } + + return PO_SUCCEEDED; +} + +/** + * po_append - concatenate an option onto a group of options + * @options: pointer to mount options + * @option: pointer to a C string containing the option to add + * + * Returns 1 if the list was successfully concatenated; otherwise + * zero. + */ +int po_append(struct mount_options *options, char *str) +{ + struct mount_option *option = option_create(str); + + if (option) { + options_tail_insert(options, option); + return PO_SUCCEEDED; + } + return PO_FAILED; +} + +/** + * po_contains - check for presense of an option in a group + * @options: pointer to mount options + * @keyword: pointer to a C string containing option keyword for which to search + * + * Returns 1 if the option is present in the list; otherwise zero. + */ +int po_contains(struct mount_options *options, char *keyword) +{ + struct mount_option *option; + + if (options && keyword) { + for (option = options->head; option; option = option->next) + if (strcmp(option->keyword, keyword) == 0) + return PO_FOUND; + } + + return PO_NOT_FOUND; +} + +/** + * po_get - return the value of the rightmost instance of an option + * @options: pointer to mount options + * @keyword: pointer to a C string containing option keyword for which to search + * + * If multiple instances of the same option are present in a mount option + * list, the rightmost instance is always the effective one. + * + * Returns pointer to C string containing the value of the option. + * Returns NULL if the option isn't found, or if the option doesn't + * have a value. + */ +char *po_get(struct mount_options *options, char *keyword) +{ + struct mount_option *option; + + if (options && keyword) { + for (option = options->tail; option; option = option->prev) + if (strcmp(option->keyword, keyword) == 0) + return option->value; + } + + return NULL; +} + +/** + * po_rightmost - determine the relative position of two options + * @options: pointer to mount options + * @key1: pointer to a C string containing an option keyword + * @key2: pointer to a C string containing another option keyword + * + * The kernel parses the mount option string from left to right. + * If an option is specified more than once (for example, "intr" + * and "nointr", the rightmost option is the last to be parsed, + * and it therefore takes precedence over previous similar options. + * + * This function can be used to determine which of two similar + * options will be the one to take effect. + * + * Returns 1 if key2 is rightmost or key1 is not present. + * Returns -1 if key1 is rightmost or key2 is not present. + * Returns 0 if neither key is present. + */ +int po_rightmost(struct mount_options *options, char *key1, char *key2) +{ + struct mount_option *option; + + if (options) { + for (option = options->tail; option; option = option->prev) { + if (key2 && strcmp(option->keyword, key2) == 0) + return 1; + if (key1 && strcmp(option->keyword, key1) == 0) + return -1; + } + } + + return PO_NOT_FOUND; +} + +/** + * po_remove_all - remove instances of an option from a group + * @options: pointer to mount options + * @keyword: pointer to a C string containing an option keyword to remove + * + * Returns 1 if the option was found and removed; passed-in list is + * truncated upon return; otherwise zero. + */ +int po_remove_all(struct mount_options *options, char *keyword) +{ + struct mount_option *option, *next; + int found = PO_NOT_FOUND; + + if (options && keyword) { + for (option = options->head; option; option = next) { + next = option->next; + if (strcmp(option->keyword, keyword) == 0) { + options_delete(options, option); + found = PO_FOUND; + } + } + } + + return found; +} diff --git a/utils/mount/parse_opt.h b/utils/mount/parse_opt.h new file mode 100644 index 0000000..93430d9 --- /dev/null +++ b/utils/mount/parse_opt.h @@ -0,0 +1,46 @@ +/* + * parse_opt.h -- mount option string parsing helpers + * + * Copyright (C) 2007 Oracle. All rights reserved. + * Copyright (C) 2007 Chuck Lever + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + */ + +enum { + PO_FAILED = 0, + PO_SUCCEEDED = 1, +}; + +enum { + PO_NOT_FOUND = 0, + PO_FOUND = 1, +}; + +struct mount_options; + +struct mount_options * po_split(char *); +void po_replace(struct mount_options *, + struct mount_options *); +int po_join(struct mount_options *, char **); + +int po_append(struct mount_options *, char *); +int po_contains(struct mount_options *, char *); +char * po_get(struct mount_options *, char *); +int po_rightmost(struct mount_options *, char *, char *); +int po_remove_all(struct mount_options *, char *); +void po_destroy(struct mount_options *); diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c new file mode 100644 index 0000000..b31b3a2 --- /dev/null +++ b/utils/mount/stropts.c @@ -0,0 +1,344 @@ +/* + * stropts.c -- NFS mount using C string to pass options to kernel + * + * Copyright (C) 2007 Oracle. All rights reserved. + * Copyright (C) 2007 Chuck Lever + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "xcommon.h" +#include "mount.h" +#include "nls.h" +#include "nfs_mount.h" +#include "mount_constants.h" +#include "stropts.h" +#include "error.h" +#include "network.h" +#include "parse_opt.h" + +#ifdef HAVE_RPCSVC_NFS_PROT_H +#include +#else +#include +#define nfsstat nfs_stat +#endif + +#ifndef NFS_PORT +#define NFS_PORT 2049 +#endif + +#ifndef NFS_MAXHOSTNAME +#define NFS_MAXHOSTNAME (255) +#endif + +#ifndef NFS_MAXPATHNAME +#define NFS_MAXPATHNAME (1024) +#endif + +extern int nfs_mount_data_version; +extern char *progname; +extern int verbose; + +static int parse_devname(const char *spec, char **hostname) +{ + int ret = 0; + char *dev, *pathname, *s; + + dev = xstrdup(spec); + + if (!(pathname = strchr(dev, ':'))) { + nfs_error(_("%s: remote share not in 'host:dir' format"), + progname); + goto out; + } + *pathname = '\0'; + pathname++; + + /* + * We don't need a copy of the pathname, but let's + * sanity check it anyway. + */ + if (strlen(pathname) > NFS_MAXPATHNAME) { + nfs_error(_("%s: export pathname is too long"), + progname); + goto out; + } + + /* + * Ignore all but first hostname in replicated mounts + * until they can be fully supported. (mack@sgi.com) + */ + if ((s = strchr(dev, ','))) { + *s = '\0'; + nfs_error(_("%s: warning: multiple hostnames not supported"), + progname); + nfs_error(_("%s: ignoring hostnames that follow the first one"), + progname); + } + *hostname = xstrdup(dev); + if (strlen(*hostname) > NFS_MAXHOSTNAME) { + nfs_error(_("%s: server hostname is too long"), + progname); + free(*hostname); + goto out; + } + + ret = 1; + +out: + free(dev); + return ret; +} + +static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr) +{ + struct hostent *hp; + addr->sin_family = AF_INET; + + if (inet_aton(hostname, &addr->sin_addr)) + return 1; + if ((hp = gethostbyname(hostname)) == NULL) { + nfs_error(_("%s: can't get address for %s\n"), + progname, hostname); + return 0; + } + if (hp->h_length > sizeof(struct in_addr)) { + nfs_error(_("%s: got bad hp->h_length"), progname); + hp->h_length = sizeof(struct in_addr); + } + memcpy(&addr->sin_addr, hp->h_addr, hp->h_length); + return 1; +} + +/* + * Append the 'addr=' option to the options string to pass a resolved + * server address to the kernel. After a successful mount, this address + * is also added to /etc/mtab for use when unmounting. + * + * If 'addr=' is already present, we strip it out. This prevents users + * from setting a bogus 'addr=' option themselves, and also allows bg + * retries to recompute the server's address, in case it has changed. + * + * Returns 1 if 'addr=' option appended successfully; + * otherwise zero. + */ +static int append_addr_option(struct sockaddr_in *saddr, + struct mount_options *options) +{ + char new_option[24]; + + po_remove_all(options, "addr"); + + snprintf(new_option, sizeof(new_option) - 1, + "addr=%s", inet_ntoa(saddr->sin_addr)); + + if (po_append(options, new_option) == PO_SUCCEEDED) + return 1; + return 0; +} + +/* + * Called to discover our address and append an appropriate 'clientaddr=' + * option to the options string. + * + * Returns 1 if 'clientaddr=' option created successfully or if + * 'clientaddr=' option is already present; otherwise zero. + */ +static int append_clientaddr_option(struct sockaddr_in *saddr, + struct mount_options *options) +{ + struct sockaddr_in my_addr; + char new_option[32]; + + if (po_contains(options, "clientaddr") == PO_SUCCEEDED) + return 1; + + if (!get_client_address(saddr, &my_addr)) + return 0; + + snprintf(new_option, sizeof(new_option) - 1, + "clientaddr=%s", inet_ntoa(my_addr.sin_addr)); + + if (po_append(options, new_option) == PO_SUCCEEDED) + return 1; + return 0; +} + +/* + * Called to resolve the 'mounthost=' hostname and append a new + * option using an IPv4 address. + */ +static int fix_up_mounthost_opt(struct mount_options *options) +{ + struct sockaddr_in maddr; + char *mounthost, new_option[32]; + + mounthost = po_get(options, "mounthost"); + if (!mounthost) + return 1; + + if (!fill_ipv4_sockaddr(mounthost, &maddr)) + return 0; + + snprintf(new_option, sizeof(new_option) - 1, + "mountaddr=%s", inet_ntoa(maddr.sin_addr)); + + if (po_append(options, new_option) == PO_SUCCEEDED) + return 1; + return 0; +} + +/* + * nfsmount_s - Mount an NFSv2 or v3 file system using C string options + * + * @spec: C string hostname:path specifying remoteshare to mount + * @node: C string pathname of local mounted on directory + * @flags: MS_ style flags + * @extra_opts: pointer to C string containing fs-specific mount options + * (possibly also a return argument) + * @fake: flag indicating whether to carry out the whole operation + * @child: one if this is a backgrounded mount + * + * XXX: need to handle bg, fg, and retry options. + */ +int nfsmount_s(const char *spec, const char *node, int flags, + char **extra_opts, int fake, int child) +{ + struct mount_options *options = NULL; + struct sockaddr_in saddr; + char *hostname; + int err, retval = EX_FAIL; + + if (!parse_devname(spec, &hostname)) + goto out; + err = fill_ipv4_sockaddr(hostname, &saddr); + free(hostname); + if (!err) + goto out; + + options = po_split(*extra_opts); + if (!options) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + + if (!append_addr_option(&saddr, options)) + goto out; + + if (!fix_up_mounthost_opt(options)) + goto out; + + if (po_join(options, extra_opts) == PO_FAILED) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + + if (verbose) + printf(_("%s: text-based options: '%s'\n"), + progname, *extra_opts); + + if (!fake) { + if (mount(spec, node, "nfs", + flags & ~(MS_USER|MS_USERS), *extra_opts)) { + mount_error(spec, node, errno); + goto out; + } + } + + retval = EX_SUCCESS; + +out: + po_destroy(options); + return retval; +} + +/* + * nfs4mount_s - Mount an NFSv4 file system using C string options + * + * @spec: C string hostname:path specifying remoteshare to mount + * @node: C string pathname of local mounted on directory + * @flags: MS_ style flags + * @extra_opts: pointer to C string containing fs-specific mount options + * (possibly also a return argument) + * @fake: flag indicating whether to carry out the whole operation + * @child: one if this is a backgrounded mount + * + * XXX: need to handle bg, fg, and retry options. + * + */ +int nfs4mount_s(const char *spec, const char *node, int flags, + char **extra_opts, int fake, int child) +{ + struct mount_options *options = NULL; + struct sockaddr_in saddr; + char *hostname; + int err, retval = EX_FAIL; + + if (!parse_devname(spec, &hostname)) + goto out; + err = fill_ipv4_sockaddr(hostname, &saddr); + free(hostname); + if (!err) + goto out; + + options = po_split(*extra_opts); + if (!options) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + + if (!append_addr_option(&saddr, options)) + goto out; + + if (!append_clientaddr_option(&saddr, options)) + goto out; + + if (po_join(options, extra_opts) == PO_FAILED) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + + if (verbose) + printf(_("%s: text-based options: '%s'\n"), + progname, *extra_opts); + + if (!fake) { + if (mount(spec, node, "nfs4", + flags & ~(MS_USER|MS_USERS), *extra_opts)) { + mount_error(spec, node, errno); + goto out; + } + } + + retval = EX_SUCCESS; + +out: + po_destroy(options); + return retval; +} diff --git a/utils/mount/stropts.h b/utils/mount/stropts.h new file mode 100644 index 0000000..a2a0604 --- /dev/null +++ b/utils/mount/stropts.h @@ -0,0 +1,25 @@ +/* + * stropts.h -- Provide common network functions for NFS mount/umount + * + * Copyright (C) 2007 Oracle. All rights reserved. + * Copyright (C) 2007 Chuck Lever + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + */ + +int nfsmount_s(const char *, const char *, int , char **, int, int); +int nfs4mount_s(const char *, const char *, int, char **, int, int); diff --git a/utils/mount/token.c b/utils/mount/token.c new file mode 100644 index 0000000..5ef9604 --- /dev/null +++ b/utils/mount/token.c @@ -0,0 +1,157 @@ +/* + * token.c -- tokenize strings, a la strtok(3) + * + * Copyright (C) 2007 Oracle. All rights reserved. + * Copyright (C) 2007 Chuck Lever + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + */ + +/* + * We've constructed a simple string tokenizer that is better than + * strtok(3) in several ways: + * + * 1. It doesn't interfere with ongoing tokenizations using strtok(3). + * 2. It's re-entrant so we can nest tokenizations, if needed. + * 3. It can handle double-quoted delimiters (needed for 'context="sd,fslj"'). + * 4. It doesn't alter the string we're tokenizing, so it can work + * on write-protected strings as well as writable strings. + */ + + +#include +#include +#include +#include +#include +#include + +#include "token.h" + + +struct tokenizer_state { + char *pos; + char delimiter; + int error; +}; + +static void find_next_nondelimiter(struct tokenizer_state *tstate) +{ + while (*tstate->pos != '\0' && *tstate->pos == tstate->delimiter) + tstate->pos++; +} + +static size_t find_next_delimiter(struct tokenizer_state *tstate) +{ + size_t len = 0; + int quote_seen = 0; + + while (*tstate->pos != '\0') { + if (*tstate->pos == '"') + quote_seen ^= 1; + + if (!quote_seen && *tstate->pos == tstate->delimiter) + break; + + len++; + tstate->pos++; + } + + /* did the string terminate before the close quote? */ + if (quote_seen) { + tstate->error = EINVAL; + return 0; + } + + return len; +} + +/** + * next_token - find the next token in a string and return it + * @tstate: pointer to tokenizer context object + * + * Returns the next token found in the current string. + * Returns NULL if there are no more tokens in the string, + * or if an error occurs. + * + * Side effect: tstate is updated + */ +char *next_token(struct tokenizer_state *tstate) +{ + char *token; + size_t len; + + if (!tstate || !tstate->pos || tstate->error) + return NULL; + + find_next_nondelimiter(tstate); + if (*tstate->pos == '\0') + goto fail; + token = tstate->pos; + + len = find_next_delimiter(tstate); + if (len) { + token = strndup(token, len); + if (token) + return token; + tstate->error = ENOMEM; + } + +fail: + tstate->pos = NULL; + return NULL; /* no tokens found in this string */ +} + +/** + * init_tokenizer - return an initialized tokenizer context object + * @string: pointer to C string + * @delimiter: single character that delimits tokens in @string + * + * Returns an initialized tokenizer context object + */ +struct tokenizer_state *init_tokenizer(char *string, char delimiter) +{ + struct tokenizer_state *tstate; + + tstate = malloc(sizeof(*tstate)); + if (tstate) { + tstate->pos = string; + tstate->delimiter = delimiter; + tstate->error = 0; + } + return tstate; +} + +/** + * tokenizer_error - digs error value out of tokenizer context + * @tstate: pointer to tokenizer context object + * + */ +int tokenizer_error(struct tokenizer_state *tstate) +{ + return tstate ? tstate->error : 0; +} + +/** + * end_tokenizer - free a tokenizer context object + * @tstate: pointer to tokenizer context object + * + */ +void end_tokenizer(struct tokenizer_state *tstate) +{ + free(tstate); +} diff --git a/utils/mount/token.h b/utils/mount/token.h new file mode 100644 index 0000000..47762dc --- /dev/null +++ b/utils/mount/token.h @@ -0,0 +1,29 @@ +/* + * token.h -- tokenize strings, a la strtok(3) + * + * Copyright (C) 2007 Oracle. All rights reserved. + * Copyright (C) 2007 Chuck Lever + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program 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 + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + */ + +struct tokenizer_state; + +char *next_token(struct tokenizer_state *); +struct tokenizer_state *init_tokenizer(char *, char); +int tokenizer_error(struct tokenizer_state *); +void end_tokenizer(struct tokenizer_state *); diff --git a/utils/mount/umount.nfs.man b/utils/mount/umount.nfs.man index 8214c9a..ee4cdaf 100644 --- a/utils/mount/umount.nfs.man +++ b/utils/mount/umount.nfs.man @@ -1,4 +1,4 @@ -.\"@(#)mount.nfs.8" +.\"@(#)umount.nfs.8" .TH UMOUNT.NFS 8 "6 Jun 2006" .SH NAME umount.nfs, umount.nfs4 \- unmount a Network File System @@ -66,9 +66,8 @@ table of mounted file systems .BR nfs (5), .BR umount (8), -.SH BUGS -Please notify current developers of NFS of any bugs in the current software or mail nfs@lists.sourceforge.net +.SH "BUGS" +Please notify nfs@lists.sourceforge.net of any bugs found in this software. .SH "AUTHOR" Amit Gud - diff --git a/utils/mountd/Makefile.in b/utils/mountd/Makefile.in index b5b55e4..2bacc50 100644 --- a/utils/mountd/Makefile.in +++ b/utils/mountd/Makefile.in @@ -129,9 +129,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/utils/mountd/auth.c b/utils/mountd/auth.c index f7fe23d..a821c13 100644 --- a/utils/mountd/auth.c +++ b/utils/mountd/auth.c @@ -37,6 +37,7 @@ static nfs_export my_exp; static nfs_client my_client; extern int new_cache; +extern int use_ipaddr; void auth_init(char *exports) @@ -47,6 +48,34 @@ auth_init(char *exports) xtab_mount_write(); } +/* + * A client can match many different netgroups and it's tough to know + * beforehand whether it will. If the concatenated string of netgroup + * m_hostnames is >512 bytes, then enable the "use_ipaddr" mode. This + * makes mountd change how it matches a client ip address when a mount + * request comes in. It's more efficient at handling netgroups at the + * expense of larger kernel caches. + */ +static void +check_useipaddr() +{ + nfs_client *clp; + int old_use_ipaddr = use_ipaddr; + unsigned int len = 0; + + /* add length of m_hostname + 1 for the comma */ + for (clp = clientlist[MCL_NETGROUP]; clp; clp = clp->m_next) + len += (strlen(clp->m_hostname) + 1); + + if (len > (NFSCLNT_IDMAX / 2)) + use_ipaddr = 1; + else + use_ipaddr = 0; + + if (use_ipaddr != old_use_ipaddr) + cache_flush(1); +} + unsigned int auth_reload() { @@ -72,6 +101,7 @@ auth_reload() export_freeall(); memset(&my_client, 0, sizeof(my_client)); xtab_export_read(); + check_useipaddr(); ++counter; return counter; @@ -88,23 +118,37 @@ auth_authenticate_internal(char *what, struct sockaddr_in *caller, int i; /* return static nfs_export with details filled in */ char *n; - my_client.m_addrlist[0] = caller->sin_addr; - n = client_compose(caller->sin_addr); - *error = unknown_host; - if (!n) + free(my_client.m_hostname); + if (use_ipaddr) { + my_client.m_hostname = + strdup(inet_ntoa(caller->sin_addr)); + } else { + n = client_compose(hp); + *error = unknown_host; + if (!n) + my_client.m_hostname = NULL; + else if (*n) + my_client.m_hostname = n; + else { + free(n); + my_client.m_hostname = strdup("DEFAULT"); + } + } + if (my_client.m_hostname == NULL) return NULL; - strcpy(my_client.m_hostname, *n?n:"DEFAULT"); - free(n); my_client.m_naddr = 1; + my_client.m_addrlist[0] = caller->sin_addr; my_exp.m_client = &my_client; exp = NULL; for (i = 0; !exp && i < MCL_MAXTYPES; i++) for (exp = exportlist[i]; exp; exp = exp->m_next) { - if (!client_member(my_client.m_hostname, exp->m_client->m_hostname)) - continue; if (strcmp(path, exp->m_export.e_path)) continue; + if (!use_ipaddr && !client_member(my_client.m_hostname, exp->m_client->m_hostname)) + continue; + if (use_ipaddr && !client_check(exp->m_client, hp)) + continue; break; } *error = not_exported; @@ -155,11 +199,7 @@ auth_authenticate(char *what, struct sockaddr_in *caller, char *path) epath[sizeof (epath) - 1] = '\0'; auth_fixpath(epath); /* strip duplicate '/' etc */ - hp = get_reliable_hostbyaddr((const char*)&caller->sin_addr, sizeof(struct in_addr), - AF_INET); - if (!hp) - hp = get_hostent((const char*)&caller->sin_addr, sizeof(struct in_addr), - AF_INET); + hp = client_resolve(caller->sin_addr); if (!hp) return exp; diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index 15100d4..ce1a5a9 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -61,6 +61,7 @@ int cache_export_ent(char *domain, struct exportent *exp, char *p); char *lbuf = NULL; int lbuflen = 0; +extern int use_ipaddr; void auth_unix_ip(FILE *f) { @@ -74,8 +75,9 @@ void auth_unix_ip(FILE *f) char *cp; char class[20]; char ipaddr[20]; - char *client; + char *client = NULL; struct in_addr addr; + struct hostent *he = NULL; if (readline(fileno(f), &lbuf, &lbuflen) != 1) return; @@ -94,18 +96,22 @@ void auth_unix_ip(FILE *f) auth_reload(); /* addr is a valid, interesting address, find the domain name... */ - client = client_compose(addr); - + if (!use_ipaddr) { + he = client_resolve(addr); + client = client_compose(he); + } qword_print(f, "nfsd"); qword_print(f, ipaddr); qword_printint(f, time(0)+30*60); - if (client) + if (use_ipaddr) + qword_print(f, ipaddr); + else if (client) qword_print(f, *client?client:"DEFAULT"); qword_eol(f); if (client) free(client); - + free(he); } void auth_unix_gid(FILE *f) @@ -264,6 +270,8 @@ void nfsd_fh(FILE *f) unsigned int fsidnum=0; char fsid[32]; struct exportent *found = NULL; + struct hostent *he = NULL; + struct in_addr addr; char *found_path = NULL; nfs_export *exp; int i; @@ -389,7 +397,7 @@ void nfsd_fh(FILE *f) next_exp = exp->m_next; } - if (!client_member(dom, exp->m_client->m_hostname)) + if (!use_ipaddr && !client_member(dom, exp->m_client->m_hostname)) continue; if (exp->m_export.e_mountpoint && !is_mountpoint(exp->m_export.e_mountpoint[0]? @@ -441,10 +449,21 @@ void nfsd_fh(FILE *f) continue; #endif } + if (use_ipaddr) { + if (he == NULL) { + if (!inet_aton(dom, &addr)) + goto out; + he = client_resolve(addr); + } + if (!client_check(exp->m_client, he)) + continue; + } /* It's a match !! */ if (!found) { found = &exp->m_export; found_path = strdup(path); + if (found_path == NULL) + goto out; } else if (strcmp(found->e_path, exp->m_export.e_path)!= 0) { xlog(L_WARNING, "%s and %s have same filehandle for %s, using first", @@ -492,6 +511,8 @@ void nfsd_fh(FILE *f) qword_print(f, found->e_path); qword_eol(f); out: + free(found_path); + free(he); free(dom); return; } @@ -579,6 +600,8 @@ void nfsd_export(FILE *f) char *dom, *path; nfs_export *exp, *found = NULL; int found_type = 0; + struct in_addr addr; + struct hostent *he = NULL; if (readline(fileno(f), &lbuf, &lbuflen) != 1) @@ -601,7 +624,7 @@ void nfsd_export(FILE *f) /* now find flags for this export point in this domain */ for (i=0 ; i < MCL_MAXTYPES; i++) { for (exp = exportlist[i]; exp; exp = exp->m_next) { - if (!client_member(dom, exp->m_client->m_hostname)) + if (!use_ipaddr && !client_member(dom, exp->m_client->m_hostname)) continue; if (exp->m_export.e_flags & NFSEXP_CROSSMOUNT) { /* if path is a mountpoint below e_path, then OK */ @@ -615,6 +638,15 @@ void nfsd_export(FILE *f) continue; } else if (strcmp(path, exp->m_export.e_path) != 0) continue; + if (use_ipaddr) { + if (he == NULL) { + if (!inet_aton(dom, &addr)) + goto out; + he = client_resolve(addr); + } + if (!client_check(exp->m_client, he)) + continue; + } if (!found) { found = exp; found_type = i; @@ -656,6 +688,7 @@ void nfsd_export(FILE *f) out: if (dom) free(dom); if (path) free(path); + if (he) free(he); } diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c index 999f035..4a50588 100644 --- a/utils/mountd/mountd.c +++ b/utils/mountd/mountd.c @@ -40,6 +40,7 @@ static struct nfs_fh_len *get_rootfh(struct svc_req *, dirpath *, mountstat3 *, int reverse_resolve = 0; int new_cache = 0; int manage_gids; +int use_ipaddr = -1; /* PRC: a high-availability callout program can be specified with -H * When this is done, the program will receive callouts whenever clients diff --git a/utils/nfsd/Makefile.in b/utils/nfsd/Makefile.in index 6dcb301..c3f828a 100644 --- a/utils/nfsd/Makefile.in +++ b/utils/nfsd/Makefile.in @@ -123,9 +123,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/utils/nfsstat/Makefile.in b/utils/nfsstat/Makefile.in index ba3cc92..399b695 100644 --- a/utils/nfsstat/Makefile.in +++ b/utils/nfsstat/Makefile.in @@ -123,9 +123,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/utils/nfsstat/nfsstat.c b/utils/nfsstat/nfsstat.c index 76d8f8b..828119b 100644 --- a/utils/nfsstat/nfsstat.c +++ b/utils/nfsstat/nfsstat.c @@ -25,36 +25,36 @@ #define MAXNRVALS 32 -static unsigned int srvproc2info[20], srvproc2info_tmp[20]; /* NFSv2 call counts ([0] == 18) */ -static unsigned int cltproc2info[20], cltproc2info_tmp[20]; /* NFSv2 call counts ([0] == 18) */ -static unsigned int srvproc3info[24], srvproc3info_tmp[24]; /* NFSv3 call counts ([0] == 22) */ -static unsigned int cltproc3info[24], cltproc3info_tmp[24]; /* NFSv3 call counts ([0] == 22) */ -static unsigned int srvproc4info[4], srvproc4info_tmp[4]; /* NFSv4 call counts ([0] == 2) */ -static unsigned int cltproc4info[37], cltproc4info_tmp[37]; /* NFSv4 call counts ([0] == 35) */ -static unsigned int srvproc4opsinfo[42], srvproc4opsinfo_tmp[42]; /* NFSv4 call counts ([0] == 40) */ -static unsigned int srvnetinfo[5], srvnetinfo_tmp[5]; /* 0 # of received packets +static unsigned int srvproc2info[20], srvproc2info_old[20]; /* NFSv2 call counts ([0] == 18) */ +static unsigned int cltproc2info[20], cltproc2info_old[20]; /* NFSv2 call counts ([0] == 18) */ +static unsigned int srvproc3info[24], srvproc3info_old[24]; /* NFSv3 call counts ([0] == 22) */ +static unsigned int cltproc3info[24], cltproc3info_old[24]; /* NFSv3 call counts ([0] == 22) */ +static unsigned int srvproc4info[4], srvproc4info_old[4]; /* NFSv4 call counts ([0] == 2) */ +static unsigned int cltproc4info[37], cltproc4info_old[37]; /* NFSv4 call counts ([0] == 35) */ +static unsigned int srvproc4opsinfo[42], srvproc4opsinfo_old[42]; /* NFSv4 call counts ([0] == 40) */ +static unsigned int srvnetinfo[5], srvnetinfo_old[5]; /* 0 # of received packets * 1 UDP packets * 2 TCP packets * 3 TCP connections */ -static unsigned int cltnetinfo[5], cltnetinfo_tmp[5]; /* 0 # of received packets +static unsigned int cltnetinfo[5], cltnetinfo_old[5]; /* 0 # of received packets * 1 UDP packets * 2 TCP packets * 3 TCP connections */ -static unsigned int srvrpcinfo[6], srvrpcinfo_tmp[6]; /* 0 total # of RPC calls +static unsigned int srvrpcinfo[6], srvrpcinfo_old[6]; /* 0 total # of RPC calls * 1 total # of bad calls * 2 bad format * 3 authentication failed * 4 unknown client */ -static unsigned int cltrpcinfo[4], cltrpcinfo_tmp[4]; /* 0 total # of RPC calls +static unsigned int cltrpcinfo[4], cltrpcinfo_old[4]; /* 0 total # of RPC calls * 1 retransmitted calls * 2 cred refreshs */ -static unsigned int srvrcinfo[9], srvrcinfo_tmp[9]; /* 0 repcache hits +static unsigned int srvrcinfo[9], srvrcinfo_old[9]; /* 0 repcache hits * 1 repcache hits * 2 uncached reqs * (for pre-2.4 kernels:) @@ -65,7 +65,7 @@ static unsigned int srvrcinfo[9], srvrcinfo_tmp[9]; /* 0 repcache hits * 7 stale */ -static unsigned int srvfhinfo[7], srvfhinfo_tmp[7]; /* (for kernels >= 2.4.0) +static unsigned int srvfhinfo[7], srvfhinfo_old[7]; /* (for kernels >= 2.4.0) * 0 stale * 1 FH lookups * 2 'anon' FHs @@ -113,19 +113,34 @@ static const char * nfssrvproc4opname[40] = { "setcltidconf", "verify", "write", "rellockowner" }; +#define LABEL_srvnet "Server packet stats:\n" +#define LABEL_srvrpc "Server rpc stats:\n" +#define LABEL_srvrc "Server reply cache:\n" +#define LABEL_srvfh "Server file handle cache:\n" +#define LABEL_srvproc2 "Server nfs v2:\n" +#define LABEL_srvproc3 "Server nfs v3:\n" +#define LABEL_srvproc4 "Server nfs v4:\n" +#define LABEL_srvproc4ops "Server nfs v4 operations:\n" +#define LABEL_cltnet "Client packet stats:\n" +#define LABEL_cltrpc "Client rpc stats:\n" +#define LABEL_cltproc2 "Client nfs v2:\n" +#define LABEL_cltproc3 "Client nfs v3:\n" +#define LABEL_cltproc4 "Client nfs v4:\n" + typedef struct statinfo { char *tag; + char *label; int nrvals; unsigned int * valptr; } statinfo; /* * We now build the arrays of statinfos using macros, which will make it easier - * to add new variables for --diff-stat. - * e.g., SRV(net) expands into the struct statinfo: { "net", 5, srvnetinfo } + * to add new variables for --sleep. e.g., SRV(net) expands into the struct + * statinfo: { "net", "Server packet stats:\n", 5, srvnetinfo } */ #define ARRAYSIZE(x) sizeof(x)/sizeof(*x) -#define STATINFO(k, t, s...) { #t, ARRAYSIZE(k##t##info##s), k##t##info##s } +#define STATINFO(k, t, s...) { #t, LABEL_##k##t, ARRAYSIZE(k##t##info##s), k##t##info##s } #define SRV(t, s...) STATINFO(srv, t, s) #define CLT(t, s...) STATINFO(clt, t, s) #define DECLARE_SRV(n, s...) static statinfo n##s[] = { \ @@ -137,7 +152,7 @@ typedef struct statinfo { SRV(proc3,s),\ SRV(proc4,s), \ SRV(proc4ops,s),\ - { NULL, 0, NULL }\ + { NULL, NULL, 0, NULL }\ } #define DECLARE_CLT(n, s...) static statinfo n##s[] = { \ CLT(net,s), \ @@ -145,27 +160,28 @@ typedef struct statinfo { CLT(proc2,s),\ CLT(proc3,s), \ CLT(proc4,s),\ - { NULL, 0, NULL }\ + { NULL, NULL, 0, NULL }\ } DECLARE_SRV(srvinfo); -DECLARE_SRV(srvinfo, _tmp); +DECLARE_SRV(srvinfo, _old); DECLARE_CLT(cltinfo); -DECLARE_CLT(cltinfo, _tmp); +DECLARE_CLT(cltinfo, _old); static void print_numbers(const char *, unsigned int *, unsigned int); static void print_callstats(const char *, const char **, unsigned int *, unsigned int); -static int parse_statfile(const char *, struct statinfo *); +static int parse_raw_statfile(const char *, struct statinfo *); +static int parse_pretty_statfile(const char *, struct statinfo *); static statinfo *get_stat_info(const char *, struct statinfo *); static int mounts(const char *); -static void get_stats(const char *, statinfo *, int *, int, const char *); +static void get_stats(const char *, struct statinfo *, int *, int, + int); static int has_stats(const unsigned int *); -static void copy_stats(statinfo *, statinfo *); -static void diff_stats(statinfo *, statinfo *); +static void diff_stats(struct statinfo *, struct statinfo *, int); static void unpause(int); static time_t starttime; @@ -207,7 +223,8 @@ void usage(char *name) -v, --verbose, --all\tSame as '-o all'\n\ -r, --rpc\t\tShow RPC statistics\n\ -n, --nfs\t\tShow NFS statistics\n\ - -Z, --sleep\tSaves stats, pauses, diffs current and saved\n\ + -Z, --sleep\t\tSaves stats, pauses, diffs current and saved\n\ + -S, --since file\tShows difference between current stats and those in 'file'\n\ --version\t\tShow program version\n\ --help\t\tWhat you just did\n\ \n", name); @@ -229,6 +246,7 @@ static struct option longopts[] = { "help", 0, 0, '\1' }, { "version", 0, 0, '\2' }, { "sleep", 0, 0, 'Z' }, + { "since", 1, 0, 'S' }, { NULL, 0, 0, 0 } }; @@ -239,9 +257,17 @@ main(int argc, char **argv) opt_srv = 0, opt_clt = 0, opt_prt = 0, - opt_sleep = 0; + opt_sleep = 0, + opt_since = 0; int c; - char *progname; + char *progname, + *serverfile = NFSSRVSTAT, + *clientfile = NFSCLTSTAT; + + struct statinfo *serverinfo = srvinfo, + *serverinfo_tmp = srvinfo_old, + *clientinfo = cltinfo, + *clientinfo_tmp = cltinfo_old; struct sigaction act = { .sa_handler = unpause, @@ -253,7 +279,7 @@ main(int argc, char **argv) else progname = argv[0]; - while ((c = getopt_long(argc, argv, "234acmno:Zvrsz\1\2", longopts, NULL)) != EOF) { + while ((c = getopt_long(argc, argv, "234acmno:ZS:vrsz\1\2", longopts, NULL)) != EOF) { switch (c) { case 'a': fprintf(stderr, "nfsstat: nfs acls are not yet supported.\n"); @@ -286,6 +312,11 @@ main(int argc, char **argv) case 'Z': opt_sleep = 1; break; + case 'S': + opt_since = 1; + serverfile = optarg; + clientfile = optarg; + break; case '2': case '3': case '4': @@ -341,38 +372,43 @@ main(int argc, char **argv) "server.\n"); } + if (opt_since || opt_sleep) { + serverinfo = srvinfo_old; + serverinfo_tmp = srvinfo; + clientinfo = cltinfo_old; + clientinfo_tmp = cltinfo; + } + if (opt_srv) - get_stats(NFSSRVSTAT, srvinfo, &opt_srv, opt_clt, "Server"); + get_stats(serverfile, serverinfo, &opt_srv, opt_clt, 1); if (opt_clt) - get_stats(NFSCLTSTAT, cltinfo, &opt_clt, opt_srv, "Client"); + get_stats(clientfile, clientinfo, &opt_clt, opt_srv, 0); - /* save stat snapshots; wait for signal; then diff current and saved stats */ if (opt_sleep) { starttime = time(NULL); printf("Collecting statistics; press CTRL-C to view results from interval (i.e., from pause to CTRL-C).\n"); - if (opt_srv) - copy_stats(srvinfo_tmp, srvinfo); - if (opt_clt) - copy_stats(cltinfo_tmp, cltinfo); if (sigaction(SIGINT, &act, NULL) != 0) { fprintf(stderr, "Error: couldn't register for signal and pause.\n"); return 1; } pause(); + } + + if (opt_since || opt_sleep) { if (opt_srv) { - get_stats(NFSSRVSTAT, srvinfo, &opt_srv, opt_clt, "Server"); - diff_stats(srvinfo, srvinfo_tmp); + get_stats(NFSSRVSTAT, serverinfo_tmp, &opt_srv, opt_clt, 1); + diff_stats(serverinfo_tmp, serverinfo, 1); } if (opt_clt) { - get_stats(NFSCLTSTAT, cltinfo, &opt_clt, opt_srv, "Client"); - diff_stats(cltinfo, cltinfo_tmp); + get_stats(NFSCLTSTAT, clientinfo_tmp, &opt_clt, opt_srv, 0); + diff_stats(clientinfo_tmp, clientinfo, 0); } } if (opt_srv) { if (opt_prt & PRNT_NET) { print_numbers( - "Server packet stats:\n" + LABEL_srvnet "packets udp tcp tcpconn\n", srvnetinfo, 4 ); @@ -380,7 +416,7 @@ main(int argc, char **argv) } if (opt_prt & PRNT_RPC) { print_numbers( - "Server rpc stats:\n" + LABEL_srvrpc "calls badcalls badauth badclnt xdrcall\n", srvrpcinfo, 5 ); @@ -388,7 +424,7 @@ main(int argc, char **argv) } if (opt_prt & PRNT_RC) { print_numbers( - "Server reply cache:\n" + LABEL_srvrc "hits misses nocache\n", srvrcinfo, 3 ); @@ -410,12 +446,12 @@ main(int argc, char **argv) srvfhinfo[5]=srvfhinfo[0]; /* relocate 'stale' */ print_numbers( - "Server file handle cache:\n" + LABEL_srvfh "lookup anon ncachedir ncachedir stale\n", srvfhinfo + 1, 5); } else /* < 2.4 */ print_numbers( - "Server file handle cache:\n" + LABEL_srvfh "lookup anon ncachedir ncachedir stale\n", srvrcinfo + 3, 5); printf("\n"); @@ -423,21 +459,21 @@ main(int argc, char **argv) if (opt_prt & PRNT_CALLS) { if ((opt_prt & PRNT_V2) || ((opt_prt & PRNT_AUTO) && has_stats(srvproc2info))) print_callstats( - "Server nfs v2:\n", - nfsv2name, srvproc2info + 1, sizeof(nfsv2name)/sizeof(char *) + LABEL_srvproc2, + nfsv2name, srvproc2info + 1, sizeof(nfsv2name)/sizeof(char *) ); if ((opt_prt & PRNT_V3) || ((opt_prt & PRNT_AUTO) && has_stats(srvproc3info))) print_callstats( - "Server nfs v3:\n", + LABEL_srvproc3, nfsv3name, srvproc3info + 1, sizeof(nfsv3name)/sizeof(char *) ); if ((opt_prt & PRNT_V4) || ((opt_prt & PRNT_AUTO) && has_stats(srvproc4info))) { print_callstats( - "Server nfs v4:\n", + LABEL_srvproc4, nfssrvproc4name, srvproc4info + 1, sizeof(nfssrvproc4name)/sizeof(char *) ); print_callstats( - "Server nfs v4 operations:\n", + LABEL_srvproc4ops, nfssrvproc4opname, srvproc4opsinfo + 1, sizeof(nfssrvproc4opname)/sizeof(char *) ); } @@ -447,7 +483,7 @@ main(int argc, char **argv) if (opt_clt) { if (opt_prt & PRNT_NET) { print_numbers( - "Client packet stats:\n" + LABEL_cltnet "packets udp tcp tcpconn\n", cltnetinfo, 4 ); @@ -455,7 +491,7 @@ main(int argc, char **argv) } if (opt_prt & PRNT_RPC) { print_numbers( - "Client rpc stats:\n" + LABEL_cltrpc "calls retrans authrefrsh\n", cltrpcinfo, 3 ); @@ -464,17 +500,17 @@ main(int argc, char **argv) if (opt_prt & PRNT_CALLS) { if ((opt_prt & PRNT_V2) || ((opt_prt & PRNT_AUTO) && has_stats(cltproc2info))) print_callstats( - "Client nfs v2:\n", + LABEL_cltproc2, nfsv2name, cltproc2info + 1, sizeof(nfsv2name)/sizeof(char *) ); if ((opt_prt & PRNT_V3) || ((opt_prt & PRNT_AUTO) && has_stats(cltproc3info))) print_callstats( - "Client nfs v3:\n", + LABEL_cltproc3, nfsv3name, cltproc3info + 1, sizeof(nfsv3name)/sizeof(char *) ); if ((opt_prt & PRNT_V4) || ((opt_prt & PRNT_AUTO) && has_stats(cltproc4info))) print_callstats( - "Client nfs v4:\n", + LABEL_cltproc4, nfscltproc4name, cltproc4info + 1, sizeof(nfscltproc4name)/sizeof(char *) ); } @@ -533,9 +569,9 @@ print_callstats(const char *hdr, const char **names, printf("\n"); } - +/* returns 0 on success, 1 otherwise */ static int -parse_statfile(const char *name, struct statinfo *statp) +parse_raw_statfile(const char *name, struct statinfo *statp) { char buffer[4096], *next; FILE *fp; @@ -545,7 +581,7 @@ parse_statfile(const char *name, struct statinfo *statp) */ if ((fp = fopen(name, "r")) == NULL) { // fprintf(stderr, "Warning: %s: %m\n", name); - return 0; + return 1; } while (fgets(buffer, sizeof(buffer), fp) != NULL) { @@ -575,7 +611,79 @@ parse_statfile(const char *name, struct statinfo *statp) } fclose(fp); - return 1; + return 0; +} + +/* returns 0 on success, 1 otherwise */ +static int +parse_pretty_statfile(const char *filename, struct statinfo *info) +{ + int numvals, curindex, numconsumed, n, sum, err = 1; + char buf[4096], *bufp, *fmt, is_proc; + FILE *fp = NULL; + struct statinfo *ip; + + if ((fp = fopen(filename, "r")) == NULL) + //err(2, "Unable to open statfile '%s'.\n", filename); + goto out; + + while (fgets(buf, sizeof(buf), fp) != NULL) { + for (ip = info; ip->tag; ip++) { + if (strcmp(buf, ip->label)) + continue; + + sum = 0; + numvals = ip->nrvals - 1; + is_proc = strncmp("proc", ip->tag, 4) ? 0 : 1; + if (is_proc) { + fmt = " %u %*u%% %n"; + curindex = 1; + ip->valptr[0] = 0; + } else { + fmt = " %u %n"; + curindex = 0; + } +more_stats: + /* get (and skip) header */ + if (fgets(buf, sizeof(buf), fp) == NULL) { + fprintf(stderr, "Failed to locate header after " + "label for '%s' in %s.\n", + ip->tag, filename); + goto out; + } + /* no header -- done with this "tag" */ + if (*buf == '\n') { + ip->valptr[numvals] = sum; + break; + } + /* get stats */ + if (fgets(buf, sizeof(buf), fp) == NULL) { + fprintf(stderr, "Failed to locate stats after " + "header for '%s' in %s.\n", + ip->tag, filename); + goto out; + } + bufp = buf; + for (; curindex < numvals; curindex++) { + n = sscanf(bufp, fmt, &ip->valptr[curindex], + &numconsumed); + if (n != 1) + break; + if (is_proc) { + ip->valptr[0]++; + sum++; + } + sum += ip->valptr[curindex]; + bufp += numconsumed; + } + goto more_stats; + } + } + err = 0; +out: + if (fp) + fclose(fp); + return err; } static int @@ -627,11 +735,45 @@ mounts(const char *name) } static void -get_stats(const char *file, statinfo *info, int *opt, int other_opt, const char *label) +get_stats(const char *file, struct statinfo *info, int *opt, int other_opt, + int is_srv) { - if (!parse_statfile(file, info)) { + FILE *fp; + char buf[10]; + int err = 1; + char *label = is_srv ? "Server" : "Client"; + + /* try to guess what type of stat file we're dealing with */ + if ((fp = fopen(file, "r")) == NULL) + goto out; + if (fgets(buf, 10, fp) == NULL) + goto out; + if (!strncmp(buf, "net ", 4)) { + /* looks like raw client stats */ + if (is_srv) { + fprintf(stderr, "Warning: no server info present in " + "raw client stats file.\n"); + *opt = 0; + } else + err = parse_raw_statfile(file, info); + } else if (!strncmp(buf, "rc ", 3)) { + /* looks like raw server stats */ + if (!is_srv) { + fprintf(stderr, "Warning: no client info present in " + "raw server stats file.\n"); + *opt = 0; + } else + err = parse_raw_statfile(file, info); + } else + /* looks like pretty client and server stats */ + err = parse_pretty_statfile(file, info); +out: + if (fp) + fclose(fp); + if (err) { if (!other_opt) { - fprintf(stderr, "Warning: No %s Stats (%s: %m). \n", label, file); + fprintf(stderr, "Error: No %s Stats (%s: %m). \n", + label, file); exit(2); } *opt = 0; @@ -650,28 +792,14 @@ has_stats(const unsigned int *info) return (info[0] && info[info[0] + 1] > info[0]); } -/* clone 'src' to 'dest' */ -static void -copy_stats(struct statinfo *dest, struct statinfo *src) -{ - int i, j; - - for (i = 0; src[i].tag; i++) { - dest[i].tag = src[i].tag; - dest[i].nrvals = src[i].nrvals; - for (j = 0; j < dest[i].nrvals; j++) - dest[i].valptr[j] = src[i].valptr[j]; - } -} - /* * take the difference of each individual stat value in 'new' and 'old' * and store the results back into 'new' */ static void -diff_stats(struct statinfo *new, struct statinfo *old) +diff_stats(struct statinfo *new, struct statinfo *old, int is_srv) { - int i, j, is_srv, nodiff_first_index, should_diff; + int i, j, nodiff_first_index, should_diff; /* * Different stat types have different formats in the /proc @@ -682,7 +810,6 @@ diff_stats(struct statinfo *new, struct statinfo *old) * procX types ("i" < 2 for clt, < 4 for srv), or if it's not * the first entry ("j" > 0). */ - is_srv = (new == srvinfo); nodiff_first_index = 2 + (2 * is_srv); for (i = 0; old[i].tag; i++) { @@ -700,7 +827,7 @@ diff_stats(struct statinfo *new, struct statinfo *old) * diff -- i.e., it should always be included in the * total. */ - if (!strncmp("proc", new[i].tag, 4)) + if (!strncmp("proc", new[i].tag, 4) && old[i].valptr[0]) new[i].valptr[new[i].nrvals - 1] += new[i].valptr[0]; } } diff --git a/utils/showmount/Makefile.in b/utils/showmount/Makefile.in index 1f3ee90..490e995 100644 --- a/utils/showmount/Makefile.in +++ b/utils/showmount/Makefile.in @@ -123,9 +123,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@ diff --git a/utils/statd/Makefile.in b/utils/statd/Makefile.in index c85b40a..d682468 100644 --- a/utils/statd/Makefile.in +++ b/utils/statd/Makefile.in @@ -137,9 +137,9 @@ EXEEXT = @EXEEXT@ F77 = @F77@ FFLAGS = @FFLAGS@ GREP = @GREP@ -GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ -GSSAPI_LIBS = @GSSAPI_LIBS@ GSSD = @GSSD@ +GSSGLUE_CFLAGS = @GSSGLUE_CFLAGS@ +GSSGLUE_LIBS = @GSSGLUE_LIBS@ HAVE_LIBWRAP = @HAVE_LIBWRAP@ HAVE_TCP_WRAPPER = @HAVE_TCP_WRAPPER@ IDMAPD = @IDMAPD@