Use StrSafe string manipulation functions in place of most
instances of strcpy, strcat, sprintf, etc. With the use
of StringCbCopy, StringCbCat, StringCbPrintf, etc. there
is no longer a need to manually assign a NUL to the end
of a C string buffer as was required with strncpy or
strncat.
There is one strcpy instance remaining due to the inability
to know what the length of the destination buffer. The API
needs to be altered to make the destlen available and that is
not an appropriate change for this patchset. A deprecated
warning is a reminder to revisit this in the future.
Several int to unsigned int type changes to avoid signed
vs unsigned warnings.
Shuffle the order of header files to avoid macro
redefinition warnings.
LICENSE MIT
Change-Id: I4b5d15b60918cc8dc6ab205f1a7d45e17d14de43
Reviewed-on: http://gerrit.openafs.org/1567
Reviewed-by: Asanka Herath <asanka@secure-endpoints.com>
Tested-by: Asanka Herath <asanka@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
KFW 3.1 is supported by OpenAFS but does not contain krb5_get_error_message
or krb5_free_error_message. As a result it must be loaded at run-time
and conditionally used.
LICENSE MIT
Change-Id: I803b4af726605dc49baf2c2d45fae3ecafe2ccf9
Reviewed-on: http://gerrit.openafs.org/1529
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
KFW 3.1 is supported by OpenAFS but does not contain krb5_get_error_message
or krb5_free_error_message. As a result it must be loaded at run-time
and conditionally used.
LICENSE MIT
Change-Id: Ic2ad16bb5c2d905e30ec814951b5253e2ef888da
Reviewed-on: http://gerrit.openafs.org/1530
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
sadly this can mean we lie and say delete will work when it will fail, but
finder looks for KAUTH_VNODE_DELETE_CHILD along with
KAUTH_VNODE_ADD_SUBDIRECTORY and KAUTH_VNODE_ADD_FILE, not as one-offs.
Change-Id: I4079b89e188992ee33594cad5bd15f7bf6106203
Reviewed-on: http://gerrit.openafs.org/1561
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Trying to build vos in src/tvolser can produce a warning, at least on
amd64_linux26, since we cast to an int of the wrong size in SendFile and
ReceiveFile. Use intptr_t like we do everywhere else instead.
Change-Id: Ic624bf90ab7338b63f8177b762e1deddbe7fb73d
Reviewed-on: http://gerrit.openafs.org/1556
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Commit d008089a79ef268bbca91d660a840f32cb416865 broke things so that
we were always trying to use the local cell, rather than the one specified
by the user. Fix this so that the command line cell is used, unles -localauth
is specified, which restores the existing behaviour.
FIXES 126716
Change-Id: I2ce34e764780d5a22c67474d5ae1076d52b04113
Reviewed-on: http://gerrit.openafs.org/1555
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Udebug gets the last 'yes' host in HBO, but afs_inet_ntoa wants it in
NBO. So convert it to NBO.
Change-Id: I5524d8086d5ac08875306fee923cb297c971cda8
Reviewed-on: http://gerrit.openafs.org/1549
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
vldb_check was ntohl'ing fields like serverNumber when reading in a VL
entry. Since this is a u_char, ntohl'ing will just always result in 0,
not the actual value. Remove the ntohls so we read in VL data correctly.
FIXES 126661
Change-Id: If5117e1750d6dacd9bbe18bc936e0a1ba3d44340
Reviewed-on: http://gerrit.openafs.org/1548
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Add the function FSYNC_VerifyCheckout, which can be used to verify that
a previous checkout of a volume is still known by the fileserver, and
hasn't been forgotten about (by e.g. the fileserver restarting).
Change-Id: Ie3ec63d155fe16ca4929b370bbe55850075cec83
Reviewed-on: http://gerrit.openafs.org/1404
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Add some developer documentation for DAFS. This isn't comprehensive or
extremely detailed, but is intended to provide a larger-picture overview
of some of the pieces of DAFS. More detailed docs are intended to exist
in source comments (doxygen and such), and should already be there for
the most part.
Change-Id: I167b52c3bfb9e6b4b7111b3548ca8b1dafe305ea
Reviewed-on: http://gerrit.openafs.org/1376
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Add a VLockFile function, VLockFileReinit, to close all locks on that
particular lock file.
Change-Id: Ie1e4af21a486fb0451b6d613117027a522c9bb5a
Reviewed-on: http://gerrit.openafs.org/1358
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Add a couple of asserts to make some mistakes very obvious, such as
passing in an invalid 'locktype' or unlocking more times than locking.
Change-Id: Ie6e707ea515d5a6527dedc8875f0a4694b7b93c9
Reviewed-on: http://gerrit.openafs.org/1357
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Change I03ecf6302436c35fec705cd6c84a40b7cdbf6f97 allowed non-fileserver
programs to schedule salvages via FSSYNC, making the FSSYNC call
directly in VRequestSalvage_r. This isn't as safe as making the call in
VScheduleSalvage_r (as is done when the fileserver schedules a salvage
via SALVSYNC), since we may not have relinquished all of our handles and
such for the volume by the time the salvager starts.
So instead, make this path a bit more like the fileserver, and make
non-fileserver programs actually make the FSSYNC call in
VScheduleSalvage_r. Consequently, make VScheduleSalvage_r conditionally
hit FSSYNC or SALVSYNC. Add a VCheckSalvage to attach2 failures, so
non-fileserver salvage requests actually get scheduled.
Also, reorganize the attach2 error handling a bit to make this a bit
easier.
Change-Id: I786a7953e860a132575caad8fe12168f6841442b
Reviewed-on: http://gerrit.openafs.org/1356
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Add logging for what FSSYNC commands are being received by the
fileserver, so it is possible to see what's going on with FSSYNC. Log at
level 125, since this isn't interesting unless you knows some FSSYNC
details, and it can get quite verbose.
Change-Id: Ia067d3ba5084a919332989aac437ae4d4082e2e4
Reviewed-on: http://gerrit.openafs.org/1349
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Move the routines for translating ProgramType codes, and SYNC command
codes, response codes, etc out of fssync-debug, and into header files
anyone can use. These routines are useful especially for SYNC-related
debug or error logs.
Change-Id: Idc5ffe0dd798a9f18ca733e94d0bb4d740ad0836
Reviewed-on: http://gerrit.openafs.org/1390
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
VCloseVolumeHandles_r and VReleaseVolumeHandles_r were using V_id to get
the id of the volume; just use vp->hashid so we can call these even if
we lack a header.
Change-Id: I0f0bc0ae82a7b86135aebe194c79a223a6f25094
Reviewed-on: http://gerrit.openafs.org/1348
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
also report unload. in event of panic after module is unloaded (which
*shouldn't* happen but i have evidence it might) you can retcon where the
module was
Change-Id: I07f89d2393605c4b7cac853cbe09b5a4a52ea4cd
Reviewed-on: http://gerrit.openafs.org/1544
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Include prototypes for osi_fbsd_alloc() and osi_fbsd_free() in
osi_machdep.h, since afs_prototypes.h is not included when compiling
the rx code. afs_osi_Alloc_NoSleep is #defined to be osi_fbsd_free,
and is used in the rx code; if the prototype for the latter is not
included, then int is assumed for all parameters and return values,
which breaks the calling convention for 64-bit pointers.
Change-Id: I3d7575525f159097d1f8ca9ecb22af9f27b63111
Reviewed-on: http://gerrit.openafs.org/1541
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
For the FreeBSD 5.3 release, UFS (and everything else) took a
"dreaded s/dev_t/struct cdev */" change; we need to keep up
with this when comparing mountpoints' devices.
Change-Id: I47d3f874be05b16fc2da89dac2bb1b64c573ab8e
Reviewed-on: http://gerrit.openafs.org/1540
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
msleep() does not take a struct timespec*, it takes its timeout
value as a multiple of the kernel's HZ parameter (tuneable at
startup). Since the afs_osi_TimedSleep interface is documented
to take a timeout in milliseconds, we must correct for the (sometimes)
different units (currently HZ defaults to 1000). We prefer
to multiply the timeout by HZ before dividing by 1000 so as to
not lose precision; overflow is assumed to be unlikely.
Change-Id: Ic101f3bf54213eebe249cb6c40a6d8cbd3d722f0
Reviewed-on: http://gerrit.openafs.org/1539
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Declare the fd variable. Also a preprocessor tweak, as e2b65732
seems to have gotten the sense of the AFS_FBSD50_ENV check wrong.
Change-Id: I7e498a8276586af5afe0483380d00ef83266c316
Reviewed-on: http://gerrit.openafs.org/1526
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
pull out the cellname from the reply
Change-Id: I8e0dbb5b82e353ecd29a9cce25eaee1255062cd9
Reviewed-on: http://gerrit.openafs.org/1537
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
OpenBSD 4.7 (currently in beta) removes the (dummy) VREF() macro from the
system header files. For at least as far back as OpenBSD 3.6, all this
macro does is expand to a call to a system routine by the same name in
lower case. This patch therefore replaces the single OpenBSD use of
VREF() with a direct call to the routine to which it expanded.
Change-Id: I44888ed1ba7ba8e7150202798def10bed2ab3158
Reviewed-on: http://gerrit.openafs.org/1532
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Formerly, in AFS_FBSD50_ENV, we used curproc for the ThreadUnique
value; however, curproc (#defined as curthread->td_proc) is a
struct proc *, not an actual pid. (As such, it suffers from
a 32/64-bit mismatch on 64-bit systems.) Use the correct value,
curproc->p_pid, instead.
Change-Id: If07ef3b0814c0fee63b62d2f36fa94d6e45573b9
Reviewed-on: http://gerrit.openafs.org/1528
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Actually declare the global afs_global_owner, in afs_osi.c.
This allows all symbols to resolve, so that the loader will
accept the module. There are still significant issues, though.
Change-Id: I705178cfa152f4ceaf59f008f53c1f62fb92826f
Reviewed-on: http://gerrit.openafs.org/1527
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
krb5_get_error_message() can return more descriptive errors
based upon the context in which the error occurred by extracting
the cached error message from the krb5_context. Since aklog
has a krb5_context, use that instead of error_message().
Use GetProcAddress to load krb5_get_error_message and
krb5_free_error_message function pointers because versions
of KFW prior to 3.2 do not export them.
LICENSE MIT
Change-Id: I12043ec1890bcf0f4d9566f35bb1228e579c49fe
Reviewed-on: http://gerrit.openafs.org/1520
Reviewed-by: Asanka Herath <asanka@secure-endpoints.com>
Tested-by: Asanka Herath <asanka@secure-endpoints.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
The keyring destructor on Linux was only destroying the first
unixuser structure found for the PAG being destroyed. In environments
where each PAG contains tokens for multiple cells, this led to us
leaking unixuser structures, and eventually grinding to a hault due
to the length of the resulting hash chains (and some horrific
O(n-squared) performance in the PAG statistics code).
Add a utility function for the keyring destruction function to call
which will mark as deleted all unixuser structures for a particular
PAG, and use it.
Change-Id: I355465c43cc2cf9d70f613d6f97cd65552260157
Cc: Eric.Hagberg@morganstanley.com
Reviewed-on: http://gerrit.openafs.org/1524
Tested-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
RHEL4 has a very old 2.6 kernel (2.6.9), which predates the start of
the Linux git tree. When I started using page_offset, I mistakenly assumed
that everything in the initial commit to that tree was available in all
2.6 versions we care about. That isn't the case, sadly.
Secondly, the new readpage code uses zero_user_segments, which has only
been available in the mainline kernel since 2.6.25 (RHEL5 appears to have
a backport)
Implement local wrappers for both of these functions when configure can't
find them in the kernel we're building for.
These functions have been created independently of the Linux tree.
page_offset is a copy of the code we used before we replaced it.
zero_user_segments() is a first-principles implementation
of the function (which zeros a pair of memory ranges within a single page)
FIXES 126678
Change-Id: I622aec4d653567d5234e7a127b981e97468bbe7c
Reviewed-on: http://gerrit.openafs.org/1525
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This helper has been deprecated for a while, and gets removed
with 2.6.34.
Replace it with invalidate_remote_inode, which has been around for
all of 2.6's life, according to Chaskiel in RT #124377.
Change-Id: I8658b454e1c997c041f654ba55d06f713ea25459
Reviewed-on: http://gerrit.openafs.org/1523
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Use krb5_get_error_message to translate krb5 errors to strings
in the afskfw library. This provides error translations to afscreds
and afslogon.dll.
LICENSE MIT
Change-Id: Idd4c15b3719be517a79947f6af52a4bdf50b1155
Reviewed-on: http://gerrit.openafs.org/1519
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Add krb5_get_error_message and krb5_free_error_message
to loadfuncs-krb5.h so that they can be used in conjunction
with LoadFuncs to obtain function pointers when available.
LICENSE MIT
Change-Id: Ice7c2f6384c480570fcec4810bd86f4d0c525227
Reviewed-on: http://gerrit.openafs.org/1517
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
When a re-initialization is taking place, be sure to reset
cm_noLocalMountPoints to 0 in case someone deletes the "Freelance"
registry key out from underneath the service.
LICENSE MIT
Change-Id: I2c3edd0d617d8fb7d670036510ca2a22eece0e6d
Reviewed-on: http://gerrit.openafs.org/1514
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Don't leak the GLOCK when we're iterating over the CellServDB in
response to a read of /proc/fs/openafs/CellServDB
Change-Id: I2ed08b9d7f93c7513b49708d009e8acaa478b5f8
Reviewed-on: http://gerrit.openafs.org/1522
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
make the launchd check run as root without whining about passwords
repeatedly
Change-Id: Ib4bac7c9ddf1837a8e86bf17a8a66b6ba1247272
Reviewed-on: http://gerrit.openafs.org/1511
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
make sure we really have a volid and avoid dereferencing tvp
if there's none
Change-Id: Iec6e7cba4d43e2d9c9af296bd6a1574e290bd118
Reviewed-on: http://gerrit.openafs.org/1512
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
on every other platform, we check for afs unmounted before allowing shutdown.
do the same here.
Change-Id: Ic8c287be3ae39ad2d2ecb633748813f7f07b16e3
Reviewed-on: http://gerrit.openafs.org/1507
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
existing mariner clients treat fetch$ and store$ special and otherwise
just blat out a string. use this to our advantage
Change-Id: Ib218918abe6038a08af58ea58405b2856ba1da9f
Reviewed-on: http://gerrit.openafs.org/1505
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
if a mariner message is passed in without a vcache, print it as-is
Change-Id: I1791102826db3cde484e0809ba79d54f22220be1
Reviewed-on: http://gerrit.openafs.org/1504
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
marinerlogfetching and marinerlog have a lot of code duplication.
fix that.
Change-Id: I52624ab8d1a6310c92a580990c45cc9313ea7a1c
Reviewed-on: http://gerrit.openafs.org/1503
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
sometime after afs 3.3, the mariner log "storing" message was
lost in code restructuring. restore it.
Change-Id: I7832718973bf6378e643aea5391a0fd4940b5d3f
Reviewed-on: http://gerrit.openafs.org/1502
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
put most printfs into either afs_warn or comment out entirely
move a couple uprintfs to afs_warnuser (and allow them to trigger on macos)
Change-Id: If67a09287fcfbe44cc76961dd59d2aad3299e887
Reviewed-on: http://gerrit.openafs.org/1501
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Eliminate a few duplicate targets in the tubik Makefile, and
clean up some dependencies that could cause the same source file
to be compiled by different threads simultaneously when building
in parallel. At least on my current gcc this would consistently
result in a gcc internal error.
The duplicate targets generate make warnings.
Change-Id: I807debae67c04b00a88ec798b966628e10c5f316
Reviewed-on: http://gerrit.openafs.org/1506
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
kill off the old k&r prototypes in osi_vfsops.c
Change-Id: Ifd9bb9bd7f303f0f05f0776bb94222c3b138e808
Reviewed-on: http://gerrit.openafs.org/1500
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>