Fix two bugs reported via Windows Crash Reporting:
* Freelance initialization is somehow broken allowing the number of
locally defined mountpoints to become negative. Due to the use of
!= instead of < in loops, it is possible to read/write unallocated
memory.
* GetTextualSid() was not properly handling a NULL output buffer
pointer as an indication that the desired size should be returned.
(cherry picked from commit 77de32ed745d912e35990c5602b4a69a1b654973)
* AFS_Logoff_Event must destroy tokens even if integrated logon is not
being used unless LogoffPreserveTokens is non-zero
(cherry picked from commit 18e7ef272ab4efbd599c5d10174f0afd87c57c2e)
* fix LogoffPreserveTokens to work in the correct direction
* modify behavior to avoid domain controller queries when integrated
logon is disabled or the logon account is local
(cherry picked from commit f213588374ab92e27bb524cd747152270f9290ca)
* cell names must be treated as case insensitive
* smb logoff messages do not mean the user is logging off the machine.
do not use as an indication that tokens should be destroyed
* use the correct lock and avoid a deadlock when handling dead VCs
(cherry picked from commit 22b02189ecc70a94410fb1648da987d0964ddcaf)
* add port numbers to Host addresses so we can distinguish clients behind
NATs
* make messages consistent with regards to case and punctuation of
"Host x.x.x.x:y"
* convert hex addresses to dotted notation
(cherry picked from commit 04c3d3cc3900914725c479b993a6313b0ef29e3f)
* remove all references to 'dead_vcp'; cleanup smb_vc_t's as soon as
we know they are dead
* add mx holds across the cm_cell_t updates
* add cm_FindSCacheParent() and remove duplicate code elsewhere
* add mx holds across scp->flags updates
* add cm_CleanFile()
* clear CM_SCACHEFLAG_CALLBACK when discarding callbacks
* fix smb fid wrapping. wrap at 0xFFFF instead of 0 because 0xFFFF
is -1 which is INVALID_HANDLE
* add missing mx holds around vcp->flags updates
(cherry picked from commit 8b39114d5b36f60904e5a615a16b43b7e65c3017)
rewrite of GetSomeSpace_r to get rid of the brokenness we had before.
also make GetCapabilities work like other rpc stubs which don't need callbacks
(cherry picked from commit ecb9da5839e8e2ed0d52d87e426a728700bbd389)
Fixup token deletion logic
Surround all references to smb_fid_t flags and other references
by obtaining and releasing the 'mx' lock.
(cherry picked from commit bceabce8498127c550bbe5a9a430c8589f76d162)
Initial cut at an HTML conversion of the POD reference pages. Requires
Pod::Simple be installed (version 3.0 or later, probably). Also fix a POD
formatting bug in the afs(1) man page noticed while testing HTML output.
(cherry picked from commit 6eb9f473add1426b52861574c841b1fdfd80367b)
this is only a partial pullup
64-bit type safety changes required for successful compilation
on Windows 64-bit systems with the VS 2005 compiler
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
this is a partial pullup
64-bit type safety changes required for successful compilation
on Windows 64-bit systems with the VS 2005 compiler
FIXES 25829
the dynamic/system inode version of the linux client already keeps an
extra reference when the inode is on the vcache list. the inode/vnode
should not go away while we are trying to flush the dcache children.
(cherry picked from commit 78835720e0eac5897568f0ce32cd0ec20dc4c569)
FIXES 25879
KBUILD_BASENAME will need to be set in 2.6.15 and later for configure to work usefully
(cherry picked from commit c7df78fd7f9c4a29f8af32e49217806ef352ea01)
Because we use a private pool of vnodes, it's up to us to trigger cleanup.
here we do so.
(cherry picked from commit ad86f80fc2a7c02452d4bf280236f4c5df317fe9)
Further testing revealed that some smb_vc_t objects could not be freed
because the associated smb_fid_t objects never reached a zero refcount.
Additional auditing uncovered cases in which there were holds not being
released and others in which they were released to many times. This
patch fixes the problems and improves auditability by modifying the
behavior of the smb_IoctlXXX() functions to not release a reference
that was obtained by the caller. Now the caller releases the reference.
* re-enable LogoffTokenTransferTimeout and LogoffTokenTransfer.
Tokens are now destroyed at logoff based upon the values specified
here. Default is ON and 120 seconds. Setting this to OFF will
result in tokens never being destroyed. This will leak memory.
* protect global queues with mutexes and avoid a variety of race
conditions.
(cherry picked from commit 97304b84f76154d067717e3b34a3525abebc0cf7)
and jhutz@cs.cmu.edu
The size of h_maxSlots as computed based upon the value of
MAX_FILESERVER_THREAD is too small. It is possible for h_lwpIndex
(in the pthread case) to have produce the same Slot value for multiple
threads. In that case it is possible for the following to occur:
X: h_Hold_r(host)
X: H_UNLOCK
...
E: H_LOCK
E: Check h_Held_r(host); it is true, so don't hold
E: H_UNLOCK
X: H_LOCK
X: h_Release_r(host)
X: h_TossStuff_r(host) [called by h_Release_r]
X: H_UNLOCK
E: CheckHost(host)
The end result would be a crash due to a reference to a null field
in the host processed by CheckHost.
This patch is a bit of a hack in that it solves the problem by increasing
the number of slots for threads and does not determine the correct number
of threads the process should be allowed to produce.
(cherry picked from commit 4a5dda84178842e3eaa61d03fecc96149333dd13)
There should never be a case where h_Enumerate calls CheckHost with a
host whose callback_rxcon that is NULL. However, due to a bug it ended up
being the case that it happened. An examination of the CheckHost code
showed that the check for the HOSTDELETED flag should take place before
a reference to callback_rxcon is obtained. If HOSTDELETED were set, the
code would simply release the reference immediately. However, the process
of obtaining and releasing the reference required dropping and obtaining
locks that would be a performance hit.
(cherry picked from commit ff40c87da3ce4c6a7a58c08eaa223e8760dc8f73)
This patch:
(1) removes the rest of the dead logoff code that was originally
stripped of any meaning by DELTA
winnt-win2000-win98-afs-client-updates-20010623.
(2) gives new meaning to smb_TokenTransfer and smb_TokenTransferTimeout.
these variables now control how long a smb_username_t and its
associated cm_user_t and its cm_cellinfo_t (including tokens)
will be preserved after a logoff.
(3) adds logic to detect logoff conditions
(4) adds cm_CheckVCs(). This function probes the SMB client with a ECHO
response to determine if the associated SMB virtual circuit is still
valid. This is executed once every five minutes by smb_Daemon()
and whenever the machine's IP addresses change. This allows
abandoned VCs to be detected and the associated user credentials,
file handles, and locks to be cleaned up. This will also prevent
the exhaustion of the limited number of SMB sessions.
====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================
and remember to mark the session dead so it can be re-used
====================
fix an error caused by patch conflict during pullup
(cherry picked from commit 7fde756a2c6f17e6a3b0db7659c6edcc2eaa0bd7)
FIXES 25647
don't do lookups on the wrong vnode, if it's a mvstat=1 vnode, it's not useful
(cherry picked from commit a784c131709a8252fa1e8cb4ce49cb0c655dd7aa)
The Integrated Logon hack of setting a token for a smb name different
than the one associated with the current smb session fails when smb
virtual circuits, sessions and username objects are properly reference
counted. When refcounts are not leaked the constructed smb_username_t
is destroyed immediately after the token is set since there are not
references to it from a current session.
The fix is to mark the smb_username_t object with a flag indicating that
it was created by the Network Provider. This flag prevents the destruction
when the refcount is zero so that it will be available at the time the
smb session is created (just a moment or two later.) During the binding
of the smb_username_t to the smb_vc_t the flag is cleared allowing the
tokens to be destroyed when the smb session is closed.
(cherry picked from commit 70b76b3a1cff1dabe9b10b8222cd84fc207b6704)