Mark Vitale [Thu, 7 Mar 2013 14:34:55 +0000 (09:34 -0500)]
vos: noise messages when attempting to delete non-existent volume
With vos refactor commit f4e73067cdef990262c69c38ac98761620a63f25,
some formerly conditional volume deletes are now unconditional.
This regresses 'vos move' output with harmless "error" messages
when AFSVolTransCreate() returns VNOVOL:
"Failed to start transaction on <volume>"
"Volume not attached, does not exist, or not online"
Modify DoVolDelete() to return early (and silently) with VNOVOL
in this case, allowing the caller to handle this appropriately.
OpenBSD: Replace "vnodeop_desc" with "vops" in kernel module.
In OpenBSD 4.9, the vnode operations vector in the "vnode" struct
was changed from using a "vnodeop_desc" struct to a new "vops"
struct. This patch makes the appropriate changes to the OpenBSD
kernel module support to accommodate the change.
Jeffrey Altman [Mon, 11 Mar 2013 04:43:26 +0000 (00:43 -0400)]
Windows: Enforce free space checks every 1MB
Instead of performing a free space (or quota) check on every extending
write, perform the check only when the file length is increased beyond
the next 1MB boundary. The file server permits 1MB quota over runs
and issuing the volume status rpc to the file server is extremely
expensive. Especially for append only applications that write just a few
bytes at a time.
Simon Wilkinson [Fri, 8 Mar 2013 16:15:51 +0000 (16:15 +0000)]
bos: Remove theoretical overflow in DateOf
DateOf copies the results of ctime into a static buffer. Typically
ctime will return a 26 byte string, but if you pass it a year larger
than 9999 (which we shouldn't), you can get a 32 (or more) byte string.
Get rid of this unlikely event by using strlcpy for the copy. We already
truncate at 24 bytes when we remove the \n, so this shouldn't cause any
further problems.
Really, this whole thing should be rewritten to use strftime.
Simon Wilkinson [Fri, 8 Mar 2013 13:01:28 +0000 (13:01 +0000)]
bos: Don't overflow cellname buffer
Don't overflow the fixed sized cellname buffer when copying the
information in from the command line - instead, just use a
dynamically allocated buffer.
Simon Wilkinson [Mon, 4 Mar 2013 16:34:20 +0000 (16:34 +0000)]
butc: Init volheader before using it for hton
When converting a volume header from host to network order, make
sure that any unused fields in the structure are zero'd, so we don't
end up filling them with stack garbage in the network version of
the structure.
Simon Wilkinson [Mon, 4 Mar 2013 16:31:50 +0000 (16:31 +0000)]
bucoord: restore requires server and partition
The VolRestoreCmd sub command requires that the user specifies
the server and partition - calls which don't do so won't get past
libcmd. Don't check again in the handler that they have been supplied,
as it confuses things.
Jeffrey Altman [Fri, 8 Mar 2013 06:41:22 +0000 (01:41 -0500)]
Windows: Use Microsoft IO_REPARSE_TAG_SYMLINK tag
For symlinks and DFS Links use Microsoft's NTFS Symlink tag,
IO_REPARSE_TAG_SYMLINK, instead of the OpenAFS assigned tag.
The DeleteFile() and RemoveDirectory() Win32 APIs do not delete
non-Microsoft reparse points and instead delete the target object.
While it is possible for Take Command and potentially Cygwin to
alter their behavior with AFS specific knowlege, it is not possible
to alter the Explorer Shell, cmd.exe and powershell.
Using the Microsoft tag is a violation of Microsoft policy.
Jeffrey Altman [Thu, 7 Mar 2013 14:25:09 +0000 (09:25 -0500)]
Windows: cm_BPlusDirEnumBulkStatNext index error
In cm_BPlusDirEnumBulkStatNext the 'next' variable was being set
even if the FileId was not added to the list of objects added to
the cm_bulkStat array. Delay the assignment to ensure that 'next'
refers to the first element in the array.
In the CM_ERROR_BULKSTAT_FAILURE processing, 'next' is used to
obtain a reference to the cm_scache object that is supposed to
correlate to the [1] entry in the array. If 'next' == -1, there
is no such entry. Add a conditional to ensure that 'next' is not
used when its value is -1.
Jeffrey Altman [Mon, 11 Mar 2013 04:03:38 +0000 (00:03 -0400)]
Windows: Report actual volume creation time
The cm_scache.volumeCreationDate is populated by any non-bulkstat
callback issuing operation. If it is not set at the time the
redirector requests volume information, force an RXAFS_FetchStatus
and then use the resulting timestamp in the response.
Jeffrey Altman [Wed, 6 Mar 2013 14:53:41 +0000 (09:53 -0500)]
Windows: Service processing for Symlink creation
Initial support for symlink creation via the Win32 CreateSymbolicLink api.
Add support for AFS_REQUEST_TYPE_CREATE_SYMLINK redirector requests via
the new RDR_CreateSymlinkEntry() function.
Since CreateSymbolicLink api creates a new directory or file object and
then assigns the Microsoft reparse tag data to that object,
RDR_CreateSymlinkEntry must first delete the empty directory or file and
then create the new symlink object in its place. If the empty object can
be removed but the symlink cannot be created, STATUS_FILE_DELETED is
returned to indicate to the redirector that a failure occurred that
changed the state of the directory without creating a new object.
If the empty object cannot be removed, a STATUS_ACCESS_DENIED error will
be returned and the empty object will unfortunately remain in the AFS
directory.
Target path translation is performed. Absolute AFS paths are stored in
UNIX notation. Absolute non-AFS UNC and device paths are prefaced with
"msdfs:".
Simon Wilkinson [Sat, 2 Mar 2013 13:01:14 +0000 (13:01 +0000)]
auth: Don't overflow buffer in CompFindUser
The fullname buffer in CompFindUser is theoretically big enough
to take the data usually supplied to it. However, play it safe by
using strlcat and strlcpy to catch buffer overflows.
Simon Wilkinson [Sat, 2 Mar 2013 12:55:18 +0000 (12:55 +0000)]
auth: Catch long cells in backwards compat code
ktc_SetTokenEx can fall back to calling the SetToken pioctl when
the kernel module doesn't support the newer call. When we do this,
we have to transform the token structure into the older format.
Catch tokens whose cells are too long to be represented in the
older format, and bail with KTC_INVAL, rather than overflowing the
array.
Simon Wilkinson [Sat, 2 Mar 2013 12:38:49 +0000 (12:38 +0000)]
audit: Fix overflow in file backend
If the filename passed to open_file was larger than MAXPATHLEN-5,
then we'd overflow the oldName buffer when creating the backup
filename. Fix the overflow by using a malloc'd buffer instead.
Jeffrey Altman [Sun, 10 Mar 2013 14:49:42 +0000 (10:49 -0400)]
Windows: IsSpaceAvail lock order violation
cm_IsSpaceAvailable() obtains the cm_scache.rw lock of the volume
root directory. Therefore it is a lock order violation to call the
function while any other cm_scache.rw lock is held belonging to an
object in the same volume. vnode 1 is always less than any other
vnode value.
Jeffrey Altman [Sat, 9 Mar 2013 20:43:14 +0000 (15:43 -0500)]
Windows: Fix directory to service null mask lookups
The direct to service for non-wildcard lookups, commit b7ba97ad537bd0e9a241f052ddd1c3a50c74745b, introduced a bug when the search
mask is left unspecified. Do not set bNonWildcardMatch to TRUE
when the mask is NULL.
Change-Id: I6c4846b443acc7e5e42d4e83e75ef383fc400db9
Reviewed-on: http://gerrit.openafs.org/9542 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Peter Scott <pscott@kerneldrivers.com> Reviewed-by: Rod Widdowson <rdw@steadingsoftware.com> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Jeffrey Altman [Fri, 8 Mar 2013 03:05:20 +0000 (22:05 -0500)]
Windows: Permit deletion of reparse points
AFSSetDispositionInfo did not set the AFS_DIR_ENTRY_PENDING_DELETE
flag if the DirectoryCB type was mountpoint, symlink, dfslink or invalid.
This patchset permits the flag to be set so reparse point objects can be
deleted without using the AFS "symlink.exe remove" command.
Jeffrey Altman [Thu, 7 Mar 2013 22:39:05 +0000 (17:39 -0500)]
Windows: AFSLocateNameEntry Backup Volume Change
When AFSLocateNameEntry() calls AFSBackupEntry() in the name array it is
possible that the DirectoryCB returned belongs to a different VolumeCB.
If so, pCurrentVolume must be updated and reference counts must be
adjusted.
pete scott [Tue, 5 Mar 2013 20:21:41 +0000 (13:21 -0700)]
Windows: RDR SymbolicLink create support
Permit the redirector to handle Microsoft's IO_REPARSE_TAG_MOUNT_POINT
and IO_REPARSE_TAG_SYMLINK requests. The IO_REPARSE_TAG_SYMLINK request
is issued as a result of a CreateSymbolicLink Win32 API.
Creating a symlink in Windows is not equivalent to the way a symlink is
created in AFS or UNIX. Instead of creating a symlink object whose data
string represents the target and mode bits indicate that the stream should
be treated as a link, on Windows it is a two step process.
To create a symlink to a directory, create an empty directory and then
assign the reparse tag data to the directory object. To create a symlink
to anything else, create an empty file and assign the reparse tag data to
the file. Deleting a reparse point simply removes the reparse tag data
and not the underlying directory or file.
The way this will work for AFS is that assigning reparse data to an
existing directory or file will require that the object be deleted from
the directory and a new symlink object be created in its place. This is
why upon successful completion of the upcall to the service the directory
object information has the AFS_OBJECT_FLAGS_DIRECTORY_ENUMERATED flag
cleared.
This patchset permits symlink creation but does not do anything to support
symlink removal.
Jeffrey Altman [Tue, 5 Mar 2013 12:52:37 +0000 (07:52 -0500)]
Windows: Avoid race during cm_FreeServerList
cm_FreeServerList obtains cm_serverLock exclusively and in some
circumstances will call cm_FreeServer(). cm_FreeServer() will
drop the cm_serverLock if the cm_server_t.refCount is zero in order to
avoid a lock order violation when calling cm_GCConnections() since
cm_connLock is higher in the lock hierarchy.
The call to cm_FreeServer is performed after the cm_serverRef_t
to be deleted is identified but before it is removed from the list.
There is the potential for two threads calling cm_FreeServerList()
to race and for more than one thread to attempt to delete the same
cm_serverRef_t twice.
Fix this by:
1. maintain a private copy of the cm_server_t pointer, delete the
cm_serverRef_t and update the list pointers before calling cm_FreeServer().
2. obtain and release a refcnt on the next cm_serverRef_t to ensure
that it is not deleted out from underneath the thread in case the
cm_serverLock is dropped.
Simon Wilkinson [Sat, 2 Mar 2013 12:15:22 +0000 (12:15 +0000)]
aklog: Protect against overflows from cmdline
The cell, realm and path arrays are populated based on the user's
command line, and xlog_path is populated from their passwd map
entry. Protect against all of these overflowing, by making suitable
use of strlcpy and strlcat.
Simon Wilkinson [Sat, 2 Mar 2013 12:04:46 +0000 (12:04 +0000)]
aklog: Fix overflows in auth_to_path
In the auth_to_path routine, don't use strcpy and strcat when
working with the fixed length pathtocheck buffer. Instead, use
strlcpy and strlcat to ensure that all string operations fit within
the buffer limits.
Simon Wilkinson [Sat, 2 Mar 2013 10:27:47 +0000 (10:27 +0000)]
util: Avoid overflow in GetNameByINet
We copy the results of gethostbyaddr into a fixed length buffer
without checking whether they fit. Add a length check, and use
strlcpy to do the copy to make sure we can't overflow.
Simon Wilkinson [Sat, 2 Mar 2013 09:35:01 +0000 (09:35 +0000)]
kauth: Don't overflow stack when building username
knfs constructs the userName by combining the clientName.name
and clientName.instance arrays, along with a dot separator. Make
sure that the userName array is big enough to hold these, and
use strlcpy and strlcat just to make sure.
Simon Wilkinson [Fri, 1 Mar 2013 12:08:46 +0000 (12:08 +0000)]
fs: Fix improper use of readlink
readlink returns a non-NUL terminated buffer. If we are going to
terminate its response, we need to make sure that there's space to
do so. So the length passed to readlink should be one less than the
real length of the buffer.
Simon Wilkinson [Sat, 2 Mar 2013 11:49:13 +0000 (11:49 +0000)]
fstrace: Don't read uninitialised data
The pftix variable points to the next free element in the
printfTypes array, so when we iterate through that array to
read that data back, we should stop when our iterator equals
pftix, not when it is greater than it.
Simon Wilkinson [Sat, 2 Mar 2013 11:44:02 +0000 (11:44 +0000)]
readpwd: Make sure user supplies a passwdfile
If the user supplies enough command line arguments, but doesn't
provide a passwdfile, then we can end up trying to open whatever
garbage is on the stack.
Once we've finished parsing the command line arguments, make sure
that a filename was supplied.
Simon Wilkinson [Sat, 2 Mar 2013 11:44:02 +0000 (11:44 +0000)]
readgroup: Make sure user supplies a groupfile
If the user supplies enough command line arguments, but doesn't
provide a groupfile, then we can end up trying to open whatever
garbage is on the stack.
Once we've finished parsing the command line arguments, make sure
that a filename was supplied.
Simon Wilkinson [Sat, 2 Mar 2013 11:36:31 +0000 (11:36 +0000)]
libadmin: Don't pass garbage to pts_UserCreate
The libadmin pts_UserCreate function uses the value passed to
it in newUserId to control whether the user is being created
with a user supplied ID or not.
Initialise this value in the caller, so we don't end up creating
users with corrupt ids.
Simon Wilkinson [Sat, 2 Mar 2013 11:36:31 +0000 (11:36 +0000)]
libadmin: Don't pass garbage to pts_GroupCreate
The libadmin pts_GroupCreate function uses the value passed to
it in newGroupId to control whether the group is being created
with a user supplied ID or not.
Initialise this value in the caller, so we don't end up creating
groups with corrupt ids.
Simon Wilkinson [Sat, 2 Mar 2013 11:09:08 +0000 (11:09 +0000)]
libadmin: Don't double check for required param
The server, process and stat_type parameters are declared as
required when the command syntax is set up - so they must be
present when the command handler is called. So, don't bother
checking for them.
Simon Wilkinson [Sat, 2 Mar 2013 10:15:10 +0000 (10:15 +0000)]
rmtsys: Don't overflow pathname buffer
When we're constructing a homedirectory path to look for the
.AFSSERVER file in, we copy the HOME environment variable into a
static buffer, with a risk of overflowing that buffer.
Instead of using a static buffer, just allocate one with asprintf.
Simon Wilkinson [Sat, 2 Mar 2013 09:59:20 +0000 (09:59 +0000)]
auth: Don't overflow hostName array
afsconf_cell's hostName structure is a fixed length. Don't overflow
it by writing whatever comes back from gethostbyaddr into it. Use
strlcpy to catch an overflow, and if one occurs, just use
"UNKNOWNHOST", rather than a truncated host name.
Simon Wilkinson [Sat, 2 Mar 2013 09:47:53 +0000 (09:47 +0000)]
libadmin: Don't overflow volume name
The maximum volume name length in the VLDB RPCs is VL_MAXNAMELEN
(65), not 64 as used as a hardcoded value in vsprocs. Switch to
using the defined value, and also use strlcat to check that we
don't overflow this.
Simon Wilkinson [Sat, 2 Mar 2013 09:47:53 +0000 (09:47 +0000)]
volser: Don't overflow volume name
The maximum volume name length in the VLDB RPCs is VL_MAXNAMELEN
(65), not 64 as used as a hardcoded value in vsprocs. Switch to
using the defined value, and also use strlcat to check that we
don't overflow this.
Simon Wilkinson [Sat, 2 Mar 2013 09:26:05 +0000 (09:26 +0000)]
auth: Don't overflow cell string
If the kernel gives us bogus data back from the VIOCGETTOK pioctl,
we might overflow the cell string when copying in to it. Use
strlcpy to avoid this (unlikely) occurrence.
Andrew Deason [Sat, 23 Feb 2013 04:46:12 +0000 (22:46 -0600)]
viced: Improve CallPreamble error messages
These messages are not very useful right now. At least try to say what
host we sent an error to, so we know which host may be experiencing
some troubles as a result.
Andrew Deason [Wed, 19 Dec 2012 23:11:40 +0000 (17:11 -0600)]
ihandle: Remove ih_sync_thread
ih_sync_thread currently syncs files flagged as needing
synchronization in the background every 10 seconds. This practice has
caused severe data corruption on more than one occasion over the past
few years (124359, 131530). It has also been argued repeatedly that it
provides no meaningful additional on-disk consistency, so there is no
reason for it to exist even if it were error-free.
Syncing files in the background provides no guarantee on the
consistency of the file contents, since the files are not synced in
any order with respect to each other, or with respect to what
filesystem operations may be occurring in the application.
Additionally, journalling filesystems common on fileserver backends
will typically ensure some consistency after a certain amount of time
(by default, 5 seconds on ZFS and ext3+), so doing this sync ourselves
is often redundant or even counterproductive.
So, to avoid current and future issues with ih_sync_thread interacting
with other ihandle users, just get rid of it. Files flagged as needing
sync are still synced (not in the background) during IH_REALLYCLOSE.
Modify AFSPopulateNameArrayFromRelatedArray so that the DirectoryCB
parameter can safely be NULL. A NULL DirectoryCB input is required
to copy the entire NameArray.
src/rxosd/Makefile.in: avoid infinite recursion in CC variable
src/rxosd/Makefile sets CC=$(MT_CC).
src/config/Makefile.config sets MT_CC=$(CC).
Since both are recursive-expansion variables, this causes an infinite
loop, and make complains about it:
afscp: Fix check for bare root.cell dirs in dynroot mode
A previous fix (git commit fb1d7491fbe2e90300b23284f213cac2bdcd56ac)
added a check for '!p' in gettoproot(), but p is always a non-NULL pointer
(in part since it's dereferenced just above in the code), so the check
is always false.
Instead, I suspect the original author intended to check for '!*p',
which this patch does.
Simon Wilkinson [Fri, 1 Mar 2013 12:12:07 +0000 (12:12 +0000)]
up: Fix improper use of readlink
readlink returns a non-NUL terminated string. If the string must be
terminated, we need to have space in the buffer for it. So, the
buffer passed to readlink must be 1 less than the real length of
the buffer.
Simon Wilkinson [Fri, 1 Mar 2013 12:01:19 +0000 (12:01 +0000)]
util: Fix overflows in address parsing
The extractAddr function (which turns a dotted quad into an IP
address), has a number of overflows when one or more elements of
the quad are more than 31 characters in length.
The array allocated for each portion is 32 bytes long, but we only
stop writing into the array when the indexing pointer reaches 32,
which doesn't leave us with space for the trailing NULL.
Rework this so we always allow space for the NULL, and use a #define
for the array length to make it more clear whats going on.
Caught by coverity (#985591, #985592, #985593, #985594)
Simon Wilkinson [Fri, 1 Mar 2013 11:47:03 +0000 (11:47 +0000)]
ubik: Don't overflow server's addr array
We're checking to see if we've overflowed the array _after_ we've
looked up an element within it - so on the final iteration, we
always read past the end of the array.
Fix this by swapping the order of the tests in the for statemen
Simon Wilkinson [Fri, 1 Mar 2013 11:35:05 +0000 (11:35 +0000)]
rxgen: Don't overflow PackageIndex
PackageIndex++ returns the pre-index value of PackageIndex, so the
error statement isn't run when PackageIndex == MAX_PACKAGES. This
means we go on to overflow all of the arrays that are MAX_PACKAGES
in size.
Caught by coverity (#985583, #985584, #985585, #985586,
#985587, #985588, #985589)
Simon Wilkinson [Fri, 1 Mar 2013 11:31:31 +0000 (11:31 +0000)]
unlog: Don't overflow cells array
cells has a maximum size of MAXCELLS. Doing cells[MAXCELLS] overflows
that array. Clamp our maximum number of cells at one below this to
avoid the overflow.
Simon Wilkinson [Fri, 1 Mar 2013 11:22:26 +0000 (11:22 +0000)]
kauth: Don't overflow cellinfo hostAddrs array
The hostaddrs array has MAXHOSTSPERCELL (8) available elements.
The ubik connections list has MAXSERVERS (20) elements - when copying
from the ubik list into the cellinfo hostaddrs list, be careful not
to overflow it.
Simon Wilkinson [Fri, 1 Mar 2013 11:09:04 +0000 (11:09 +0000)]
bucoord: Remove theoretical overflow of ubik array
The ubik connections array is NULL terminated, so we have to
ensure that there is enough space for the trailing NULL. As the
array is MAXSERVERS elements long, this means that we can only
store MAXSERVERS-1 connections in it.
This problem will never be encountered by the correct code, as
the number of hosts returned from afsconf_Open is capped at
MAXHOSTSPERCELL (currently 8). MAXSERVERS is currently 20. However,
fix the bug in case we increase MAXHOSTSPERCELL at some point in
the future.
Marc Dionne [Sat, 2 Mar 2013 15:06:47 +0000 (10:06 -0500)]
crypto: make krb5_enomem a static inline function
With the recent update to the imported heimdal code, krb5_enomem
is used in a few places as a simple statement that doesn't make
use of the value. With the current definition, this triggers
compiler warnings because the statement has no effect.
Replace the definition with a static inline function that returns
the expected value.
Jeffrey Altman [Thu, 28 Feb 2013 22:11:57 +0000 (17:11 -0500)]
Windows: afslogon !KA_USERAUTH_AUTHENT_LOGON
Patchset 305133cde60fec7fb1050caf60a4319cdcf88a27 halted the practice
of calling ka_UserAuthenticateGeneral2() with the alternate smbName.
It should have halted the practice of passing flag
KA_USERAUTH_AUTHENT_LOGON which indicates that the smbName parameter
has been provided. Passing KA_USERAUTH_AUTHENT_LOGON without the smbName
field results in a KTC_INVAL error.
This error only impacts sites that still use kaserver or Kerberos v4 for
authentication.
Simon Wilkinson [Thu, 28 Feb 2013 22:07:12 +0000 (22:07 +0000)]
libadmin: Don't free garbage
Make sure that we initialise the nbulkentries structure to 0 before
we start work, so that if the failure handler is called, it doesn't
try to free garbage.
If an array is n elements long, accessing element array[n] is an
overflow. Fix various places where we apply loop bounds incorrectly
using the NUM_CM_STAT_ENTRIES constant.
If an array is n elements long, accessing element array[n] is an
overflow. Fix various places where we apply loop bounds incorrectly
using the NUM_FS_STAT_ENTRIES constant.
Simon Wilkinson [Thu, 28 Feb 2013 17:07:31 +0000 (17:07 +0000)]
afsmonitor: Add missing items to fsOpNames array
The Lookup and Residency fs stats counters were missing from the
fsOpNames array. Add them in - Lookup has been missing since the
IBM release, Residency was missed when the MR-AFS code was merged.
This is still rather fragile, as there's no guarantee that
AFS_STATS_NUM_FS_RPC_OPS matches the number of elements in this
array. However, this is now correct until someone breaks it again...
Simon Wilkinson [Thu, 28 Feb 2013 15:26:15 +0000 (15:26 +0000)]
Unix CM: Fix hash table overflow in dnlc code
In GetMeAnEntry, we can end up overflowing the nameHash array by one
element if the stars are particularly badly aligned.
nameptr is a static across function calls, so nameptr and j are not
equal. If nameptr is increment to NHSIZE in the same loop iteration
as j reaches NHSIZE + 2, the loop will terminate. We'll then
lookup nameHash[NHSIZE], which is 1 element passed the end of the
array.
Add an if statement which loops nameptr outside the loop (in the
same way as the if statement in the loop)
Simon Wilkinson [Thu, 28 Feb 2013 13:45:00 +0000 (13:45 +0000)]
Unix CM: Don't overflow ICL logs array
When checking whether a user supplied index into the ICL logs array
is out of bounds, we need to check whether it is greater or equal
to the maxmimum number of elements. Otherwise we can access one
more than the number of elements in the array.
in order to remove new lines from cmdbuf. Coverity thinks there's
a danger of strlen(cmdbuf) being 0, and thus the strlen being negative.
That shouldn't happen, but if fgets hits EOF midway through a line, we
might get a string that doesn't have a trailing '\n', and end up
removing the wrong character. Tidy this up by checking that the string
isn't 0 length, and that the character we're zapping is a newline.
Jeffrey Altman [Wed, 27 Feb 2013 20:19:41 +0000 (15:19 -0500)]
Windows: afsio reduce library link list
When linking afsio many of the libraries specified in the EXELIB3
list were unnecessary. The only lib in the list that is required
is libcmd.lib. Rename EXELIB3 to LIBCMD and prune the rest.
Jeffrey Altman [Wed, 27 Feb 2013 20:07:57 +0000 (15:07 -0500)]
Windows: Remove RXAFS* from afsrpc.dll
afsrpc.dll is supposed to be the multi-threaded dynamic loadable
version of the RX package. It has also included the RXAFS and
RXAFSCB client functions from src/fsint. Including the RXAFS* is
nice in theory but in practice the afsd_service.exe must link to
afsint.lib anyway in order to obtain access to RXAFSCB_ExecuteRequest()
which is part of the server portion. Linking to both results in
multiple instances of the same symbols in which case afsint.lib
must be linked to first and the dynamic version of the functions
are ignored.
The only other module that used RXAFS* functions from afsrpc.dll
is the adminutil library from the libadmin package. adminutil
doesn't implement the server functions but it can just as easily
link against afsint.lib.
Removing RXAFS* from afsrpc.dll results in a library that only
contains RX, RXSTATS, core xdr and rxkad.
This patchset also fixes some minor bugs:
1. $(UTILOBJS) were not being linked to the library due to
a typo.
2. Always use multi-thread safe versions of afsutil.lib
even though a dedicated afspthread.dll existed and all pthreaded
modules must link to afspthread.dll and not all link to
afsauthent.dll. Move these functions and the global mutex variable
to afspthread.dll to ensure that only one instance of the variable
is present in any binary.
Also remove from src/libafsauthent/NTMakefile the local building
of src/util object files and link to mtafsutil.lib.
Simon Wilkinson [Wed, 27 Feb 2013 10:34:59 +0000 (10:34 +0000)]
ubik: Avoid unlinking garbage
If SDISK_SendFail fails before the pathname to the temporary file
has been constructed, then the failure handler will unlink stack
garbage, with variable results.
Initialise the string, and check to see if it has contents before
calling unlink
Simon Wilkinson [Wed, 27 Feb 2013 10:28:05 +0000 (10:28 +0000)]
Unix CM: Don't free cell, then release lock on it
If afs_NewCell fails, then we can end up releasing a lock on a
section of memory that we have already freed. As this only happens
if the memory we're operating on is newly allocated and not yet
visible to anyone else, it is safe to release the lock before
starting to tidy things up.
Simon Wilkinson [Wed, 27 Feb 2013 10:11:21 +0000 (10:11 +0000)]
libafscp: Can't unlock something we've freed
When we call _StatCleanup on a stored statent structure, it
deletes the mutex, and frees the structure itself. This means it
can't be called with a locked structure as the mutex deletion
will fail, and then we'll try to reference freed memory when we
later unlock that mutex.
Fix this by unlocking the mutex before calling _StatCleanup. This
is safe because the only reference to the structure visible to other
threads must have been deleted by the time we reach this point.
Simon Wilkinson [Wed, 27 Feb 2013 09:23:07 +0000 (09:23 +0000)]
pt_util: Protect against corrupt input files
If we have an input file which contains a group membership line
(with a leading space) before any group definitions occur, pt_util
would use stack garbage as the group to create these members in.
Avoid this by requiring the presence of a group line before any
membership lines.