openafs.git
8 years agoWindows: fix RDR detection of ambiguous directory entries
Jeffrey Altman [Wed, 8 Jul 2015 20:49:38 +0000]
Windows: fix RDR detection of ambiguous directory entries

The redirector is supposed to reject access to file objects if there
is no case exact match and multiple entries match in a case insensitive
comparison.  The check was only present in the AFSLocateNameEntry()
function and not elsewhere.

Fix the AFSLocateNameEntry() call and addd the missing checks.

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

8 years agoWindows: rdr pioctl operations are opaque
Jeffrey Altman [Mon, 19 Oct 2015 00:32:06 +0000]
Windows: rdr pioctl operations are opaque

Although pioctl operations are delivered through the redirector the
contents of the operations are opaque to the redirector.  Therefore,
the cm_req must not be initialized as a redirector operation.  If they
are the necessary invalidation notifications for symlink and mount point
operations will not be delivered.

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

8 years agoWindows: clientServiceProviderKeyExists use subkey
Jeffrey Altman [Thu, 15 Oct 2015 17:22:05 +0000]
Windows: clientServiceProviderKeyExists use subkey

clientServiceProviderKeyExists() must use AFSREG_CLT_SVC_PROVIDER_SUBKEY
since it is a relative path from HKEY_LOCAL_MACHINE.

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

8 years agoWindows: if no known IP addrs, query the addr list
Jeffrey Altman [Fri, 9 Oct 2015 14:20:41 +0000]
Windows: if no known IP addrs, query the addr list

If cm_noIPAddrs == 0, then no servers will be probed.   If
syscfg_GetIFInfo() fails then cm_noIPAddrs is set to 0.  Therefore,
also set cm_LanAdapterChangeDetected to non-zero if syscfg_GetIFInfo()
fails so that the interface info can be queried again prior to a server
probe attempt.

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

8 years agoWindows: Only install Service NP if one exists
Jeffrey Altman [Wed, 7 Oct 2015 22:09:50 +0000]
Windows: Only install Service NP if one exists

Do not blindly install a network provider for the service since at
least one end user organization does not install the service's network
provider.

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

8 years agoWindows: InstNetProvider do not leak key handle
Jeffrey Altman [Wed, 7 Oct 2015 22:09:17 +0000]
Windows: InstNetProvider do not leak key handle

If we open a handle, close it.

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

8 years agoWindows: multi ping do not leak ping count
Jeffrey Altman [Wed, 30 Sep 2015 17:23:36 +0000]
Windows: multi ping do not leak ping count

In cm_CheckServersMulti() if cm_ConnByServer() fails or if cm_noIPAddr is
zero then a cm_server.pingCount will be leaked.  This can result in
servers being marked down and never restored to an up state.

This change adds the necessary pingCount decrement and moves the
assignment of the cm_server_t pointer to serversp[] to make it clear
that the cm_server_t will not be in the array if a failure occurs.
Only objects in the array will have the pingCount decremented after
the RPCs are issued.

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

8 years agoSOLARIS: Minor whitespace corrections
Perry Ruiter [Sun, 13 Sep 2015 15:53:22 +0000]
SOLARIS: Minor whitespace corrections

Fix some incorrectly indented code in osi_file.c

Change-Id: I75a8ec18bfef13bb05a99f84b2cfbfae34fcd440
Reviewed-on: http://gerrit.openafs.org/12017
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@dson.org>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovolser: update log formatting in dump and restore
Michael Meffie [Fri, 30 Jan 2015 16:53:58 +0000]
volser: update log formatting in dump and restore

Update the log messages to use modern formatting specifiers for
volume ids and inodes in the volume dump and restore code.

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

8 years agoWindows: remove extraneous "pingCount" format param
Jeffrey Altman [Fri, 25 Sep 2015 22:12:24 +0000]
Windows: remove extraneous "pingCount" format param

In 0a0927497c8165aec11e718df01632da75fa4cdc an extra "pingCount"
format parameter was added in cm_DumpServers().  Remove it.

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

8 years agoWindows: Replace CM_SERVERFLAG_PINGING with pingCount
Jeffrey Altman [Tue, 16 Jul 2013 13:10:04 +0000]
Windows: Replace CM_SERVERFLAG_PINGING with pingCount

Instead of replying upon a server flag use a pingCount interlocked
variable to track whether active ping operations are being performed
and whether or not to wait sleeping threads.

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

8 years agoWindows: cm_GetCell_Gen rework cell prefix matching
Jeffrey Altman [Thu, 14 May 2015 22:29:45 +0000]
Windows: cm_GetCell_Gen rework cell prefix matching

The cm_GetCell_Gen() function permits cells to be searched for by
prefix.  The idea is to permit "cs.cmu.edu" to be abbreviated "cs"
when at CMU.  There are two problems with the current behavior:

1. the existing match rules will accept "cs.c" and "cs.cmu.ed" as
   valid prefix matches.  By not restricting the prefix matching
   to full components the Freelance symlink list can become
   cluttered.

2. the existing match rules will accept the first cell that
   matches even if there are more than one cells that would match.
   this can result in unpredictable behavior since the ordering
   of the cells is not guaranteed.

Instead, fail requests for cell prefixes that are not full component
matches or that would be ambiguous.

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

8 years agoWindows: Network Provider registration at service start
Jeffrey Altman [Mon, 4 May 2015 17:25:04 +0000]
Windows: Network Provider registration at service start

Windows 8, 8.1 and pre-releases of 10 have a horrible bug as part
of the upgrade process.  All non-Microsoft network provider services
are removed from the NetworkProvider "Order" registry value.  For
OpenAFS this has the side effect of breaking integrated logon and
all drive letter mappings to \\AFS.

During service start add code to:

 1. Add "AFSRedirector" before "LanmanWorkstation" if not present
 2. Add "TransarcAFSDaemon" to the end of the list if not present

If the service is running in SMB mode

 3. Remove "AFSRedirector" if present

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

8 years agoWindows: cm_Analyze mark server down for misc rx errors
Jeffrey Altman [Sun, 28 Jun 2015 19:06:34 +0000]
Windows: cm_Analyze mark server down for misc rx errors

In cm_Analyze() replace the token error retry logic for miscellaneous
rx errors and simply mark the server down.  The most common error
that will be seen in this category is RX_INVALID_OPERATION which would
be received if the Rx service id or security class is not recognized
by the peer.  This could happen if an AuriStor server is replaced by
an AFS3 server or if a packet is reflected.

A side effect of this change is that V* and CM_ERROR_* errors will
once again be retried.  This will permit proper failover to occur.

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

8 years agoWindows: avoid vldb lookup race with network stack
Jeffrey Altman [Sun, 28 Jun 2015 18:56:47 +0000]
Windows: avoid vldb lookup race with network stack

If a VLDB query attempt occurs when there is no current cell db server
list then the VLDB query won't actually occur but the last query time
would be set.  This prevents a query from taking place again on the volume
for 60 seconds.  If the volume in question is the root.cell volume then
the redirector will be forced to return device not ready for the share
(aka \\afs\cell).

Check for a failure of cm_UpdateCell() and only set the last update time
for the volume if there was success or if the VLDB responded with volume
unknown.

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

8 years agoWindows: cm_ApplyDir calls cm_SyncOpDone too soon
Jeffrey Altman [Sun, 28 Jun 2015 18:00:24 +0000]
Windows: cm_ApplyDir calls cm_SyncOpDone too soon

cm_ApplyDir() failed to maintain the synchronization state while the
GetBuffer() operation proceeded.

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

8 years agoWindows: cm_CheckNTDelete missing SyncDone call
Jeffrey Altman [Sun, 28 Jun 2015 17:59:28 +0000]
Windows: cm_CheckNTDelete missing SyncDone call

cm_CheckNTDelete() forgot to call cm_SyncDone() in one of the error
paths.  Fixup the call pattern and do not forget to call cm_SyncDone().

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

8 years agoWindows: NPSupport Remote Name verification
Jeffrey Altman [Sun, 28 Jun 2015 17:51:40 +0000]
Windows: NPSupport Remote Name verification

When adding a connection verify that the server name and the share name
are valid.  If not return ERROR_BAD_NETWORK_NAME.

When getting connection information, if a pre-existing connection does
not exist and either the server name or the share name do not verify
return ERROR_BAD_NETWORK_NAME and not ERROR_INVALID_PARAMETER.

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

8 years agoWindows: NPGetResourceInformation return redir error
Jeffrey Altman [Sun, 28 Jun 2015 17:43:03 +0000]
Windows: NPGetResourceInformation return redir error

When the redirector ioctl fails in NPGetResourceInformation() return the
actual error to the caller.   Do not hide all errors as WN_BAD_NETNAME.

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

8 years agoWindows: NP RemoteName Length checks
Jeffrey Altman [Sun, 28 Jun 2015 17:39:32 +0000]
Windows: NP RemoteName Length checks

Ensure that RemoteName paths have at least two characters before
attempting to access character [1].

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

8 years agoWindows: AFSParseName() uniFullName.MaximumLength
Jeffrey Altman [Sun, 28 Jun 2015 17:27:03 +0000]
Windows: AFSParseName() uniFullName.MaximumLength

The uniFullName.MaximumLength in AFSParseName() is not properly
modified and can end up being extended beyond the actual memory
allocation due to a missing decrement.

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

8 years agoWindows: remove dead network provider code
Jeffrey Altman [Sun, 28 Jun 2015 17:24:13 +0000]
Windows: remove dead network provider code

Remove all #if 0 code blocks.

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

8 years agoWindows: npdll do not retrieve auth id
Jeffrey Altman [Sun, 28 Jun 2015 17:21:35 +0000]
Windows: npdll do not retrieve auth id

The authentication id for the process will always be obtained in kernel
so no longer try to fetch it in userland.

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

8 years agoWindows: Always fetch auth id in kernel
Jeffrey Altman [Sun, 28 Jun 2015 17:18:01 +0000]
Windows: Always fetch auth id in kernel

When processing network provider requests in afsredirlib.sys always
obtain the auth id using the SYSTEM worker thread.   Do not trust
the values provided by userland.

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

8 years agoWindows: Move GetAuthenticationId to Worker Thread
Jeffrey Altman [Sun, 28 Jun 2015 17:12:13 +0000]
Windows: Move GetAuthenticationId to Worker Thread

When PsReferenceImpersonationToken(), PsReferencePrimaryToken(), and
SeQueryInformationToken() are called in the kernel from a user process
thread the restrictions on the userland process still apply.  Since we do
not want to be restricted we must obtain the token and query the token
information from a SYSTEM thread.

This change restructures the AFSGetAuthenticationId() process to queue a
synchronous task to the worker thread.

This should address the problem that has been seen during system boot when
the Group Policy Service attempts to query, remove or create a drive
letter mapping.

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

8 years agoWindows: AFSRetrieveFileAttributes no parent path
Jeffrey Altman [Tue, 9 Jun 2015 12:55:44 +0000]
Windows: AFSRetrieveFileAttributes no parent path

Modify AFSRetrieveFileAttributes() to handle the case of a ParentPathName
with a Length == 0.   In such a case the introduction of a path separator
would result in the construction of an absolute path when a relative path
is required.

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

8 years agoWindows: AFSRetrieveParentPath handle no parent
Jeffrey Altman [Tue, 9 Jun 2015 12:44:43 +0000]
Windows: AFSRetrieveParentPath handle no parent

AFSRetrieveParentPath() when presented with a relative path that has no
parent will walk off the front of the FullFileName buffer.  Add checks to
ensure that Length never becomes less than zero.

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

8 years agoWindows: AFSGetConnectionInfo partial match validation
Jeffrey Altman [Wed, 13 May 2015 03:15:50 +0000]
Windows: AFSGetConnectionInfo partial match validation

AFSGetConnectionInfo() is called to respond to NPGetResourceInformation
and NPGetConnectionPerformance WNet API requests.  The former permits
the requestor to provide a path containing components that are not
processed by the file system represented by the called network provider.
As such partial matches are permitted BUT they must consist of full
components.  In other words, \\afs\sh is not a valid partial match for
\\afs\share but \\afs\share is a valid partial match for \\afs\share\dir.

This change adds validation checks to enforce full component comparisons.
It also cleans up some of the associated comparisons and trace output.

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

8 years agoWindows: NetrShareGetInfo do not return registry errors
Jeffrey Altman [Mon, 6 Jul 2015 05:39:41 +0000]
Windows: NetrShareGetInfo do not return registry errors

In NetrShareGetInfo() when registry api calls fail do not leak the
error codes to the caller.  Instead, set the error to CM_ERROR_NOSUCHPATH
so that NERR_NetNameNotFound can be returned.

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

8 years agoWindows: NetrShareGetInfo no return buffer on error
Jeffrey Altman [Mon, 6 Jul 2015 05:38:01 +0000]
Windows: NetrShareGetInfo no return buffer on error

When processing the NetrShareGetInfo() pipe service rpc do not
allocate memory for the return buffer is the path cannot be found.

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

8 years agolibafs: remove linux conditionals for md5 inode number calculation
Michael Meffie [Wed, 29 Apr 2015 15:54:45 +0000]
libafs: remove linux conditionals for md5 inode number calculation

Remove the conditionals which hide the md5 digest calculation for inode
numbers on non-linux platforms.  This feature was originally added to
support sites running on linux, but is generally useful and the
implementation is not specific to linux.

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

8 years agoopenafs: add a contributor code of conduct
Daria Phoebe Brashear [Thu, 20 Aug 2015 17:20:38 +0000]
openafs: add a contributor code of conduct

In the interest of fostering a friendly, welcoming environment
for contributors, institute a code of conduct for the project.

Adapted from the Contributor Covenant.

LICENSE MIT

Change-Id: I4eb3b8a84981ef04f02e7d60ec46873305888147
Reviewed-on: http://gerrit.openafs.org/11987
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
Reviewed-by: Thomas L. Kula <kula@tproa.net>
Reviewed-by: Nathaniel Filardo <nwfilardo@gmail.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agoLINUX: Fix oops during negative dentry caching
Michael Meffie [Tue, 15 Sep 2015 17:33:12 +0000]
LINUX: Fix oops during negative dentry caching

Commit 2e9dcc069904aaa434787eec53c6f9821911cbab reinstated negative
dentry caching, but introduced an oops when fakestat is in use.  Be sure
the GLOCK is held when looking up the parent vcache dv when the parent
is a mount point and fakestat is in use, since the calls to do the
lookup require the GLOCK to be held.

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

8 years agodoc: remove supergroup caution from pt_util
Chas Williams (CONTRACTOR) [Fri, 16 Jan 2015 01:27:04 +0000]
doc: remove supergroup caution from pt_util

Supergroup information is explicitly present in -members

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

8 years agobozo: move more initialization code to functions
Michael Meffie [Thu, 22 Jan 2015 03:44:32 +0000]
bozo: move more initialization code to functions

Move the code to create the initial "localcell" configuration and the
code to get the rx bind address out of main and into separate
functions.

Replace the global array of host addresses used to get the rx bind
address with a local variable.

Replace the call to rx_getAllAddr() with rx_getAllAddrMaskMtu(). The
former is not safe to call before rx_InitHost().

Initialize the cell info structure to zeros when creating the initial
"localcell" configuration.

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

8 years agoopr: export softsig functions
Michael Meffie [Thu, 3 Sep 2015 20:07:32 +0000]
opr: export softsig functions

Add the softsig functions to the exported symbols list.

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

8 years agoafs: Increase vcache and dcache hash table sizes
Benjamin Kaduk [Thu, 15 Jan 2015 16:54:30 +0000]
afs: Increase vcache and dcache hash table sizes

Now that we are using a real hash function, larger hash tables
will be more useful.

The vcache hash tables are statically sized, and this increase will
add about a megabyte to the kernel module's memory footprint.

Update the algorithm used to dynamically size the dcache hash tables,
keeping the old behavior for small numbers of dcaches, but growing
the hash table's size to keep the average chain length near two
for a range of dcache numbers.  Cap the dcache hash tables at 32k
entries to avoid excessive resource usage.

This involves code from opr, namely opr/ffs.h, which is acceptable
in the kernel module because that header is a standalone header
like jhash.h, with no dependencies on the system.

Change-Id: I7cdb3e993b1c2ad177a46ecc06bfa2be52e619e5
Reviewed-on: http://gerrit.openafs.org/11679
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agoreturn an error from afs_readdir when out of buffers
Michael Meffie [Fri, 18 Dec 2009 13:20:24 +0000]
return an error from afs_readdir when out of buffers

Instead of silently failing, return EIO from readdir when the
cache manager is unable to allocate a buffer in afs_newslot,
(afs: all buffers locked).

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

8 years agoLINUX: Restore negative dentry caching
Andrew Deason [Mon, 25 Aug 2014 04:01:16 +0000]
LINUX: Restore negative dentry caching

One of the changes in commit 652f3bd9cb7a5d7833a760ba50ef7c2c67214bba
effectively disabled negative caching for dentries, by always
invalidating a negative dentry in afs_linux_dentry_revalidate. This
was because various temporary errors could result in ENOENT errors
being returned to afs_lookup, which created incorrect negative dentry
cache entries.

These incorrect ENOENT errors were rectified in change
Ib01e4309e44b532f843d53c8de2eae613e397bf6 . So, negative dentry cache
entries should work now, so remove the code to unconditionally
invalidate these negative entries.

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

8 years agoMake compile_et output usable out-of-tree
Benjamin Kaduk [Tue, 27 Jan 2015 21:33:25 +0000]
Make compile_et output usable out-of-tree

Prior to this commit, the output C files from compile_et would
emit #includes of <afsconfig.h> and <afs/param.h>.  These files
are not installed, and are only available in an OpenAFS build tree.
The output C files also emit #includes of <afs/error_table.h>, which
is an installed file, and is therefore expected to be available on
a system with OpenAFS installed.  Removing the first two headers will
allow OpenAFS's compile_et binary to be used to compile error tables
which are not part of OpenAFS, on systems where OpenAFS is installed.

The inclusion of afsconfig.h was added in commit
972a4072827fb2ec680354d5adebc2c5cca06939 to ensure that it was included
prior to afs/param.h; however, the inclusion of afs/param.h in
compile_et.c stems from the original IBM import and seems of minimal
value.  The only changes needed to build without param.h are to use
int instead of afs_int32 in a couple places (int is 32 bits on
all platforms currently supported) and to include <sys/types.h>
for size_t.

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

8 years agoafs: use jenkins hash for dcache, vcache tables
Benjamin Kaduk [Wed, 14 Jan 2015 01:22:59 +0000]
afs: use jenkins hash for dcache, vcache tables

Switch the four dcache and vcache hash tables to use the jenkins
hash from opr.

This requires making DCHash into a full-weight function in order
to properly hash all three inputs; convert all four symbols to
full functions for consistency.  Just pull in <opr/jhash.h> via
afs.h so all consumers (e.g., of VCSIZE) can use it without
modification.

This is the first use of src/opr/ in src/afs/ (outside UKERNEL),
but it is permissible because opr/jhash.h is a standalone
header and there are no C files needed for its implementation which
would require anything from the system.

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

8 years agorx: Tidy up rxi_CheckCall()'s mtuout handling
Benjamin Kaduk [Sun, 14 Dec 2014 21:13:39 +0000]
rx: Tidy up rxi_CheckCall()'s mtuout handling

We don't actually do anything that matters if lastPacketSizeSeq
is set and lastPacketSize is zero, so zero both when we're cleaning
up.

lastPacketSize and lastPacketSizeSeq are set together in
rxi_SendPacket (and rxi_SendPacketList), when we are sending a packet
larger than the current estimate of the peer's maxPacketSize.

The two fields are checked together during ack processing, but
rxi_CheckCall() only checks lastPacketSize, ignoring lastPacketSizeSeq.

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

8 years agoDocument KeyFileExt(5)
Benjamin Kaduk [Fri, 27 Feb 2015 23:20:19 +0000]
Document KeyFileExt(5)

Add a manual page for the KeyFileExt file.

Add cross-references from all places which currently reference
KeyFile(5), and update their body text accordingly.

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

8 years agobozo: use the full path when renaming BosLog to BosLog.old
Michael Meffie [Wed, 21 Jan 2015 19:31:51 +0000]
bozo: use the full path when renaming BosLog to BosLog.old

Use the full path when renaming the BosLog file to BosLog.old and when
checking whether the BosLog file can be opened, otherwise the rename
will fail (and go unnoticed), and the initial BosLog check opens a
handle to a file in the wrong directory.

Create the server directories, including the logs directory, before
forking and log file initialization.

Change-Id: I3733d64335f348190572f6278086b634641f2754
Reviewed-on: http://gerrit.openafs.org/11685
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agobozo: fix -pidfiles default
Michael Meffie [Mon, 9 Feb 2015 20:04:19 +0000]
bozo: fix -pidfiles default

Fix the default value for the -pidfiles argument. The pidfiles
should be stored in the local state directory, not the server
configuration directory when using modern paths.

Fixes commit bdf86d245fd55c5c7ac7ea81e3d6b6bafdbe1783.

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

8 years agokauth: Resolve date signedness warning in SetFields
Anders Kaseorg [Fri, 31 Jul 2015 05:49:03 +0000]
kauth: Resolve date signedness warning in SetFields

Resolves this warning:

admin_tools.c: In function ‘SetFields’:
admin_tools.c:611:30: warning: pointer targets in passing argument 2 of ‘ktime_DateToInt32’ differ in signedness [-Wpointer-sign]
  code = ktime_DateToInt32(s, &expiration);
                              ^
In file included from /home/anders/wd/openafs/include/afs/afsutil.h:84:0,
                 from admin_tools.c:39:
/home/anders/wd/openafs/include/afs/afsutil_prototypes.h:101:18: note: expected ‘afs_int32 *’ but argument is of type ‘afs_uint32 *’
 extern afs_int32 ktime_DateToInt32(char *adate, afs_int32 * aint32);
                  ^

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

8 years agoUpdate asetkey.8 for KeyFileExt
Benjamin Kaduk [Fri, 27 Feb 2015 22:47:45 +0000]
Update asetkey.8 for KeyFileExt

Prefer KeyFileExt to KeyFile ~everywhere.  Make the main documentation
assume a modern cell with KeyFileExt and rxkad-k5, moving the old
rxkad and KeyFile documentation to a new section,
HISTORICAL COMPATIBILITY.

Note that kaserver is deprecated.

Do not mention the Update Server, which is also disrecommended for
new installations.

Add a copyright statement for the new content.

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

8 years agoLinux: Only use automount for volume roots
Marc Dionne [Wed, 29 Jul 2015 12:03:14 +0000]
Linux: Only use automount for volume roots

As long as we avoid using directory aliases when crossing
a mount point (at the volume root), we should always get
to a given non root directory with the same dentry.
The mechanism added by commit de381aa0 ("Linux: Make dir
dentry aliases act like symlinks") is therefore only really
necessary for a volume root.

With kernel 4.2 it is not possible to tweak the "total link
count", resulting in ELOOP errors when looking up a path
with 40 or more directories that are being looked up for
the first time.  With this change, only mountpoints will
count against the limit.

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

8 years agotests: give the full path to the softsig test helper program
Marcio Barbosa [Thu, 6 Aug 2015 14:53:23 +0000]
tests: give the full path to the softsig test helper program

In order to start the softsig test helper properly,
the full path of this program is necessary.

FIXES 132246

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

8 years agotests/auth/keys-t.c: Don’t ignore return value of write
Anders Kaseorg [Sat, 1 Aug 2015 03:26:43 +0000]
tests/auth/keys-t.c: Don’t ignore return value of write

Resolves this warning:

keys-t.c: In function ‘copy’:
keys-t.c:63:6: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
      write(out, block, len);
      ^

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

8 years agoUnix CM: Make rootVolume array big enough
Simon Wilkinson [Sat, 2 Mar 2013 09:19:13 +0000]
Unix CM: Make rootVolume array big enough

In afs_CheckRootVolume, the local rootVolumeName array needs to
be large enough to hold the contents of the global
afs_rootVolumeName string, which is 64 characters long. Fix our
local array to be the same length by using a new defined constant
MAXROOTVOLNAMELEN.

Caught by coverity (#985758)

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

8 years agovos dump -clone: use volumename of cloned volume
Hans-Werner Paulsen [Wed, 14 Jan 2015 11:39:38 +0000]
vos dump -clone: use volumename of cloned volume

with the command "vos dump -clone" use the volumename of the cloned volume
instead of the fixed string "dump-clone-temp". This volumename is recorded
in the DumpHeader and VolumeHeader of the dump file.

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

8 years agoafsmonitor: Skip additional bits for large timeval
Marc Dionne [Mon, 16 Dec 2013 21:52:17 +0000]
afsmonitor: Skip additional bits for large timeval

When the timeval structure uses 64-bit values for sec and usec,
64 extra bits need to be skipped in the input for every time value
that is parsed.  There's a remaining assumption in this part of the
code that the time values received from the server are 32-bits, but
after decoding they will always have the local size which may well
be 64-bits.

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

8 years agovol: Switch to Jenkins hash for volume hash table
Benjamin Kaduk [Mon, 12 Jan 2015 21:34:21 +0000]
vol: Switch to Jenkins hash for volume hash table

While here, bump the default size from 256 to 1024.

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

8 years agoSwitch to jhash for VNODE_HASH
Benjamin Kaduk [Mon, 12 Jan 2015 21:13:28 +0000]
Switch to jhash for VNODE_HASH

Remove the vnodeHashOffset field, as the Jenkins hash will get
a uniform-enough distribution without this extra help.  Per-volume
unique hashing is retained by using the volume ID as the initial
value input to the Jenkins hash.

While here, increase the vnode hash table size from 256 to 2048.

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

8 years agovol: relocate some comments
Benjamin Kaduk [Mon, 12 Jan 2015 21:15:53 +0000]
vol: relocate some comments

Put them closer to the code they are describing.

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

8 years agoNormalize on vp->hashid for hash table usage
Benjamin Kaduk [Mon, 12 Jan 2015 20:14:48 +0000]
Normalize on vp->hashid for hash table usage

At present the hashid is set to the same value as the volume ID
(i.e., V_id(vp) a.k.a. vp->header->diskstuff.id), but we should
not leak across the abstraction barrier without cause.

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

8 years agoobjdir build: Normalize COMPILE_ET_* commands
Andrew Deason [Thu, 14 Aug 2014 20:13:48 +0000]
objdir build: Normalize COMPILE_ET_* commands

A few different places in the tree currently invoke compile_et in a
few different ways. These three general styles all appear:

    ${COMPILE_ET_H} -p ${srcdir} foo
    ${COMPILE_ET_H} -p ${srcdir} foo.et
    ${COMPILE_ET_H} ${srcdir}/foo.et

Of these, the first is the correct way to invoke compile_et in a
Makefile. The other two can fail during at least some objdir builds.

Take this example of the second style of invocation:

    afs_trace.h: afs_trace.et
            ${COMPILE_ET_H} -v 2 -p ${srcdir} afs_trace.et

During an objdir build, the compile_et command will get expanded like
so, due to VPATH expansion:

    $top_objdir/src/comerr/compile_et -emit h -v 2 \
        -p $top_srcdir/src/afs \
        $top_srcdir/src/afs/afs_trace.et

The compile_et command concatenates the -p prefix with the actual
filename provided, so the file it tries to open is:

    $top_srcdir/src/afs/$top_srcdir/src/afs/afs_trace.et

For non-objdir builds this doesn't happen, since $srcdir is just '.',
and afs_trace.et gets expanded to just afs_trace.et (or possibly
./afs_trace.et). This is also not a problem for objdir builds that are
specified as a relative path and are 'adjacent' to the srcdir. For
example, if we ran '../openafs-1.6.10pre1/configure --options', our
$top_srcdir is just '../openafs-1.6.10pre1', with some magic to
expand '..' to the correct number of levels. So in the above example,
the compile_et invocation gets expanded to:

    /path/to/objdir/src/comerr/compile_et -emit h -v 2 \
        -p ../../../openafs-1.6.10pre1/src/afs \
        ../../../openafs-1.6.10pre1/src/afs/afs_trace.et

And compile_et then tries to open the path
../../../openafs-1.6.10pre1/src/afs/../../../openafs-1.6.10pre1/src/afs/afs_trace.et
which collapses to just
../../../openafs-1.6.10pre1/src/afs/afs_trace.et, which is the correct
file.

However, if the $srcdir is specified as an absolute path, or if the
number of '..'s is wrong, this doesn't work. It is perhaps easiest to
explain why by just using another example. For an absolute path, the
invoked command is:

    /path/to/objdir/src/comerr/compile_et -emit h -v 2 \
        -p /path/to/openafs-1.6.10pre1/src/afs \
        /path/to/openafs-1.6.10pre1/src/afs/afs_trace.et

And compile_et tries to open
/path/to/openafs-1.6.10pre1/src/afs/path/to/openafs-1.6.10pre1/src/afs/afs_trace.et,
which obviously does not exist. This results in a build failure like:

    /path/to/openafs-1.6.10pre1/src/afs/path/to/openafs-1.6.10pre1/src/afs/afs_trace.et: No such file or directory
    *** Error code 1
    make: Fatal error: Command failed for target `afs_trace.msf'

For a non-working relative objdir, we may invoke a command like this:

    /path/to/objdir/src/comerr/compile_et -emit h -v 2 \
        -p ../../../../openafs-1.6.10pre1/src/afs \
        ../../../../openafs-1.6.10pre1/src/afs/afs_trace.et

And compile_et tries to open
../../../../openafs-1.6.10pre1/src/afs/../../../../openafs-1.6.10pre1/src/afs/afs_trace.et,
which is ../../../../../openafs-1.6.10pre1/src/afs/afs_trace.et, which
(probably) doesn't exist, since it goes one too many levels up.

To avoid this, we can just prevent the filename argument to compile_et
from undergoing VPATH expansion. compile_et never opens the given path
directly if -p is given, so it's not really a file path and so should
not be altered by VPATH.

compile_et will add a trailing .et to the filename if it doesn't have
one, so we can avoid the VPATH expansion by just leaving out the
trailing .et. We could also avoid the VPATH expansion by specifying
something like './afs_trace.et', but it is perhaps more clear to not
say the explicit filename, since we're not really specifying a path to
a file.

Just leaving out the -p option, as in this style of compile_et
invocation:

    dumpscan_errs.h: ${srcdir}/dumpscan_errs.et
        $(COMPILE_ET_H) ${srcdir}/dumpscan_errs.et

also fails for objdir builds. This is because, without the -p option,
compile_et defaults to '.' as the prefix. If the srcdir is
/path/to/openafs-1.6.10pre1, then this will expand to:

    /path/to/objdir/src/comerr/compile_et -emit h \
        .//path/to/openafs-1.6.10pre1/src/tools/dumpscan/dumpscan_errs.et

which will fail, since that path to dumpscan_errs.et does not exist.

So to fix this, make all compile_et invocations follow this style:

    ${COMPILE_ET_H} -p ${srcdir} foo

Many other invocations of compile_et in the tree are already like
this, so this commit just changes the others to match.

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

8 years agoLINUX: Fix "unused but set var" autoconf warnings
Andrew Deason [Mon, 13 Jan 2014 05:24:55 +0000]
LINUX: Fix "unused but set var" autoconf warnings

A few of the linux autoconf tests generate -Wunused-but-set-variable
warnings, unless the test is run with -Wno-unused-but-set-variable.
Since we run these tests with -Werror, this can cause the tests to
incorrectly fail if they are not run with
-Wno-unused-but-set-variable.

The Linux kernel build process normally does run with that option, but
due to some other (possibly buggy) behavior, sometimes these configure
tests do not run with that option. So, make our tests work without
generating that warning, so we will work in more cases.

Reorganize a few of these tests so we are setting a field in a global
structure, instead of a function-local one. Make the test function
names and style little more consistent while we are here, but do not
make the global structure 'static', in case the compiler recognizes we
are setting fields for a structure that cannot be used by anything.

In particular, the "revalidate takes nameidata" test had been wrongly
succeeding, but that didn't usually matter because of how the feature
tests are ordered in the code.  It does matter in the case when the
"revalidate takes unsigned" check also gets a wrong result, which
can cause kernel BUGs, which should be fixed by these changes.

See:
<http://lists.openafs.org/pipermail/openafs-devel/2014-January/019727.html>
<http://thread.gmane.org/gmane.comp.file-systems.openafs.devel/11361>

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

8 years agoopr: fix often reported warning
Sami Kerola [Sun, 23 Jun 2013 21:08:34 +0000]
opr: fix often reported warning

$ make CC=cgcc CHECK="smatch -Wsparse-all" 2>&1 | tee debug
$ sed -n 's/.*warning: //p' debug | sort | uniq -c | sort -n | tail -1
   7218 passing argument 1 of 'opr_AssertionFailed' discards 'const' qualifier from pointer target type [enabled by default]

Change-Id: I81c5c1db39b1a08c7dda3caa3d4cdf685186ff5b
Address: http://smatch.sourceforge.net/
Reviewed-on: http://gerrit.openafs.org/10019
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agovol: Log more info on wrong SYNC response length
Andrew Deason [Mon, 10 Feb 2014 20:13:39 +0000]
vol: Log more info on wrong SYNC response length

We log that the length of the response was wrong, so we're dropping
the connection. Log what the actual and expected lengths were, at
least, so we can maybe get a little bit of useful information from
this message.

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

8 years agoafs: Stop abusing ENOENT
Andrew Deason [Sat, 14 Feb 2015 00:08:25 +0000]
afs: Stop abusing ENOENT

When looking up a file, the ENOENT error code is supposed to be used
if we know that the target filename does not exist. That is, the
situation is a user or application error; they specified a filename
that was not previously created.

Currently, though, we use ENOENT for a variety of different
situations, such as:

 - After successfully looking up a directory entry, we fail to
   afs_GetDCache or afs_GetVCache on the FID for that entry.

 - We encounter an invalid mount point, in certain code paths.

In each of these situations, an ENOENT error code is incorrect, since
the target filename does indeed exist and these situations may be
caused by network or administrative errors. An ENOENT error implies
that the user may be able to then create the target filename, which is
not true most of the time in the above situations.

In addition, on LINUX we return a negative dcache entry when we
encounter an ENOENT error on lookup. This means that if any of the
above scenarios occur, Linux would cache the fact that that directory
entry did not exist, and return ENOENT for future lookups. This was
worked around in one of the changes in commit
652f3bd9cb7a5d7833a760ba50ef7c2c67214bba to always invalidate such
negative dentries, but at the cost of performance (since this caused
negative lookups to never be cached).

To avoid all of these issues, just don't use ENOENT in these
situations. For simple non-disconnected afs_GetDCache or afs_GetVCache
errors, return EIO, since we have encountered an error that is
internal to AFS (either the underlying data is inconsistent, or we
have a network error, or something else). In disconnected operation,
return ENETDOWN like in other disconnected code paths, since often the
root cause is due to us not having network access. When a bad
mountpoint is encountered, return ENODEV, since that is what we use
elsewhere in the code when encountering a bad mountpoint.

It is also noteworthy that this changes removes the translation of
VNOVNODE into ENOENT, since a nonexistent vnode is not the same as a
nonexistent filename, as described above. Some code paths have special
behavior for this situation (ignoring the error in some cases where it
does not matter). These code paths should be okay with this change,
since all of them examine error codes that have not been translated
through afs_CheckCode.

Some useless references to ENOENT were also removed in
src/afs/LINUX*/osi_misc.c. These did not result in incorrect behavior,
but removing them makes searching for bad ENOENT references easier.

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

8 years agoafs: Clarify vcache->mvid accesses
Andrew Deason [Sat, 14 Feb 2015 00:02:44 +0000]
afs: Clarify vcache->mvid accesses

Currently, numerous places in the code treat the 'mvid' field in
struct vcache as a few different things:

 - If the vcache is a mountpoint, mvid points to the fid of the root
   dir of the target volume.

 - If the vcache is a volume root dir, mvid points to the fid of the
   parent dir for the mountpoint.

 - If the vcache is a sillyrenamed file, mvid points to a string,
   which is the name the vcache was renamed to.

Despite these three things being very different (and one of them is a
completely different type than the others), everywhere in the code
just accesses mvid as 'avc->mvid'. This can make it very confusing as
to what the field actually means at any particular part of the code,
and makes it very difficult to search the code for places that use
mvid in any one of these specific ways.

So, to aid in code clarity, make mvid into a union, with the following
members:

 - target_root: For the "mountpoint" case.

 - parent: For the "root dir" case.

 - silly_name: For the "sillyrename" case.

This should have no effect on code behavior, but just makes the code a
bit clearer.

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

8 years agoafs: Use named constants for mvstat
Andrew Deason [Fri, 13 Feb 2015 23:31:37 +0000]
afs: Use named constants for mvstat

Currently the vcache 'mvstat' field is assigned three magic values: 0
for normal files and directories, 1 for mountpoint objects, and 2 for
volume root dirs. These values are clearly defined in comments, but
everywhere we actually assign or compare these values, we use the bare
numbers.

Stop this nonsense and use named constants, to make the code less
inscrutable.

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

8 years agovol: Avoid FDH_SEEK/FDH_READ
Andrew Deason [Mon, 11 Aug 2014 18:51:39 +0000]
vol: Avoid FDH_SEEK/FDH_READ

All code in the tree except for this uses positional i/o
(FDH_PREAD/FDH_PWRITE). For consistency and to ensure that we do not
mix positional and non-positional i/o, just use the positional i/o
functions here. It's simpler, too.

Change-Id: Ib65f81dde7532631cd7d642c9ef814d47c71581a
Reviewed-on: http://gerrit.openafs.org/11377
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Hans-Werner Paulsen <hans@mpa-garching.mpg.de>
Tested-by: Hans-Werner Paulsen <hans@mpa-garching.mpg.de>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agoreadme: remove README.PTHREADED_UBIK
Michael Meffie [Mon, 31 Mar 2014 18:25:54 +0000]
readme: remove README.PTHREADED_UBIK

We enabled pthreaded ubik by default in commit 27cb0d38885428474b0d4287,
and it is no longer considered beta or experimental.  There is no longer
a need for separate documentation of it, and adjust the options
listing in INSTALL accordingly.

[kaduk@mit.edu: adjust for the changed default behavior.]

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

8 years agoreadme: Rename README to INSTALL
Michael Meffie [Mon, 31 Mar 2014 18:03:58 +0000]
readme: Rename README to INSTALL

Create a new top level README to introduce OpenAFS.

Move the old README to a file called INSTALL for information about
building and installing OpenAFS on various platforms.

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

8 years agoreadme: move the LICENSE file to the top level directory
Michael Meffie [Mon, 31 Mar 2014 17:02:00 +0000]
readme: move the LICENSE file to the top level directory

Move the LICENSE file to the top directory to make it
more visible and to clean up the src directory.

Update the top level make file and redhat packaging
to accomodate the new path to the LICENSE file.

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

8 years agovlserver: ListAttributesN2 volume name safety
Jeffrey Altman [Sat, 1 Aug 2015 13:32:35 +0000]
vlserver: ListAttributesN2 volume name safety

The vlserver ListAttributesN2 RPC permits filtering the result set
by volume name in addition by site or volume id.

Two issues identified by Andrew Deason (Sine Nomine Associates) are
addressed by this patch.  First, the size of the volumename[] buffer
is insufficient to store the valid input read over the network.  The
buffer needs to be able to store VL_MAXNAMELEN characters of the volume
name, two characters for the regular expression '^' and '$', and the
trailing NUL.

Second, sprintf() is used to write to the buffer and even with valid
input from the caller SVL_ListAttributesN2 can overflow the buffer
when ".backup" and ".readonly" are appended to the volume name.  If
there is an overflow the search name is invalid and there can not be
a valid match.

This patch increases the size of volumename[] to VL_MAXNAMELEN+3.

It also uses snprintf() instead of sprintf() and performs error
checking.  The error VL_BADNAME is returned when the network input is
invalid.

Change-Id: Id65b83e0dd14c6f41af73c6868975ae53c4975a7
Reviewed-on: http://gerrit.openafs.org/11969
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Nathaniel Filardo <nwfilardo@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

8 years agovlserver: limit use of regex to admins always
D Brashear [Fri, 18 Jul 2014 20:00:12 +0000]
vlserver: limit use of regex to admins always

allow regexes only if the querying user is a superuser.
if the superuser uses up all the resources, well, they could just do
whatever damage directly anyway. means even in unrestricted mode
we are not vulnerable

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

8 years agoRevert "vlserver: Disable regex volume name processing in ListAttributesN2"
Jeffrey Altman [Mon, 3 Aug 2015 19:03:00 +0000]
Revert "vlserver: Disable regex volume name processing in ListAttributesN2"

This change reverts commit 22481ab3705522ac1988b7de038c4dbc1e5009a9 which
by disabling regex queries of volume names breaks some backup software
including TSM.

Change-Id: Ic8b398e289845b45b6b073729e9a091c8b5d71b5
Reviewed-on: http://gerrit.openafs.org/11967
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>

8 years agokas: remove @CFLAGS_NOERROR@ in favor of specific pragma
Anders Kaseorg [Mon, 3 Aug 2015 01:26:13 +0000]
kas: remove @CFLAGS_NOERROR@ in favor of specific pragma

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

8 years agotests/volser/vos-t.c: Don’t ignore return value of pipe
Anders Kaseorg [Sat, 1 Aug 2015 03:28:49 +0000]
tests/volser/vos-t.c: Don’t ignore return value of pipe

Resolves this warning:

vos-t.c: In function ‘TestListAddrs’:
vos-t.c:60:5: warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result [-Wunused-result]
     pipe(outpipe);
     ^

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

8 years agotests/opr/jhash-t.c: Fix unsigned constant warning
Anders Kaseorg [Sat, 1 Aug 2015 09:05:11 +0000]
tests/opr/jhash-t.c: Fix unsigned constant warning

Resolves this warning on 32-bit GCC:

jhash-t.c: In function ‘main’:
jhash-t.c:60:4: warning: this decimal constant is unsigned only in ISO C90
    is_int(3704403432, opr_jhash(test, 2, 0),
    ^
jhash-t.c:62:4: warning: this decimal constant is unsigned only in ISO C90
    is_int(3704403432, opr_jhash_int2(test[0], test[1], 0),
    ^

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

8 years agoSquash a frightening number of warnings from XBSA-related code
Anders Kaseorg [Sat, 1 Aug 2015 07:15:39 +0000]
Squash a frightening number of warnings from XBSA-related code

Mostly missing prototypes and mismatched format strings, but also some
more disturbing bugs.

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

8 years agoAdd XBSA_XLIBS to XLIBS after it’s computed
Anders Kaseorg [Sat, 1 Aug 2015 07:58:19 +0000]
Add XBSA_XLIBS to XLIBS after it’s computed

Commit 353aa7ef2c172f574998480d6d051b3f4e95ae7b (after 1.6 was
branched) reordered things such that XBSA_XLIBS was being added to
XLIBS before it was computed, which caused link failures with
--enable-tivoli-tsm.

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

8 years agotests/opr/time-t.c: Use labs instead of abs for long argument
Anders Kaseorg [Sat, 1 Aug 2015 09:54:42 +0000]
tests/opr/time-t.c: Use labs instead of abs for long argument

Resolves this warning with clang:

time-t.c:46:8: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause
      truncation of value [-Wabsolute-value]
    ok(abs(osTime - osNow) < 2, "opr_time_Now returns a reasonable value");
       ^
time-t.c:46:8: note: use function 'labs' instead
    ok(abs(osTime - osNow) < 2, "opr_time_Now returns a reasonable value");
       ^~~
       labs

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

8 years agosrc/kauth/krb_udp.c: Remove redundant NULL check for array address
Anders Kaseorg [Sat, 1 Aug 2015 09:52:59 +0000]
src/kauth/krb_udp.c: Remove redundant NULL check for array address

Resolves this warning with clang:

krb_udp.c:302:13: warning: address of array 'tentry.misc_auth_bytes' will always evaluate to 'true' [-Wpointer-bool-conversion]
        if (tentry.misc_auth_bytes) {
        ~~  ~~~~~~~^~~~~~~~~~~~~~~

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

8 years agorfc3961: prototype _krb5_internal_hmac
Anders Kaseorg [Fri, 31 Jul 2015 05:35:05 +0000]
rfc3961: prototype _krb5_internal_hmac

Resolves this warning:

src/external/heimdal/krb5/crypto-arcfour.c: In function ‘_oafs_h__krb5_HMAC_MD5_checksum’:
src/external/heimdal/krb5/crypto-arcfour.c:82:5: warning: implicit declaration of function ‘_oafs_h__krb5_internal_hmac’ [-Wimplicit-function-declaration]
     ret = _krb5_internal_hmac(context, c, signature, sizeof(signature),
     ^

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

8 years agomake distclean: clean doc/xml/*/Makefile
Anders Kaseorg [Sat, 1 Aug 2015 01:27:42 +0000]
make distclean: clean doc/xml/*/Makefile

These files are conditionally generated by configure.ac.
(Conditionally is okay because this is an ‘rm -f’ line.)

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

8 years agolibadmin: #define UBIK_LEGACY_CALLITER 1 in afs_kasAdmin.c
Anders Kaseorg [Sat, 1 Aug 2015 00:47:35 +0000]
libadmin: #define UBIK_LEGACY_CALLITER 1 in afs_kasAdmin.c

Replaces this warning:

afs_kasAdmin.c: In function ‘GetPrincipalLockStatus’:
afs_kasAdmin.c:710:6: warning: implicit declaration of function ‘ubik_CallIter’ [-Wimplicit-function-declaration]
      ubik_CallIter(KAM_LockStatus, kaserver->servers, UPUBIKONLY,
      ^

with these marginally less alarming warnings:

In file included from ../adminutil/afs_AdminInternal.h:17:0,
                 from afs_kasAdmin.c:21:
/home/anders/wd/openafs/include/ubik.h:627:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern afs_int32 ubik_CallIter(int (*aproc) (), struct ubik_client *aclient,
 ^
/home/anders/wd/openafs/include/ubik.h:632:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern afs_int32 ubik_Call_New(int (*aproc) (), struct ubik_client
 ^

Change-Id: I49dbc5f6bb9199764c73c6ee8449d62518f377e6
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-on: http://gerrit.openafs.org/11954
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agovlserver: Disable regex volume name processing in ListAttributesN2
Andrew Deason [Wed, 8 Jul 2015 18:37:16 +0000]
vlserver: Disable regex volume name processing in ListAttributesN2

For the interim and until it is needed, this is most prudently
simply disabled.

FIXES 131890

Change-Id: Ib52da4ba38b579e51a0d8571e2da1307ae50a06f

8 years agoSolaris: setpag should verify that ngroups will not overflow
Mark Vitale [Wed, 8 Jul 2015 18:28:50 +0000]
Solaris: setpag should verify that ngroups will not overflow

Our ngroups management (since PAGs are still encoded as 2 groups) needs
to ensure that we do not overflow what we are prepared to handle,
and do not panic due to misheld mutexes if we have to return an error
when handling it.

FIXES 131878 (CVE-2015-3286)

Change-Id: I044d5e7d3161de815b3c2dace9c211fbb4b51ffa

8 years agoafs: Use correct output buffer for FSCmd pioctl
Andrew Deason [Wed, 8 Jul 2015 18:20:13 +0000]
afs: Use correct output buffer for FSCmd pioctl

MRAFS added the FsCmd pioctl for passing messages to the fileserver;
a bug causes it to write into the wrong memory and potentially panic
clients.

FIXES 131896 (CVE-2015-3285)

Change-Id: Ic3a81fe06edc886f24bbc0537ea53e994b086c9e

8 years agoafs: Clear pioctl data interchange buffer before use
Daria Brashear [Wed, 8 Jul 2015 18:16:41 +0000]
afs: Clear pioctl data interchange buffer before use

Avoid leaking data in pioctl interchange buffers; clear the memory
when one is allocated.

FIXES 131892 (CVE-2015-3284)

Change-Id: I880bbaa75b07b491a08c62fb17527b9fff47ec8c

8 years agobos: Use crypt for commands where spoofing could be a risk
Daria Brashear [Wed, 8 Jul 2015 18:11:33 +0000]
bos: Use crypt for commands where spoofing could be a risk

bos defaults to not requiring crypt in a lot of cases, instead using clear.

As the simplest way to secure the channel is to enable crypt, do so.

FIXES 131782 (CVE-2015-3283)

Change-Id: I354fcbb5db37db225391a47b59d99518d1d0b2f9

8 years agovos: Clear nvldbentry before sending on the wire
Daria Brashear [Wed, 8 Jul 2015 17:51:47 +0000]
vos: Clear nvldbentry before sending on the wire

Don't leak stack data onto the wire. Clear nvldbentry before use.

FIXES 131907 (CVE-2015-3282)

Change-Id: I18ea2c6ce21b6462277d067de329f4fb44dfb3ae

8 years agovos: changeaddr refuse to change mh entries without -force
Michael Meffie [Wed, 17 Dec 2014 00:25:06 +0000]
vos: changeaddr refuse to change mh entries without -force

Add a client side check to vos changeaddr -oldaddr -newaddr
to refuse to change multihomed server entries, unless -force
is given.

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

8 years agoLinux 4.2: Changes in link operation APIs
Marc Dionne [Mon, 6 Jul 2015 16:01:38 +0000]
Linux 4.2: Changes in link operation APIs

The follow_link and put_link operations are revised.
Test for the new signature and adapt the code.

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

8 years agoLinux: Add AC_CHECK_LINUX_OPERATION configure macro
Marc Dionne [Mon, 6 Jul 2015 15:00:10 +0000]
Linux: Add AC_CHECK_LINUX_OPERATION configure macro

Add a new macro to check the signature of a particular
operation against a provided typed argument list.
One of the arguments is an arbitrary label that is used
to construct the pre-processor define name.  This will
allow for testing of different forms for the same
operation.

This can be used to replace many of the remaining odd
checks in src/cf/linux_test4.m4.

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

8 years agoLinux 4.2: total_link_count is no longer accessible
Marc Dionne [Mon, 6 Jul 2015 14:00:13 +0000]
Linux 4.2: total_link_count is no longer accessible

The value is now stored in the nameidata structure which
is private to fs/namei.c, so we can't modify it here.

The effect is that using a path that contains 40+ directories
may fail with ELOOP, depending on which directories in the
path were previously used.  After a directory is accessed once
its D_AUTOMOUNT flag is reset and it will no longer count
against the symlink limit in later path lookups.

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

8 years agoLinux 4.2: Pass namespace to sock_create_kern
Marc Dionne [Wed, 8 Jul 2015 17:32:31 +0000]
Linux 4.2: Pass namespace to sock_create_kern

sock_create_kern gains an additional network namespace
argument.

Pass in the default system namesapce.

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

8 years agodoc: bosserver runs in the background
Michael Meffie [Fri, 26 Jun 2015 13:09:18 +0000]
doc: bosserver runs in the background

Since OpenAFS 1.0 bosserver automatically puts itself into the
background and removes it's controlling terminal. Update the examples in
the Admin and Quick Start Guides to remove the unneeded '&' on the
command line to start the bosserver.

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

8 years agotests: fix typo in softsig test helper
Michael Meffie [Fri, 12 Jun 2015 16:38:49 +0000]
tests: fix typo in softsig test helper

Change-Id: I74183a04b54b70bf3593a53fdb5f164cbd6c3b98
Reviewed-on: http://gerrit.openafs.org/11893
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

8 years agovos: desupport -stayonline
Daria Brashear [Wed, 4 Mar 2015 22:25:14 +0000]
vos: desupport -stayonline

roll back -stayonline support for volume releases for now.

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

8 years agolibafs: reset all the volumes with fs flushall
Michael Meffie [Fri, 12 Jun 2015 00:28:43 +0000]
libafs: reset all the volumes with fs flushall

Fix a logic bug in fs flushall in which only the first volume in each
hash chain is reset (invalidated).  Instead, reset all the volumes in
the volume hash.

This bug was introduced in commit 4197bbecd9d0b2ff0b8eaec75a0df9a64f713cf0
(libafs: fs flushall for unix cm)

Also, when flushing a single volume with fs flushvolume, don't bother
searching all the hash chains, instead start on the hash chain
containing the volume being flushed.

Change-Id: I7be67fdb310b4845d02dc916f4400f83cc649cb8
Reviewed-on: http://gerrit.openafs.org/11892
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agopagsh: do not call set[ug]id()
Benjamin Kaduk [Mon, 9 Feb 2015 17:09:32 +0000]
pagsh: do not call set[ug]id()

Supposedly calling setuid(getuid()) and setgid(getgid()) would
help pick up a new group list on some systems, in the depths
of history.  In the absence of reason to believe this is still
the case, drop the calls to avoid scary warnings about unchecked
return values.

Change-Id: I39e87a27fb52f5a6868b867c9325d4a5fa93ef58
Reviewed-on: http://gerrit.openafs.org/11759
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoAvoid unsafe scanf("%s")
Benjamin Kaduk [Mon, 9 Feb 2015 15:38:04 +0000]
Avoid unsafe scanf("%s")

Reading user input into a fixed-length buffer just to check the
first character is silly and an easy buffer overrun.  gcc on
Ubuntu 13.03 warns about the unchecked return value for scanf(),
but scanf("%s") is guaranteed to either succeed or get EOF/EINTR/etc..

In any case, we don't need to use scanf() at all, here -- reuse an
idiom from BSD cp(1) and loop around getchar to read the user's
response, eliminating the fixed-length buffer entirely.  A separate
initial loop is needed to skip leading whitespace, which is done
implicitly by scanf().

Change-Id: Ic5ed65e80146aa3d08a4b03c213f748ef088156b
Reviewed-on: http://gerrit.openafs.org/11758
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoafs: Do not supply bogus poll vnodeops for FBSD
Benjamin Kaduk [Wed, 27 May 2015 20:13:13 +0000]
afs: Do not supply bogus poll vnodeops for FBSD

We currently provide one which just always returns 1, but the
kernel provides a vop_nopoll which conceptually is the same thing.
That one, however, provides some feature checks and fails when
consumers ask for fancy features that are not portable.

Change-Id: Iba03904aac2883e18a1abdd4f09289b6c6f907c0
Reviewed-on: http://gerrit.openafs.org/11882
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

8 years agoIgnore return values more harder
Benjamin Kaduk [Fri, 6 Feb 2015 19:15:11 +0000]
Ignore return values more harder

Building on Ubuntu 14.04 with gcc 4.8.2-19ubuntu1, we encounter
fatal warnings about unchecked return values in uss, which is
now always built, as of 00a33b26d74aa067086ddc340efb82184715857f.

Change-Id: I997dcb683e33902c2765121c70bdcf21e9d5e892
Reviewed-on: http://gerrit.openafs.org/11757
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>