summaryrefslogtreecommitdiff
path: root/usr.bin/tcfs/tcfsgenkey.c
diff options
context:
space:
mode:
authorAaron Campbell <aaron@cvs.openbsd.org>2000-06-19 22:42:30 +0000
committerAaron Campbell <aaron@cvs.openbsd.org>2000-06-19 22:42:30 +0000
commit86c00b230b2edb5f31c3feff302c91fb0000bf26 (patch)
tree5ef86a945bb5ac53b3fcf29334cfaa7539d48fe5 /usr.bin/tcfs/tcfsgenkey.c
parent1abef89558453935167b734f3edda32d8a73ab1a (diff)
KNF
Diffstat (limited to 'usr.bin/tcfs/tcfsgenkey.c')
-rw-r--r--usr.bin/tcfs/tcfsgenkey.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/usr.bin/tcfs/tcfsgenkey.c b/usr.bin/tcfs/tcfsgenkey.c
index 19132a7509b..a244b17f150 100644
--- a/usr.bin/tcfs/tcfsgenkey.c
+++ b/usr.bin/tcfs/tcfsgenkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcfsgenkey.c,v 1.5 2000/06/19 20:35:48 fgsch Exp $ */
+/* $OpenBSD: tcfsgenkey.c,v 1.6 2000/06/19 22:42:28 aaron Exp $ */
/*
* Transparent Cryptographic File System (TCFS) for NetBSD
@@ -26,7 +26,7 @@ Generate a TCFS key adding it to the user entry into the TCFS database.
-h Shows this help\n";
int
-genkey_main (int argn, char *argv[])
+genkey_main(int argn, char *argv[])
{
int val;
char *user, *passwd;
@@ -41,67 +41,67 @@ genkey_main (int argn, char *argv[])
switch (val) {
case 'h':
show_usage(genkey_usage, argv[0]);
- exit (OK);
+ exit(OK);
break; /* Useless code */
default:
- fprintf (stderr, "Try %s --help for more information.\n", argv[0]);
- exit (ER_UNKOPT);
+ fprintf(stderr, "Try %s --help for more information.\n", argv[0]);
+ exit(ER_UNKOPT);
break;
}
if (argn - optind)
- tcfs_error (ER_UNKOPT, NULL);
+ tcfs_error(ER_UNKOPT, NULL);
/*
* Must be root to do all this stuff
*/
if (geteuid())
- tcfs_error (ER_CUSTOM, "I don't have root privileges!");
+ tcfs_error(ER_CUSTOM, "I don't have root privileges!");
/*
* Authenticate user
*/
- if (!unix_auth (&user, &passwd, TRUE))
- tcfs_error (ER_CUSTOM, "Who are you?!");
+ if (!unix_auth(&user, &passwd, TRUE))
+ tcfs_error(ER_CUSTOM, "Who are you?!");
- if (!tcfs_getpwnam (user, &user_info))
- tcfs_error (ER_CUSTOM, "You do not have an entry in the TCFS key database.");
+ if (!tcfs_getpwnam(user, &user_info))
+ tcfs_error(ER_CUSTOM, "You do not have an entry in the TCFS key database.");
if (strlen(user_info->upw))
- tcfs_error (ER_CUSTOM,"You already have a TCFS key.");
+ tcfs_error(ER_CUSTOM, "You already have a TCFS key.");
/*
* Generate a new key for the user.
*/
- newkey = gentcfskey ();
+ newkey = gentcfskey();
/*
* Encrypt the generated key with user password
*/
cryptedkey = (char*)calloc(UUKEYSIZE + 1, sizeof(char));
if (!cryptedkey)
- tcfs_error (ER_MEM, NULL);
+ tcfs_error(ER_MEM, NULL);
- if (!tcfs_encrypt_key (passwd, newkey, KEYSIZE, cryptedkey, UUKEYSIZE + 1))
- tcfs_error (ER_MEM, NULL);
+ if (!tcfs_encrypt_key(passwd, newkey, KEYSIZE, cryptedkey, UUKEYSIZE + 1))
+ tcfs_error(ER_MEM, NULL);
/*
* Update TCFS key database
*/
- if (!tcfspwdbr_new (&userinfo))
- tcfs_error (ER_MEM, NULL);
+ if (!tcfspwdbr_new(&userinfo))
+ tcfs_error(ER_MEM, NULL);
- if (!tcfspwdbr_edit (&userinfo, F_USR|F_PWD, user, cryptedkey))
- tcfs_error (ER_MEM, NULL);
+ if (!tcfspwdbr_edit(&userinfo, F_USR|F_PWD, user, cryptedkey))
+ tcfs_error(ER_MEM, NULL);
/* TODO:
- if (!change && tcfs_getpwnam (user, &userinfo))
- tcfs_error (ER_CUSTOM, "Use -c to change the key.");
+ if (!change && tcfs_getpwnam(user, &userinfo))
+ tcfs_error(ER_CUSTOM, "Use -c to change the key.");
*/
- if (!tcfs_putpwnam (user, userinfo, U_CHG))
- tcfs_error (ER_CUSTOM, "Error: cannot generate key.");
+ if (!tcfs_putpwnam(user, userinfo, U_CHG))
+ tcfs_error(ER_CUSTOM, "Error: cannot generate key.");
- tcfs_error (ER_CUSTOM, "\nKey succesfully generated.");
+ tcfs_error(ER_CUSTOM, "\nKey succesfully generated.");
}