budb: don't malloc(0) on error condition in GetText()
malloc(0) is non-portable (may return a pointer to no space, or it
may return NULL. Just set the result to NULL without bothering to
call malloc(), as is done earlier in this function.
rx: don't leak a connection hash table in unlikely error condition
If getsockname() returns an error (which shouldn't be possible),
rx_InitHost would leak a connection hash table (which probably
doesn't matter because the caller will just exit anyway). Make
the analyzer happy by freeing the memory anyway.
The AFS file server had always performed a PRSFS_READ permission
check on the volume's root directory (1.1) vnode before responding
succesfully to the client. A successful response contains the
following volume state information:
Message of the day (if any)
Offline message (if any)
Online flag
InService flag
Blessed flag
NeedsSalvage flag
Type
MinQuota
MaxQuota
BlocksInUse
PartBlocksAvail
PartMaxBlocks
All of this information is publicly available to anonymous users
via other services so it is odd that it is hidden from anonymous
cache managers.
As sites begin to tighten the ACLs on volumes due to privacy
and security concerns this READ permission check is begin to
cause problems for Windows clients that rely upon the quota and
block counts to determine whether or not it is likely to be safe
to perform an extending write. In many environments volumes are
being configured such that the root directory is 'l' for all and
only the subdirectories provide for 'ridw'. Under these situations
the user is able to read/write the data but cannot determine how
much free space is available. Since all of the data returned by
RXAFS_GetVolumeStatus is publicly available, the patchset removes
the access check entirely.
bozo: small-notifier: don't ignore return from system()
Nobody can possibly be using this program, but even so, don't ignore
return values. Unfortunately, the return value of system() is a bit
complicated to interpret.
The interface flag has one fewer T than normal English usage would
suggest, so this code was never compiled on systems that don't have
the normally-spelled version as an alias.
FBSD: don't reference libc_r; no release OpenAFS works on still uses it
libc_r is the old user-mode threading library. Modern versions of
FreeBSD don't include it, and the conditionals here that (nearly
always) override it with the correct library, libpthread, are true
on every version of FreeBSD for which OpenAFS might plausibly be
compiled. So just use the correct library all the time.
Michael Meffie [Wed, 4 Jul 2012 21:54:02 +0000 (17:54 -0400)]
vlserver: fix logging of ip addresses
Remove the spurious dates surrounding IP addresess in the VLLog.
Instead of multiple calls to the logging function for a given log
line, format a string containing the addresses and call the log
function once.
Changes the log output from,
... The following fileserver is being registered in the VLDB:
... [Tue Jul 4 14:11:43 2012 192.168.10.128Tue Jul 4 14:11:43 2012 ]
... It will create a new entry in the VLDB.
to,
... The following fileserver is being registered in the VLDB:
... [192.168.10.128]
... It will create a new entry in the VLDB.
Use interlocked increment and decrement to track the waiters
and use the wait queue itself to determine if there are waiters
instead of the CM_SCACHEFLAG_WAITING flag.
When performing a RXAFS_FetchData[64] RPC, a short read from
rx_Read[v] is not a reason to stop processing the call unless
it is the first read and the file server FetchData offset bug
has been detected. If not, only stop processing if the
rx_Read[v] return value is <= 0.
The Windows cache manager stores the mount point or symlink target
string in the cm_scache_t object. If the string is the empty string
then the target needs to be resolved. Otherwise it is considered
up to date. With this approach, care must be taken to ensure that
the string is erased whenever the data version changes.
This patchset records the data version of the mount point target
string in the cm_scache_t object. Being up to date is determined
by comparing the current data version of the object to the mount
point string version. A match and the string is up to date.
Andrew Deason [Wed, 20 Jun 2012 21:28:51 +0000 (16:28 -0500)]
vos: Avoid creating volume with the same RO/BK ids
If we specified an RW id of 5, an RO id of 6, and no BK id, this code
would assign the BK id to RW+1, or 6. This gives the RO and BK volumes
the same volume id, which is a mistake. Choose a different id instead.
Andrew Deason [Fri, 29 Jun 2012 04:16:33 +0000 (23:16 -0500)]
viced: fsprobe needs MT_LIBS
fsprobe is built pthreaded, so it needs MT_LIBS; otherwise HP-UX and
possibly other platforms complain about missing pthread symbols. Just
copy the libs from the fileserver link line.
On multiprocessor systems, spin counts are faster than entering
a processor wait state when there is critical section contention.
Microsoft recommends a count of 4000. This feature is only available
on XP and above which is fine since OpenAFS master and 1.7 no longer
support Windows 2000.
Windows: Apply cm_GetVolServerList() to cm_ConnFromVolume()
Use cm_GetVolServerList() in cm_ConnFromVolume() to ensure an
error is returned instead of dereferencing a NULL pointer if
the serverRef list for the requested volume cannot be obtained.
Windows: Apply cm_GetVolServerList() to cm_Analyze()
Using cm_GetVolServerList() it is possible to simplify
the logic in cm_Analyze(). It is no longer necessary
for cm_Analyze() to call cm_GetServerList() which must
obtain its own reference the the cm_volume_t object via
a fileId lookup. This reduces lock contention and makes
the code a bit more readable.
cm_GetVolServerList() is a wrapper for cm_GetVolServers() that
returns CM_ERROR_NOSUCHVOLUME if the server list cannot be
obtained for the requested volume.
Windows: Modify cm_GetVolServers and cm_GetServerList
Move the determination of the 'replicated' state into
cm_GetVolServers() so that cm_GetServerList() and
cm_ConnFromVolume() can be implemented without duplicating
the resolution of the cm_vol_state_t object.
Windows: RDR RXAFS_GetVolumeStatus vs 1.1 'l' only
The Windows redirector relies upon the ability to obtain volume
status information to decide whether a file system volume object
can be created and whether or not an extending write can be
permitted. As of this writing, the file server always performs
a PRFS_READ access check on the volume's root directory (1.1)
vnode as a condition for releasing the volume state information
which includes:
Message of the day (if any)
Offline message (if any)
Online flag
InService flag
Blessed flag
NeedsSalvage flag
Type
MinQuota
MaxQuota
BlocksInUse
PartBlocksAvail
PartMaxBlocks
All of this information is publicly available to anonymous users
via "vos examine" so it is odd that it is hidden from anonymous
cache managers. When RXAFS_GetVolumeStatus fails, the AFS redirector
was failing to create a file system object for the AFS volume. That
in turn prevented the volume from being accessed even if the user
had 'l' in the root directory and full access everywhere else.
This patchset will make up fake data for the AFS volume if the
RPC fails. However, doing so does have consequences. The client
will be unable to make an accurate determination regarding free space
on the file server. As a result, an extending write may be permitted
which writes data into the system page cache which in turn cannot
be written to the file server. Such data will be lost and unrecoverable.
commit f716962ab41847af4450d0a361f5de9195b32ed0
inadvertently broke the offline .readonly is valid functionality
when readonly volume versioning is disabled. Restore it.
commit f716962ab41847af4450d0a361f5de9195b32ed0
clears the cm_scache_t volumeCreationDate field.
It shouldn't because the volumeCreationDate is not a property of
the callback. It is a property of the status information which
does not change simply because the callback expires.
Jeffrey Altman [Tue, 26 Jun 2012 03:06:30 +0000 (23:06 -0400)]
Windows: afslogon expand short domain names
Depending on how the user specifies the domain name during login,
NPLogonNotify may be given a short or a full domain or kerberos
realm name. If the name is the short name, attempt to expand it
automatically if there is no 'realm' configured for the short
domain name.
This patchset relies upon data in the local registry instead of
using an API such as NameTranslate in order to avoid network
queries to the domain controller that might not be reachable.
Jeffrey Altman [Mon, 25 Jun 2012 05:33:02 +0000 (01:33 -0400)]
Windows: Remove HELP from afscreds
The old .hlp format is no longer supported and the text of the
help files is long out of date. Remove the HELP buttons from
the dialogs and all references to WM_HELP message processing
from the application.
Jeffrey Altman [Tue, 19 Jun 2012 02:03:21 +0000 (22:03 -0400)]
Windows: afslogon major refactoring NPLogonNotify()
This is a major refactoring of NPLogonNotify() that is meant
to reduce redundancy and add functionality. Key highlights
include:
* New Domain\user hierarchy that permits configuration
settings to be applied on a per user basis instead of a
domain basis. As part of the extension the username itself
can be mapped.
* Attempt to import the MSLSA credentials prior to performing
KFW_AFS_get_cred().
* Do not perform redundant KFW_AFS_get_cred() calls.
* Add a flag to indicate if the authentication name is the
LSA principal name.
Andrew Deason [Fri, 29 Jun 2012 17:36:36 +0000 (12:36 -0500)]
Remove empty Makefile continuation lines
HP-UX make gets confused by constructs like:
FOO = bar \
BAZ = quux
Where a line continuation is followed by an empty line. So, get rid of
all of these in the tree. Not all of them matter, but removing all of
them makes it easier to find these, and catch them in the future.
Jeffrey Altman [Wed, 27 Jun 2012 05:00:20 +0000 (01:00 -0400)]
Windows: ensure TreeLock obtain and release same pointer
The indirection ObjectInformation->ParentObjectInformation does
not appear to be stable. When acquiring and releasing a parent
TreeLock, use a local variable to store the ParentObjectInformation
pointer and use that to access the TreeLock. This will ensure that
the resource obtained is the one that is released.
Jeffrey Altman [Sun, 24 Jun 2012 14:16:42 +0000 (10:16 -0400)]
Windows: Media Protected if create on RO volume
If there is an attempt to create a file/directory on a readonly
volume as indicated by the Volume Characteristics, return
STATUS_MEDIA_WRITE_PROTECTED immediately. Do not bother contacting
the afsd_service.
Jeffrey Altman [Sat, 23 Jun 2012 19:04:29 +0000 (15:04 -0400)]
Windows: NPGetConnectionPerformance
Restore the implementation of NPGetConnectionPerformance
in AFSRDFSProvider.dll. This time just return 0 for all fields
except for the preferred read/write size which is set to 64K.
When this function is not implemented at all, a query for
performance of a \\AFS path will be processed by the SMB
redirector. This can result in a 20 second timeout while waiting
for the SMB Browser query for "AFS <20>" to complete.
Jeffrey Altman [Fri, 22 Jun 2012 04:25:26 +0000 (00:25 -0400)]
Windows: check perms before RXAFS_GetVolumeStatus
Instead of calling RXAFS_GetVolumeStatus naked, perform a read
permission check using RXAFS_FetchStatus first. This permits EACCES
caching to prevent unnecessary requests.
Regardless of which FileId is queried, always use the root vnode
FileId for the permission check. The file server performs its
permission check using the root vnode.
Jeffrey Altman [Thu, 21 Jun 2012 23:34:58 +0000 (19:34 -0400)]
Windows: Replicated requires more than one site
The VLDB response may include a list of servers some of which
are not valid replicas because the DONOTUSE flag is set or
because the replica site may be out of date. Instead of setting
the replication state based upon the server count in the VLDB
response, use the number of RO sites that were deemed valid
at the end of processing.
Jeffrey Altman [Thu, 21 Jun 2012 23:29:26 +0000 (19:29 -0400)]
Windows: [Inline]BulkStat VolSync not accurate?
Instead of only recording the volume creation date when
cm_readonlyVolumeVersioning is true, record the date whenever
the RPC in use is not a RXAFS_[Inline]BulkStatus. This is
tracked by the addition of flags for cm_MergeStatus and
cm_EndCallBackGrantingCall which identify when the RPC was
in fact a BulkStat variant.
As a reminder, pre- 1.4.11 and 1.6.0 file servers do not
properly set the VolSync structure when responding to BulkStat
RPCs. At present, there is no method of identifying when it
is safe to use them. When cm_readonlyVolumeVersioning is TRUE,
it is assumed that the file servers are new enough to do the
right thing.
Jeffrey Altman [Wed, 20 Jun 2012 04:05:44 +0000 (00:05 -0400)]
Windows: force vldb lookup if server list is empty
The Windows cache manager can mark server references as "deleted"
which can give the impression that a server reference list is not
empty when it is. If the volume list is empty any attempt to
issue an RPC would fail with a CM_ERROR_ALLDOWN error. Since the
VLDB data is current, this condition will remain for two hours.
This patchset adds a new error, CM_ERROR_EMPTY, which is returned
when the server reference list is empty. cm_Analyze() is modified
to process the CM_ERROR_EMPTY error by attempting to update the
server reference list. If the update succeeds and the list is no
longer empty, the RPC is retried. Otherwise, the RPC fails as
before.
Jeffrey Altman [Mon, 18 Jun 2012 14:10:32 +0000 (10:10 -0400)]
Windows: Do not permit RDR worker threads to quit
If the DeviceIoControl from the service's redirector worker threads
fails the thread will terminate. This is a problem because if all
of the threads quit the afs redirector will end up deadlocking
all requests since there will be no method of delivering them to
the service. If there is an error log it (if possible), and retry.
Hopefully it will be transient.
Jeffrey Altman [Thu, 7 Jun 2012 13:23:26 +0000 (09:23 -0400)]
Windows: misplaced brace in KFW_AFS_get_cred
A misplaced brace in KFW_AFS_get_cred() results in KFW_AFS_klog()
being executed twice in a row if successful. The second attempt
could fail due to a KRB5KRB_AP_ERR_REPEAT error issued by the KDC.
Steve Simmons [Wed, 27 Jun 2012 21:28:36 +0000 (17:28 -0400)]
Added build of cscope index to Makefile
Add ability to do 'make cscope' at the top of
the distribution tree and get 'cscope.out' built
in ./src. Index file is removed in 'make clean'.
cscope.out is now ignored in src/.gitignore
Use rk_alloc, rk_calloc, rk_free, rk_realloc instead of Windows
C RTL allocators. The OpenAFS source tree has a bad habit of
allocating memory in one module and freeing it in another. This
is not a problem for POSIX but is disaster on Windows. This change
ensures that all OpenAFS modules share the same allocator.
Andrew Bartlett (1):
Revert "make paranoia check less paranoid" - check that key types strictly match
Jeffrey Altman (3):
do not include stdint.h unprotected
Windows EAFNOSUPPORT defined by VS2010
roken: Use a common allocator for all windows
Love Hornquist Astrand (2):
add rk_getpwnam_r
move windows compat errno constants to after <errno.h> is included
Nicolas Williams (7):
Fixes to make Heimdal -Wall -Werror clean
Make krb5_kuserok() pluggable and add features (including MIT config compat)
Generalize token expansion to allow for context-specific tokens
Address code review comments (use krb5_enomem())
Make master build on Windows
Fix a compiler warning in lib/roken/snprintf.c on 32-bit Ubuntu
Move base into lib
Roland C. Dowdeswell (3):
Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
Provide support for enctype aliases for ease of use.
Additional changes to make -Wshadow build on Ubuntu 10.04.
Simon Wilkinson (1):
hcrypto: Use correct size for memset in md2
New files are:
roken/realloc.c
roken/win32_alloc.c
Simon Wilkinson [Mon, 2 Jul 2012 13:50:10 +0000 (14:50 +0100)]
roken: Import Windows allocator changes
Roken now supports using a single allocator across all of the objects
which include that roken library. Two additional objects are required
to support this, so add them to the list of symbols that we import.
Heimdal's expand_path.c now makes use of a new function krb5_enomem()
which is a wrapper around krb5_set_error_message(). Add a dummy
implementation to src/cmd/krb5_locl.h so that expand_path.c can
build within the OpenAFS tree.
Remove #if 0 disabled definitions and those for strtoll and
strtoull as they are not used anywhere in the tree. strtoll
and strtoull will conflict with the next roken.h update.
Jeffrey Altman [Mon, 11 Jun 2012 18:45:15 +0000 (14:45 -0400)]
Windows: afslogon is only an authentication provider
afslogon.dll is just a Authentication Provider DLL. It does not
provide network file system browse and mapping functions. Therefore,
do not include the "ProviderPath" registry value when the
AuthentProviderPath variable is sufficient.
Ben Kaduk [Thu, 28 Jun 2012 02:04:24 +0000 (22:04 -0400)]
Patch up FreeBSD-10 support
The auto-guessing code for sysnames produces *_fbsd_100, so we can't
just claim that we'll be *_fbsd_1000 for kicks.
Revert back to the old behavior so as to be less disruptive.
Simon Wilkinson [Tue, 26 Jun 2012 16:42:39 +0000 (17:42 +0100)]
viced: Remove localcellname
Commit 8a040cfd848410b75b4e5ac5498f00f073932598 removed all of the
code which relies on the localcellname variable being set, but didn't
remove the variable itself. So do so.
Simon Wilkinson [Wed, 27 Jun 2012 09:51:37 +0000 (10:51 +0100)]
viced: Make the config directory path global
Store the location of the configuration directory in a global
variable, rather than hardcoding it in multiple locations in the file.
This makes it easier to write unit tests for portions of the fileserver,
and is a step towards producing a fileserver that can be run from
within the test suite.
Simon Wilkinson [Tue, 26 Jun 2012 20:04:41 +0000 (21:04 +0100)]
tests: Abstract out code for a test RPC service
Lots of our tests want to start a test RPC server, and then run
commands against it. Start to abstract out the code to do this
by pulling the code to start a test RPC server into its own
function in the common test directory.
Simon Wilkinson [Tue, 26 Jun 2012 20:16:28 +0000 (21:16 +0100)]
Unix builds: Reference krb5 libs in standard way
Use $(LIB_krb5) and $(LDFLAGS_krb5) to reference the Kerberos
library and linker flags, rather than directly using an autoconf
substitution. This brings us in line with the way other libraries
are handled.
Andrew Deason [Tue, 19 Jun 2012 19:42:23 +0000 (14:42 -0500)]
viced: Clear all client CPS on FlushCPS
Currently the fileserver only finds the first applicable 'client'
structure (via h_ID2Client) for a FlushCPS operation, and invalidates
the CPS for it. However, there may be many 'client' structures in
memory for the given viceid, since we may have many connections for
the same user (possibly from different hosts).
So, modify FlushCPS to find all relevant client structures, and
invalidate the CPS calculation on them.
Andrew Deason [Mon, 18 Jun 2012 22:01:24 +0000 (17:01 -0500)]
cacheout: Perform authenticated RXAFS_FlushCPS
Fileservers may now require RXAFS_FlushCPS calls to be made with
administrator tokens. So, try to make the call with admin tokens, and
provide the usual -noauth and -localauth options.
Andrew Deason [Fri, 15 Jun 2012 21:58:42 +0000 (16:58 -0500)]
viced: Restrict RXAFS_FlushCPS to administrators
RXAFS_FlushCPS currently can be run by anyone, including
unauthenticated users. Forcing CPS calculation can be a relatively
resource-intensive operation, though, if done frequently enough, and
only should need to be done by administrators. Thus, only let
administrators use it.
Andrew Deason [Mon, 18 Jun 2012 20:06:49 +0000 (15:06 -0500)]
doc: Consolidate NetRestrict format docmentation
We were specifying exactly the same format in two different places;
consolidate them into one place. In addition, explicitly say there are
is no way to specify a range of addresses, in case some people are
confused by the previous versions of this man page that erroneously
said you could use 255 as a wildcard.
Ben Kaduk [Sat, 23 Jun 2012 01:33:50 +0000 (21:33 -0400)]
Catch up on fbsd releases
Pull in the changes needed to even have a chance at supporting
FreeBSD 8.3, 8.4, 9-stable, and 10-current.
Conditionals for changed interfaces in a follow-up commit.