12058 Commits

Author SHA1 Message Date
Benjamin Kaduk
f2d4ba8b61 Build hcrypto with libtool
Or rather, with lwptool, since we need a LWP version as well as
the various pthreaded versions.

The previous version was the initial version, 1.1, but since we're
switching to libtool, bump the version to 2.0 just to be safe.

Libtool abstracts away the extra logic that had previously been needed
to build different copies of rand-fortuna for the pthreaded and LWP
libraries.

As for roken, we must install both shared and static libraries
to $(TOP_LIBDIR) for unity of consumption, but remove the libtool
archive after instllation.

Change-Id: Ibc530a1fa4baa7a38b44eb3e0719e1905a6fe269
Reviewed-on: http://gerrit.openafs.org/11482
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:54:54 -04:00
Benjamin Kaduk
a6d7014187 Allow external hcrypto
Put the configure checks into a separate file in src/cf, following
the same general structure as the roken checks.

Allow explicitly requesting the internal version, or checking
what's in the default paths, or providing a specific hcrypto root
or lib/include dirs for Debian compatibility.

We must still always compile libafshcrypto_lwp.a for use by LWP
binaries, from the bundled sources, but other binaries will use
the system version.

The hcrypto headers have an unfortunately large number of dependencies,
including depending on being able to find each other by including
<hcrypto/foo.h> paths.  As such we must pass both the user-supplied
directory and $dir/hcrypto to the preprocessor in order for things
to work, and we also may need to revisit the includes used in the
configure check for use on non-linux systems due to the dependencies
on system headers.

Change-Id: Idcba1418a19a7b562335524c911d69dc84268177
Reviewed-on: http://gerrit.openafs.org/11481
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:54:40 -04:00
Benjamin Kaduk
493765cc88 Link aklog against LIB_hcrypto
This was the last place where libafshcrypto.a was explicitly referenced,
preventing the use of an out-of-tree hcrypto library.

We will continue to need to build the in-tree code to produce a
libafshcrypto_lwp.a library for use in LWP applications, until we
do not have any more LWP applications, but some systems (such as
Debian) have a desire to avoid bundled libraries, so we should
facilitate the use of an external libhcrypto where possible.

Many consumers of libafshcrypto_lwp.a will be removed when the
LWP versions of various modules are removed after 1.8 is branched.

Change-Id: I23049866caae9c16ffb2ec32c5e7b058465a26ba
Reviewed-on: http://gerrit.openafs.org/11480
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:54:12 -04:00
Benjamin Kaduk
d31d7c3cb0 Build venus tests with libtool
This was the only place doing -lafshcrypto_lwp on the command line.
(There are other consumers, which list libafshcrypto_lwp.a explicitly;
we can use the presence of libafshcrypto_lwp.a to track progress towards
not needing a LWP hcrypto build, which must come from the in-tree version.)

Convert the tests to build with libtool (as pthreaded), where we can
just throw in $(LIB_hcrypto) and deal with what we get.

Change-Id: Ibc99615d2ff03b8aebf956502a2a6b1cb26f0a65
Reviewed-on: http://gerrit.openafs.org/11479
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:53:58 -04:00
Benjamin Kaduk
3160b1ad38 Build roken using libtool
Previously it was version 1.1; just in case I did something terrible,
bump it to 2.0, as was done for the other libtool conversions.

Install both the libtool archive and the static archive to $(TOP_LIBDIR),
so that all our internal consumers can just use -L$(TOP_LIBDIR) -lrokenafs
(well, via the LDFLAGS_roken and LIB_roken aliases) whether linking
statically or shared.  Installing the libtool archive gets us the shared
library there, but we have to then remove the libtool archive, since
this is not the location we told libtool we would install to (the prefix
we configured with), and libtool would get confused trying to use this
installed, but installed-at-the-wrong-place libtool archive.

Add rk_vsyslog to the export list, for AIX.

It is tempting to eschew this installation and instead point LIB_roken
at the libtool archive file librokenafs.la directly (with empty
LDFLAGS_roken), but this is not possible until all consumers of roken
are converted to build using libtool.  In practice, this will probably
not happen until LWP is evicted from the tree.

Change-Id: If6ab6c2d57c0a1b1511f9631b9aeb522d7e7392b
Reviewed-on: http://gerrit.openafs.org/11477
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:52:53 -04:00
Benjamin Kaduk
933d980341 Build auth tests with libtool
(And pthreaded.)

This was the only place consuming librokenafs directly, which is
forbidden if we are to properly support using an external roken.
Convert to libtool and throw $(LIB_roken) on at the end.

Change-Id: I0cdea690800be1022888244b613929ce3154db1d
Reviewed-on: http://gerrit.openafs.org/11476
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:52:40 -04:00
Benjamin Kaduk
efe449adbb Fix LT_LDLIB_shlib_missing
Libtool's -symbols-file argument is taken as an exact match of symbols
that this library claims to export.  It does not filter based on what
symbols are actually present in the objects comprising the library.
Instead, if there are symbols in the file which are not implemented
by the library, there is an implicit assumption that some other library
will provide those symbols, which must be linked into a consumer of
this library alongside this library.

These are not the semantics we want (at present, only for roken), wherein
a library will implement some (but probably not all) of a given list
of symbols, and we want the export list to reflect only those symbols
which are implemented.  Instead, use the symbols file to build a regex that
will only match symbols listed in the file (and no other symbols), and
only export the subset which is present.

Change-Id: Id81f7a35089ae7f760fe643680f9bfb9c81521aa
Reviewed-on: http://gerrit.openafs.org/11475
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:52:27 -04:00
Benjamin Kaduk
119d2edf8a Allow building with MIT krb5 and external roken
That is, an external roken which is part of a heimdal distribution,
with full headers and libraries, most notably krb5.h and libkrb5.

This adjusts the ordering of file- and module-specific compiler and
linker arguments so that the more specific arguments are able to
take precedence.  For general flags arguments, such as enabling
or disabling warnings or features, the more-specific settings should
come last, so as to override the flags set by default.  However,
for arguments that affect a global search list (e.g., for headers
or libraries),  the more-specific arguments must come first, so
as to be at the beginning of the search list.

We presently use per-file CFLAGS for both warning-type flags and
preprocessor (i.e., include path) type flags, so add an additional
file-specific setting for CPPFLAGS, which comes at the beginning of
the compiler invocation.

At present, MODULE_CFLAGS are essentially only used for preprocessor
functionality, so treat them as CPPFLAGS and put them right after
the per-file CPPFLAGS.  (It might be cleaner to rename them to
MODULE_CPPFLAGS, but that would be more churn than is needed.  If
such a distinction turns out to be necessary, it can be done at a
later date.)  Likewise the MODULE_LDFLAGS are generally being used
to affect the library search path, so put them early as well.

Make the necessary Makefile changes to use these new features to
allow building with MIT krb5 and external roken: put KRB5_CPPFLAGS
in per-file CPPFLAGS, and put LDFLAGS_KRB5 in MODULE_LDFLAGS for
aklog.

Change-Id: I1091223b3b75c782b39b9e189bdd47e52ebefae2
Reviewed-on: http://gerrit.openafs.org/11474
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:52:14 -04:00
Benjamin Kaduk
9e3596c3fa Adjust roken.m4 to allow separate lib and include
In some installations (e.g., Debian), the roken libraries and headers
will not be installed in a common root directory to which /lib and
/include may be appended to find the appropriate library and header
directories, respectively.

Take inspiration from rra-c-util's GSSAPI macros and allow the
specification of separate include and lib directories.  Since there
are now three values to pass to the guts of the checking routine,
pass them in global variables instead of as parameters.

The expected usage would be to set either --with-roken, or both of
--with-roken-libdir and --with-roken-includedir, as in
configure --with-roken-include=/usr/include/heimdal
--with-roken-lib=/usr/lib/x86_64-linux-gnu/heimdal

This also fixes a typo that prevented --with-roken=internal from
functioning as intended.

Change-Id: I6f651ef3f3abf37c92ea81ea1801294ca3dc00b2
Reviewed-on: http://gerrit.openafs.org/11473
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:51:59 -04:00
Benjamin Kaduk
bd5c12995e Deorbit separate JUAFS build
Since 80943970b8cfcdf3fc630b25804aebaea228bd73, when the web enhancements
were enabled universally, there has no longer been a functional difference
between the UAFS and JUAFS builds.  Their object files are compiled
using the same compilation rule, and the list of object files differed
only by rx_kmutex.o (which is devoid of content) and xdr_int32.o
(which is preumably an oversight).

Save the extra build time by just reinstalling libuafs.a as libjuafs.a
to preserve the existing interfaces.

Additionally, drop the LIBJUAFS make variable -- all definitions set
it to libjuafs.a.  Similarly, the LIBJUAFS_FLAGS variable was unused
and can be removed.

Change-Id: I2074d5bc26e326db36b16e055431818ef1c69210
Reviewed-on: http://gerrit.openafs.org/11471
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:51:08 -04:00
Benjamin Kaduk
9799484891 Deorbit the netscape plugin
Netscape hasn't been a thing since 2008.

We would only try to build it if someone manually ran 'webinstall'
in src/libuafs, and there is no documentation telling anyone to do so.

It's dead, Jim.

Change-Id: I7486ca33da7ff19f23f0d9f54f5fb4e7e3232540
Reviewed-on: http://gerrit.openafs.org/11470
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:50:49 -04:00
Benjamin Kaduk
5d2bd0416b Make pam conditional on INSTALL_KAUTH
The pam module we provide is only useful in kaserver-like environments,
and as such should not be installed when the user has requested to
not have kauth.

Change-Id: I9b336593e34cedfd6e8c2210f3798575d115d2d6
Reviewed-on: http://gerrit.openafs.org/11466
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:50:17 -04:00
Benjamin Kaduk
6825d6aeaa Build a usable pam_afs.so
Our use of libtool for building the pam modules resulted in shared
objects which had dependencies on liboafs_auth.so and liboafs_kauth.so,
neither of which are installed.

We still need some way to resolve those dependencies at link time, and
a dependency on libafsauthent.so seems ill-advised to insert into the
pam stack, so we are left with only the option of directly linking in
the requisite functionality.  Fortunately, almost all of the requisite
convenience libraries of PIC objects already exist to meet the
requirements of libafsrpc and libafsauthent; the only exception is
from the auth module.  Here, we require a new convenience library,
because the pam_afs.krb.so module includes its own version of ktc.o,
compiled with AFS_KERBEROS_ENV defined, yet the pam_afs.so module
requiers a ktc.o compiled without AFS_KERBEROS_ENV defined.  The
convenience library from the auth module can only include one version,
and would therefore be wrong for the other.  As such, create the new
libpam_auth.la archive from the BASE_objs in src/auth, and manually
compile ktc.lo and ktc_krb.lo as needed for the pam modules.

As for libafsrpc and libafsauthent, the convenience libraries included
from other parts of the tree belong in LT_objs, not LT_deps, because
they are contributing actual content to be included in the resulting
library; they are not library dependencies of the output of this module.

Change-Id: I5292718a5494710d166043fd08ad07269ff9fdf2
Reviewed-on: http://gerrit.openafs.org/11463
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:50:03 -04:00
Benjamin Kaduk
96b0307b3c Build and install libafsauthent.so.2
During the libtool interim, we had been building a .0 but not
installing it.  Prior to the libtoolization of shlibafsauthent, we
had installed a libafsauthent.so.1.1, which is the same version currently
installed by the 1.6 branch.  Since there have been backwards-incompatible
ABI changes (e.g., afsconf_BuildServerSecurityObjects) since the .1.1
version, we must bump the SONAME to .2.0.

At time of this writing, the libtool rules for updating the
version information is found at:
http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
and
http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html

This lets us consolidate the building of the shared and static libafsrpc
and their installation), as libtool will happily do both for us
at once.

We explicitly do not install the .la files, as our libtool use is
to be kept entirely internal.

Change-Id: I283f9bb74eb9853c268e8642ac1f01741deeae2b
Reviewed-on: http://gerrit.openafs.org/11462
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:49:49 -04:00
Benjamin Kaduk
248b3216e7 Build and install libafsrpc.so.2
During the libtool interim, we had been building a .0 but not
installing it.  Prior to the libtoolization of shlibafsrpc, we
had installed a libafsrpc.so.1.4 (though the 1.6 branch was
installing libafsrpc.so.1.5, "so we don't collide with the shlibafsrpc
versions on the master branch", which seems misguided).  Since there
have been backwards-incompatible ABI changes (e.g., rx_SetMaxMTU) since
the .1.4 version, we must bump the SONAME to .2.0.

At time of this writing, the libtool rules for updating the
version information is found at:
http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
and
http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html

This lets us consolidate the building of the shared and static libafsrpc
and their installation), as libtool will happily do both for us
at once.

We explicitly do not install the .la files, as our libtool use is
to be kept entirely internal.

Change-Id: I11bc3cbc80048d0192aadeb80b89d2772bcd01cd
Reviewed-on: http://gerrit.openafs.org/11461
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:49:36 -04:00
Benjamin Kaduk
cd030f3c36 Normalize LT_deps/LT_objs split
As described in the commit message of
69f26ece3c4545ecc9099641f7a507796fe9dc77, LT_objs should contain
the .lo files for the given module, and LT_deps should contain the
libtool dependencies, i.e., the .la files from other parts of the
tree.  However, this simple split by file suffix is not correct
when we are using convenience libraries.  Really, LT_objs represents
the "new" objects being provided by the module, and LT_deps is
libraries from other modules that provide functionality on which
we depend.  Since convenience libraries are just thin aggregates
of object files, they behave more like object files than libraries
upon which we depend.  In particular, libafsrpc and libafsauthent
are wrapper libraries that gather together the functionality of
several modules and export them as a single library interface;
they do not have any objects of their own.

However, libafsauthent has a dependency on libafsrpc, which does
belong in LT_deps (or possibly in LT_libs).

Simon's description of LT_libs leaves a little ambiguity, as it
does not describe what should be done with non-libtool libraries
from within OpenAFS.  (At present, these include libafshcrypto
and librokenafs, both of which are regularly put in LT_libs.)
I prefer to recast LT_libs as containing externally visible libraries,
not just external libraries, which rationalizes the inclusion of
roken and hcrypto there, since we currently install those libraries,
and build libraries that have shared library dependencies on them.

In the future, as we begin committing to stable shared library
interfaces for libraries produced by libtool, I would like to
have those .la files be moved to LT_libs, since they would then
be external library dependencies of the given module.

Change-Id: Ie50010da84df99cec048c3e39ffeb9d5897fc08c
Reviewed-on: http://gerrit.openafs.org/11460
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:48:07 -04:00
Benjamin Kaduk
a470b30eca Normalize names of libtool convenience libraries
Part of why libtool was introduced into the tree was to reduce the
number of times each source file is compiled.  PIC code is needed
for shared objects, and non-PIC code for static libraries, so in most
cases a C file must be compiled twice, but not more than that.

Libtool automatically manages which version of an object is passed to
the linker when libtool is used to link .la files.  At several places
in the tree (libafsrpc, libafsauthent, libuafs_pic.so, and pam_afs.so)
we use libtool to link a .la library and pass other .la libraries in
as linker inputs.  In normal situations, libtool would produce an
output shared library that registered a shared library dependency on
the (shared version of the) input library.  However, in our usage,
these input .la libraries are used only for our convenience, and are
not intended to be installed, so libtool would produce an output
library that was not usable.

Libtool refers to our usage of libraries not intended to be installed
as "convenience libraries"; for us, they are essentially just
static archives that contain PIC objects (as opposed to normal
static archives which contain non-PIC objects).

Prior to this commit, we had named our convenience libraries things
like libafsauthent_auth.la or libafsrpc_comerr.la, since they were
mostly only used for either libafsrpc or libafsauthent.  However,
future commits will need to use some of these convenience libraries
in other shared objects (such as pam_afs.so), so we normalize the
library name to indicate merely that it is a PIC version of that
module.

There are three exceptions to this rule: libafsrpc_sys.la, which
contains only a single file and not the whole of the sys module,
libafsrpc_util.la, which contains a subset of the util objects,
and libauthent_ubik.la, which contains a subset of the ubik
objects.  Since these convenience libraries are in fact tailored to
the particular application, a target-specific name is appropriate.

The convenience library provided by the ptserver module is named
libprot_pic to match the existing public interface libprot.a.

We cannot link the dependencies of the convenience libraries
directly into them, because any given object may only be linked
once into a given library, and our dependency graph between
modules is decidedly not a tree, so attempting to link in the
dependencies would result in duplicate symbol errors.

Change-Id: I5f10af74b8582edd51e5f1b3f0026dbc7ef9f7ad
Reviewed-on: http://gerrit.openafs.org/11459
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:47:55 -04:00
Benjamin Kaduk
81189b7bc9 Use correct syntax for libtool version info
It does not take an '='.

Whomever thought that making libtool silently accept all (i.e.,
malformed) command-line arguments was a good idea ... seems to
have been mistaken.

Change-Id: I357cd44ac6f495474f9763a2f768ac9c8d1e4cb4
Reviewed-on: http://gerrit.openafs.org/11458
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:47:34 -04:00
Michael Meffie
25be085209 build: remove trailing whitespace from makefiles
Remove trailing whitespace from the makefiles, except for
trailing whitespace in the boilerplate comment headers.

Change-Id: Ib8ee87a51f00633ba15e1974ac0b311969bef1bf
Reviewed-on: http://gerrit.openafs.org/11456
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:46:57 -04:00
Anders Kaseorg
fbea3265b3 aklog: Fix segfault on aklog -path
Commit 2fac53522e7ef5b3a376e191bffdc1f6784e6995 “aklog: Fix improper
use of readlink” inadvertently changed the meaning of int link from a
boolean flag (length > 0) to just a length.  This caused ‘aklog -path
(anything)’ to segfault.

Update the type of link and the condition of the while loop to account
for this change.

FIXES 131930

Change-Id: Ia05836795425a53e858ab29866900f6d45970644
Reviewed-on: http://gerrit.openafs.org/11517
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Tested-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: D Brashear <shadow@your-file-system.com>
2014-10-08 10:29:28 -04:00
Perry Ruiter
c6b61a4510 afs: Verify osi_UFSOpen worked
In some builds (UKERNEL) osi_UFSOpen returns a NULL if it runs
into a problem.  On the other builds osi_UFSOpen simply panics.
afs/afs_cell.c was checking for a NULL return but other callers
were not.  Add checking logic to all callers.
  This is a prepartory patch.  A subsequent patch will have
osi_UFSOpen return NULL rather than panic for other builds too.

Change-Id: I3610a57dff59b84fe5ea8b1c862f3192157f255f
Reviewed-on: http://gerrit.openafs.org/11243
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Garrett Wollman <wollman@csail.mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
2014-10-06 14:48:07 -04:00
Jeffrey Altman
c90c5e97c6 Windows: SetDispositionInfo vs Link Count
When SetDispositionInfo is called to mark a file for pending
delete the link count should not be decrememented.  The count is
decremented only when the file is actually deleted.

Change-Id: I611e2b9695179abcba01d6fa83022b08044ee8bf
Reviewed-on: http://gerrit.openafs.org/11508
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-10-03 02:57:50 -04:00
Jeffrey Altman
8da84729c8 Windows: FileStandardInfo Link count
Instead of returning 1 in all cases the ObjectInformation.Links
value should be returned to the caller.

Change-Id: I719bebca9299953c6afc3352117c1e1bf99d63f6
Reviewed-on: http://gerrit.openafs.org/11507
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-10-03 02:57:22 -04:00
pete scott
243537f707 Windows: Check for RO and Open Target in rename
During a file rename operation, check to see if the target file
has the DOS readonly attribute set or has a non-zero reference
count.  If yes, the request must be failed.  The error status
depends upon the state of the pending delete flag.  Either
STATUS_PENDING_DELETE or STATUS_ACCESS_DENIED.

Change-Id: I90fa1ea54176f96ca3052ee2b774b1179642e2ef
Reviewed-on: http://gerrit.openafs.org/11506
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-10-03 02:56:50 -04:00
Andrew Deason
a27bed59ca afs: Move init_hckernel_init to osi_Init
Currently we call init_hckernel_init inside afs_InitSetup, to
initialize the hcrypto mutex. However, we use the hcrypto mutex in the
AFSOP_SEED_ENTROPY syscall, which afsd calls before any syscall that
cals afs_InitSetup. This means we crash on trying to
AFSOP_SEED_ENTROPY.

To avoid this, just call init_hckernel_init inside osi_Init instead,
which is called when our kernel module itself is initialized. This
ensures that the mutex is initialized early on, regardless of what
happens with afsd and the startup syscalls.

Change-Id: Ib6cbed7abcfd8f9a61685f613a848e9f36d6050d
Reviewed-on: http://gerrit.openafs.org/11509
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-26 10:12:58 -04:00
pete scott
cdfa21ad5e Windows: Use the allocation size from the service
The prior patchset modified the service AllocationSize return value
to count the number of 1KB units.  Use the value from the service
without modification.  This corrects an inconsistency in the
FileStandardInformation response.

Change-Id: I9a5f0a4f43aa12de903875b6ed4c5493e37b0163
Reviewed-on: http://gerrit.openafs.org/11491
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-25 08:31:09 -04:00
Jeffrey Altman
d9ca3050c6 Windows: report AllocationSize in 1KB increments
Windows expects storage to be allocated in increments of some
block size.  The AFS servers allocate in 1K units so lets report
that to Windows.

Change-Id: I64ad1844339357733933cd9e360551fdcd450146
Reviewed-on: http://gerrit.openafs.org/11490
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-25 08:30:45 -04:00
pete scott
3f1465f8da Windows: Remove trailing slash on non-root directories
For the FileNameInformation and FilePhysicalNameInformation queries
a trailing slash is required for the \\server\share\ path but is
not required for directories below the root.

Change-Id: Iabbe7daed4f60ad995c04c70dfb2992af095281e
Reviewed-on: http://gerrit.openafs.org/11489
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-25 08:30:24 -04:00
pete scott
70f67371e7 Windows: FilePhysicalNameInfo query AFS prefix
In response to the FilePhysicalNameInformation query the AFS redirector
failed to include the server name in the response.  Since the constructed
name is the same as the FileNameInformation query create a helper function
AFSGetFullFileName() to populate the file name into the provided buffer
and use it to satisfy both queries.

Change-Id: I78eef49a9902341c751d942a395921bb687c503b
Reviewed-on: http://gerrit.openafs.org/11488
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-25 08:29:58 -04:00
pete scott
af72e83832 Windows: FileInfo too small INFO_LENGTH_MISMATCH
The FileAllInformation query is initially processed by the IO Manager
and when the IO Manager is passed a buffer that is too small to hold
the File Information structure it returns STATUS_INFO_LENGTH_MISMATCH.
Previously the afs redirector returned STATUS_BUFFER_TOO_SMALL in this
case.  Instead follow IO Manager's lead.

Change-Id: I74d1b68d37fb9e79cae79408eac1f5dc4dd05e1e
Reviewed-on: http://gerrit.openafs.org/11487
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-25 08:29:23 -04:00
pete scott
06995ceb4d Windows: !overwrite IOMgr populated FileInfo data
I/O Manager will populate the FILE_ACCESS_INFORMATION,
FILE_MODE_INFORMATION, and FILE_ALIGNMENT_INFORMATION portions of
a FILE_ALL_INFORMATION structure prior to forwarding a FileAllInformation
FileInfo query to the file system.  There is no need for the file system
to duplicate the effort.

Change-Id: Iaa7f1de95c6b7e42bdc326cc3f4bfe8596add949
Reviewed-on: http://gerrit.openafs.org/11478
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-25 08:28:48 -04:00
Jeffrey Altman
5ebe2437ef Windows: preserve prior vlserver list on dns failure
Do not destroy the existing vlserver list if the DNS resolver query
fails.  Continue using the prior vlserver values until a DNS response
is obtained.  This will result in repeated DNS queries and a delay
if there is continued failure, but it will permit VL RPCs to continue
to be issued in the face of a DNS failure or misconfiguration.

Change-Id: Icac97c2bebdef744cc316225c1a6b1888ceb2f6e
Reviewed-on: http://gerrit.openafs.org/11457
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-24 18:17:11 -04:00
Jeffrey Altman
f999113d33 Windows: power management suspend/resume changes
1. Call cm_UpdateIFInfo() for all power management events to force
   an update of the valid network interface count.

2. Ensure that regardless of which Suspend and Resume events are
   generated that the service only suspends once and resumes once.

Change-Id: If0c2fe5b6a18dd6b7ee01b511378cb78837efa3d
Reviewed-on: http://gerrit.openafs.org/11447
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-24 18:16:56 -04:00
Jeffrey Altman
ac60131470 Windows: No network, no probe
Modify cm_PingServer and cm_CheckServersMulti to avoid probing servers
when there are no network interfaces with which to do so.  Just mark
the servers down.

Change-Id: I5ba6c9813a28ec44b09dccd8f8c5ffc7e0c0ce10
Reviewed-on: http://gerrit.openafs.org/11446
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-24 18:16:44 -04:00
Jeffrey Altman
15c62a9dd0 Windows: introduce cm_MarkServerDown
Consolidate the operations necessary to mark a server down into a
new routine cm_MarkServerDown()

Change-Id: I9f70752498600046d677686c212c3adf3e810bde
Reviewed-on: http://gerrit.openafs.org/11445
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-24 18:16:31 -04:00
Jeffrey Altman
ec1dcfbe29 Windows: replace lana_OnlyLoopback() calls
lana_OnlyLoopback() relies upon Netbios over TCP being enabled but
Netbios over TCP is not officially supported on Vista and above.
Replace all lana_OnlyLoopback() calls with a test on the number of
network interfaces as computed by syscfg_GetIFInfo().   That list
excludes loopback interfaces.

Change-Id: I22d952f1487734ead02335108377bc404baa6024
Reviewed-on: http://gerrit.openafs.org/11444
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-24 18:16:19 -04:00
Jeffrey Altman
95c3db9c7c Windows: cm_UpdateIFInfo consolidate syscfg_GetIFInfo calls
Add a new function cm_UpdateIFInfo() that consolidates all of the
syscfg_GetIFInfo() call functionality into a single rountine.  Replace
all of the existing call sites.

It is safe to call cm_UpdateIFInfo() without holding cm_syscfgLock
during afsd initialization because no other threads have been created.

Change-Id: Ifd4ca4f4f698014852a26d2c95a523c3b2cc851f
Reviewed-on: http://gerrit.openafs.org/11443
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-24 18:16:05 -04:00
Jeffrey Altman
092684e2bd Windows: Prevent MDL leak on Cc*Mdl* failure
If CcMdlRead or CcPrepareMdlWrite fail, check the IoStatus.Information
field to see if any MDL pages have been locked.  If the Information
value is greater than zero, complete the Mdl operation to unlock the
pages.

Change-Id: Icb44e74e25b46c7976f3f418410364a90a723d91
Reviewed-on: http://gerrit.openafs.org/11442
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Peter Scott <pscott@kerneldrivers.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-24 18:15:52 -04:00
Benjamin Kaduk
bf11f54790 Sort libtool symbol files
Some entropy had crept in.

Change-Id: I72ae9d16a3aa4b9b66bc8efcda46bdc35edf95c9
Reviewed-on: http://gerrit.openafs.org/11323
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-10 15:24:56 -04:00
Ben Kaduk
544b5096e5 Remove rx_SetEpoch, rx_SetConnectionEpoch, rx_SetConnectionId
The core RX code now manages the Epoch and CID; external callers
should not be modifying them.

Change-Id: Ia517205aa280b2a0bbd2568274be7fb010fba0bc
Reviewed-on: http://gerrit.openafs.org/10843
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-10 15:09:15 -04:00
Ben Kaduk
a63a07c335 Garbage-collect afs_GCUserData's argument
We no longer need the ability to force all rxnull connections to be
reaped, as the epoch is set globally.  Change the prototype and
callers accordingly.

Change-Id: I0815fdd035c3dd9d56f72e43603f9c53f5cec79d
Reviewed-on: http://gerrit.openafs.org/10842
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-10 15:08:08 -04:00
Ben Kaduk
39b165cdda Move epoch and cid generation into the rx core
Now that we have hcrypto available everywhere, we can get real randomness
in the rx core (both uerspace and kernel), and thus can initialize the
RX epoch to a real random value when first initializing a host; there is
no need to rely on rxkad to produce randomness for this purpose.
Initialize a connection ID counter at the same time, and use that in
rx_NewConnection, also supplanting rxkad-specific logic.

The rxkad-specific logic is removed, and in particular there is no longer
a need to export rxkad_EpochWasSet to the rest of the world.
The code in afs_Daemon() to check whether the rxepoch was set can be
removed, as if the epoch is not set, rx initialization fails.

Add libafshcrypto to LIBS in the handful of places it hadn't crept already,
and likewise afshcrypto.lib in the NTMakefiles.

Change-Id: I1dd1015b29a600aaf72b6b4b36f8a17032453c97
Reviewed-on: http://gerrit.openafs.org/10841
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-10 15:05:32 -04:00
Ben Kaduk
0d67b00ff9 Export heimdal's rand-fortuna PRNG to the kernel
Some systems (e.g., AIX, SGI, DFBSD, HPUX) do not supply a useful
implementation of osi_readRandom(), in some cases because the kernel
does not expose a random-number interface to kernel modules.  We want
real random numbers on all systems, because we want to use the for
setting the RX epoch and connection ID in the kernel.

Build hcrypto's rand-fortuna PRNG into the rand-kernel interface we expose,
and implement RAND_bytes using rand-fortuna when osi_ReadRandom()
is not useful.

Add stub routines to config.h as needed, and add a heim_threads.h
with the necessary locking for rand-fortuna.  The rand-fortuna algorithm
requires some measure of time's passage, so provide a stub gettimeofday()
with single-second resolution.  We use a single (global) mutex for the
hcrypto kernel code, so that we can statically declare an initializer to
be the address of that mutex.  Otherwise the locking is taken essentially
wholesale from rx_kmutex.

rand-fortuna requires the sha256 code for its hashing, and also
requires a stub rand-fortuna to satisfy linker symbol visibility.

Since the rand-fortuna code does not have any actual sources of entropy
available to it during its initialization routines, we must explicitly
seed the in-kernel rand-fortuna using entropy passed in from userland.
(Userland will always have at least /dev/random available, so the
userland hcrypto should always have usable entropy.)  Be sure to do so
early in the afsd startup sequence, before any daemons are started, so
that entropy is available to the core rx code for generating the epoch
and cid -- the rand-fortuna code will (erroneously) always claim that
it has startup entropy even though in this case it may not actually
have any entropy.  The rand-fortuna code does not consider itself
fully seeded until it has 128 bytes of entropy, so be sure to pass
more than that in from userspace.

It is preferrable to always build this code into the kernel, even on
systems when it is not going to be used, to help prevent bitrot.  This
also avoids the possibility of a new system being supported that would
attempt to use the rand-fortuna code but fail to supply any seed entropy,
which would not necessarily be readily apparent.

Change-Id: I614d2bd9ac52803ec3b9572cc694cd836c8427dd
Reviewed-on: http://gerrit.openafs.org/10840
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-10 15:05:07 -04:00
Benjamin Kaduk
bcf3d33f28 Add missing tests to tests/opr/.gitignore
dict-t and fmt-t were missing.

While here, sort the existing entries.

Change-Id: If62e0f9f93f4d51900cdd7747beede561861f51e
Reviewed-on: http://gerrit.openafs.org/11454
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-10 11:13:21 -04:00
Benjamin Kaduk
75d9e4b954 Fix memset invocation in rx/event-t.c
The order of the parameters was swapped, which recent gcc complains
loudly about.

Change-Id: I2329ca3dd0eee81639731e78172621b580199024
Reviewed-on: http://gerrit.openafs.org/11451
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-10 11:10:51 -04:00
Simon Wilkinson
11efae8362 ubik: Don't leak UBIK_VERSION_LOCK if udisk_LogEnd fails
If the call to udisk_LogEnd() fails (probably due to an I/O error)
don't leak the UBIK_VERSION_LOCK.

This is the possible cause of a vlserver deadlock, which had
approximately 4800 threads blocked. Analysis of backtrace of all
of these threads showed that all blocked threads were waiting in
ubik.c:555 (blocked on DBHOLD) with the exception of:

One in beacon.c:388 (blocked on UBIK_VERSION_LOCK)
One in recovery.c:503 (blocked on DBHOLD)
One in ubik.c:125 (blocked on DBHOLD)
One in ubik.c:585 (blocked on UBIK_VERSION_LOCK)

The last of these is the critical one, because it already holds
the lock that DBHOLD waits on - so despite the vast majority of
threads being blocked in DBHOLD, it's actually UBIK_VERSION_LOCK
that we're waiting on.

There is no sign of a thread which is still active which currently
holds UBIK_VERSION_LOCK.

Change-Id: I1627b448d359152237912d4d78c9fa52c7149aa0
Reviewed-on: http://gerrit.openafs.org/11427
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-04 08:52:19 -04:00
Simon Wilkinson
b9bbd21e88 ubik: Don't leak UBIK_VERSION_LOCK if setlabel fails
If a call to the setlabel() physical IO function fails, don't
leak the UBIK_VERSION_LOCK.

This is the possible cause of a vlserver deadlock, which had
approximately 4800 threads blocked. Analysis of backtrace of all
of these threads showed that all blocked threads were waiting in
ubik.c:555 (blocked on DBHOLD) with the exception of:

One in beacon.c:388 (blocked on UBIK_VERSION_LOCK)
One in recovery.c:503 (blocked on DBHOLD)
One in ubik.c:125 (blocked on DBHOLD)
One in ubik.c:585 (blocked on UBIK_VERSION_LOCK)

The last of these is the critical one, because it already holds
the lock that DBHOLD waits on - so despite the vast majority of
threads being blocked in DBHOLD, it's actually UBIK_VERSION_LOCK
that we're waiting on.

There is no sign of a thread which is still active which currently
holds UBIK_VERSION_LOCK.

Change-Id: Ie6093409e9375d50fa69733908b5ce99586e1b1d
Reviewed-on: http://gerrit.openafs.org/11426
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-09-04 08:52:01 -04:00
Garrett Wollman
123f0fb134 config: remove support for old FreeBSD releases
The FreeBSD project no longer supports 5.x, 6.x, or 7.x releases, and
has not done so for a long time.  It's unlikely the OpenAFS works
properly on any of them, if it even still builds, since it is not
regularly build-tested on anything older than 8.3.  Unclutter
src/config by removing the param.*.h files for these obsolete
releases.

Change-Id: Iedd11e9a9045b39d2193c61b9833abd592d1bfa2
Reviewed-on: http://gerrit.openafs.org/11438
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-08-30 09:51:13 -04:00
Garrett Wollman
ad655372fc README: update for current state of FreeBSD support
The FreeBSD project hasn't supported releases prior to 8.x for a long
time now, and OpenAFS is neither built nor tested regularly on
anything that old.  Dedocument support for these releases in
preparation for later removing configuration support.

Change-Id: I42e78291cfed91e20b3414576cf885a11b7f341b
Reviewed-on: http://gerrit.openafs.org/11437
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
2014-08-30 09:50:55 -04:00
Hans-Werner Paulsen
65ec004ce5 vos clone use the value of the -toname argument
The -toname argument was not followed with the vos clone command. The name
of the clone volume was always ".clone".

Change-Id: I76b78d239ecb38e793098078ac34a703f2ffeeeb
Reviewed-on: http://gerrit.openafs.org/11431
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>
2014-08-26 06:55:59 -04:00