openafs.git
4 years agorxkad: Update ticket5 from heimdal 87/13287/6
Andrew Deason [Mon, 20 Aug 2018 20:47:13 +0000]
rxkad: Update ticket5 from heimdal

This updates the rxkad code that we pull from heimdal to heimdal 7.7.0
(heimdal.git commit e1959605bd). This also updates the instructions in
README.v5 to accommodate changes in the heimdal tree, and converts
ticket5.c to use KRB5_ENCTYPE_* constants instead of ETYPE_*
constants (since heimdal has also similarly converted in krb5_asn1.h).

This removes a few -Werror=format-truncation warnings that were
present in the heimdal code before this commit.

README.v5 tweaked in collaboration with kaduk@mit.edu.

Change-Id: I5fdaab600b4a1b42658a60259fde3fc9f7dced04
Reviewed-on: https://gerrit.openafs.org/13287
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoafs: remove bogus comment from afs_IsTokenExpired 40/13640/2
Mark Vitale [Thu, 13 Jun 2019 03:44:32 +0000]
afs: remove bogus comment from afs_IsTokenExpired

Remove an incorrect comment, introduced with commit
adf2e6e827c6caf55247c5e63b88775393156ae5 'Unix CM: Generalise token
storage'.

No functional change is incurred by this commit.

Change-Id: Ie56c4f22a06321c56f62fce9704419ce3c4e7bf2
Reviewed-on: https://gerrit.openafs.org/13640
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

4 years agoafs: add a file-level comment to afs_osidnlc.c 57/13557/2
Benjamin Kaduk [Fri, 19 Apr 2019 15:38:24 +0000]
afs: add a file-level comment to afs_osidnlc.c

This file doesn't currently do a great job of telling the reader what
it's used for.  Let's give them a hint, especially for the expansion
of "DNLC".

Change-Id: Ie5d1f1162a4b59c479bc2961b33cd696e83bdc3a
Reviewed-on: https://gerrit.openafs.org/13557
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoptserver: Check for superuser in WhoIsThisWithName 08/13508/3
Andrew Deason [Wed, 27 Feb 2019 02:47:00 +0000]
ptserver: Check for superuser in WhoIsThisWithName

In WhoIsThisWithName, if we don't understand the rx security class
being used (such as rxgk), we'll set the calling id to the anonymous
user and return an error. But for SYSADMINID specifically, we don't
really need to know any security-class-specific details; we just need
to know that the caller is the superuser.

So add a fallback case to check for that; if we don't understand the
calling rx security class, just check if the calling user is
RX_ID_SUPERUSER, and use SYSADMINID if so.

This allows the ptserver to handle rxgk localauth requests (and
theoretically, localauth requests for any future security classes),
and theoretically any localauth requests for future security classes.

Based on a commit from mvitale@sinenomine.net.

Change-Id: Ia9bc91fb5a0d9ebf16b32659c9068aa5a9da8401
Reviewed-on: https://gerrit.openafs.org/13508
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoptclient: rxgk support 01/13501/5
Mark Vitale [Mon, 11 Feb 2019 06:21:08 +0000]
ptclient: rxgk support

Allow ptclient to use rxgk, with the new -rxgk option. While we're
here, also allow the user to specify a security level of 3, to turn on
rxkad encryption for non-localauth conns.

Change-Id: I201154c1b5298f31912d8841f8310363e13afa08
Reviewed-on: https://gerrit.openafs.org/13501
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoAdd rxgk client options to vl and pt utilities 05/11105/17
Benjamin Kaduk [Mon, 14 Apr 2014 02:01:59 +0000]
Add rxgk client options to vl and pt utilities

Add options to use rxgk for outgoing connections to vlserver, vos,
ptserver, and pts.

For vlserver and ptserver, name the new option -s2scrypt, similar to
the existing volserver option -s2scrypt. For vlserver and ptserver,
specify 'rxgk-crypt' to turn on rxgk crypt connections for our
server-to-server ubik communication.

For vos and pts, just name the new option '-rxgk', and allow the user
to specify the rxgk level to use ('clear', 'auth', or 'crypt'). The
pts code is currently somewhat ill-suited to changing what rx security
class and security level we use, but do the best we can without
refactoring the whole thing.

Change-Id: Iefae46291330d2b5e05b2a2bbaec1b9150b3c892
Reviewed-on: https://gerrit.openafs.org/11105
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agopioctl: limit fruitless token searches 97/13597/2
Mark Vitale [Thu, 23 May 2019 02:52:10 +0000]
pioctl: limit fruitless token searches

getNthCell searches the afs_users table for the nth token set belonging to a
given user.  However, it is impossible for a user to have more than one
token set per cell.  If the caller specifies a number greater than the
total number of cells this cache manager knows about, we know the search
will be fruitless.

Instead, return early in this case, avoiding both the lock and the
search.

Change-Id: I509408d9aaa8f511813c4d82c121e199121bb8f3
Reviewed-on: https://gerrit.openafs.org/13597
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoAdd --quiet option to lwptool 94/13594/2
Andrew Deason [Wed, 15 May 2019 19:35:41 +0000]
Add --quiet option to lwptool

Add an option to lwptool, called --quiet, to suppress printing the
literal commands run. On error, we still print the exact failed
command to stderr.

For "pretty" V=0 builds, use this new option, to make our
lwptool-using compile rules look more like our other compile rules.

Change-Id: I3fed6db3205f8de5e275e9b70aba9e1995afd02f
Reviewed-on: https://gerrit.openafs.org/13594
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoUse the ppc64le_linuxXX sysname for ppc64le builds 93/13593/2
Andrew Deason [Fri, 17 May 2019 01:01:17 +0000]
Use the ppc64le_linuxXX sysname for ppc64le builds

Commit 191e18eb (Open ppc64le_linux sysname space) added the
ppc64le_linux26 sysname, but it still must be manually specified when
running on ppc64le. Use the ppc64le_linux26 by default on ppc64le, so
we can compile without needing to specify an explicit sysname.

Change-Id: I5abbdde06622d5f2b067bfd003f9d4cd51c56f1a
Reviewed-on: https://gerrit.openafs.org/13593
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoDo not define AFS_SYSCALL for ppc64le_linux26 92/13592/2
Andrew Deason [Thu, 16 May 2019 21:12:47 +0000]
Do not define AFS_SYSCALL for ppc64le_linux26

AFS_SYSCALL is defined to the syscall number we can use for a certain
platform (for pioctls and other AFS-specific kernel calls). On many
modern platforms, such as Linux, we don't use direct syscalls anymore,
instead routing our AFS-specific syscalls through an ioctl, and
AFS_SYSCALL is just used as a fallback for compatibility for older
OpenAFS releases that might still be using the syscall.

For new platforms, we have no need for this compatibility code path,
since there is no existing code we might need to be compatible with.
We should avoid defining AFS_SYSCALL for those, so we can avoid
manually-issuing syscalls in more cases. The ppc64le_linux26 platform
is a very new platform (introduced in 191e18eb "Open ppc64le_linux
sysname space"), and so should not have AFS_SYSCALL defined.

So, remove AFS_SYSCALL from ppc64le_linux26's param.h.

Change-Id: I7811831b05a17c9428556aca49681cd544da4ff1
Reviewed-on: https://gerrit.openafs.org/13592
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoOpen ppc64le_linux sysname space 62/13562/2
Nathaniel Filardo [Wed, 1 May 2019 22:01:51 +0000]
Open ppc64le_linux sysname space

While here, add config/param.ppc64le_linux26.h; it's just like
ppc64_linux26.h, except not AFSBIG_ENDIAN.

Change-Id: I6671405f829f2bf50b6e8d3355ab9e8aed384c02
Reviewed-on: https://gerrit.openafs.org/13562
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoFix static expressions in conditionals 58/13158/6
Pat Riehecky [Fri, 1 Jun 2018 21:33:37 +0000]
Fix static expressions in conditionals

The conditions in these if statements are always true (or always false).
Remove the check in cmdebug.c, as it is unnecessary, and fix the check
in vlclient.c to actually check for a valid voltype. (via cppcheck)

Change-Id: Ica7dfc9b81fe8bd0f156f6e4e616ed45e205985a
Reviewed-on: https://gerrit.openafs.org/13158
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoredhat: RHEL8 add elfutils-devel as build dependency for kernel module 60/13560/3
Cheyenne Wills [Thu, 18 Apr 2019 15:55:09 +0000]
redhat: RHEL8 add elfutils-devel as build dependency for kernel module

Building the kernel modules under RHEL8 produces the following error
message:
    Makefile:952: *** "Cannot generate ORC metadata for
     CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or
     elfutils-libelf-devel".  Stop.

Add elfutils-devel to the BuildRequires in the rpm spec when building
rhel >= 8

Add elfutils-devel to the BuildRequires in the rpm spec that
openafs-kmodtool produces

FIXES 134900

Change-Id: Ie3e03336d9599caa6ceb7879199eab3b12eb971b
Reviewed-on: https://gerrit.openafs.org/13560
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoasetkey: add 'add-random' command 68/12768/9
Andrew Deason [Thu, 9 Nov 2017 18:50:53 +0000]
asetkey: add 'add-random' command

Add a new command, 'add-random', to allow the creation of a new key
with random data. This is helpful for certain rxgk keys, which only
need to exist in KeyFileExt and not in any other database (like a krb5
KDC), and so aren't derived from a krb5 keytab.

Change-Id: I1f3b27e074b0931deb8645f7550e0b315d82e249
Reviewed-on: https://gerrit.openafs.org/12768
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoasetkey: Add new 'delete' command variants 67/12767/10
Andrew Deason [Thu, 9 Nov 2017 18:47:57 +0000]
asetkey: Add new 'delete' command variants

The current 'delete' command from asetkey only lets the user delete
old-style rxkad keys. Add a couple of new variants to allow specifying
the key type and subtype, so the user can delete specific key types
and enctypes if they want.

Change-Id: If0dfaa70ea0b749dadd52a6b7d62fd3ad2b61d18
Reviewed-on: https://gerrit.openafs.org/12767
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

4 years agoafs: Raise osidnlc NCSIZE 31/13531/2
Andrew Deason [Fri, 28 Sep 2018 19:55:56 +0000]
afs: Raise osidnlc NCSIZE

The currrent size of the osi DNLC is very small; only 300 entries.
Raise it to 4096 entries, to give it some chance of actually helping.

In the future, of course, this should be runtime configurable, and we
should also raise the hash table size. For now, just raise the number
of entries without changing anything else, to try to make sure nothing
breaks.

With the hash size of 256, this means our hash chains will be at least
16 items long. However, traversing even hundreds of hash items should
still be better than frequently hitting the disk cache to find
entries, and acquiring more locks, etc.

Change-Id: I48f496e8c25fa869ded83e97ff686ed028c923c5
Reviewed-on: https://gerrit.openafs.org/13531
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agodoc: Remove one lingering reference to src/mcas 39/13539/2
Andrew Deason [Mon, 1 Apr 2019 16:57:42 +0000]
doc: Remove one lingering reference to src/mcas

Change-Id: I8b137d28d33a805c4aa941cc64a89d6a504fabc6
Reviewed-on: https://gerrit.openafs.org/13539
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoRemove src/mcas 38/13538/2
Benjamin Kaduk [Wed, 2 Aug 2017 01:57:52 +0000]
Remove src/mcas

This lock-free library toolkit is intriguing and may be the subject
of future work, but currently nothing uses this code, and these files
are just clutter.

Remove src/mcas and stop mentioning it in SOURCE-MAP; don't reference
it in the rpctests, either.

Reviewed-on: https://gerrit.openafs.org/12682
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit bfc5d1ada2f5ce12bfafe65d352982adbefe9911)

Change-Id: I98bec6f0a91e4aad05846a6791719cac63050f02
Reviewed-on: https://gerrit.openafs.org/13538
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

4 years agoafsmonitor: avoid double free on exit 61/13161/7
Pat Riehecky [Wed, 6 Jun 2018 15:01:02 +0000]
afsmonitor: avoid double free on exit

The afsmonitor may leak memory and do a double free on shutdown when it
was started with a non-zero -buffers parameter value. The deallocation
of the cm results circular buffer incorrectly frees the base of the
array of results instead of each result.  The fs buffer clean up got
this right.

This fixes the clang scan-build warning:

    afsmonitor.c:461:7: warning: Attempt to free released memory
                        free(tmp_cmlist);
                        ^~~~~~~~~~~~~~~~

[mmeffie: update code and commit message]

Change-Id: Ifd4ea5b9b865f04e5cf88560dd8a9dfdbe7e32cb
Reviewed-on: https://gerrit.openafs.org/13161
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoasetkey: Allow rxgk keys 66/12766/9
Andrew Deason [Thu, 9 Nov 2017 06:03:04 +0000]
asetkey: Allow rxgk keys

Add rxgk support to asetkey. This just allows asetkey to display rxgk
keys more prettily, and allows the user to add literal rxgk key data
on the command line, or add keytab-derived keys.

Change-Id: Ic28fea628614be2b20276631bc7e7c2f85ccc154
Reviewed-on: https://gerrit.openafs.org/12766
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoauth: Add afsconf_ClientAuthRXGK variants 04/11104/17
Benjamin Kaduk [Mon, 14 Apr 2014 01:38:02 +0000]
auth: Add afsconf_ClientAuthRXGK variants

Add various afsconf_ClientAuthRXGK* variants, to use local printed
rxgk tokens with clear, auth, or crypt levels.

Also add the flag AFSCONF_SECOPTS_RXGK for afsconf_PickClientSecObj,
to let callers of afsconf_PickClientSecObj use rxgk connections. To
allow selecting of the "clear" level, add the flag
AFSCONF_SECOPTS_ALWAYSCLEAR. And to allow selecting the "auth" level
but letting "crypt" be the default for rxgk, add the new flag
AFSCONF_SECOPTS_NEVERENCRYPT.

Change-Id: Ib27f2799eb927ac5aa71eab94212171344dd93df
Reviewed-on: https://gerrit.openafs.org/11104
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agodir: Honor non-ENOENT lookup errors 31/13431/4
Andrew Deason [Thu, 17 Jan 2019 06:04:36 +0000]
dir: Honor non-ENOENT lookup errors

Currently, several places in src/dir/dir.c assume that any error from
a lower-level function (e.g. FindItem) means that the item we're
looking for does not exist in that directory. But if we encountered
some other error, that may not be the case; the directory blob may be
corrupt, we may have encountered some I/O error, etc.

To detect cases like this, return the actual error code from FindItem
&c, instead of always reporting ENOENT. For the code paths that are
actually specifically looking for if the target exists (in
afs_dir_Create), change our checks to specifically check for ENOENT,
and return any other error.

Do the same thing for a few similar callers in viced/afsfileprocs.c,
as well.

FIXES 134904

Change-Id: I41073464b9ef20e4cbb45bcc61a43f70380eb930
Reviewed-on: https://gerrit.openafs.org/13431
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLINUX: Avoid lookup ENOENT on fatal signals 30/13530/2
Andrew Deason [Thu, 21 Mar 2019 20:24:06 +0000]
LINUX: Avoid lookup ENOENT on fatal signals

Various Linux kernel operations on various Linux kernel versions can
fail if the current process has a pending fatal signal (i.e. SIGKILL),
including reads and writes to our local disk cache. Depending on what
and when something fails because of this, some parts of libafs throw
an ENOENT error, which may propagate up to callers, and be returned
from afs_lookup(). Notably this can happen via some functions in
src/dir/dir.c, and previously was possible with some code paths before
they were fixed by commit 2aa4cb04 (afs: Stop abusing ENOENT).

For the most part, the exact error given to the userspace caller
doesn't matter, since the process will die as soon as we return to
userspace. However, for ENOENT errors specifically for lookups, we
interpret this to mean that the target filename is known to not exist,
and so we create a negative dentry for that name, which is cached.
Future lookups for that filename will then result in ENOENT before any
AFS functions are called.

The lingering abuses of the ENOENT error code should be removed from
libafs entirely, but as an extra layer of safety, we can just avoid
returning ENOENT from lookups if the current process has a pending
fatal signal. So to do that, change all afs_lookup() callers in
src/afs/LINUX to translate ENOENT to EINTR if we have a pending fatal
signal. If fatal_signal_pending() is not available, then we don't do
this translation.

FIXES 134904

Change-Id: I00f1516c2aa0f45f1129f5d5a44150b7539c31cc
Reviewed-on: https://gerrit.openafs.org/13530
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoUse rxgk in afsconf_BuildServerSecurityObjects 41/12941/7
Andrew Deason [Sun, 4 Mar 2018 23:33:47 +0000]
Use rxgk in afsconf_BuildServerSecurityObjects

In afsconf_BuildServerSecurityObjects, create a server security object
for rxgk. Currently, this will only accept printed rxgk tokens, not
tokens negotiated via GSSNegotiate. Future commits will add
functionality to handle user-negotiated tokens, fileserver-specific
creds, etc.

Change-Id: Ie2bbef0d591641e80bb85240316c4ee5f9f8ff05
Reviewed-on: https://gerrit.openafs.org/12941
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoImplement afsconf_GetRXGKKey 99/11099/17
Benjamin Kaduk [Wed, 26 Mar 2014 10:24:02 +0000]
Implement afsconf_GetRXGKKey

Also afsconf_GetLatestRXGKKey, as a side effect, since we want to have
a single getkey function both for getting encrypting and decrypting keys;
a kvno/enctype pair of 0/0 indicates that the "get latest" behavior is
desired.

Implement both functions in terms of an internal helper that takes
as an argument the type of key to look for in the KeyFileExt.  We
can reuse these helpers wholesale for per-fileserver keys, later.

This also requires implementing an ordering on the quality of the
different RFC 3961 enctypes (which are stored as the subtype of keys
of type afsconf_rxgk). This is subject to debate on the actual
ordering, but since the IANA enctype registry changes rarely, just
assign a full ordering on the standardized (symmetric!) enctypes.
Implement this via a new function, rxgk_enctype_better, in
rxgk_crypto_rfc3961.c.

Introduce a new header file, rxgk_types.h, so we can avoid including
the entire rxgk.h header in cellconfig.p.h.

Change-Id: I81389b21238fd6588cc4381b026816005f81a30c
Reviewed-on: https://gerrit.openafs.org/11099
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAdd rxgk support to userok 76/10576/23
Ben Kaduk [Wed, 4 Dec 2013 18:03:46 +0000]
Add rxgk support to userok

Change-Id: I5da2a89532453b6bec61fc87218a61455e39f6f0
Reviewed-on: https://gerrit.openafs.org/10576
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoBuild rxgk support into libafsrpc 91/10591/22
Ben Kaduk [Fri, 13 Dec 2013 23:46:11 +0000]
Build rxgk support into libafsrpc

Add a dependency on the appropriate $(GSSAPI_LIBS) and link in the
librxgk_pic.la helper. Careful control of what functions are exposed
allows static linking to continue to work when rxgk is disabled,
though a stub is needed for the case of rxgk_GetServerInfo, so that
there is a symbol present to satisfy the export symbol list.

Consumers of libafsrpc.a need not be modified in accordance
with this change.

Change-Id: I76c0329ba842fb0d4d66534810b114a0813c90a0
Reviewed-on: https://gerrit.openafs.org/10591
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoAdd rxgk_GetServerInfo stub 21/12721/10
Benjamin Kaduk [Fri, 1 Sep 2017 22:45:10 +0000]
Add rxgk_GetServerInfo stub

Provide a stub function that libafsrpc can export when rxgk support
is disabled.  (It always returns failure, of course.)

Change-Id: Id9f816d25c1a8f56995ec185ae83db0924de0010
Reviewed-on: https://gerrit.openafs.org/12721
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agorxdebug: Add rxgk support 40/12940/7
Andrew Deason [Fri, 2 Mar 2018 06:24:54 +0000]
rxdebug: Add rxgk support

Change-Id: I6ffeb7b36f41816ca1c3d12bb5e8097dd5d7a3fd
Reviewed-on: https://gerrit.openafs.org/12940
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoImplement rxgk client security object routines 73/10573/24
Ben Kaduk [Tue, 10 Dec 2013 05:09:35 +0000]
Implement rxgk client security object routines

Change-Id: Ic7e11b02cb1573cfdb6d11d4de9a77ab1c563262
Reviewed-on: https://gerrit.openafs.org/10573
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoImplement the rxgk server security object routines 72/10572/28
Ben Kaduk [Tue, 10 Dec 2013 03:13:16 +0000]
Implement the rxgk server security object routines

Provide non-trivial implementations of the security class routines
used by the server, along with helpers as necessary.

The identity supplied in a client's token is given as a list of
PrAuthNames; we assume that at most one name is supplied at present,
as the meaning of compound identities (and the use of compound
identities for keyed cache managers) is not fully specified yet.
Convert the PrAuthName to an rx_identity for caching in the server
connection state, as the rx_identity type is more compatible with
superuser checks on the connection.

Also provide an rxgk_GetServerInfo routine which extracts the cached
identity, for use in libauth when making superuser checks.
This moves our dependency on rx_identity from the private data structures
into the public header, so move the nested include accordingly.

Change-Id: I0f48b69d4ab758d8a4d76ebfb1daf3009c4fe060
Reviewed-on: https://gerrit.openafs.org/10572
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agorxgk: Avoid calling xdr_destroy on blank xdrs 21/13521/4
Andrew Deason [Tue, 12 Mar 2019 22:03:09 +0000]
rxgk: Avoid calling xdr_destroy on blank xdrs

A couple of callers in rxgk_token.c call xdr_destroy(&xdrs) in a
cleanup code path; at present the code is fine because we are careful to
only jump to the cleanup path from a state where the xdrs are initialized,
but this is needlessly fragile (and is an undocumented requirement of the
code).  Since xdr_destroy() unconditionally looks at xdrs.x_ops->x_destroy,
this could cause a NULL dereference if an error is encountered in a future
version where the 'xdrs' may be zeroed when the cleanup path runs.

Change-Id: I23c1bd09c88238bc602cc92572df4cd2278c69c9
Reviewed-on: https://gerrit.openafs.org/13521
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorxgk: Do not require gss_pseudo_random 20/13520/4
Andrew Deason [Tue, 12 Mar 2019 23:42:42 +0000]
rxgk: Do not require gss_pseudo_random

We actually do not yet call gss_pseudo_random anywhere in the rxgk
codebase. We will need this later, so print a warning when we don't
have it, but let rxgk build so we can build on platforms without
gss_pseudo_random for now (Solaris/SEAM).

Change-Id: I1cee935a12caad1ac00717f468d7e6661e0817c9
Reviewed-on: https://gerrit.openafs.org/13520
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoauth: Make afsconf_PutTypedKeyList idempotent 07/13507/4
Andrew Deason [Sat, 2 Feb 2019 05:25:02 +0000]
auth: Make afsconf_PutTypedKeyList idempotent

Currently, if we call afsconf_PutTypedKeyList on a key list, we set
the key list to NULL. But then if we call afsconf_PutTypedKeyList on a
NULL key list, we segfault because we try to dereference the list.

Change afsconf_PutTypedKeyList to be a noop if we give it a NULL list,
avoiding a segfault in such a situation.

Change-Id: I2c1de0c0a05ab036667031eb0e765933917826a6
Reviewed-on: https://gerrit.openafs.org/13507
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agorx: Do not ignore RXS_* op errors 22/13522/4
Andrew Deason [Wed, 13 Mar 2019 23:30:43 +0000]
rx: Do not ignore RXS_* op errors

Several places in rx call an RXS_* security layer operation, but
ignore the error code. Though errors for these operations are rare or
impossible currently, if they ever do return an error there could be
noticeable consequences, like a connection getting an uninitialized
challenge nonce, or sending a challenge packet with uninitialized
payload.

Change these call sites to record and handle the error. Errors from
the security class normally mean aborting the entire conn, but for
many operations we need to behave differently:

- For RXS_DestroyConnection, errors don't make sense, since we're just
  freeing an object. Change the op to return void, and update our
  implementations of DestroyConnection to match.

- For RXS_GetStats, just clear the relevant stats structure on error
  instead. This change also results in us clearing the stats structure
  when there is no security class associated with the connection;
  previously we just reused the same struct data as the previous conn.

- For RXS_CreateChallenge, aborting the entire conn is difficult,
  because some code paths have callers that potentially lock multiple
  calls on the same conn (rxi_UpdatePeerReach -> TryAttach ->
  rxi_ChallengeOn -> RXS_CreateChallenge), and aborting our conn
  requires locking every call on the conn. So instead we just
  propagate an error up to our callers, and we abort just the call we
  have.

- For RXS_GetChallenge, we cannot abort the conn when
  rxi_ChallengeEvent is called directly, because the caller will have
  the call locked. But when rxi_ChallengeEvent is called as an event
  (when we retry sending the challenge), we can.

- For RXS_SetConfiguration, propagate the error up to our caller.
  Update all rx_SetSecurityConfiguration callers to record and handle
  the error; all of these are during initialization of daemons, so
  have them log an error and exit.

Change-Id: I138b3e06da00470c7d70c458879cc741d296d225
Reviewed-on: https://gerrit.openafs.org/13522
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAdd param.h files and sysnames for FreeBSD 11.2 34/13534/3
Stephan Wiesand [Fri, 22 Mar 2019 11:46:17 +0000]
Add param.h files and sysnames for FreeBSD 11.2

Thanks to MÃ¥ns Nilsson for filing the bug. Note that this change
differs from the proposed patch in the report, in that it
doesn't define the 10.4 symbols in the 11.2 param.h files.

FIXES 134850

Change-Id: I83b3a81609c109eef243533b0e1defa3aca0d526
Reviewed-on: https://gerrit.openafs.org/13534
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>

5 years agoman-pages: create the man3 subdirectory in prep-noistall 33/13533/2
Karl Behler [Fri, 22 Mar 2019 11:22:05 +0000]
man-pages: create the man3 subdirectory in prep-noistall

This should fix a build failure reported on the openafs-devel list
today.

Change-Id: I227922f78aaa614b73dd1f5c1c61116168fc0b69
Reviewed-on: https://gerrit.openafs.org/13533
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoafs: Cleanup state on rxfs_*Init errors 10/13510/2
Andrew Deason [Sat, 2 Mar 2019 21:58:00 +0000]
afs: Cleanup state on rxfs_*Init errors

Currently, rxfs_storeInit and rxfs_fetchInit return early if they
encounter an error while starting the relevant fetch/store RPC (e.g.
StartRXAFS_FetchData64). In this scenario, they osi_FreeSmallSpace
their rock before returning, but they never go through their
destructor to free the contents of the rock
(rxfs_storeDestroy/rxfs_fetchDestroy), leaking any resources inside
that have already been initialized.

The only thing that could have been initialized by this point is
v->call, so hitting this condition means we leak an Rx call, and means
we can report the wrong error code (since we never go through
rx_EndCall, we never look at the call's abort code). For
rxfs_fetchInit, most code paths call rx_EndCall explicitly, except for
the code path where StartRXAFS_FetchData64 itself fails.

For both fetches and stores, it's difficult to hit this condition,
because this requires that the StartRXAFS_* call fails, before we have
sent or received any data from the wire. However, this can be hit if
the call is already aborted before we use it, which can happen if the
underlying connection has already been aborted by a connection abort.

Before commit 0835d7c2 ("afs: make sure to call afs_Analyze after
afs_Conn"), this was most easily hit by trying to fetch data with a
bad security object (for example, with expired credentials). After the
first fetch failed due to a connection abort (e.g. RXKADEXPIRED),
afs_GetDCache would retry the fetch with the same connection, and
StartRXAFS_FetchData64 would fail because the connection and call were
already aborted. In this case, we'd leak the Rx call, and we would
throw an RXGEN_CC_MARSHAL error (-450), instead of the correct
RXKADEXPIRED error. This causes libafs to report that the target
server as unreachable, due to the negative error code.

With commit 0835d7c2, this doesn't happen because we call afs_Analyze
before retrying the fetch, which detects the invalid credentials and
forces creating a new connetion object. However, this situation should
still be possible if a different call on the same connection triggered
a connection-level abort before we called StartRXAFS_FetchData64.

To fix this and ensure that we don't leak Rx calls, explicitly call
rxfs_storeDestroy/rxfs_fetchDestroy in this error case, before
returning from rxfs_storeInit/rxfs_fetchInit.

Thanks to yadayada@in.ibm.com for reporting a related issue and
providing analysis.

Change-Id: I15e02f8c9e620c5861e3dcb03c42510528ce9a60
Reviewed-on: https://gerrit.openafs.org/13510
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRemove references to SunOS 4 06/13506/2
Andrew Deason [Mon, 25 Feb 2019 17:35:24 +0000]
Remove references to SunOS 4

We already removed support for Solaris versions before Solaris 8, in
commit e4c2810f ("Remove support for Solaris pre-8"), but there are
still some references to SunOS (meaning SunOS 4) in the tree. This is
even older than Solaris (aka SunOS 5), so get rid of these.

This commit removes most references to SunOS 4 regarding platform
support, and a few comments. This also removes a few comments that
were just wrong or nonsensical (e.g. CMAPPED in afs.h is used by
other platforms; some comments in platform-specific osi_file.c files
referenced SunOS for some reason).

Change-Id: I0dd3176c582409176fd898f9c9539fbd833ea789
Reviewed-on: https://gerrit.openafs.org/13506
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorx: Make rxi_Free(NULL, size) a no-op 14/13514/2
Andrew Deason [Thu, 7 Mar 2019 05:06:16 +0000]
rx: Make rxi_Free(NULL, size) a no-op

Commit 75233973 (afs: Make afs_osi_Free(NULL) a no-op) intended to
make some of our free abstractions behave like the userspace free, so
freeing NULL is a no-op. However, that commit still left rxi_Free such
that rxi_Free(NULL, size) would decrement the relevant allocation
counters.

So to make our free abstractions more consistent, just skip all of
rxi_Free when the given pointer is NULL.

Change-Id: I89047e1846eb3e2932d2a125676fb7ffec8972dc
Reviewed-on: https://gerrit.openafs.org/13514
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAdd rxgk_util.c 37/10937/18
Ben Kaduk [Tue, 10 Dec 2013 22:47:42 +0000]
Add rxgk_util.c

A few helper routines for the security class implementation.

Change-Id: I395802b6c3b2436df4b00906544fc797f3e12e9b
Reviewed-on: https://gerrit.openafs.org/10937
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoAdd rxgk_packet.c 71/10571/20
Ben Kaduk [Tue, 10 Dec 2013 04:07:17 +0000]
Add rxgk_packet.c

Routines to apply and verify encryption and MICs to the data in
rx packets.  Backend to the rxgk_crypto framework for the actual
crypto operations.

Change-Id: I724efacf7df1d688c0d61a327fa9ee9c8168d715
Reviewed-on: https://gerrit.openafs.org/10571
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorxgk: fix typo in make dest rule 89/13489/3
Mark Vitale [Mon, 11 Feb 2019 23:08:42 +0000]
rxgk: fix typo in make dest rule

make dest should create directories in DEST, not DESTDIR.

Fix the rule.

Change-Id: I355e35cc6902517956935d3d2970836494490e69
Reviewed-on: https://gerrit.openafs.org/13489
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agobos: remove smail-notifier 09/13509/4
Cheyenne Wills [Fri, 1 Mar 2019 15:46:32 +0000]
bos: remove smail-notifier

smail-notifier is a sample program that is undocumented and has not
been well maintained.  It produces copious compiler warnings, and
would require effort to bring the code up to decent coding practices.

The bosserver provides a -notifier feature that can be used for
notifications, but that feature does not depend on this sample program.

Removed the code, cleaned up the Makefiles and .gitignore.

Change-Id: I6bd56559121d12ad007acc571b6653aa934eb97f
Reviewed-on: https://gerrit.openafs.org/13509
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoscout: band-aid -Wformat-truncation 70/13470/2
Benjamin Kaduk [Sat, 2 Feb 2019 23:02:08 +0000]
scout: band-aid -Wformat-truncation

gcc8 gets pretty confused about the bounds on these things (presumably
due to our alignment options) and thinks this could potentially be a huge
string.  Check for truncation to appease the compiler, instead of trying
to ensure that the buffer is big enough.

Change-Id: I4c1e0e6a5a38ee67845cbb7791b280b965989bc8
Reviewed-on: https://gerrit.openafs.org/13470
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovol: check snprintf return values in namei_ops 63/13463/5
Benjamin Kaduk [Sat, 2 Feb 2019 18:49:07 +0000]
vol: check snprintf return values in namei_ops

gcc8 is more aggressive about parsing format strings and computing bounds
on the generated text from functions like snprintf.  In this case it seems best
to detect cases of truncation and error out, rather than trying to increase
stack buffer sizes or switch to asprintf.  These paths should be well-behaved
since they are local to the fileserver, so this is mostly about appeasing the
compiler's -Wformat-truncation checks to allow us to build with --enable-checking.

Change-Id: Id3f15e450c0f03143c0cc7e40186d5944a8fa3b4
Reviewed-on: https://gerrit.openafs.org/13463
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agolibadmin: appease clang -Wsometimes-uninitialized 76/13476/2
Benjamin Kaduk [Sun, 3 Feb 2019 01:52:26 +0000]
libadmin: appease clang -Wsometimes-uninitialized

clang thinks that 'time' can be used uninitialized:

bos.c:1472:9: error: variable 'time' is used uninitialized whenever 'if' condition is
      false [-Werror,-Wsometimes-uninitialized]
    if (as->parms[TIME].items) {
        ^~~~~~~~~~~~~~~~~~~~~
bos.c:1478:57: note: uninitialized use occurs here
    if (!bos_ExecutableRestartTimeSet(bos_server, type, time, &st)) {
                                                        ^~~~
bos.c:1472:5: note: remove the 'if' if its condition is always true
    if (as->parms[TIME].items) {
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
bos.c:1445:5: note: variable 'time' is declared here
    bos_RestartTime_t time;
    ^

but in this command description, the TIME argument is required.
Add a never-triggered error exit to appease the compiler when
--enable-checking is activated.

Change-Id: I38fac64fc5aba071f84f2f9e1b497df22df76f09
Reviewed-on: https://gerrit.openafs.org/13476
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agouss: signed/unsigned char fallout 75/13475/2
Benjamin Kaduk [Sun, 3 Feb 2019 01:48:20 +0000]
uss: signed/unsigned char fallout

When char is signed, assigning 255 to a variable of type char changes
the value, which causes clang to emit a warning and fail the
--enable-checking build.

Change-Id: Id02e2526a9a9dd6657dee55b9dc22da03d102d8c
Reviewed-on: https://gerrit.openafs.org/13475
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorework afs_random() yet again 74/13474/2
Benjamin Kaduk [Sun, 3 Feb 2019 01:45:31 +0000]
rework afs_random() yet again

clang 7 notes that ~0 is signed and that left-shifting into the sign
bit is undefined behvaior.  Use a new construction to clear the low
byte of tv_usec with only bitwise operations that are independent of
the width of tv_usec and stay within the realm of C's defined behavior.

Change-Id: I3e4f0fa4a8b8b72df23ef0c8ad7c4a229ac942f3
Reviewed-on: https://gerrit.openafs.org/13474
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAvoid incomplete function type in casts 73/13473/2
Benjamin Kaduk [Sun, 3 Feb 2019 00:39:53 +0000]
Avoid incomplete function type in casts

clang complains that these casts contain an incomplete function type
(since the function argument is omitted rather than declared to be
void).  Since we just need the cast to pointer type, let the compiler
do it implicitly and pass stock NULL, rather than trying to force a
cast to function-pointer type.

Change-Id: I7f19f2936fe5425573c68fdd727ea90de02defd7
Reviewed-on: https://gerrit.openafs.org/13473
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agodumpscan: appease gcc8 -Wformat-overflow 72/13472/2
Benjamin Kaduk [Sat, 2 Feb 2019 23:10:29 +0000]
dumpscan: appease gcc8 -Wformat-overflow

gcc does not benefit from our external knowledge that tm_year is
tightly bounded, and thinks it could still be in the range
[-21474817482147483647], which would overflow our string buffer.
The function in question does not have error handling in place, so
rather than adding some or trying to assert the proper bounds, just
use a slightly larger buffer for safety.

Change-Id: Iafcba5588b805347ddcc0102969bd0e2a3173dd0
Reviewed-on: https://gerrit.openafs.org/13472
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovenus: appease gcc8's -Wformat-string 71/13471/2
Benjamin Kaduk [Sat, 2 Feb 2019 23:09:36 +0000]
venus: appease gcc8's -Wformat-string

Interestingly, even before this commit, the buffer size was larger
than what the kernel would accept.  Since the kernel does its own
length checking, it's simplest to just allow slightly larger requests
here and have them fail later.

Change-Id: I9ed636e4ad025240cb27b3cc066a8f2a72959396
Reviewed-on: https://gerrit.openafs.org/13471
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agobutc: -Wformat-truncation fallout 68/13468/2
Benjamin Kaduk [Sat, 2 Feb 2019 21:44:54 +0000]
butc: -Wformat-truncation fallout

Increase some buffer sizes to appease gcc8.  While here, use snprintf
instead of plain sprintf(!).

Change-Id: I39d29522b92070ce2845ba3d392aaf2d97fc7b6e
Reviewed-on: https://gerrit.openafs.org/13468
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovlserver: use large enough buffer for rxinfo string 66/13466/2
Benjamin Kaduk [Sat, 2 Feb 2019 20:43:04 +0000]
vlserver: use large enough buffer for rxinfo string

The "[dotted-quad] rxkad:name.inst@cell" construct can be as large as
(3*4+3)+7+3*64+2+1 == 217 characters (including trailing NUL); size
our buffer accordingly to avoid the risk of truncation.

Change-Id: Iee635aa66f5f639dfb0572c559a87b5313c305a9
Reviewed-on: https://gerrit.openafs.org/13466
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovlserver: fix vlentryread() for old vldb formats 65/13465/2
Benjamin Kaduk [Sat, 2 Feb 2019 20:23:03 +0000]
vlserver: fix vlentryread() for old vldb formats

When we're using old format compatibility, use OMAXNSERVERS for the
array lengths instead of MAXNSERVERS.  Otherwise we'll try to copy more
data than we've read.

Detected by gcc8 as:

vlutils.c:183:2: error: â€˜memcpy’ forming offset [149, 151] is out of the bounds [0, 148] of object â€˜tentry’ with type â€˜struct vlentry’ [-Werror=array-bounds]
  memcpy(nbufp->serverFlags, oep->serverFlags, NMAXNSERVERS);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vlutils.c:141:26: note: â€˜tentry’ declared here
     struct vlentry *oep, tentry;
                          ^~~~~~

Change-Id: Ie720ca037c5a8bd6aaff5b6d5348161e0175b23b
Reviewed-on: https://gerrit.openafs.org/13465
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovol: avoid -Wformat-truncation issues in vol-salvage.c 64/13464/2
Benjamin Kaduk [Sat, 2 Feb 2019 18:56:26 +0000]
vol: avoid -Wformat-truncation issues in vol-salvage.c

Make some formerly-64-character buffers VMAXPATHLEN (plus a smidgeon)
to give them space to hold the composed paths.

Change-Id: I403c822a8b7376d08fb29f0127315ec439a5cf0d
Reviewed-on: https://gerrit.openafs.org/13464
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agouss: Allocate buffer space for trailing NUL 67/13467/2
Benjamin Kaduk [Sat, 2 Feb 2019 21:26:23 +0000]
uss: Allocate buffer space for trailing NUL

Appease gcc8's -Wformat-truncation engine.

Change-Id: I2113770f63357edf0f5ca273daf0c516a72034a8
Reviewed-on: https://gerrit.openafs.org/13467
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAdd rxgk_token.c 67/10567/22
Ben Kaduk [Mon, 9 Dec 2013 19:35:52 +0000]
Add rxgk_token.c

Routines for constructing tokens (both regular and printed), extracting
and decrypting tokens, and helpers therein.

Provide the ability to print a token using a given session key and
using a random session key; the former is useful for certain variants
of localauth wherein a dummy GSS negotiation is performed with the
same identity acting as initiator and acceptor.

Include a paranoid sanity-check that only the routines intended to
produce printed tokens can produce tokens with a zero-length identities
list.

Change-Id: I0cde7fd0cdf9a27777523cd502b21bdccef41dcc
Reviewed-on: https://gerrit.openafs.org/10567
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoptclient: enable pthreaded support 00/13500/2
Mark Vitale [Mon, 11 Feb 2019 07:54:31 +0000]
ptclient: enable pthreaded support

ptclient has been essentially disabled for pthreads since the ibm-1.0
release.  Remove the conditionals to make a functional pthreaded
ptclient.

Change-Id: Ib0f60b3ab395827b73e5646b014e28ab09607e0e
Reviewed-on: https://gerrit.openafs.org/13500
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoauth: refactor afsconf_Open 97/13397/10
Michael Meffie [Wed, 21 Nov 2018 12:39:24 +0000]
auth: refactor afsconf_Open

Move code to check the AFSCONF environment variable and read the
.AFSCONF files to separate functions.

Rename the internal functions afsconf_OpenInternal and
afsconf_CloseInternal to the more aptly named LoadConfig and
UnloadConfig in preparation for other changes. Add doxygen comments for
these functions.

Change-Id: Ie3361036c59c9e6ef99801891fff9fad63840344
Reviewed-on: https://gerrit.openafs.org/13397
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoSOLARIS: Switch non-embedded vnodes for Solaris 11 96/12696/3
Andrew Deason [Thu, 10 Aug 2017 01:06:05 +0000]
SOLARIS: Switch non-embedded vnodes for Solaris 11

Newer updates to Solaris 11 have been including several changes to the
vnode struct. Since we embed a vnode in our struct vcache, our kernel
module must be recompiled for any such change in order for the openafs
client to work at all.

To avoid the need for this, switch Solaris to using a non-embedded
vnode in our struct vcache. Follow a similar technique as is used in
DARWIN and XBSD, where we allocate a vnode in osi_AttachVnode, and
free it in afs_FlushVCache.

Change-Id: I85fd5d084a13bdea4353b5ad9840fddbc45ce8c0
Reviewed-on: https://gerrit.openafs.org/12696
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Tested-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoSOLARIS: Fix vnode/vcache casts 95/12695/3
Andrew Deason [Thu, 10 Aug 2017 01:06:03 +0000]
SOLARIS: Fix vnode/vcache casts

A few places were using vnodes and vcaches interchangeably. This is
incorrect, since they may not always be the same thing if we stop
embedding vnodes directly in vcaches Fix these to properly go through
AFSTOV/VTOAFS to convert between vcaches and vnodes.

Change-Id: I8a2e42d7b83a5374d2b16b19c47417e7f44d4f27
Reviewed-on: https://gerrit.openafs.org/12695
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoSOLARIS: Accept vnodes in vnode ops 94/12694/3
Andrew Deason [Thu, 10 Aug 2017 01:06:00 +0000]
SOLARIS: Accept vnodes in vnode ops

Currently, our vnode op callbacks look like this:

    int gafs_fsync(struct vcache *avc, afs_ucred_t *acred);

And a pointer to gafs_fsync is given directly to Solaris. This cannot
be correct, since 'struct vcache' is an OpenAFS type, so Solaris
cannot possibly give us a 'struct vcache'. The actual correct
signature for such a function is something like this:

    int gafs_fsync(struct vnode *vp, afs_ucred_t *acred);

And then the 'gafs_fsync' function is supposed to translate 'vp' into
a vcache.

This works on Solaris right now because we embed the vnode as the
first member in our vcache, and so a pointer to a vnode is also a
pointer to a vcache. However, this would break if we ever change
Solaris vcaches to use a non-embedded vnode (like on some other
platforms). And even now, this causes a lot of warnings in
osi_vnodeops.c, since the function signatures are wrong for our vnode
callbacks.

So to fix this, change all of these functions to accept a 'struct
vnode', and translate to/from vnodes and vcaches appropriately.

Change-Id: Ic1c4bfdb7675037d947273ed987cacd05eddfc92
Reviewed-on: https://gerrit.openafs.org/12694
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoSOLARIS: Reorder definitions for vnode callbacks 93/12693/3
Andrew Deason [Thu, 10 Aug 2017 01:05:56 +0000]
SOLARIS: Reorder definitions for vnode callbacks

Currently, many of the functions for our vnode ops are
forward-declared, right before they are referenced in the relevant
vnop template array. Move the function definitions to before the
references, so we can simply get rid of the forward declarations.

These functions are also all only referenced in this file, so declare
them 'static'.

Change-Id: Icd82b6d6176342e2576ce333b40c4b79e8c692c1
Reviewed-on: https://gerrit.openafs.org/12693
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoSOLARIS: Clean up some osi_vnodeops func defs 92/12692/3
Andrew Deason [Thu, 10 Aug 2017 01:05:50 +0000]
SOLARIS: Clean up some osi_vnodeops func defs

Currently, the Solaris osi_vnodeops.c file forward-declares many of
its function definitions, but doesn't declare the arguments. For
example:

    int afs_nfsrdwr();

This avoids type-checking for a few functions that are called before
they are defined in this file. Furthermore, many of these functions
are only used within this file, but are not declared 'static'.

To fix this weirdness, remove most of the forward declarations (most
are not referenced until the function is defined), and fully declare
the rest. Declare functions 'static' that are not referenced outside
of this file.

This commit only changes functions up to the 'afs_getsecattr'
definition. The rest of the file will be fixed in a future commit.

Change-Id: I3f58b9ad8e9c3ea8b3fe3dffacd5118eee0a7ff2
Reviewed-on: https://gerrit.openafs.org/12692
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoauth: remove stale "magic number" comment 90/13490/2
Mark Vitale [Wed, 6 Feb 2019 21:55:03 +0000]
auth: remove stale "magic number" comment

A comment in GenericAuth() refers to a "magic number" which used to be
present as:

  *aindex = 2;

Commit d5622d03196762bd8a60404fea98b4bb044e076d made this a proper enum:

  *aindex = RX_SECIDX_KAD;

Update the comment to remove mention of a "magic number".

No functional change is incurred by this commit.

Change-Id: I1d4770211fe4f88822426a9fe19db77bbb0d7738
Reviewed-on: https://gerrit.openafs.org/13490
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agocmd: bail if out of memory while printing syntax 35/13335/6
Pat Riehecky [Fri, 21 Sep 2018 15:05:24 +0000]
cmd: bail if out of memory while printing syntax

Bail with an error message to stderr if we are unable to format the
command syntax due to a string allocation error.

Found via scan-build.

[mmeffie: updated commit]

Change-Id: Ib3bc7f53c295d8dde6c07b9c4990cd1b3bcee58c
Reviewed-on: https://gerrit.openafs.org/13335
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLINUX: Propagate afs_linux_readdir BlobScan errors 30/13430/3
Andrew Deason [Thu, 17 Jan 2019 05:44:58 +0000]
LINUX: Propagate afs_linux_readdir BlobScan errors

In afs_linux_readdir, if we detect an error code from BlobScan,
currently we 'break' out of the current while() loop. But right after
this loop, we reset 'code' to 0, ignoring the error we just got from
BlobScan, and acting like we just reached the end of the directory.

This means that if BlobScan could not process the given directory at
all, we'll just fail to iterate through some of the entries in the
given directory, and not report an error.

To fix this, process errors from BlobScan like we do for
afs_dir_GetVerifiedBlob, and return an error code and log a message
about the corrupted dir.

Change-Id: I8bd628624ffc04fc55fd6a0820c73018bd9e4a18
Reviewed-on: https://gerrit.openafs.org/13430
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoptserver: Check for -restricted in SPR_Delete 74/13374/4
Andrew Deason [Sat, 3 Nov 2018 06:04:43 +0000]
ptserver: Check for -restricted in SPR_Delete

Currently, all prdb write operations, except for SPR_Delete, will fail
with PRPERM if called by a non-system:administrators caller while
restricted mode is active.  SPR_Delete is missing this check, and so
is not affected by the -restricted option.

Fix this by inserting the same check for -restricted as all other code
paths that check for -restricted.

Change-Id: I35f19d0b715423cd91769e6de845efa330368e50
Reviewed-on: https://gerrit.openafs.org/13374
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agovol: fix vutil format-truncation nit 62/13462/2
Benjamin Kaduk [Sat, 2 Feb 2019 18:25:35 +0000]
vol: fix vutil format-truncation nit

We need one more byte for the trailing NUL.

Change-Id: I1379e958e3b5ec92802060c4541f419599e49311
Reviewed-on: https://gerrit.openafs.org/13462
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoptserver: Fix AccessOK -restricted for SYSADMINID 73/13373/2
Andrew Deason [Sat, 3 Nov 2018 05:58:58 +0000]
ptserver: Fix AccessOK -restricted for SYSADMINID

According to the documentation, as well as other code paths that check
for -restricted, the -restricted option does not affect members of
system:administrators. Currently, though, AccessOK only bypasses the
-restricted check if the caller is SYSADMINID itself (i.e. localauth).

Fix AccessOK to only do the -restricted checks if the caller is not in
system:administrators, to match the documentation as well as other
ptserver operations.

Change-Id: I3074d4537845f1f4deb7f4b72cdb819391b617e3
Reviewed-on: https://gerrit.openafs.org/13373
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoptserver: Fix AccessOK -restricted for addToGroup 70/13370/2
Andrew Deason [Tue, 30 Oct 2018 19:29:24 +0000]
ptserver: Fix AccessOK -restricted for addToGroup

The function AccessOK is used by all of ptserver RPC handlers that
need to do an authorization check, and the last two arguments are set
as such:

- When adding a member to a group, 'mem' is PRP_ADD_MEM and 'any' is
  PRP_ADD_ANY

- When removing a member from a group, 'mem' is PRP_REMOVE_MEM and
  'any' is 0

- When modifying an entry (setFieldsEntry) or modifying some global
  database fields, 'mem' and 'any' are both set to 0

- When reading an entry and not modifying it, 'mem' and/or 'any' are
  set to other values (depending on if we're checking membership,
  examining the entry itself, etc)

Commit 93ece98c (ptserver-restricted-mode-20050415) added a check to
AccessOK to make it return false for -restricted mode when we are
adding a member to a group, or when 'mem' and 'any' are both 0. This
didn't catch the case when we are removing a member from a group,
though, when 'mem' is PRP_REMOVE_MEM.

It looks like commit a614a8d9 (ptutils-restricted-accessok-20081025)
tried to fix this by adding a check for PRP_REMOVE_MEM, but it also
required 'any' to be set to 0 for the conditional to succeed. This is
true when removing a member from a group, but when adding a member to
a group, 'any' is PRP_ADD_ANY, and so this check fails.

This means that currently, when restricted mode is turned on,
non-admins can still run addToGroup and setFieldsEntry successfully.

Fix this by checking for PRP_ADD_MEM/PRP_REMOVE_MEM separately from
checking if 'mem'/'any' are set to 0. Break up this conditional into
separate if() statements with comments to try to make the checks
more clear.

Change-Id: I7e647865b772c42e70014f48ce9cd53ef511cd5b
Reviewed-on: https://gerrit.openafs.org/13370
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRedhat: 'clean build area' error message during dkms build/install 60/13460/2
Cheyenne Wills [Sat, 26 Jan 2019 00:35:51 +0000]
Redhat: 'clean build area' error message during dkms build/install

dkms invokes a make clean command before and after building the kernel
module. The make clean that is issued at the start of building results
in a nuisance error message because the Makefile doesn't yet exist

    Building module:
    cleaning build area...(bad exit status: 2)

In the dkms.conf file, built from within the openafs.spec, change the
command defined in the CLEAN statement to test for the existence of the
Makefile prior to running the actual make clean

Change-Id: Ifc0d5eed6ef0cbc3ddfd193d27bbcb8a7cf52f2a
Reviewed-on: https://gerrit.openafs.org/13460
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoAvoid calling krb5_free_context(NULL) 61/13461/2
Andrew Deason [Fri, 1 Feb 2019 22:31:50 +0000]
Avoid calling krb5_free_context(NULL)

Several places in the code currently call krb5_free_context(ctx) in a
cleanup code path, where 'ctx' may or may not be NULL. This is not
guaranteed to be okay, so check for NULL to make sure we don't cause
issues in these code paths.

While we are here cleaning up krb5_free_context() calls, also fix a
few call sites in afscp_util.c that were not calling krb5_free_context
in all error paths.

Change-Id: I881f01bdf94f00079f84c4bd4bcfa58998e51ac9
Reviewed-on: https://gerrit.openafs.org/13461
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoafs: Throw EIO in DRead on empty dir blob 29/13429/2
Andrew Deason [Thu, 17 Jan 2019 05:46:34 +0000]
afs: Throw EIO in DRead on empty dir blob

DRead currently returns ENOENT if we try to read a page beyond the end
of the given dir blob. We do this to indicate we've hit EOF, but we do
this even if the dir blob is completely empty (which is not a valid
dir blob).

If a dir blob in the cache is truncated due to cache corruption
issues, that means we'll indicate a normal EOF condition in that
directory for most code paths. If someone is trying to list the
directory's entries, for instance, we'll just return that there are no
entries in the dir, even though the dir itself is just invalid.

To avoid this for at least some cases, return an EIO error instead if
the dir blob is completely empty.

Change-Id: I8544e125ad12632523d7c514fe63ff9d87e1cd8f
Reviewed-on: https://gerrit.openafs.org/13429
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovolser: Remove unused VolRestore flags args 58/13458/3
Andrew Deason [Thu, 31 Jan 2019 21:44:38 +0000]
volser: Remove unused VolRestore flags args

SAFSVolRestore has a 'flags' argument, which the volserver passes on
to various internal functions, but the value of the flags never
actually changes any behavior. Remove the 'aflags' argument (and the
derived 'incremental' arg) from a few of our internal functions.

The relevant arguments have been unused since OpenAFS 1.0.

Change-Id: Ib6ba3d5d9aa3e29d720921cb32fe45c871cd803e
Reviewed-on: https://gerrit.openafs.org/13458
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoxstat: remove unused variable 55/13455/2
Michael Meffie [Tue, 29 Jan 2019 16:22:41 +0000]
xstat: remove unused variable

Fix unused variable warning for unused variable oneShotCode.

Change-Id: I8c2a5e8bf0cfc2570985b17d8e250403d459e50a
Reviewed-on: https://gerrit.openafs.org/13455
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>

5 years agoscout: fix missing softsig header 54/13454/2
Michael Meffie [Tue, 29 Jan 2019 16:20:52 +0000]
scout: fix missing softsig header

Fix implicit declaration of function opr_softsig_Init() in scout.

Change-Id: I2bb9eb5240b053b2f16ef1f37035b01dbc42fb84
Reviewed-on: https://gerrit.openafs.org/13454
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Tested-by: Michael Meffie <mmeffie@sinenomine.net>

5 years agoviced: use calloc in SRXAFS_GetXStats 04/13204/8
Michael Meffie [Tue, 12 Jun 2018 15:37:01 +0000]
viced: use calloc in SRXAFS_GetXStats

The file server stats are maintained in global static structures, which
are zero-ed on program start. The full contents are memcpy-ed to
allocated buffers as rx output arguments, so no uninitialized data is
sent over the wire. However, this commit converts the output buffer
allocation from malloc to calloc to make this more clear from code
inspection and make the code more robust.

While here, clean up the comments in SRXAFS_GetXStats and remove the
commented out code for a collection type which was never implemented.
Remove the comments about overwriting spare xstat values, which seems to
be a remnant from an early version of the code.

For informational purposes, add a note at the top of SRXAFS_GetXStats to
make it clear the CallPremable() is intentionally avoided in this
implementation of the GetXStats RPC.  Apparently, the CallPremable() is
omitted since the OpenAFS file server does not to send callbacks to
clients issuing only GetXStats RPCs, and so also avoids sending TMAY
requests to clients like xstat_fs_test.

Note that the presumably older GetStatistics and GetStatistics64 do
unfortunately invoke CallPreamble(), so programs such as scout, must be
able receive RXAFSCB RPCs from OpenAFS file servers.

Change-Id: I7b90c7c6c561c74961fb7f7694a9576e1bed44d6
Reviewed-on: https://gerrit.openafs.org/13204
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoconvert xstat and friends to pthreads 53/12753/13
Michael Meffie [Tue, 17 Oct 2017 20:39:50 +0000]
convert xstat and friends to pthreads

Convert the xstat, fsprobe, and gtx libraries and test programs to
pthreads. Build these libraries with libtool.

Build the scout and afsmonitor programs with pthreads instead of LWP.

Change-Id: Ie1737e71b4e57735bf7b6c7dc3177d717ea35ac6
Reviewed-on: https://gerrit.openafs.org/12753
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoauth: fix afsconf_GetExtendedCellInfo memory leak 96/13396/7
Michael Meffie [Thu, 15 Nov 2018 21:19:51 +0000]
auth: fix afsconf_GetExtendedCellInfo memory leak

Commit c4a127d0578e521b97131c5dedf9da58f71b0242
(ubik-clone-support-20010212) added changes to support ubik clone sites.
This commit added the afsconf_GetExtendedCellInfo function, which
returns the info given by the original afsconf_GetCellInfo, plus an
array of booleans (as chars) to indicate which cell servers are ubik
clones.

Unfortunately, the afsconf_GetExtendedCellInfo function calls the
afsconf_OpenInternal function on an already opened configuration. It
does so to look for server entries which are marked as clone sites in
the CellServDB file. Opening the already opened configuration leaks at
least the cellName and local realms information, and is generally
confusing.

Instead, remember which sites are designated as clone sites when the
CellServDB is read when the configuration is opened, and return that
info to the callers of afsconf_GetExtendedCellInfo.

This commit adds the clone array to the afsconf_cell structure and
changes to afsconf_GetCellInfo() for this new server-related data.

As part of this change, remove the no longer needed cell and clones
arguments to the internal function afsconf_OpenInternal, which were
added by commit c4a127d0578e521b97131c5dedf9da58f71b0242.

Update the testcellconfig test program to output the new afsconf_cell
clone member.

This leak was found with valgrind.

Change-Id: I73db60b6a4a77e620e0511ca45cc3418503278a4
Reviewed-on: https://gerrit.openafs.org/13396
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoauth: plug auth realms memory leaks 95/13395/6
Michael Meffie [Fri, 16 Nov 2018 15:00:17 +0000]
auth: plug auth realms memory leaks

The function _afsconf_FreeRealms, called by afsconf_CloseInternal, leaks
two afsconf_realms structures.

The function _afsconf_LoadRealms also leaks those two structures when it
fails.

These memory leaks were discovered with valgrind.

Change-Id: I1436ce21609951bc3433b6c91221cc45e78881bc
Reviewed-on: https://gerrit.openafs.org/13395
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoAdd the CellServDB pathname to the afsconf_dir 08/13408/5
Michael Meffie [Sat, 8 Dec 2018 01:29:03 +0000]
Add the CellServDB pathname to the afsconf_dir

The determination of the CellServDB pathname is platform-dependent.
However, error reporting in the current code base assumes the CellServDB
location is platform-independent.

Add the pathname of the CellServDB file to the configuration directory
structure and set the new cellservDB member when opening the
configuration. Use this value when checking if the CellServDB has
changed and update the callers to use the cellservDB member when
reporting errors about the CellServDB file.

Change-Id: I5a3393fb9d4ae3c637d5a0d773598115314bfe1c
Reviewed-on: https://gerrit.openafs.org/13408
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoafs: Do not ignore errors in afs_CacheFetchProc 28/13428/2
Andrew Deason [Thu, 17 Jan 2019 06:12:06 +0000]
afs: Do not ignore errors in afs_CacheFetchProc

afs_CacheFetchProc currently has a section of code that looks like
this pseudocode:

    if (!code) do {
        while (length > 0) {
            code = read_from_rx();
            if (code) {
                break;
            }
            code = write_to_cache();
            if (code) {
                break;
            }
        }
        code = 0;
    } while (moredata);
    return code;

When we encounter an error when reading from rx or writing to the
cache, we break out of the current loop to stop processing and return
an error. But there are _two_ loops in this section of the code, so
what we actually do is break out of the inner loop, set 'code' to 0,
and then usually return (since 'moredata' is usually never set).

This means that when we encounter an unexpected error either from the
net or disk (or the memcache layer), we ignore the error and return
success. This means that we'll store a subset of the relevant chunk's
data to disk, and flag that chunk as complete and valid for the
relevant DV. If the error occurred before we wrote anything to disk,
this means we'll store an empty chunk and flag it as valid. The chunk
will be flagged as valid forever, serving invalid data, until the
cache chunk is evicted or manually kicked out. This can result in
files and directories appearing blank or truncated to applications
until the bad chunk is removed.

Possibly the most common way to encounter this issue is when using a
disk cache, and the underlying disk partition is full, resulting in an
unexpected ENOSPC error. Theoretically this can be seen from an
unexpected error from Rx, but we would have to see a short read from
Rx without the Rx call being aborted. If the call was aborted, we'd
get an error from the call to rx_EndCall() later on.

To fix this, change all of these 'break's into 'goto done's, to be
more explicit about where we are jumping to. Convert all of the
'break's in this function in the same way, to make the code flow more
consistent and easier to follow. Remove the 'if () do' on a single
line, since it makes it a little harder to see from a casual glance
that there are two nested loops here.

This problem appears to have been introduced in commit 61ae8792 (Unite
CacheFetchProcs and add abstraction calls), included in OpenAFS
1.5.62.

Change-Id: Ib965a526604e629dc5401fa0f1e335ce61b31b30
Reviewed-on: https://gerrit.openafs.org/13428
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLinux_5.0: replaced current_kernel_time with ktime_get_coarse_real_ts64 34/13434/8
Cheyenne Wills [Sat, 19 Jan 2019 00:22:44 +0000]
Linux_5.0: replaced current_kernel_time with ktime_get_coarse_real_ts64

In Kernel commit fb7fcc96a86cfaef0f6dcc0665516aa68611e736 the
current_kernel_time/current_kernel_time64 functions where renamed
and the calling was standardized.

According to the Linux Documentation/core-api/timekeeping.rst
ktime_get_coarse_real_ts64 is the direct replacement for
current_kernel_time64.  Because of year 2038 issues, there is no
replacement for current_kernel_time.

Updated code that used current_kernel_time to use new name and calling
convention.

Updated autoconf test that sets IATTR_TAKES_64BIT_TIME as well.

Change-Id: I607bdcf6f023425975e5bb747e0e780b3d2a7ce5
Reviewed-on: https://gerrit.openafs.org/13434
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLinux_5.0: replace do_gettimeofday with ktime_get_real_ts64 33/13433/4
Cheyenne Wills [Fri, 18 Jan 2019 23:53:58 +0000]
Linux_5.0: replace do_gettimeofday with ktime_get_real_ts64

In Kernel commit e4b92b108c6cd6b311e4b6e85d6a87a34599a6e3 the
do_gettimeofday function was removed.

According to the Linux Documentation/core-api/timekeeping.rst
ktime_get_real_ts64 is the direct replacement for do_gettimeofday

Updated the macro osi_GetTime to use ktime_get_real_ts64 if it is
available.

Change-Id: I7fcd49958de83a6a040e40bd310a228247c481b2
Reviewed-on: https://gerrit.openafs.org/13433
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agoLINUX: correct include for ktime_get_coarse_real_ts64() 37/13437/2
Mark Vitale [Fri, 18 Jan 2019 22:05:49 +0000]
LINUX: correct include for ktime_get_coarse_real_ts64()

The include for the ktime_get_coarse_real_ts64() autoconf test is
incorrect; ktime_get_coarse_real_ts64() has always been in linux/ktime.h
(via #include timekeeping.h), not linux/time.h.

This autoconf test still ran correctly because the OpenAFS build was
inadvertently picking up ktime.h via the default autoconf include path.
Therefore, this commit is needed only to provide documentation and
clarity to future maintainers.

Introduced as a cut-n-paste error (from the current_kernel_time test)
with commit 3c454b39d04f4886536267c211171dae30dc0344 for Linux 4.20.

Change-Id: I994b03a1700330756216c7feab0121c82d0f3ee4
Reviewed-on: https://gerrit.openafs.org/13437
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoLinux_5.0: Use super_block flags instead of Mount flags when filling sb 32/13432/2
Cheyenne Wills [Thu, 17 Jan 2019 23:00:37 +0000]
Linux_5.0: Use super_block flags instead of Mount flags when filling sb

In Kernel commit e262e32d6bde0f77fb0c95d977482fc872c51996
the mount flags (MS_) were moved from uapi/linux/fs.h to
uapi/linux/mount.h. This caused a compile failure in
src/afs/LINUX/osi_vfsops.c

The Linux documentation in uapi/linux/mount.h indicates that the MS_
(mount) flags should only be used when calling sys_mount and filesystems
should use the SB_ (super_block) equivalent.

src/afs/LINUX/osi_vfsops.c utilized the mount flag MS_NOATIME while
filling the super_block.  Changed to use SB_NOATIME (which has the same
numeric value as MS_NOATIME) if available.

Change-Id: I2b2199de566fbadd45e857b37d24ce63002c7736
Reviewed-on: https://gerrit.openafs.org/13432
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovol: remove empty directories left by vos zap -force 79/12879/4
Marcio Barbosa [Sat, 11 Aug 2018 17:17:28 +0000]
vol: remove empty directories left by vos zap -force

The vos zap -force command does not remove the directories associated
with the volume in question (AFS_NAMEI_ENV). When the vos zap -force
command is executed, the volume server goes through the /vicep*/AFSIDat
directories and removes the files associated with the volume id received
as an argument. Unfortunately, the volume server does not remove the
directories associated with this volume. As a result, empty directories
are left behind.

To fix this problem, remove the empty directories left behind when vos
zap -force is executed.

Change-Id: I56fd52918223f87e424121bac6a086d7b0a46284
Reviewed-on: https://gerrit.openafs.org/12879
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoroken: Use srcdir for roken-post.h 87/13387/2
Andrew Deason [Tue, 13 Nov 2018 17:09:52 +0000]
roken: Use srcdir for roken-post.h

roken-post.h is a source file, not a generated file in the objdir.
Specify $(srcdir) so we can work with objdir builds.

Change-Id: I1d00ba1f28bea99770c2af56890fbf22ee764820
Reviewed-on: https://gerrit.openafs.org/13387
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRedhat: correct path to kernel module in dkms.config 04/13404/6
Cheyenne Wills [Wed, 28 Nov 2018 22:45:20 +0000]
Redhat: correct path to kernel module in dkms.config

This fix corrects some annoying error and warning messages during
dkms install or uninstall.

Install:
DKMS: build completed.

openafs:
Running module version sanity check.
ERROR: modinfo: could not open /lib/modules/2.6.32-754.6.3.el6.x
86_64/weak-updates/openafs.ko: No such file or directory
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/2.6.32-754.6.3.el6.x86_64/extra/
Adding any weak-modules
WARNING: Can't read module /lib/modules/2.6.32-754.6.3.el6.x86_6
4/weak-updates/openafs.ko: No such file or directory
egrep: /lib/modules/2.6.32-754.6.3.el6.x86_64//weak-updates/open
afs.ko: No such file or directory

Remove
Status: Before uninstall, this module version was ACTIVE on this
kernel.
Removing any linked weak-modules
rmdir: failed to remove `.': Invalid argument
WARNING: Can't read module /lib/modules/2.6.32-754.6.3.el6.x86_6
4/weak-updates/openafs.ko: No such file or directory
egrep: /lib/modules/2.6.32-754.6.3.el6.x86_64//weak-updates/open
afs.ko: No such file or directory

openafs.ko:
 - Uninstallation
   - Deleting from:/lib/modules/2.6.32-754.6.3.el6.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel
   - Use the dkms install command to reinstall any previous
   module version.

Background:

Commit 1c96127e37c0ec41c7a30ea3e4aa68f3cc8a24f6 standardized the
location where the openafs.ko module is installed (from
/kernel/3rdparty to /extra/).  The RPM Spec file was not updated to
build the dkms.conf file with the corrected location.

From the documentation for dkms

 DEST_MODULE_LOCATION is ignored on Fedora Core 6 and higher, Red Hat
 Enterprise Linux 5 and higher, Novell SuSE Linux Enterprise Server 10
 and higher, Novell SuSE Linux 10.0 and higher, and Ubuntu.  Instead,
 the proper distribution-specific directory is used.

However the DEST_MODULE_LOCATION is still used saving and restoring old
copies of the module.

The NO_WEAK_MODULES parameter prevents dkms from creating a symlink into
weak-updates directory, which can lead to broken symlinks when
dkms-openafs is removed.  The weak modules facility was designed to
eliminate the need to rebuild kernel modules when kernel upgrades occur
and relies on the symbols within the kABI.  Openafs uses symbols that
are outside the kABI, and therefor is not a candidate for a weak module.

Change-Id: I52a332036056a359a57a3ab34d56781c896a2eea
Reviewed-on: https://gerrit.openafs.org/13404
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agobuild: declare test targets as phony 19/13419/2
Michael Meffie [Thu, 27 Dec 2018 14:32:35 +0000]
build: declare test targets as phony

Modern versions `make` will not build the 'test' target since a
directory exists with the same name.

    $ grep -C1 '^test:' Makefile
    test:
        cd test; $(MAKE)

    $ make test
    make: 'test' is up to date.

Declare these targets as .PHONY to force make to build the test programs
even when the 'test' directory is present. Also use '&&' to concatenate
commands instead ';' to avoid running the second command when the first
fails.

Change-Id: Id561d7610f80b87b59c632801fa0a4b216feb42d
Reviewed-on: https://gerrit.openafs.org/13419
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agolwp: Avoid freeing 'stackmemory' on AIX32 26/13426/2
Andrew Deason [Mon, 14 Jan 2019 23:12:27 +0000]
lwp: Avoid freeing 'stackmemory' on AIX32

Commit 55013a11 (lwp: Fix possible memory leak from scan-build) added
some free() calls to some otherwise-leaked memory. However, one of
these calls frees the 'stackmemory' pointer, which on AIX32 is not a
pointer from malloc/calloc, but calculated from reserveFromStack().

To avoid corrupting the heap, skip this free call on AIX32. This
commit adds another #ifdef to avoid this, which is unfortunate, but
this is also how the free is avoided in the existing code for
Free_PCB().

Change-Id: I6c4518f810e56c362ee744f250747fe8fc765b13
Reviewed-on: https://gerrit.openafs.org/13426
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agorx: remove rx_atomic bitops 90/13390/7
Mark Vitale [Fri, 5 Oct 2018 14:39:23 +0000]
rx: remove rx_atomic bitops

The rx_atomic bitops were introduced with commit
1839cdbe268f4b19ac8e81ae78548f5c78e0c641 ("rx: atomic bit ops").

The last (only) reference to them was recently removed with commit
5ced6025b9f11fadbdf2e092bf40cc87499ed277 ("rx: Convert rxinit_status to
rx_IsRunning()").

Remove the now unreferenced bitops.  This commit is comprised of partial
or complete reverts of the following commits:

ae4ad509d35 rx: fix rx_atomic warnings under Solaris (partial)
c16423ec4e6 rx: fix atomics on darwin (partial)
9dc6dd9858a rx: Fix AIX test_and_set_bit (complete)
1839cdbe268 rx: atomic bit ops (complete)

Note: The rx_atomic bitops for Linux systems are known to be broken due
to incorrect casting of rx_atomic_t into the unsigned long operand
expected by the native Linux bitops.  The failure modes include silent
overruns on little-endian and incorrect results on big-endian.  Do not
merely revert this commit in order to bring these bitops back into the
tree.

Change-Id: I6b63519f63d370ccc8df816b4388487909c17dcd
Reviewed-on: https://gerrit.openafs.org/13390
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

5 years agorx: Statically check rx_statisticsAtomic size 14/13414/4
Andrew Deason [Thu, 20 Dec 2018 20:29:47 +0000]
rx: Statically check rx_statisticsAtomic size

Currently, rx_GetStatistics assumes that struct rx_statistics and
rx_statisticsAtomic have the same size (we just memcpy between them).
However, this is never checked, and rx_statistics contains many 'int'
fields where rx_statisticsAtomic has rx_atomic_t fields.

If these are not the same size, our rx stats will silently break, so
add a static assert to make sure they are the same size.

Change-Id: I889867f4a85530c30dd15d32d1822144ea128a95
Reviewed-on: https://gerrit.openafs.org/13414
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoRevert "rx: fix rx_atomic warnings under Solaris" 15/13415/3
Andrew Deason [Thu, 20 Dec 2018 20:37:31 +0000]
Revert "rx: fix rx_atomic warnings under Solaris"

This reverts commit ae4ad509d35aab73936a1999410bd80bcd711393. While
that commit did fix the mentioned warnings on Solaris, it also changed
the size of rx_atomic_t. Our code in rx_stats.c assumes that an
rx_atomic_t is 4-bytes wide, and so changing the size of rx_atomic_t
broke our reporting for stats in the 'rx_stats' structure.

To fix this, revert that commit. This reintroduces the mentioned
warnings, but those warnings are reported for our atomic bit-op
functions, which are unused and will be removed by another commit.

Change-Id: Ie3e72cc06690d9f8de79e8f0274ea51079004c38
Reviewed-on: https://gerrit.openafs.org/13415
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoauth: update the auth test programs 94/13394/4
Michael Meffie [Thu, 15 Nov 2018 18:49:21 +0000]
auth: update the auth test programs

Fix build errors for the auth test programs.

Close the configuration directory before exiting the testcellconf
program so we can check for leaks.

Add a call to afsconf_GetExtendedCellInfo to the testcellconf test
program.

Use libcmd to parse the testcellconf command line options.

Add the -reload option to testcellconf to perform an optional reload
test. The user must have file permissions to touch the CellServDB to
perform the reload test.

Change-Id: I1cb4cacf9a15ccf7066fb32bfe5f5d03ef64bfd7
Reviewed-on: https://gerrit.openafs.org/13394
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agoafs: avoid afs_GetDownDSlot panic on afs_WriteDCache failure 64/13364/4
Mark Vitale [Mon, 29 Oct 2018 20:48:14 +0000]
afs: avoid afs_GetDownDSlot panic on afs_WriteDCache failure

If afs_GetDownDSlot() finds insuffcient free slots in the
afs_freeDSList, it will walk the afs_DLRU attempting to flush and free
eligible dcaches.  However, if an error occurs during the flush to
CacheItems (afs_WriteDCache()), e.g., -EINTR, afs_GetDownDSlot() will
assert.

However, a panic in this case is overkill, since afs_GetDownDSlot() is a
best-effort attempt to free dslots.  The caller (afs_UFSGetDSlot()) will
allocate more dcaches if needed.

Instead:
- Refactor afs_GetDownDSlot() by moving the QRemove() call to after the
afs_WriteDCache logic, so it accompanies the logic that puts the dcache
back on the freelist.  This is safe because we hold the afs_xdcache W
lock for the duration of the routine.
- If afs_WriteDCache() returns an error, return early and let the caller
handle any recovery.

Change-Id: Ifd0d56120095c9792998ff935776bbd339a76c8a
Reviewed-on: https://gerrit.openafs.org/13364
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

5 years agovos: restore status information to 'vos status' 00/13400/4
Mark Vitale [Fri, 30 Nov 2018 17:10:50 +0000]
vos: restore status information to 'vos status'

Commit d3eaa39da3693bba708fa2fa951568009e929550 'rx: Make the rx_call
structure private' created accessors for several rx_call members.
However, it simply #ifdef'd out the packet counters and timestamps
reported by 'vos status' (AFSVol_Monitor).  This is a regression for the
1.8.x 'vos status' command.

Instead, supply an accessor so 'vos status' can again be used to monitor
the progress of certain volume operations.

FIXES 134856

Change-Id: I91f5831b21f128bd8e86db63387a454c9e57bcdf
Reviewed-on: https://gerrit.openafs.org/13400
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>

5 years agoafs: Reword "cache is full" messages 10/13410/3
Andrew Deason [Thu, 13 Dec 2018 18:25:32 +0000]
afs: Reword "cache is full" messages

Currently, there are multiple different areas in the code that log a
message that look like this, when we encounter an ENOSPC error when
writing to the cache:

    *** Cache partition is FULL - Decrease cachesize!!! ***

The message is a bit unclear, and doesn't even mention AFS at all.
Reword the message to try to explain a little more what's happening.

Also, since we log the same message in several different places, move
them all to a common function, called afs_WarnENOSPC, so we only need
to change the message in one place.

Change-Id: If1c259bd22a382ff56ed29326aa20c86389d06bc
Reviewed-on: https://gerrit.openafs.org/13410
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>