//This program compiled and ran until I put /*******/ on top of some words // Login a user and ask for a change of password #include #include #include #include #include "SecureBuffer.h" using namespace std; int main(int argc, char * argv[]) { try{ if(argc !=1 ) { cerr <<"Usage: use\n"; exit(1); } Buffer id; SecureBuffer password; bool authenticated=false; fstream passwd("passwd", ios::in | ios::out); const int record_size= sizeof(Buffer)+sizeof(SecureBuffer); // Format of "passwd" is in list.cpp. File= record* blank*. // record=Buffer SecureBuffer. if(!passwd) { throw runtime_error("File passwd can not be opened\n"); } int number_of_recs; passwd.seekp(0, ios::end); number_of_recs=passwd.tellp()/record_size ; Buffer file_id; Buffer blank;// deleted data SecureBuffer file_password; int attempt=0; streampos user_position; while(not authenticated) { cout << "Input your user name: "; cin >> id; cout << "Input your password: "; cin >> password; password.encrypt(id); attempt++; // find id in file int record_number; for(record_number=0; record_number10)) throw runtime_error("Attacking Hacker"); }//end while not authenticated cout << "Welcome "<< id << endl; // cerr << "user number " << user_position <> password; password.encrypt(id); // cerr << "Write "<< password<< " at "<< user_position + sizeof(id)<