openafs.git
9 years agoAdd AFSCONF_NOCELLNAME error code
Benjamin Kaduk [Wed, 10 Dec 2014 19:36:36 +0000]
Add AFSCONF_NOCELLNAME error code

Contrast with AFSCONF_NOCELL, which is for when no cell configuration
information is available at all (i.e., a struct afsconf_dir* was NULL) --
this code is used when there is some cell configuration available, but
that configuration does not include the cell name.

Replace the only existing use of AFSCONF_UNKNOWN with this more-informative
error code, leaving AFSCONF_UNKNOWN free for use in other situations.

Change-Id: I989756a960e5377545af43f8e9414d1f2d6476b4
Reviewed-on: http://gerrit.openafs.org/11628
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoLinux 3.19: struct nameidata becomes opaque
Marc Dionne [Mon, 5 Jan 2015 12:17:14 +0000]
Linux 3.19: struct nameidata becomes opaque

With kernel 3.19 struct nameidata becomes opaque.  As a result
we cannot rely on STRUCT_NAMEIDATA_HAS_PATH being true for
new kernels.

Rework the conditions here so that STRUCT_NAMEIDATA_HAS_PATH
is only tested when we're using a nameidata structure and
the result matters.

Also modify a configure test to use a nameidata pointer
instead of an actual structure.

Change-Id: I0d71fca44a67570ac3b86151c70f2969dc463f4f
Reviewed-on: http://gerrit.openafs.org/11648
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoLinux 3.19: Use mgs_iter in struct msghdr
Marc Dionne [Mon, 5 Jan 2015 12:13:37 +0000]
Linux 3.19: Use mgs_iter in struct msghdr

struct msghdr gets msg_iov replaced by msg_iter.  Add a configure
test and adjust the affected code.

Change-Id: I9b9e3987e55a10e48087b318d98a5a7bb17a4612
Reviewed-on: http://gerrit.openafs.org/11647
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoLinux 3.19: No more f_dentry
Marc Dionne [Mon, 5 Jan 2015 12:03:16 +0000]
Linux 3.19: No more f_dentry

Back in kernel 2.6 .20 struct file lost its f_dentry field
which was replaced by f_path.To ease transition f_dentry
was defined as f_dpath.dentry in the same header.This
define finally gets removed with kernel 3.19.

Keep using f_dentry in the code, but add a configure test
for the presence of f_path and the absence of the f_dentry
macro so we can add it if its missing.

Change - Id:I8e8a7e4d3ddd861018de50af1eb7315e730ad529

Change-Id: I4b05aa3d37f01e0e675c420cbf941d682c49c69c
Reviewed-on: http://gerrit.openafs.org/11646
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoLinux: d_alias becomes d_u.d_alias
Marc Dionne [Thu, 18 Dec 2014 12:13:46 +0000]
Linux: d_alias becomes d_u.d_alias

The fields in struct dentry are re-arranged so that d_alias
shares space wth d_rcu inside the d_u union.  Some references
need to change from d_alias to d_u.d_alias.

The kernel change was introduced for 3.19 but was also backported
to the 3.18 stable series in 3.18.1, so this commit is required
for 3.19 and current 3.18 kernels.

Change-Id: I711a5a3a89af6e0055381dfd4474ddca2868bb9c
Reviewed-on: http://gerrit.openafs.org/11642
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoptserver: Limit length on namelist, idlist
Andrew Deason [Tue, 12 Mar 2013 14:51:39 +0000]
ptserver: Limit length on namelist, idlist

namelist and idlist are used as IN parameters to ptserver RPCs that
can be issued by unauthenticated clients. Not having a length limit on
them means anyone can use up a ton of ptserver memory by just issuing
those RPCs with a very large length.

So, put a limit on them. PR_MAXLIST is a constant that already exists,
but is small enough to potentially limit real use, so define a new
OpenAFS-internal value for this purpose.

prlist and prentries are returned from the ptserver to clients, so
also limit them in the same way.

Change-Id: Iaf45639bbae401093354adbfb4daa172fe97ede1
Reviewed-on: http://gerrit.openafs.org/9588
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>

9 years agouss: always build uss
Chas Williams (CONTRACTOR) [Mon, 5 Jan 2015 15:41:53 +0000]
uss: always build uss

Revert change Ibab1dd189e7fbc41ca01e7ef7479421c056999f5 since uss
should always be safe to build now that its parser symbols are private.

Change-Id: I65fd2008b037dd36a2c7d3ef8817d4d7dda689d7
Reviewed-on: http://gerrit.openafs.org/11653
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>

9 years agouss: Avoid -i (inplace) with sed
Chas Williams (CONTRACTOR) [Tue, 6 Jan 2015 22:58:05 +0000]
uss: Avoid -i (inplace) with sed

Not all sed versions support inplace editing, so do things ourselves.
Also use the sed version found by configure for consistency.

Change-Id: I6194b8dd6b7abf88d0b0fa36ba871e0ba092ce1e
Reviewed-on: http://gerrit.openafs.org/11655
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>

9 years agoLinux: Move code to reset the root to afs/LINUX
Marc Dionne [Thu, 18 Dec 2014 11:57:22 +0000]
Linux: Move code to reset the root to afs/LINUX

Move the Linux specific bit of code to reset the root to
afs/LINUX platform specific files.  Things that play with
the Linux vfs internals should not be exposed here.

No functional change, but this helps cleanup some ifdef
mess.

Change-Id: Ia27fca3d8052ead45783cb2332c04fe6e99e5d9f
Reviewed-on: http://gerrit.openafs.org/11641
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>

9 years agoFix unchecked return values
Jeffrey Hutzelman [Sun, 16 Jun 2013 19:28:03 +0000]
Fix unchecked return values

This change fixes numerous places where the return values of various
system calls and standard library routines are not checked.  In
particular, this fixes occurrances called out when building on Ubuntu
12.10, with gcc 4.7.2 and eglibc 2.15-0ubuntu20.1, when the possible
failure is one we actually do (or should) care about.  This change
does not consider calls where the failure is one we deliberately
choose to ignore.

Change-Id: Id526f5dd7ee48be2604b77a3f00ea1e51b08c21d
Reviewed-on: http://gerrit.openafs.org/9979
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agovol: rename volUpdateCounter macro
Michael Meffie [Mon, 21 Jul 2014 21:41:32 +0000]
vol: rename volUpdateCounter macro

Change the volUpdateCounter volume macro name to be
consistent with the volume header name.

Change-Id: I55f55f2c084135e9598c194ed9081fce800ddfe9
Reviewed-on: http://gerrit.openafs.org/11318
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoRemove traces of Debian packaging
Michael Laß [Mon, 8 Dec 2014 07:34:26 +0000]
Remove traces of Debian packaging

In e34e0d1 the Debian packaging was removed. Some traces are still left, so
remove those as well.

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

9 years agodafs: avoid asserting on dafs VSALVAGING error code
Michael Meffie [Thu, 19 Dec 2013 14:49:33 +0000]
dafs: avoid asserting on dafs VSALVAGING error code

DAFS introduced the VSALVAGING error code which is returned when a vnode
cannot be put and a volume has been scheduled to be salvaged.

Update the afsfileprocs to not assert on VSALVAGING, as well as the
VSALVAGE error code.

For example, VPutVnode() and VVnodeWriteToRead() may call
VRequestSalvage_r() which will set the error code to VSALVAGING when a
salvage is requested.

This was noticed during a code inspection.

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

9 years agobozo: Constify bozo_Log 'format' argument
Andrew Deason [Mon, 10 Feb 2014 22:23:07 +0000]
bozo: Constify bozo_Log 'format' argument

We clearly do not need to modify the format string; declare it const.
This makes the signature of bozo_Log identical to FSLog, which can
make it easier to use these functions interchangeably.

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

9 years agofssync-debug: close test connection
Mark Vitale [Wed, 20 Nov 2013 20:05:21 +0000]
fssync-debug: close test connection

A valid fssync-debug query <volid> command issued against
a DAFS fileserver will produce the following error messages in FileLog:

SYNC_getCom:  error receiving command
FSYNC_com:  read failed; dropping connection (cnt=1)

Routine dafs_prolog() issues a tentative FSYNC_VOL_LISTVOLUMES operation
to test for the presence of a DAFS fileserver.  If DAFS is detected,
we then call dafssync-debug for the original requested operation.
However, the FSYNC connection for the tentative LISTVOLUMES operation
is never closed. This results in the errors when the command completes.

Close the test connection.

Change-Id: I3c987289408407ba38cd184b7518e72ee1ae9cfc
Reviewed-on: http://gerrit.openafs.org/10476
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoAttempt to clean up tvolser dependencies
Benjamin Kaduk [Tue, 12 Aug 2014 19:13:46 +0000]
Attempt to clean up tvolser dependencies

The volserver only needs vl_errors.c to be locally generated, not
vlserver.h; in fact, the only consumers of vlserver.h in src/volser/
consume it via afs/vlserver.h.

Instead of reaching over to ../volser for the generated volerr.c,
generate our own local copy, as well as the volser.h generated from
the same error table -- volser.h is included with double-quotes from
the volser sources.

Add the appropriate dependencies on volser.h, and remove the unneeded
dependencies on vlserver.h

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

9 years agorx: Ignore responses to nonexistent challenges
Andrew Deason [Tue, 1 Oct 2013 19:54:15 +0000]
rx: Ignore responses to nonexistent challenges

Consider the following situation:

 - A client sends a data packet to a server, using a security class
   that requires a challenge
 - The server responds with a challenge
 - The server is restarted
 - The client responds to the challenge with a response

In that situation, the server will process the response, but since the
server was restarted, it has no knowledge of the challenge that was
sent. This generally means that we error the connection, since the
given response is not valid. For rxkad with modern endpoints, this
results in an RXKADPACKETSHORT error, since we interpret the response
as an 'old' response, but it's actually a 'v2' response, so we
interpret the fields in the response as garbage.

This means that the client gets a connection error when the client did
nothing wrong, and there's no way for the client to distinguish this
from a real connection error.

One way to solve this would be to send a Challenge packet to the
client immediately when we detect that this situation has occurred.
However, if we do that, then we never see a data packet with a
checksum, so we fall back to using "old" challenges and responses. And
in general, that would cause the server side to never see a data
packet during the connection negotiation, which is unusual and I am
concerned there may be other niggles of odd behavior that may occur in
that scenario.

So instead, to fix this, make the server ignore responses in this
situation (that is, if we haven't sent out any challenges yet).
Clients will eventually resend the data packet, and we will go through
negotiating the connection security like normal. This should never
cause any new problems, since dropping a challenge packet must be
handled anyway (sometimes packets just get dropped). And a client will
never hang on sending the same response over and over again; clients
only ever send a Response in response to a Challenge packet.

Change-Id: Id3fae425addb2ac8ab60965213b3ebca2e64ba5d
Reviewed-on: http://gerrit.openafs.org/10315
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agovldb_check: rebuild free list with -fix
Michael Meffie [Sat, 8 Nov 2014 18:14:27 +0000]
vldb_check: rebuild free list with -fix

Rebuild the vldb free chain in addition to the hash chains when
vldb_check is run with the -fix option.  Print a FIX: message for
entries added to the free chain.

Example vldb with a broken free chain.

    $ vldb_check vldb.broken
    address 199364 (offset 0x30b04): Free vlentry not on free chain
    address 223192 (offset 0x36818): Free vlentry not on free chain
    address 235180 (offset 0x396ec): Free vlentry not on free chain
    Scanning 1707 entries for possible repairs

    $ vldb_check -fix vldb.broken
    Rebuilding 1707 entries
    FIX: Putting free entry on the free chain: addr=199364 (offset 0x30b04)
    FIX: Putting free entry on the free chain: addr=223192 (offset 0x36818)
    FIX: Putting free entry on the free chain: addr=235180 (offset 0x396ec)

Thanks to Kostas Liakakis for reporting this bug.

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

9 years agoRedHat: Update configure options, again
Andrew Deason [Mon, 23 Dec 2013 22:27:05 +0000]
RedHat: Update configure options, again

Commit 83f85c9ad6c439eb9676436a3e09c40c2813f1c1 updated the arguments
we give to configure, since --enable-disconnected and --with-krb5-conf
no longer exist. But, it only updated the configure options for the
userspace configure, and did not update the configure invocation for
building kmod kernel modules.

Update the other configure invocation, so they match and both of them
avoid using outdated configure options.

Change-Id: Ia7fe16a373b5feabd4060bd85fbf9220407082f5
Reviewed-on: http://gerrit.openafs.org/10623
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agouss: Make the uss parser private
Chas Williams (CONTRACTOR) [Fri, 10 Oct 2014 13:12:31 +0000]
uss: Make the uss parser private

Attempt to make the parser in uss private so that it doesn't
conflict with other libraries that might leak their parser symbols.

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

9 years agoLinux: get sysname even if kernel module disabled
Nathaniel Wesley Filardo [Sun, 19 Oct 2014 06:42:08 +0000]
Linux: get sysname even if kernel module disabled

Fall back to `uname -r` if we aren't probing for kernel sources,
as we still need to know for the rest of the build.  While this
could be worked around by explicitly passing the sysname as an
argument, this seems friendlier.

Change-Id: I0db75ba5fc7d1f5ec08d27dfce6858b968b6ce28
Reviewed-on: http://gerrit.openafs.org/11552
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoUnix CM: Avoid using stale DV in afs_StoreAllSegments
Marc Dionne [Fri, 19 Dec 2014 15:11:53 +0000]
Unix CM: Avoid using stale DV in afs_StoreAllSegments

It was reported in RT 131976 that on Linux some file
corruption was observed when doing mmap writes to
a file substantially larger than the cache size.

osi_VM_StoreAllSegments drops locks and asks the OS to flush
any dirty pages in the file 's mapping.  This will trigger
calls into our writepage op, and if the number of dirty
cache chunks is too high (as will happen for a file larger
than the cache size), afs_DoPartialWrite will recursively
call afs_StoreAllSegments and some chunks will be written
back to the server.  After potentially doing this several
times, control will return to the original afs_StoreAllSegments.

At that point the data version that was stored before
osi_VM_StoreAllSegments is no longer correct, leading to
possible data corruption.

Triggering this bug requires writing a file larger than the
cache so that partial stores are done, and writing enough
data to exceed the system's maximum dirty ratio and cause
it to initiate writeback.

To fix, just wait until after osi_VM_StoreAllSegments to
look at and store the data version.

FIXES 131976

Change-Id: I959f06b5a7a51171e7ed70189620e9d11d52efa2
Reviewed-on: http://gerrit.openafs.org/11644
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agodoc: document the vldb free list
Michael Meffie [Sat, 8 Nov 2014 16:10:52 +0000]
doc: document the vldb free list

Document vldb free list in the vldb format (vldb.txt). The nextIdHash[0]
is on the free chain when the vl entry is free.

Also fix two typos in vldb.txt.

Change-Id: I5d79f55214295e029e7174ef46838afd7dc44bf1
Reviewed-on: http://gerrit.openafs.org/11597
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoafs: Fix some afs_conn overcounts
Andrew Deason [Sun, 14 Sep 2014 19:10:11 +0000]
afs: Fix some afs_conn overcounts

The usual pattern of using afs_Conn looks like this:

  do {
      tc = afs_Conn(...);
      if (tc) {
          code = /* ... */
      } else {
          code = -1;
      }
  } while (afs_Analyze(...));

The afs_Analyze call, amongst other things, puts back the reference to
the connection obtained from afs_Conn. If anything inside the do/while
block exits that block without calling afs_Analyze or afs_PutConn, we
will leak a reference to the conn.

A few places currently do this, by jumping out of the loop with
'goto's. Specifically, in afs_dcache.c and afs_bypasscache.c. These
locations currently leak references to our connection object (and to
the underlying Rx connection object), which can cause problems over
time. Specifically, this can cause a panic when the refcount overflows
and becomes negative, causing a panic message that looks like:

  afs_PutConn: refcount imbalance 0xd34db33f -32768

To avoid this, make sure we afs_PutConn in these cases where we 'goto'
out of the afs_Conn/afs_Analyze loop. Perhaps ideally we should cause
afs_Analyze itself to be called in these situations, but for now just
fix the problem with the least amount of impact possible.

FIXES 131885

Change-Id: I3a52f8ccef24f01d04c02db0a4b711405360e323
Reviewed-on: http://gerrit.openafs.org/11464
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agodoc: fix unbalanced <listitem> in AdminGuide/auagd018.xml
Chas Williams (CONTRACTOR) [Sat, 6 Dec 2014 12:40:04 +0000]
doc: fix unbalanced <listitem> in AdminGuide/auagd018.xml

This was introduced by c04c57c6c57d2e0b09ba60b68de738b636c9450b

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

9 years agodoc: fix duplicate tag usage in QuickStartUnix
Chas Williams (CONTRACTOR) [Sat, 6 Dec 2014 12:31:46 +0000]
doc: fix duplicate tag usage in QuickStartUnix

The duplicate LIWQ54 tag appears to break newer versions of fop.  Since it
isn't referenced by anything, just remove in both instances.

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

9 years agorxgen: Only cast array/pointer/vector types
Chaskiel Grundman [Fri, 20 Sep 2013 19:04:13 +0000]
rxgen: Only cast array/pointer/vector types

Assuming the correct values are passed to the xdr functions, no casts
are required. Don't cast simple/struct/union/typedef values. Do cast
array/pointer/vectors, since the relevant xdr wrapper functions expect
char *.

Change-Id: I375c03899576735668c1a0df0af47377223ae97a
Reviewed-on: http://gerrit.openafs.org/10260
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agorxgen: Always pass aliases (typedefs) as pointers
Chaskiel Grundman [Fri, 20 Sep 2013 18:28:07 +0000]
rxgen: Always pass aliases (typedefs) as pointers

Since prototypes were introduced, xdr functions for typedef foo
expect a foo *, never a foo, even if the underlying type is an array.
print_param (for stubs) got this right, but print_stat (for inter-xdr
calls) did not.

Change-Id: I2b12aaf919fd39e6195d85072fdfd915a1c509f0
Reviewed-on: http://gerrit.openafs.org/10259
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoRemove sunrpc compatibility
Chaskiel Grundman [Fri, 20 Sep 2013 14:42:20 +0000]
Remove sunrpc compatibility

Remove sunrpc compatibility from rxgen. It's not tested, and
rpcgen is available from other sources. This will allow changes to be
made to rxgen without worrying about their impact on rpcgen compatibility.

Removals consist of the -l, -m, and -s switches, the source files
rpc_clntout.c and rpc_svcout.c, and the scan tokens 'program' and
'version'. The -R switch ('R compatibility') is also removed, as it's
a noop.

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

9 years agovlserver: Refactor auditing
Chas Williams (CONTRACTOR) [Sun, 23 Mar 2014 21:47:25 +0000]
vlserver: Refactor auditing

Refactor auduting to be more like other uses in the code base.
Auditing is now done in a wrapper.

Change-Id: I491aeda31c223e594e3870573871ae10a541d010
Reviewed-on: http://gerrit.openafs.org/11315
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoredhat: do not overwite the server CellServDB
Michael Meffie [Thu, 13 Nov 2014 17:12:12 +0000]
redhat: do not overwite the server CellServDB

The bosserver creates a pair of symlinks in the client's configuration
directory (/usr/vice/etc) during startup, if the configuration files are
not present:

  /usr/vice/etc/CellServDB -> /usr/afs/etc/CellServDB
  /usr/vice/etc/ThisCell -> /usr/afs/etc/ThisCell

Due to a bug in the bosserver (which is not fixed on 1.6.x), the
symlinks are only created when the /usr/vice/etc directory already
exists when the bosserver is started.

If the bosserver is started before the client is installed (and the
/usr/vice/etc directory is present), then the packaging script will
write to the symlink CellServDB, overwriting the server's CellServDB with
the contents of the client's CellServDB.local and CellServDB.dist files.
Also, if the client is started after the bosserver creates the symlinks,
the client init script will overwrite the server's CellServDB with the
contents of the client's CellServDB.local and CellServDB.dist files.

Update the packaging and the client init script to delete this symlink
if present, since it is only intended to provide stub configuration
for the client utilities while setting up an initial server.  Then,
the updating of the CellServDB will create a local file, instead of
following the symlink and overwriting the server CellServDB.

While here, adjust the indentation whitespace to match the tabs below.

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

9 years agoafs: Add xvcache-related afs_FlushVCache comments
Andrew Deason [Sun, 20 May 2012 22:32:13 +0000]
afs: Add xvcache-related afs_FlushVCache comments

Add a couple of comments to help make it explicit when it is okay to
drop afs_xvcache here.

Change-Id: I451ffe80755ea471322e32017f71c0619e6a8e63
Reviewed-on: http://gerrit.openafs.org/7436
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoafs: Remove 'slept' from osi_VM_FlushVCache
Andrew Deason [Fri, 18 May 2012 21:49:31 +0000]
afs: Remove 'slept' from osi_VM_FlushVCache

No implementation of osi_VM_FlushVCache drops and reacquires
afs_xvcache. Doing so would cause problems when afs_FlushVCache calls
osi_VM_FlushVCache, since someone could grab a reference to the vcache
while xvcache is dropped. So, prohibit dropping and reacquiring
afs_xvcache in osi_VM_FlushVCache, and remove the 'slept' argument to
it.

Change-Id: I50b4ee35f54a5277749f44e93b1094e4fb5c93e9
Reviewed-on: http://gerrit.openafs.org/7435
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoafs: Correct routine name on error message
Perry Ruiter [Mon, 8 Dec 2014 20:33:05 +0000]
afs: Correct routine name on error message

While studying some code I noticed one of the error messages in
afs_UFSGetVolSlot was prefixed with a different routine name.
More shocking was that git blame fingered me as the last person
to update that line!  Indeed I had but I hadn't noticed, nor had
my reviewers, the mis-matched routine name.

Update afs/afs_volume.c to correct routine name.

Change-Id: Id7ee275c9f8991bb71082b9dfcd52c14ead83955
Reviewed-on: http://gerrit.openafs.org/11625
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoafs: Remove AFS_BOZONLOCK_ENV
Chas Williams (CONTRACTOR) [Sat, 26 Apr 2014 18:49:36 +0000]
afs: Remove AFS_BOZONLOCK_ENV

The only user of AFS_BOZONLOCK_ENV is ppc_darwin_80.  This was added
to the param file by commit:

    commit 379e3be3196aeb3fefaa1e9296e52a9f8018550a
    Author: Derrick Brashear <shadow@dementia.org>
    Date:   Sun Jun 19 00:20:01 2005 +0000

        ppc-darwin80-20050618

        this is actually a throwaway

It isn't clear to me what the intent was.  Darwin clearly isn't
using the Bozon lock around every osi_FlushPages() despite comments
in DARWIN/osi_vnodeops.c about said lock.   The possibility of the
Bozon lock being required only ppc_darwin_80 and not ppc_darwin_70 and
ppc_darwin_90 is unlikely.

The comments about the Bozon lock in FBSD/osi_vnodeops.c appears to be
a copy/paste from DARWIN's.  Curiously, FBSD doesn't drop the GLOCK()
when osi_FlushPages() calls osi_VM_FlushPages() despite a comment to
the contrary in osi_VM_FlushPages().

Also, instead of editing the alpha_dux param files, just remove them.
Nothing is using them.

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

9 years agobudb: Avoid use of anonymous structures to determine size
Chas Williams (CONTRACTOR) [Mon, 24 Sep 2012 20:26:43 +0000]
budb:  Avoid use of anonymous structures to determine size

Change-Id: Ife337e4e020a0450020f9ae641b1711435b936c4
Reviewed-on: http://gerrit.openafs.org/8153
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agovolser: Break callbacks to the target of VolClone
Marc Dionne [Thu, 27 Nov 2014 21:23:12 +0000]
volser: Break callbacks to the target of VolClone

With the "-stayup" release mechanism, clients may have callbacks
to the target of VolClone rather than the target of VolRestore,
so also break callbacks there.

This could cause clients to not be notified of a volume release
done with -stayup and have stale contents.

Change-Id: I94009f4b9382471a3615d2a729e4ee3955a14d44
Reviewed-on: http://gerrit.openafs.org/11619
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoRemove FreeBSD packaging
Benjamin Kaduk [Thu, 4 Dec 2014 22:00:04 +0000]
Remove FreeBSD packaging

The packaging used by official FreeBSD package builds is taken from
the FreeBSD Ports Collection's version control, which is currently
available at https://svnweb.freebsd.org/ports/head/net/openafs/ .

The version of the FreeBSD packaging in the openafs repository
will almost always be out-of-date and is not needed by FreeBSD
(although a small portion of it is currently used by the upstream
FreeBSD packaging), and the actual packaging used by FreeBSD is
easily available, so there is no purpose in maintaining FreeBSD
packaging in the OpenAFS source code repository.

Change-Id: I969cd6933ecd56d6940b8d48da67f50260101571
Reviewed-on: http://gerrit.openafs.org/11622
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoRemove Debian packaging
Benjamin Kaduk [Thu, 4 Dec 2014 22:00:04 +0000]
Remove Debian packaging

The packaging used for uploads to Debian is maintained on Debian
infrastructure, presently at
http://anonscm.debian.org/cgit/pkg-k5-afs/openafs.git .

The packaging repository for any given Debian openafs source
package will be listed in the Vcs-* fields in the package's
control file.

The version of the Debian packaging in the openafs repository
will almost always be out-of-date and is not used by Debian,
and the actual packaging used by Debian is easily available, so
there is no purpose in maintaining Debian packaging in the OpenAFS
source code repository.

Change-Id: I23011315ece011e32cdddd992c4f8a176e348c67
Reviewed-on: http://gerrit.openafs.org/11621
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agobuild-sys: make docbook path find easier to read
Sami Kerola [Sat, 22 Jun 2013 19:20:52 +0000]
build-sys: make docbook path find easier to read

Additional gain, when horizontal lists are converted to vertical, is that
each item will be individually version controlled.

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

9 years agoMake all VLDB interactions use VLF/VLSF names
Nathaniel Wesley Filardo [Sat, 26 Jul 2014 19:05:19 +0000]
Make all VLDB interactions use VLF/VLSF names

src/volser/volser.p.h defined the values used in VLDB entries.  These values
appear (by exhaustive walk of source and by inspection of the volser's rxrpc
api) to be unused by any aspect of the volser and were solely used in
communication with the VLDB.

This patch deletes the misplaced definitions and moves the entire tree to
use the VLF_{RW,RO,BACK}EXISTS and VLSF_* macros from vlserver/vldbint.xg .
No include wrangling was needed; these definitions have always been in scope
but relatively unused.

It also serves to head off a potential problem, which actually motivated the
whole thing: ITSRWREPL was 0x10, which was claimed as VLSF_UUID;
VLSF_RWREPLICA is 0x40, which did not have an ITS equivalent.  As ITSRWREPL
was not used, this had never shown itself in operation.  There was no ITS
semantic equivalent of VLSF_UUID.

Change-Id: I60426c2635976b9ac34bf820a8aec7a0c8575e20
Reviewed-on: http://gerrit.openafs.org/11331
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoDeleteVolume should check ITSROVOL as a bit
Nathaniel Wesley Filardo [Wed, 3 Dec 2014 07:06:35 +0000]
DeleteVolume should check ITSROVOL as a bit

Other bits may be asserted even if this is a RO vol.

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

9 years agoRevert "vos-sync-flag-voltype-properly-20080521"
Nathaniel Wesley Filardo [Thu, 31 Jul 2014 05:52:30 +0000]
Revert "vos-sync-flag-voltype-properly-20080521"

The convention appears to be that ITSRWVOL is the correct flag for
the backup volume.

This reverts commit dcafea769a1cb70c7b1f8763ae4f7b7744b2a436.

Change-Id: I0f88107d56817515f41a68062053b263683afc94
Reviewed-on: http://gerrit.openafs.org/11341
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agobuild-sys: reindent AC_ARG_WITH section in acinclude.m4
Sami Kerola [Sat, 22 Jun 2013 19:06:34 +0000]
build-sys: reindent AC_ARG_WITH section in acinclude.m4

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

9 years agonamei: Remove icreate tfd hack
Andrew Deason [Fri, 30 Aug 2013 17:23:43 +0000]
namei: Remove icreate tfd hack

Currently, the namei icreate routine creates a fake FdHandle_t for a
SetLinkCount call if we're creating a linktable. In the past this was
probably done because we did not want to open a "real" fdP ,since that
would mean opening another file descriptor, when we already had a file
descriptor (from the creating afs_open call).

This is a problem in the salvager, since it means that we can reach
ihandle code before the ihandle package has been initialized.
Specifically, we can reach icreate -> namei_SetLinkCount -> ih_fdsync.
If we reach ih_fdsync without the ihandle package being initialized,
we assert and dump core.

The ihandle package assumes that we've already initialized it if we
reach any ihandle code, since creating any IHandle_t causes the
package to initialize. But since namei_icreate fakes its own IHandle_t
and FdHandle_t structures, that doesn't happen.

So, to avoid this, stop faking our FdHandle_t and create a real one.
Since we have ih_attachfd, we can create a real FdHandle_t with our
existing file descriptor.

Change-Id: I7a8c1e0ed1ee8e5c8ce2e165b9493811d5d2435d
Reviewed-on: http://gerrit.openafs.org/10213
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agokauth: fix klog principal name parsing
Mark Vitale [Tue, 13 May 2014 23:18:57 +0000]
kauth: fix klog principal name parsing

If a principal name is specified to the klog command, it is not
correctly passed in the pw structure.  This in turn causes
uninitialized storage to be passed to ka_UserAuthenticateGeneral.
This may either lead to a segmentation fault in klog, or cause
garbage to be passed to the kaserver, leading to garbage in some
log and audit messages.  In all cases it is impossible to authenticate
to kaserver with a specified principal name.  However, klog
still works correctly when no principal name is specified.

This was introduced by commit 68ce3aa814a7e3085242e705f013f05ed5da2d5c
which removed lclpw to eliminate a clang warning.  However, the clang
warning was misleading in this case, as lclpw was actually used
(confusingly) to indirectly update the pw structure.

Instead of reverting this commit, just update pw->pwname directly.

Change-Id: I565360c6e2f970637422e8b01998d3fc29874ec4
Reviewed-on: http://gerrit.openafs.org/11145
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
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>

9 years agoauth: Clean up and document functions in netrestrict.c
Chas Williams (CONTRACTOR) [Thu, 3 Jul 2014 14:53:51 +0000]
auth: Clean up and document functions in netrestrict.c

Clean up and document parseNetRestrictFile_int and ParseNetInfoFile_int
in preparation for some future changes.

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

9 years agoExport xdr_nbulkentries in liboafs_vldb
Nathaniel Wesley Filardo [Mon, 28 Jul 2014 17:26:22 +0000]
Export xdr_nbulkentries in liboafs_vldb

Change-Id: Id6ba0e4fdb802cc10aa98b32d7e7c9b605c90606
Reviewed-on: http://gerrit.openafs.org/11334
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoliboafs_util: export symbols for tabular_output
Christof Hanke [Wed, 9 Oct 2013 05:38:10 +0000]
liboafs_util: export symbols for tabular_output

Otherwise compilation fails on AIX.

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

9 years agodoc: Document fs listquota 2TB partition limit
Andrew Deason [Tue, 10 Jun 2014 19:47:31 +0000]
doc: Document fs listquota 2TB partition limit

We have previously documented that volumes over 2TB can result in
inaccuracies, but this documentation does not say how the 'partition'
field in "fs listquota" can be inaccurate. It is confusing to see a
usage of 0% for a partition that you know is being used, so try to
briefly explain in what way this field is inaccurate.

The reason we _under_-report the partition usage is that the
fileserver actually gives back PartBlocksAvail and PartMaxBlocks (not
"blocks used" and "blocks total"). So 1TB used and 4TB total is
truncated to 2TB and given back as 2TB free and 2TB total. One we hit
3TB used we'll report it as 1TB free 2TB total (50%) when the actual
usage is 75%.

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

9 years agovol: Make FindLinkHandle static and namei-only
Andrew Deason [Tue, 18 Feb 2014 19:00:38 +0000]
vol: Make FindLinkHandle static and namei-only

FindLinkHandle is only referenced inside vol-salvage.c. Also, the
concept of a link table only exists on namei, so the function is only
used for the namei server (and it's only called by other namei-only
code).

So, make the function static, and put it inside the AFS_NAMEI_ENV
ifdef, to be a little more clear about where it can be used. Moving it
inside the AFS_NAMEI_ENV ifdef also avoids a warning if FindLinkHandle
is made static, since otherwise the function would be defined but
unused on non-namei.

This change should incur no difference in behavior; it is just code
reorganization.

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

9 years agoubik: Unlock version lock before udisk_end
Andrew Deason [Tue, 14 Oct 2014 18:17:27 +0000]
ubik: Unlock version lock before udisk_end

Currently, BeginTrans calls udisk_end with UBIK_VERSION_LOCK held when
it gets an error from DISK_Begin. However, udisk_end itself acquires
UBIK_VERSION_LOCK to update the database flags, so this causes a
deadlock.

So, unlock UBIK_VERSION_LOCK before calling udisk_end. Also unlock it
before calling DISK_Abort, udisk_abort, and DISK_Begin, as well, since
none of those modify fields protected by UBIK_VERSION_LOCK. (Any read
access is allowed because we DBHOLD the database.) This commit unlocks
the lock immediately after we are done modifying versioning
information, which is right after we change writeTidCounter for write
transactions.

Change-Id: I31343d67c82734ff88b76bec740ef16767bb9667
Reviewed-on: http://gerrit.openafs.org/11541
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>

9 years agoubik: Convert DoProbe 'i' to 'nconns'
Andrew Deason [Mon, 13 Oct 2014 20:06:36 +0000]
ubik: Convert DoProbe 'i' to 'nconns'

DoProbe was using the variable 'i' to keep track of how many
connections we have in the conns array. Keep track of this separately
using a variable called 'nconns' instead, to make this function a bit
less confusing.

Change-Id: Ica2b4901c083b315e901366820042fad64030b3c
Reviewed-on: http://gerrit.openafs.org/11540
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>

9 years agolibafs: remove "Please install afsd with check server daemon" warning
Michael Meffie [Fri, 14 Nov 2014 03:28:08 +0000]
libafs: remove "Please install afsd with check server daemon" warning

Apparently, ancient versions of afsd did not start the check server
daemon (AFSOP_START_CS). The afs_Daemon tries to detect when the check
server daemon is not running and issues a warning to upgrade afsd.  The
afs_Daemon waits for the cache initialization to complete (AFSOP_GO)
before detecting if the cache server daemon is started.

Unfortunately, when running with memcache, the cache initialization is
fast enough to race with the start of the check server daemon, and the
"Please install afsd with check server daemon" message is sometimes
printed to the syslog.

Since all modern versions of afsd do start the check server daemon, this
error message is no longer needed, so just remove the message and the
flag used to print it on only once.

Change-Id: If6a57ca0e6fb7e20a1e104c46416139cf5fe785a
Reviewed-on: http://gerrit.openafs.org/11602
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoFree security objects used in VolForward
Chaskiel Grundman [Sat, 9 Mar 2013 00:19:05 +0000]
Free security objects used in VolForward

VolForward and VolForwardMulti create rx security objects, but
never free them. The RXS_Close's are positioned where they are
to limit the need for conditionals

Change-Id: Iec6879270ad54c30c1fea571cea583afaca9364b
Reviewed-on: http://gerrit.openafs.org/9527
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agobuild-sys: fix indentation in test code
Sami Kerola [Sat, 22 Jun 2013 18:52:51 +0000]
build-sys: fix indentation in test code

Change-Id: If2c0c2a0b0b01bb425f8c1658cef9df232844b1c
Reviewed-on: http://gerrit.openafs.org/10012
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Simon Wilkinson <simonxwilkinson@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agobuild-sys: fix m4 quotation to make upstream autotools to work
Sami Kerola [Wed, 19 Jun 2013 20:15:19 +0000]
build-sys: fix m4 quotation to make upstream autotools to work

Macro arguments for AC_ARG_WITH, such as AC_CHECK_PROGS, need to be
quoted.  Unless they are the latest version of autoconf will expand
macros slightly wrong way making the configure to fail at line where
there are only two ticks.

$ ./regen.sh
[...]
$ automake -a -f
[...]
automake: error: no 'Makefile.am' found for any configure output
$ ./configure
[...]
checking pkg-config is at least version 0.9.0... yes
./configure: line 13348: syntax error near unexpected token `newline'
./configure: line 13348: `    '''

Notice that the 'automake' run is needed in order to avoid later
configure error, which would look something like.

configure: error: cannot find install-sh, install.sh, or shtool in build-tools "."/build-tools

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

9 years agoRemove UKERNEL code from files that don't need it
Chaskiel Grundman [Wed, 29 May 2013 17:24:37 +0000]
Remove UKERNEL code from files that don't need it

Remove #ifdef UKERNEL sections from auth, kauth, ptserver, and ubik sources
that are no longer part of libuafs

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

9 years agoRemove kauth headers from afs_usrops.c
Chaskiel Grundman [Wed, 29 May 2013 17:26:29 +0000]
Remove kauth headers from afs_usrops.c

Since ka_* functions are no longer called from here, we don't need
the headers

Change-Id: I538c27cf4fe2f16811d1d3056b25054c80ba5b2a
Reviewed-on: http://gerrit.openafs.org/9956
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agorxgen: skip ubik for KERNEL
Chaskiel Grundman [Wed, 29 May 2013 17:05:15 +0000]
rxgen: skip ubik for KERNEL

Declare ubik rxgen stubs only for !KERNEL, UKERNEL doesn't need them anymore.
Don't declare ubik_client or #include ubik.h on KERNEL or UKERNEL.

Change-Id: I0b1587eb46e9efbf627f04c74e0d76f9858bffd0
Reviewed-on: http://gerrit.openafs.org/9954
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoFBSD: Drop afs_xvcache for vgone()
Andrew Deason [Sun, 20 May 2012 22:20:54 +0000]
FBSD: Drop afs_xvcache for vgone()

For FreeBSD, osi_TryEvictVCache was calling vgone() without dropping
afs_xvcache. Prior to aad83a30a82407bfa6ac15b49fd31d69b563e898, this
is what osi_TryEvictVCache did, and since the 'slept' pointer
represents whether we dropped xvcache (not whether we dropped glock),
it seems like this is the intention of the code.

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

9 years agoFBSD: Do not vgone() in osi_VM_FlushVCache
Andrew Deason [Sun, 20 May 2012 22:16:37 +0000]
FBSD: Do not vgone() in osi_VM_FlushVCache

osi_VM_FlushVCache just needs to remove VM references to the given
vcache; calling vgone() entirely should be unnecessary. Remove the
call to vgone() and other osi_TryEvictVCache-ish stuff, and just try
to cache_purge the vnode, like the other BSD implementations do.

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

9 years agoRewrap some long lines in the toplevel Makefile
Benjamin Kaduk [Wed, 28 May 2014 14:47:32 +0000]
Rewrap some long lines in the toplevel Makefile

Only rewrap long lines in make scope; long lines in shell scope
are untouched.

We are inconsistent about whether continuation lines for listing
the dependencies of a target are indented by one or two tabs,
which this commit does not fix.

Change-Id: I2e438a0f42faa2ef7922d2c3b143e14bc82de826
Reviewed-on: http://gerrit.openafs.org/11178
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoRemove FOREIGN
Ben Kaduk [Wed, 15 May 2013 22:16:00 +0000]
Remove FOREIGN

It has been unused since the original import of IBM's code.

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

9 years agosalvager: Don't lie about locked-ness to namei_SLC
Andrew Deason [Thu, 29 Aug 2013 21:14:23 +0000]
salvager: Don't lie about locked-ness to namei_SLC

We have not locked the linktable with a prior call to
namei_GetLinkCount. So don't claim that we did.

Change-Id: I43adf92b60a0e46b90ae624e4713747585d12c67
Reviewed-on: http://gerrit.openafs.org/10198
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agonamei: Remove namei_SetNonZLC
Andrew Deason [Thu, 29 Aug 2013 21:00:37 +0000]
namei: Remove namei_SetNonZLC

This function is unused. Remove it.

Change-Id: Ie48d5370187c851afdd7cd359115d9e74d001aae
Reviewed-on: http://gerrit.openafs.org/10197
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agonamei: IH_REALLYCLOSE special inode on delete
Andrew Deason [Thu, 29 Aug 2013 20:33:49 +0000]
namei: IH_REALLYCLOSE special inode on delete

When we delete a special inode, we should IH_REALLYCLOSE it, to ensure
no other cached file handles are open for that special inode. However,
currently PurgeHeader_r does this, and then IH_DECs the special
inodes. On namei, calling IH_DEC on a special inode causes the inode
to be opened, so we create a cached file handle right after we closed
all cached file handles for that inode with IH_REALLYCLOSE.

Making namei IH_DEC not open an FdHandle_t for the given file is
non-trivial, at least when dec'ing the linktable. So instead, just
make namei IH_DEC itself issue the IH_REALLYCLOSE right before the
actual unlink() call.

With this, we can keep the cached file handle open for special inodes
until right before they are actually deleted, so we don't issue extra
unnecessary open()s and close()s.

Change-Id: I35b234ab429bc7cd0f29654cc8f854c82c961071
Reviewed-on: http://gerrit.openafs.org/10196
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agonamei: Remove redundant linktable SetLinkCount
Andrew Deason [Thu, 29 Aug 2013 20:16:00 +0000]
namei: Remove redundant linktable SetLinkCount

If we're setting the linktable linkcount to 0, we're about to delete
the whole linktable. So, don't bother setting the link count. Still
make sure we unlock the linktable, as we still have it locked at this
point, from the previous GetLinkCount call.

Change-Id: Ia00c1e14de6b8fcd69d594f0dbdbafa32b066dc5
Reviewed-on: http://gerrit.openafs.org/10195
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoFix unchecked calls to asprintf
Jeffrey Hutzelman [Sat, 15 Jun 2013 22:58:13 +0000]
Fix unchecked calls to asprintf

The return value of asprintf() is the number of bytes printed, or -1 if there
was an error allocating a large enough buffer.  In the latter case, the value
of the result string is undefined, and so it cannot be counted on to be NULL.

This change fixes numerous places where the result of asprintf is checked
incorrectly (by examining the output pointer and not the return value) or not
at all.

Change-Id: I9fef14d60c096795d59c42798f3906041fb18c86
Reviewed-on: http://gerrit.openafs.org/9978
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agovolser: make splitvol use VolumeId
Derrick Brashear [Mon, 7 Jan 2013 18:33:12 +0000]
volser: make splitvol use VolumeId

convert split volume rpc to also use volumeid type

Change-Id: I6b1ed670a0abdc1487daa65b7e136a1370afd5fd
Reviewed-on: http://gerrit.openafs.org/8888
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoClean up our cleaning
Benjamin Kaduk [Wed, 8 Oct 2014 20:51:33 +0000]
Clean up our cleaning

'make clean' and 'make maintainer-clean' still leave around a fair
number of droppings, prior to this commit.

We were not descending into the 'tests' top-level directory while
cleaning.  Furthermore, tests/opr/Makefile needed $(LT_CLEAN), and
tests/rx/Makefile needed to spell it correctly.

The libtoolization places a lot of files to be removed in the
'pristine' target.

The processing used to implement the =include directive in the pod
sources for the man pages leaves around the non-.in versions of
files; we should clean that up in the 'pristine' target as well.

The 'pristine' target should likewise remove the man pages which
are generated from the pod files.

Additionally, the documentation build uses a Doxyfile which is
output by configure; that should be removed (if present) by the
'distclean' target.

When hcrypto was converted to libtool, the use of ${OBJECTS} in
the clean target was missed, so we were leaving around most of the
actual object files -- $(LT_CLEAN) does not handle this for us.
Change the rule to remove *.o as is done elsewhere.

The conversion of libafsrpc to libtool added a convenience library
libafsrpc_sys.la, and changed how syscall.o was generated on
most architectures, to be the result of compiling an empty .c file
(instead of just an empty .o file).  This introduced a new
intermediate file, syscall.c, which must be cleaned up.

tvolser was only listing volserver and not vos in its list of
executables to remove while cleaning.

The conversion of venus/test to libtool was not done quite right.
Makefile.libtool and the .lo suffix are only needed when libtool
is being used to link *libraries*; just Makefile.pthread suffices
when libtool is being used to link executables.  As such, remove
the inclusion of Makefile.libtool, and change the .lo targets back
to regular .o ones, and add back *.o to the list of files to remove
in the 'clean' target (it was needed there even without the
other changes to that Makefile).

Change-Id: Ifbc3eee4ad2dce54df991301bc5edd11eb29a24a
Reviewed-on: http://gerrit.openafs.org/11532
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>

9 years agoafs: Consolidate fheader initialization
Andrew Deason [Wed, 24 Sep 2014 22:50:02 +0000]
afs: Consolidate fheader initialization

We were initializing an afs_fheader structure in two different places,
with the same values. Consolidate these into a single function, so
updating the structure is easier. Also zero the whole structure, just
to make sure everything is initialized, even if the structure changes.

This commit should have no behavior impact; it is just code
reorganization.

Change-Id: If90757166d8490eaa053aa086c7b95349a62332e
Reviewed-on: http://gerrit.openafs.org/11510
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agovos: fix crash when getting a non-loopback host address
Michael Meffie [Thu, 20 Nov 2014 21:54:25 +0000]
vos: fix crash when getting a non-loopback host address

Fix a crash in vos when trying to find a non loopback server address.

The struct hostent h_addr_list field is a null terminated array of
pointers to addresses, in network byte order.  The struct hostent length
field is not the length of the h_addr_list array (as one would expect),
but rather the length of an address in bytes, which is always 4 for IP
version 4 addresses.

Verify the returned addresses are IPv4 and take care to not iterate
beyond the end of the address pointer array.

The non-loopback address check was introduced
commit dc2a4fe4e949c250ca25708aa5a6dd575878fd7e.

Change-Id: I75dff5ed2a7dd3c4bd6605b375a7a2ffa91eff01
Reviewed-on: http://gerrit.openafs.org/11609
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agolibafs: fix some nits around the symlink VOP
Ben Kaduk [Wed, 4 Dec 2013 23:43:51 +0000]
libafs: fix some nits around the symlink VOP

Commit 3f4c1099b7b (gerrit 10474) introduced a few issues, addressed here.

vpp is idiomatically of type 'struct vnode *', not 'struct vcache *';
use pvc as the name of the parent vcache pointer instead.

Fix whitespace.

Change-Id: Ic5d98a43446861bb571fe5a260e7ae1eea1051fd
Reviewed-on: http://gerrit.openafs.org/10531
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoWindows: Fix cm_AppendServerList
Jeffrey Altman [Mon, 6 Oct 2014 23:20:27 +0000]
Windows: Fix cm_AppendServerList

Should use || and not | as the operator when testing for
NULL pointers.

Change-Id: I00afe64aec4f965d6a831028b546ed01d8e9672a
Reviewed-on: http://gerrit.openafs.org/11523
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agocmd: avoid piggy-backing flags in the help string
Michael Meffie [Fri, 4 Apr 2014 14:14:15 +0000]
cmd: avoid piggy-backing flags in the help string

Remove the hack to piggy-back the hidden command option
in the help string argument.

Change-Id: Iedcb6b96e98b766e3ef2c87cd6e5d41874f2c0b7
Reviewed-on: http://gerrit.openafs.org/10982
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agocmd: add flags argument to create syntax function
Michael Meffie [Thu, 21 Aug 2014 04:25:45 +0000]
cmd: add flags argument to create syntax function

Add the flags argument to cmd_CreateSyntax() and update all callers.
The flags argument will be used to set command options, such as
CMD_HIDDEN.

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

9 years agoFBSD: osi_vcache: remove support for unsupported FreeBSD releases
Garrett Wollman [Wed, 13 Aug 2014 01:56:22 +0000]
FBSD: osi_vcache: remove support for unsupported FreeBSD releases

Support for FreeBSD 7.x terminated in early 2013, and it's highly
unlikely that anyone was successfully using OpenAFS in that
environment.  OpenAFS has not been tested on 7.x since at least that
time, probably longer.  This removes the #ifdefs that support pre-8.0
releases.

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

9 years agoExport xdr_nbulkentries from liboafs_vldb
Nathaniel Wesley Filardo [Mon, 8 Sep 2014 00:41:06 +0000]
Export xdr_nbulkentries from liboafs_vldb

Change-Id: I117b875189f4f9de971a99ff68eca470515a11ad
Reviewed-on: http://gerrit.openafs.org/11449
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoMove vos COMMONPARMS to a larger offset
Nathaniel Wesley Filardo [Mon, 28 Jul 2014 00:16:35 +0000]
Move vos COMMONPARMS to a larger offset

Currently, vos.c leaves a gap of 12 in the argument handling array
before its common operations (-verbose, -noauth, etc.); 'vos each'
will take more, so move that to 25.

While here, switch to named constants for these arguments, which
should make it easier to do this again, if ever necessary.

Change-Id: Idc4424e5fe4efd78389ea8421db000a361b461ec
Reviewed-on: http://gerrit.openafs.org/11332
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agorx: Named values for securityObjectStats types
Ben Kaduk [Wed, 27 Nov 2013 22:31:16 +0000]
rx: Named values for securityObjectStats types

Stop using hardcoded constants and use defined symbols for these
values.

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

9 years agoDisallow creating users with ANONYMOUSID
Benjamin Kaduk [Wed, 26 Mar 2014 11:35:29 +0000]
Disallow creating users with ANONYMOUSID

It can result only in sadness.

Document this restriction alongside UID 0 as a reserved number.

Change-Id: Ibea2d98bc15a730bc85e84477791ca45a40f2d92
Reviewed-on: http://gerrit.openafs.org/10950
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agosystemd: RemainAfterExit in openafs-client.service
Andrew Deason [Tue, 2 Sep 2014 22:51:46 +0000]
systemd: RemainAfterExit in openafs-client.service

Currently, if the client is started without any options that require
an extra thread (like -afsdb), all processes spawned by afsd will
exit. There may be some kernel threads still active, but those are
spawned by the kernel module, and are not child processes of the
parent afsd process, or anything like that.

Since we are a Type=forking service in systemd, systemd interprets
this situation to mean that the service has stopped successfully, and
then runs the ExecStop commands. So, for example, if our AFSD_ARGS in
our sysconfig is "-fakestat -afsdb", the service starts as normal. But
if it is changed to "-fakestat", then when openafs-client.service is
started, it immediately stops again.

To avoid this, turn on the systemd option RemainAfterExit, which tells
systemd that the service has not stopped if all of our processes have
exited. The client service will thus remain running until it is
stopped.

Issue reported by Rich Sudlow.

Change-Id: If760d3617d4afbcfac923df726eb58b03ce25771
Reviewed-on: http://gerrit.openafs.org/11440
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

9 years agoNetBSD osi_crypto: use cprng(9) for random source on NetBSD 6.99/7.x
Jonathan A. Kollasch [Thu, 17 Apr 2014 16:03:11 +0000]
NetBSD osi_crypto: use cprng(9) for random source on NetBSD 6.99/7.x

Change-Id: Id8ee7f149cdc921989a5de7dda35739147de0014
Reviewed-on: http://gerrit.openafs.org/11086
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoUpdate CellServDB to 20141117 snapshot
Benjamin Kaduk [Wed, 19 Nov 2014 19:14:07 +0000]
Update CellServDB to 20141117 snapshot

This should be all the locations we keep it in-tree.

Change-Id: I6819bf0658766aaad21ad38417295616418d41c5
Reviewed-on: http://gerrit.openafs.org/11607
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoNetBSD: catch up to <sys/simplelock.h> removal in NetBSD 6.99.x
Jonathan A. Kollasch [Thu, 17 Apr 2014 17:32:17 +0000]
NetBSD: catch up to <sys/simplelock.h> removal in NetBSD 6.99.x

Change-Id: I2c663fc426914e978e98c6003419503b57a020d3
Reviewed-on: http://gerrit.openafs.org/11087
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agofix whitespace errors in acinclude.m4
Michael Meffie [Sat, 1 Nov 2014 03:45:13 +0000]
fix whitespace errors in acinclude.m4

Use tabs instead of spaces in the sysname lookup case
statement for the macos cases.

Change-Id: Iee03d1b593aee4f6c4bc2488b069b21e116c9f1d
Reviewed-on: http://gerrit.openafs.org/11566
Reviewed-by: D Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agoLINUX: Avoid check for key_type.match existence
Andrew Deason [Wed, 5 Nov 2014 16:22:00 +0000]
LINUX: Avoid check for key_type.match existence

Commit b5de4a9f removed our key_type 'match' function for kernels that
do not have such a 'match' function pointer. However, this added a
configure test where we are supposed to fail for the "new" behavior,
which is discouraged.

This causes an actual problem, because this test will fail on at least
RHEL5, due to arguably unrelated reasons (the header file for the
relevant struct is in key.h instead of key-type.h). And so, in that
situation we avoid defining a 'match' function callback, meaning our
'match' function callback is NULL, which causes a panic when we try to
actually look up keys for a PAG.

To fix this, transform the 'match' config test into one where we
succeed for the "new" behavior. We do this by testing for the
existence of the new functionality that replaced the old 'match'
function, which is the match_preparse function (specifically, the
'cmp' field in the structure accepted by match_preparse). This should
cause unrelated compilation errors to cause us to revert to the "old"
behavior instead of the "new" behavior. At worst, this should cause
build issues if we get the config test wrong (since we will try to use
the 'match' function definition that does not exist), instead of
panicing at runtime.

Note that while we test for key_type.match_preparse, we don't actually
use that function, since our 'match' functionality is the same as the
default behavior (according to b5de4a9f). So, we can avoid defining
any such function for newer kernels.

Thanks to Stephan Wiesand for bisecting this issue.

Change-Id: If6f93d6b5340fa738a55adeb7778d26ff5dbacc1
Reviewed-on: http://gerrit.openafs.org/11589
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

9 years agorx: initialize memory before use
Arne Wiebalck [Fri, 7 Feb 2014 10:23:32 +0000]
rx: initialize memory before use

initialize sockaddr_in.sin_zero before using. cosmetic, might fix some
compiler warnings.

Change-Id: Ib9c4707373ca98742f6a5e28e60006499527fa38
Reviewed-on: http://gerrit.openafs.org/10816
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoAllow compiling with KERNEL and AFS_PTHREAD_ENV
Benjamin Kaduk [Wed, 15 Oct 2014 19:03:36 +0000]
Allow compiling with KERNEL and AFS_PTHREAD_ENV

Add the necessary preprocessor conditionals to allow building
libuafs with AFS_PTHREAD_ENV defined.

A follow-up commit will switch to building libuafs using libtool,
which will set the pthread compiler/linker flags.  UKERNEL is already
using the pthread primitives for its internal kernel synchronization,
so there should not be any harm from additionally specifying the
pthread build arguments.

This change was produced mostly in a mechanical fashion, attempting
to perform such a build, and eliminating compiler and linker errors
in an iterative process.  No concerted effort has been made to audit
the whole kernel codebase for correctness of conditionals, but the
linktest executable does link (that is, the overall build succeeds).

Change-Id: I14a3ab5fce72812d92ba5657c734783dbd086ee3
Reviewed-on: http://gerrit.openafs.org/11546
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

9 years agoklog: make krb5_524 non-fatal for native K5 tokens
Jeffrey Altman [Wed, 15 Oct 2014 16:19:44 +0000]
klog: make krb5_524 non-fatal for native K5 tokens

The krb5_524_conv_principal() function should fail whenever the Kerberos
v5 principal cannot safely be mapped onto a Kerberos v4 principal, and
does fail on some Kerberos v5 principals used in real-world AFS
deployments.

Prior to this patchset a failure was treated as a fatal error that
in turn prevents an AFS token from being generated or set into the
cache manager.

Prior to b1f9b4cb5dd295162ae51704310e9d6058008f0a the
krb5_524_conv_principal() function wasn't used and a local client
mapping was created.  b1f9b4cb5dd295162ae51704310e9d6058008f0a
replaced the local mapping with the krb5 function because the local
mapping could be wrong and confusing.

The krb5_524_conv_principal() function as applied to AFS tokens is
just a local guess.  How the username in the token is interpreted by
the AFS server is up to the server.

krb5_524_conv_principal() is only used for Krb5 native tokens. For Krb4
tokens the krb5_524_convert_creds() function is used to obtain both the
Kerberos v4 ticket and the converted names from the KDC. Many
organizations used the krb524d service to perform name translation. When
the krb524d service is used, the name translation is performed by the KDC,
so there is no local call to krb5_524_conf_principal() which might fail.
As a result, disallowing the use of a native Krb5 token due to a failed
local name translation is a needless loss of functionality; the local name
translation is not an essential part of obtaining a token.

This patchset modifies the behavior such that krb5_524_conv_principal()
errors are non-fatal.

 1. If -noprdb is not specified the error message is generated
    and a NULL username is used.

 2. If the username is NULL the prdb lookup is disabled.

 3. If the username is NULL the informational messages do not
    include a username.

 4. If the username is NULL the username info provided to the
    cache manager in the token description is the nul string.

Credit to Ben Kaduk for assistance with the wording of this
commit message.

Change-Id: Ib07131fc0ff4bf5319815213198c3f0adac17b10
Reviewed-on: http://gerrit.openafs.org/11542
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoStylistic tweak lwp/process.o machinery
Nathaniel Wesley Filardo [Mon, 13 Oct 2014 05:02:41 +0000]
Stylistic tweak lwp/process.o machinery

Rename process.s to process.default.s so that the name "process.s" is free
for use, and switch to using that as the ephemeral file name.  This enables
the use of gcc for ${AS}, despite gcc's ignoring files with extensions that
it does not recognize.

Change-Id: Idc0716547770fe4fc94bc3fa2c223966f3f76c3b
Reviewed-on: http://gerrit.openafs.org/11535
Tested-by: BuildBot <buildbot@rampaginggeek.com>
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>

9 years agotests: Fix fmt-t.c warning
Andrew Deason [Mon, 6 Oct 2014 17:47:13 +0000]
tests: Fix fmt-t.c warning

'main' in fmt-t.c was declared as a prototype-less function, which
triggers a warning, which is an error with --enable-checking. Fix it
by declaring 'main' properly.

Change-Id: I45cfec591acd0ef8d7836c79e997e8ffe29b9e38
Reviewed-on: http://gerrit.openafs.org/11539
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: Nathaniel Filardo <nwfilardo@gmail.com>

9 years agovldb_check: fix false mh block error message
Michael Meffie [Fri, 24 Oct 2014 21:17:07 +0000]
vldb_check: fix false mh block error message

Fix a false error message about invalid mh blocks when the vldb has more
than one mh block.  To add insult to injury, vldb_check complains about
the wrong address and block number.

The flags field in the mh block header is in network byte order, in all
of the blocks, not just the first one.  Be sure to convert all of them
to host byte order so the VLCONTBLOCK flag check works.  Fix the error
message on the secondary blocks to show the correct address and block
number.

Example bogus error messages:

vldb_check ./vldb.DB0
address 132120 (offset 0x20458): Multihomed Block 0: Not a multihomed block
address 132120 (offset 0x20458): Multihomed Block 0: Not a multihomed block
address 132120 (offset 0x20458): Multihomed Block 0: Not a multihomed block

Change-Id: I31d96ad43f01fbf2774815184942be45e2d7820b
Reviewed-on: http://gerrit.openafs.org/11555
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoFinish deorbiting libjuafs.a
Benjamin Kaduk [Mon, 6 Oct 2014 21:19:44 +0000]
Finish deorbiting libjuafs.a

Change I2074d5bc26e326db36b16e055431818ef1c69210 removed the separate
compilation/link of a libjuafs.a (since it was functionally identical
to the libuafs.a already being built), but retained a libjuafs.a in
TOP_LIBDIR for use by src/JAVA/libjafs/.

This commit adjusts src/JAVA/libjafs to refer to libuafs.a directly,
and removes references to libjuafs.a which are no longer relevant.

Change-Id: I0d02ea9e4be773ac50a04925c45e5f243650e21a
Reviewed-on: http://gerrit.openafs.org/11526
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoMake afs_usrops.h more closely resemble reality
Benjamin Kaduk [Thu, 16 Oct 2014 04:04:14 +0000]
Make afs_usrops.h more closely resemble reality

Remove prototypes for many routines which are not implemented.
(I thought some toolchains would complain about this sort of thing?
Maybe we disable it.)

Change-Id: Id09f494f1c64c2feb05ae82ead9898c08888a5de
Reviewed-on: http://gerrit.openafs.org/11547
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoBuild libuafs with libtool
Benjamin Kaduk [Sat, 20 Sep 2014 03:04:10 +0000]
Build libuafs with libtool

Use the standard program for building PIC and non-PIC object files,
instead of rolling our own.  This allows us to pull the build rules
into the Makefile.common, leaving just compiler flags and similar
in the MakefileProtos.

This does change the build flags being used to compile these files
somewhat -- the old CRULE1 and CRULEPIC used CC instead of CCOBJ
or MT_CC, and did not pass MT_CFLAGS, but it should be safe to
move to the standard compiler invocations.  We can also eliminate
the libuafs-specific 'OPTF' variable which expands to OPTMZ almost
everywhere.

Rename our COMMON_INCLUDE to MODULE_INCLUDE so it's picked up properly
by the standard build rules; this will let us remove
${TOP_OBJDIR}/src/config and ${TOP_INCDIR} once the rest of the
build rules in this Makefile are converted to use libtool, as those
include directories are already added by COMMON_INCL in Makefile.config.

As a side effect, we get rid of the LIBUAFS make variable -- all sites
were defining it to libuafs.a anyway, so we can just hardcode it.

We can also build a shared libuafs.la "for free".  Don't install
it anywhere just yet, though.

Change-Id: I2bda2f40bbd0aa808c24e074d2d7bcd329f6b77e
Reviewed-on: http://gerrit.openafs.org/11472
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoAttempt to make hcrypto parallel-safe
Benjamin Kaduk [Thu, 16 Oct 2014 16:46:11 +0000]
Attempt to make hcrypto parallel-safe

make -j4 on a Fedora buildbot machine failed to compile engine.lo
because hcrypto/rand.h was missing.

Change-Id: I2750db9ed932144fbc66ede41d24c4930172a446
Reviewed-on: http://gerrit.openafs.org/11548
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years ago(Partially) unify XDR for libuafs and libafs
Benjamin Kaduk [Wed, 15 Oct 2014 23:49:12 +0000]
(Partially) unify XDR for libuafs and libafs

The libuafs build was getting xdr_vector() from both afsaux.c and
xdr_update.c, but because of the rules for creating static libraries,
this did not cause build errors.

The libafs build is sensitive to duplicate symbols, and was only
getting xdr_vector() from afsaux.c; libafs was not building xdr_update.c
or xdr_refernce.c (that is not a typo).

Remove duplicate xdr_vector() from afsaux.c, and build xdr_update.c
and xdr_refernce.c into libafs.

Remove the unused #define of AUTH_DES.

Change-Id: I58ea595d424801697acb07406664ede33aeaf026
Reviewed-on: http://gerrit.openafs.org/11545
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>

9 years agoAvoid AFS_version conflicts in uafs
Benjamin Kaduk [Wed, 15 Oct 2014 21:52:22 +0000]
Avoid AFS_version conflicts in uafs

libuafs links in both afsd.o and AFS_component_version_number.o;
afsd.c #includes AFS_component_Version_number.c, which causes
symbol conflicts when linking shared.

Don't include the version file when compiling for UKERNEL, to
avoid the conflict.

Change-Id: I9474faf10e029d0022b12431aad51e27412b19fc
Reviewed-on: http://gerrit.openafs.org/11544
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: D Brashear <shadow@your-file-system.com>