14 int main(int argc, char *argv[])
16 char *sUsername, *sPassword;
26 sUsername = GetUsername();
27 sPassword = GetPassword();
28 } while( (uid = ValidateUser(sUsername, sPassword)) == -1 );
31 // Get user information
32 uinfo = GetUserInfo(uid);
34 // Create child process
35 pid = clone(CLONE_VM, 0);
38 fprintf(stderr, "Unable to fork the login process!\n");
42 // Spawn shell in a child process
45 char *argv[2] = {uinfo->Shell, 0};
50 execve(uinfo->Shell, argv, envp);
54 // Wait for child to terminate
55 waittid(pid, &status);
62 * \fn char *GetUsername()
74 while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
83 // Echo out to the screen
86 if(pos == BUFLEN-1) break;
97 * \fn char *GetPassword()
106 printf("Password: ");
109 while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
118 // Don't echo out to the screen
121 if(pos == BUFLEN-1) break;