14 int main(int argc, char *argv[])
16 char *sUsername, *sPassword;
23 printf("\x1B[2J"); // Clear Screen
26 if(uid == -1) printf("\n");
27 sUsername = GetUsername();
28 sPassword = GetPassword();
29 } while( (uid = ValidateUser(sUsername, sPassword)) == -1 );
32 // Create child process
33 pid = clone(CLONE_VM, 0);
36 fprintf(stderr, "Unable to fork the login process!\n");
40 // Spawn shell in a child process
43 char *child_argv[2] = {NULL, 0};
44 char **child_envp = NULL;
46 // Get user information
47 uinfo = GetUserInfo(uid);
49 child_argv[0] = uinfo->Shell;
54 execve(uinfo->Shell, child_argv, child_envp);
58 // Wait for child to terminate
59 waittid(pid, &status);
66 * \fn char *GetUsername()
78 while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
87 // Echo out to the screen
90 if(pos == BUFLEN-1) break;
101 * \fn char *GetPassword()
110 printf("Password: ");
113 while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
122 // Don't echo out to the screen
125 if(pos == BUFLEN-1) break;