=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tcfs/Attic/tcfsadduser.c,v retrieving revision 1.3 retrieving revision 1.4 diff -c -r1.3 -r1.4 *** src/usr.bin/tcfs/Attic/tcfsadduser.c 2000/06/19 21:31:30 1.3 --- src/usr.bin/tcfs/Attic/tcfsadduser.c 2000/06/19 22:42:28 1.4 *************** *** 1,4 **** ! /* $OpenBSD: tcfsadduser.c,v 1.3 2000/06/19 21:31:30 fgsch Exp $ */ /* * Transparent Cryptographic File System (TCFS) for NetBSD --- 1,4 ---- ! /* $OpenBSD: tcfsadduser.c,v 1.4 2000/06/19 22:42:28 aaron Exp $ */ /* * Transparent Cryptographic File System (TCFS) for NetBSD *************** *** 31,37 **** -v Makes the output a little more verbose\n"; int ! adduser_main (int argn, char *argv[]) { char val; int have_user = FALSE, be_verbose = FALSE; --- 31,37 ---- -v Makes the output a little more verbose\n"; int ! adduser_main(int argn, char *argv[]) { char val; int have_user = FALSE, be_verbose = FALSE; *************** *** 44,69 **** while ((val = getopt(argn, argv, "g:l:hv"))!=EOF) switch (val) { case 'l': ! strlcpy (user, optarg, sizeof(user)); have_user = 1; break; case 'h': ! show_usage (adduser_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 --- 44,69 ---- while ((val = getopt(argn, argv, "g:l:hv"))!=EOF) switch (val) { case 'l': ! strlcpy(user, optarg, sizeof(user)); have_user = 1; break; case 'h': ! show_usage(adduser_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 *************** *** 71,98 **** * However we can do better. Maybe in next versions. */ if (!have_user) { ! printf ("Username to add to TCFS database: "); ! fgets (user, sizeof(user), stdin); ! user[strlen(user)-1] = '\0'; } if (be_verbose) ! printf ("Creating a new entry for user %s in the TCFS database...\n", user); /* * Creating a new entry into 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_NEW)) ! tcfs_error (ER_CUSTOM, "Error: cannot add user."); if (be_verbose) ! printf ("User entry created with success.\n"); ! tcfs_error (OK, NULL); } --- 71,98 ---- * However we can do better. Maybe in next versions. */ if (!have_user) { ! printf("Username to add to TCFS database: "); ! fgets(user, sizeof(user), stdin); ! user[strlen(user) - 1] = '\0'; } if (be_verbose) ! printf("Creating a new entry for user %s in the TCFS database...\n", user); /* * Creating a new entry into 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_NEW)) ! tcfs_error(ER_CUSTOM, "Error: cannot add user."); if (be_verbose) ! printf("User entry created with success.\n"); ! tcfs_error(OK, NULL); }