X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=Usermode%2FApplications%2Flogin_src%2Fmain.c;h=e859bfeb1b1d9ca703245088f4ba70c74ad185bc;hb=a897ce08ed162eff3e06db533c490c4dd5b23e54;hp=391d5bccfacfa5443aa306249f02bd79a19af89a;hpb=95a7eaaa4a1065334125b65130866f8d1048ddb7;p=tpg%2Facess2.git diff --git a/Usermode/Applications/login_src/main.c b/Usermode/Applications/login_src/main.c index 391d5bcc..e859bfeb 100644 --- a/Usermode/Applications/login_src/main.c +++ b/Usermode/Applications/login_src/main.c @@ -17,10 +17,12 @@ int main(int argc, char *argv[]) int pid, uid = 0; int status = 0; tUserInfo *uinfo; - + + printf("\x1B[?25h"); // Re-enable the cursor +// printf("\x1B[2J"); // Clear Screen + for(;;) { - printf("\x1B[2J"); // Clear Screen // Validate User for(;;) { @@ -28,7 +30,7 @@ int main(int argc, char *argv[]) sPassword = GetPassword(); if( (uid = ValidateUser(sUsername, sPassword)) == -1 ) { - printf("\nInvalid username or password for '%s'\n", sUsername); + printf("\nInvalid username or password\n"); free(sUsername); free(sPassword); } @@ -57,7 +59,8 @@ int main(int argc, char *argv[]) child_argv[0] = uinfo->Shell; // Set Environment setgid(uinfo->GID); - setuid(uid); + //setuid(uid); + setuid(uinfo->UID); execve(uinfo->Shell, child_argv, child_envp); exit(-1); @@ -86,6 +89,7 @@ char *GetUsername() while( (ch = fgetc(stdin)) != -1 && ch != '\n' ) { if(ch == '\b') { + if( pos <= 0 ) continue; pos --; ret[pos] = '\0'; } @@ -121,6 +125,7 @@ char *GetPassword() while( (ch = fgetc(stdin)) != -1 && ch != '\n' ) { if(ch == '\b') { + if( pos <= 0 ) continue; pos --; ret[pos] = '\0'; }