diff options
author | Serge E. Hallyn <serue@us.ibm.com> | 2009-09-16 16:27:41 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-10-09 13:47:24 -0700 |
commit | a8ba8bffbe1f3f8b3450d294b9e68d299b158209 (patch) | |
tree | 39d0dda740dd5dd97fece54db16600bffc60bb6f /fs | |
parent | 3d14b518481eb1fa10c6f6ef9efd5f4cc0f84b28 (diff) | |
download | kernel_samsung_aries-a8ba8bffbe1f3f8b3450d294b9e68d299b158209.zip kernel_samsung_aries-a8ba8bffbe1f3f8b3450d294b9e68d299b158209.tar.gz kernel_samsung_aries-a8ba8bffbe1f3f8b3450d294b9e68d299b158209.tar.bz2 |
Staging: p9auth: a few fixes
1. The memory into which we copy 'u1@u2' needs space for u1, @,
u2, and a final \0 which strcat copies in.
2. Strsep changes the value of its first argument. So use a
temporary variable to pass to it, so we pass the original
value to kfree!
3. Allocate an extra char to user_buf, because we need a trailing \0
since we later kstrdup it.
I am about to send out an LTP testcase for this driver, but
in addition the correctness of the hashing can be verified as
follows:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
char in[41], out[20];
unsigned int v;
int i, ret;
ret = read(STDIN_FILENO, in, 40);
if (ret != 40)
exit(1);
in[40] = '\0';
for (i = 0; i < 20; i++) {
sscanf(&in[2*i], "%02x", &v);
out[i] = v;
}
write(STDOUT_FILENO, out, 20);
}
as root, to test userid 501 switching to uid 0, choosing
'random' string 'ab':
echo -n "501@0" > plain
openssl sha1 -hmac 'ab' plain |awk '{ print $2 '} > dgst
./unhex < dgst > dgst.u
mknod /dev/caphash 504 0
mknod /dev/capuse 504 1
chmod ugo+w /dev/capuse
cat dgst.u > /dev/caphash
as uid 501,
echo "501@0@ab" > /dev/capuse
id -u # should now show 0.
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
0 files changed, 0 insertions, 0 deletions