git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Usermode - Starting on a text editor
[tpg/acess2.git]
/
Usermode
/
Applications
/
login_src
/
main.c
diff --git
a/Usermode/Applications/login_src/main.c
b/Usermode/Applications/login_src/main.c
index
2866dbd
..
8774298
100644
(file)
--- a/
Usermode/Applications/login_src/main.c
+++ b/
Usermode/Applications/login_src/main.c
@@
-18,9
+18,10
@@
int main(int argc, char *argv[])
int status = 0;
tUserInfo *uinfo;
int status = 0;
tUserInfo *uinfo;
+ printf("\x1B[2J"); // Clear Screen
+
for(;;)
{
for(;;)
{
- printf("\x1B[2J"); // Clear Screen
// Validate User
for(;;)
{
// Validate User
for(;;)
{
@@
-28,7
+29,7
@@
int main(int argc, char *argv[])
sPassword = GetPassword();
if( (uid = ValidateUser(sUsername, sPassword)) == -1 )
{
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);
}
free(sUsername);
free(sPassword);
}
@@
-45,6
+46,8
@@
int main(int argc, char *argv[])
return -1;
}
return -1;
}
+ printf("pid = %i\n", pid);
+
// Spawn shell in a child process
if(pid == 0)
{
// Spawn shell in a child process
if(pid == 0)
{
@@
-87,6
+90,7
@@
char *GetUsername()
while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
{
if(ch == '\b') {
while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
{
if(ch == '\b') {
+ if( pos <= 0 ) continue;
pos --;
ret[pos] = '\0';
}
pos --;
ret[pos] = '\0';
}
@@
-122,6
+126,7
@@
char *GetPassword()
while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
{
if(ch == '\b') {
while( (ch = fgetc(stdin)) != -1 && ch != '\n' )
{
if(ch == '\b') {
+ if( pos <= 0 ) continue;
pos --;
ret[pos] = '\0';
}
pos --;
ret[pos] = '\0';
}
UCC
git Repository :: git.ucc.asn.au