=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tcfs/Attic/tcfsrmuser.c,v retrieving revision 1.4 retrieving revision 1.5 diff -c -r1.4 -r1.5 *** src/usr.bin/tcfs/Attic/tcfsrmuser.c 2000/06/19 20:35:48 1.4 --- src/usr.bin/tcfs/Attic/tcfsrmuser.c 2000/06/19 22:42:29 1.5 *************** *** 1,4 **** ! /* $OpenBSD: tcfsrmuser.c,v 1.4 2000/06/19 20:35:48 fgsch Exp $ */ /* * Transparent Cryptographic File System (TCFS) for NetBSD --- 1,4 ---- ! /* $OpenBSD: tcfsrmuser.c,v 1.5 2000/06/19 22:42:29 aaron Exp $ */ /* * Transparent Cryptographic File System (TCFS) for NetBSD *************** *** 31,37 **** -v Makes the output a little more verbose\n"; int ! rmuser_main (int argn, char *argv[]) { int have_user = FALSE; int be_verbose = FALSE; --- 31,37 ---- -v Makes the output a little more verbose\n"; int ! rmuser_main(int argn, char *argv[]) { int have_user = FALSE; int be_verbose = FALSE; *************** *** 43,75 **** * Going to check the arguments */ ! if ((user = (char *) malloc(LOGIN_NAME_MAX + 1)) == NULL) err(1, NULL); ! while ((val=getopt (argn, argv, "l:hv"))!=EOF) switch (val) { ! case 'l': ! strlcpy (user, optarg, LOGIN_NAME_MAX + 1); ! have_user = TRUE; ! break; ! ! case 'h': ! show_usage (rmuser_usage, argv[0]); ! exit (OK); ! break; ! ! case 'v': ! be_verbose = TRUE; ! break; ! ! default: ! fprintf (stderr, "Try %s --help for more information.\n", argv[0]); ! exit (ER_UNKOPT); ! break; } ! if (argn-optind) ! tcfs_error (ER_UNKOPT, NULL); /* * Here we don't have to drop root privileges because only root --- 43,72 ---- * Going to check the arguments */ ! if ((user = (char *)malloc(LOGIN_NAME_MAX + 1)) == NULL) err(1, NULL); ! while ((val = getopt(argn, argv, "l:hv")) != EOF) switch (val) { ! case 'l': ! strlcpy(user, optarg, LOGIN_NAME_MAX + 1); ! have_user = TRUE; ! break; ! case 'h': ! show_usage(rmuser_usage, argv[0]); ! exit(OK); ! break; ! case 'v': ! be_verbose = TRUE; ! break; ! default: ! fprintf(stderr, "Try %s --help for more information.\n", argv[0]); ! exit(ER_UNKOPT); ! break; } ! if (argn - optind) ! tcfs_error(ER_UNKOPT, NULL); /* * Here we don't have to drop root privileges because only root *************** *** 79,109 **** if (!have_user) { int len; ! printf ("Username to remove from TCFS database: "); ! fgets (user, LOGIN_NAME_MAX + 1, stdin); len = strlen(user) - 2; if (len < 0) ! exit (1); user[len] = user[len] == '\n' ? 0 : user[len]; } if (be_verbose) ! printf ("Deleting the entry for user %s from the TCFS database...\n", user); /* * Deleting an entry from the key database */ ! if (!tcfspwdbr_new (&user_info)) ! tcfs_error (ER_MEM, NULL); ! if (!tcfspwdbr_edit (&user_info, F_USR, user)) ! tcfs_error (ER_MEM, NULL); ! if (!tcfs_putpwnam (user, user_info, U_DEL)) ! tcfs_error (ER_CUSTOM, "Error: cannot remove user."); if (be_verbose) ! printf ("User entry removed with success.\n"); ! tcfs_error (OK, NULL); } --- 76,106 ---- if (!have_user) { int len; ! printf("Username to remove from TCFS database: "); ! fgets(user, LOGIN_NAME_MAX + 1, stdin); len = strlen(user) - 2; if (len < 0) ! exit(1); user[len] = user[len] == '\n' ? 0 : user[len]; } if (be_verbose) ! printf("Deleting the entry for user %s from the TCFS database...\n", user); /* * Deleting an entry from the key database */ ! if (!tcfspwdbr_new(&user_info)) ! tcfs_error(ER_MEM, NULL); ! if (!tcfspwdbr_edit(&user_info, F_USR, user)) ! tcfs_error(ER_MEM, NULL); ! if (!tcfs_putpwnam(user, user_info, U_DEL)) ! tcfs_error(ER_CUSTOM, "Error: cannot remove user."); if (be_verbose) ! printf("User entry removed with success.\n"); ! tcfs_error(OK, NULL); }