1 /* This is a simple program which originally produced the KeyFile used
2 * by the test suite. The contents of that file shouldn't be regenerated,
3 * though, as the purpose of the tests using that file is to ensure that we
4 * can still read old KeyFiles.
9 #include <afs/cellconfig.h>
10 #include <afs/afsutil.h>
18 main(int argc, char **argv)
20 struct afsconf_dir *dir;
27 dirname = afstest_BuildTestConfig();
28 if (dirname == NULL) {
29 fprintf(stderr, "Unable to create tmp config dir\n");
33 dir = afsconf_Open(dirname);
35 fprintf(stderr, "Unable to open configuration directory\n");
39 afsconf_AddKey(dir, 1, "\x01\x02\x04\x08\x10\x20\x40\x80", 1);
40 afsconf_AddKey(dir, 2, "\x04\x04\x04\x04\x04\x04\x04\x04", 1);
41 afsconf_AddKey(dir, 4, "\x19\x16\xfe\xe6\xba\x77\x2f\xfd", 1);
45 /* Copy out the resulting keyfile into our homedirectory */
46 keyfile = afstest_asprintf("%s/KeyFile", dirname);
47 in = open(keyfile, O_RDONLY);
48 out = open("KeyFile", O_WRONLY | O_CREAT, 0644);
52 len = read(in, block, 1024);
54 if (write(out, block, len) != len) {
61 fprintf(stderr, "I/O error whilst copying file\n");
68 afstest_UnlinkTestConfig(dirname);