Add some tests for the command library to the integrated test
suite in tests. These are far from complete, and are mainly there
to ensure that we don't break any of this functionality when modifying
the library.
Change-Id: Ib6fbdca114c005c32c5ba8c41f9e350ca67e1fb8
Reviewed-on: http://gerrit.openafs.org/4538
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Make the original, command line driven, test suite build again
Change-Id: I57f0ebb5b1d13acf0809c7fa005e3556e3edb798
Reviewed-on: http://gerrit.openafs.org/4537
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
In some code branches, the PAM code "torches" a password by zeroing
it. However, it does this through a const pointer which we otherwise
know is not actually const. Make sure we get better type checking by
doing this through a non-const pointer.
Change-Id: Ibdb4c7b98baf964a8efdf0e8a9882f8ab29e22af
Reviewed-on: http://gerrit.openafs.org/4554
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
afs_setcred.c gets the "password" pointer from pam_get_data, which
always gives a const pointer (unlike pam_get_item used in afs_auth.c
&c, which sometimes gives a const or not-const pointer, depending on
the PAM implementation).
So, declare password const, to get better type checking.
Change-Id: Ic34ffa54bf0bcc19c8ed3cddc9ee1384ee2dd8f0
Reviewed-on: http://gerrit.openafs.org/4553
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
When calling KFW_AFS_get_cred() from NPLogonNotify()
always provide the user password. Do not count on a
credential cache existing from a previous call.
Change-Id: Ie94229a5b708ced2c3965f7bb333a67ee4d629d5
Reviewed-on: http://gerrit.openafs.org/4557
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Commit 78d1f8d8 expanded the use of PAM_CONST and introduced many
new warnings on Linux where pam expects "const" arguments.
This clears up the warnings by doing the following:
- Cast "user" to char * when kalling ka* functions
- Change the signature of pam_afs_prompt and pam_afs_printf to use
PAM_CONST
- Use a separate non-const password pointer for pam_afs_prompt
Change-Id: I460e1d1ca763f0aea5edcdaa208b9d4b8299ded0
Reviewed-on: http://gerrit.openafs.org/4487
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
With commit a309e27463, we changed the
number of CBRs that we allocate in a chunk from 300 to 1024. However,
this change takes the amount of memory requried to allocate a chunk
of CBRs above PAGE_SIZE on Linux. This changes the allocator that we
use from kmalloc to vmalloc. Whilst we can, and do, prevent kmalloc
from flushing filesystem pages when we invoke it, we don't have a
similar level of control over vmalloc.
In one reported case, clients deadlock whilst attempting to allocate
this memory, in a call stack that looks something like:
afs_Daemon -> afs_ShakeLooseVCaches -> osi_TryEvictVCache
-> afs_FlushVCache -> afs_QueueVCB -> afs_AllocCBR
-> osi_linux_alloc -> ... -> __vmalloc_node -> ...
-> try_to_free_pages
This is probably because we end up deadlocking in the writeback
invoked by try_to_free_pages, likely due to locks which are held
by ShakeLooseVCaches.
As a quick fix for the problem, make sure that the memory we
allocate always fits within a page, so we always use kmalloc for
it.
FIXES 129751
Change-Id: I8b5be06ed62764b67f99792df66e9cb0f8941fd6
Reviewed-on: http://gerrit.openafs.org/4510
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
h_Enumerate and h_Enumerate_r were not releasing all of the holds they
obtained when the callback function caused the enumeration to bail
early. Correct them so all host holds are released.
Change-Id: I6f405fad3d2767c9e0b3567c40cbbd1de8ac26aa
Reviewed-on: http://gerrit.openafs.org/4530
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
We should never get a deleted client back from GetClient. Log a
message if we do, to explain why access may suddenly appear to fail,
and assist in determining why.
Note that we still try to service the request, since the accessing
user may still have enough access to do whatever was requested.
Change-Id: Ie1d0c2d8a33a68a760704bfff9f268c6c507118f
Reviewed-on: http://gerrit.openafs.org/4529
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Make sure that the callback functions for h_Enumerate and
h_Enumerate_r give us back valid flags values by aborting if they
return an invalid value.
Change-Id: Id34b461d5452ac318a1714b6c3ffdaf41015995c
Reviewed-on: http://gerrit.openafs.org/4528
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Do not give uninitialized flags values to h_Enumerate callback
functions. In fact, do not give a flags value to h_Enumerate or
h_Enumerate_r callback functions at all, since they are not actually
used.
Fix host enumeration callback functions to just return 0 or the
relevant flags, instead of basing the return value off of the given
flags value. Update MultiBreakVolumeCallBack_r to use the correct
return values, since it currently tries to use the old meanings of the
host enumeration return values.
FIXES 129376
Change-Id: Ibb01ce62411602a9f83f437125fb87a7a84160b4
Reviewed-on: http://gerrit.openafs.org/4527
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
On Darwin, net/if.h is only usable if sys/socket.h is included first.
Do so, to stop autoconf from warning about this test.
Change-Id: I9e7a2642cce86c5ad6ebb3ae3cb60401dd9c26cf
Reviewed-on: http://gerrit.openafs.org/4535
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The 'Streamfiles.txt' file had been committed with both that name,
and an all lower case name. This makes git very sad on systems with
case insensitive filenames.
Change-Id: I0284415649d7568f9834ccd4d2c6a1627d309fed
Reviewed-on: http://gerrit.openafs.org/4550
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This reverts commit 65186d8390, which
was mistakenly merged to the wrong branch.
Change-Id: I3b2bf874cca15b4248978575213eae21ece2207f
Reviewed-on: http://gerrit.openafs.org/4519
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Always set the *primary flag to something in _settok_tokenCell.
Otherwise, the lag may be unset, as it is not required to be
initialized by all callers.
Change-Id: I78c775f8cd70f74f6a344094a6a677cbc74f3281
Reviewed-on: http://gerrit.openafs.org/4521
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
In cm_ReadMountPoint and cm_HandleLink the variable 'thyper'
represets the 'offset' at which cm_GetData should fetch data.
Rename 'thyper' to 'offset' and fix a coding error caused by
misinterpreting the variable purpose.
Change-Id: If60669d850f4bfba2aae6e4aaf642f7ec6f920b2
Reviewed-on: http://gerrit.openafs.org/4501
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
We weren't actually returning a token and username from
rxkad_get_converted_token. Do so.
This is a 1.6-specific change. This issue was fixed on master when
aklog was changed to use the new SetTokenEx family of pioctls in
commit 53837416cb.
Change-Id: I4c85c03be00c45fdae5657554dcd85b3a6301b23
Reviewed-on: http://gerrit.openafs.org/4513
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
use the relative path for afsio.c
use objdir path for generated files
Change-Id: I3b16108eacd949bcb1ddc2224961e87bce9999bb
Reviewed-on: http://gerrit.openafs.org/4508
Reviewed-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
Tested-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Rearrange the Makefile to make it more parallel build proof.
Add some dependencies on the header files, and avoid rules
with 2 targets.
Change-Id: I267f25504137d58dd1a335eccb7c9b138a7c66ab
Reviewed-on: http://gerrit.openafs.org/4497
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The file src/packaging/FreeBSD/Makefile is part of the repository,
and so shouldn't be excluded by .gitignore (the exclusion is inherited
from the top level). So, restore it with .gitignore in this directory.
Change-Id: I841e67aba707fd7193ba0d15a11f969ffd55829c
Reviewed-on: http://gerrit.openafs.org/4495
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
add support for locking as well as for tracking callbacks so a
lock break can be detected
Change-Id: Iff36c6528fc55cf250bc27d49af80123d7ecece3
Reviewed-on: http://gerrit.openafs.org/4476
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
cm_GetData() drops the cm_scache_t rw lock which permits other
threads to access the data while it is in an inconsistent state.
Avoid the race by using a stack allocated temporary buffer to
receive the data from cm_GetData(). Only copy the data into
the mountPointStringp buffer under the rwlock.
Change-Id: Ica853976b1094be1087e49c22d878f8ae7fca03a
Reviewed-on: http://gerrit.openafs.org/4498
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This makes afsdump_scan get the ACLs right on little endian systems.
It also corrects and slightly beautifies some output (indentation,
cut&paste error for negative ACL label).
Change-Id: I5a120630158e56fe8b55500ff9db70dded5fe0d9
Reviewed-on: http://gerrit.openafs.org/4494
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
and probably more than just these but let's start here.
Change-Id: Id0f174a84ecb8ffd1fbdcade6f139fc78c4b99e2
Reviewed-on: http://gerrit.openafs.org/4492
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
The flags that token_extractRxkad returns are flags that are passed to
ktc_SetToken, not the flags that are passed directly to the PSetTokens
pioctl. So, we should be setting AFS_SETTOK_SETPAG, which is
interpreted by ktc_SetToken.
Change-Id: Id63ba4d5874e43c8d1f02817bf33975516a974be
Reviewed-on: http://gerrit.openafs.org/4480
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
get the correct afs principal. this entire blob will go away
and be replaced by rxgk token getting, but deal for now.
Change-Id: I8e63a5de74efa6c2eeec4c67b4d14d1f69396e41
Reviewed-on: http://gerrit.openafs.org/4475
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The afs_write() code for memory and disk cache suffered from exactly
the same duplication problems as the afs_read() code.
Apply a similar fix - unify afs_UFSWrite and afs_MemWrite into a single
afs_write function, place the UFS specific code into afs_UFSWriteUIO,
and make use of the existing afs_MemWriteUIO for the memcache case.
Change-Id: I074e1f56597e5cf04d13a45bcda5ad5fedb6377f
Reviewed-on: http://gerrit.openafs.org/4465
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
afsio is a utility for file transfer to and from AFS file space
without the help of the AFS client/cache manager. Using libafscp,
this (partially rewritten) version of afsio is able to accomplish
(1) authenticated access to an AFS path or FID (an existing
KerberosV ticket is required), (2) fall back on unauthenticated
("anonymous") access if authentication (token acquisition) fails,
and (3) work independtly of the AFS cache manager (afsd need not
be running, though CellServDB and ThisCell are currently required).
issues:
1) libvldbint and libafsint are not compiled pthreaded. we link in
what we need. this should be changed when we are all-pthreaded.
2) venus is not a pthreaded-directory otherwise. same deal:
in an all-pthreaded universe, undo the bodge that we do here.
3) venus is not an all-krb5 directory either. slight ick.
Change-Id: I946e6eef58ac77c6fb97be256c4c564188201262
Reviewed-on: http://gerrit.openafs.org/4381
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Remove the osi_alloccnt and osi_allocsize counters, and the associated
osi_alloc_mutex. These counters are pretty useless since nothing looks
at them, and their use of a mutex requires Rx to be initialized before
XDR can be used. Removing them lifts this restriction.
Change-Id: I22fa1335b6d34675d37cca41a2c393b9c20d3d24
Reviewed-on: http://gerrit.openafs.org/4478
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
When we use cmp to determine whether to replace
AFS_component_version_number.c, suppress stderr in addition to stdout,
to slightly reduce output during the build.
Change-Id: I4f687ce5ffff316d8f9806181bccf1c28d218932
Reviewed-on: http://gerrit.openafs.org/4471
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
On AIX 5.1 and later, we set a process' PAG by using the AIX PAG
mechanism (and not by group ids), but we were determining what PAG a
process was in by the group list. Instead use the PAG identifier.
This effectively reverts 277c37f48c, but
it puts the kcred_getpag call in a different place that makes more
sense in the current PAG code organization.
Change-Id: If9fe621060a06664718a00acff91dea66760d5c2
Reviewed-on: http://gerrit.openafs.org/4479
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Make function definitions consistent with the formatting in the rest
of the tree.
Change-Id: Ifbccc02739f6fbc111e061397538a903b6f2289a
Reviewed-on: http://gerrit.openafs.org/4477
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Some callers of pam_get_item et al were just casting their argument to
a const void **. Some PAM implementations (Linux) want a const void**,
but others (Solaris) do not. Use the PAM_CONST symbol already defined
by autoconf to declare or cast the relevant variable const or not as
appropriate.
Change-Id: I81c7863797396eb146b78ffbb2586e4f3a1e854e
Reviewed-on: http://gerrit.openafs.org/4470
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
The POSIX getpwnam_r can yield a NULL struct passwd pointer even when
the returned error code is 0 (in particular, when the requested entry
is not found). Just add a check for a null upwd to make sure we don't
dereference a NULL pointer.
Change-Id: I00e8d6c53e8228f468c984010695b798f5dcf999
Reviewed-on: http://gerrit.openafs.org/4469
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
_POSIX_PTHREAD_SEMANTICS is now always defined for Solaris, which
means we get a POSIX-conforming getpwnam_r, which takes 5 arguments.
So, add Solaris to the list of platforms that use a POSIX getpwnam_r.
Change-Id: I1ad12420f56cf39816d94a8e9c9740436100134b
Reviewed-on: http://gerrit.openafs.org/4468
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Including roken.h in vfsck sources pulls in some more modern headers
that vfsck code isn't used to. Accommodate:
- Prevent roken.h from pulling in dirent.h so we don't conflict with
the old-style directory defines for HP-UX. Also move the inclusion
of the old-style directory defines to before roken.h, so we have
the directory types defined in roken.h.
- Remove some prototypes so the don't conflict with the prototypes in
system headers.
- Remove a couple of bizarre vprintf invocations, as they conflict
with the actual vprintf definitions.
Change-Id: Ifd7cd2544e75ed49b93ab491c4acadcb18528315
Reviewed-on: http://gerrit.openafs.org/4472
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>