diff --git a/src/bin/login/main.c b/src/bin/login/main.c index 9055f3f..d703d4e 100644 --- a/src/bin/login/main.c +++ b/src/bin/login/main.c @@ -76,6 +76,7 @@ exit(0x1); } + fd = fopen("sys:/userdb","r"); if (fd->fd == 0x0) { printf("file not found!!!\n"); @@ -87,10 +88,11 @@ memcpy(data[0].username,"root",4); memcpy(data[0].password,"user",4); memcpy(data[0].shell,"sys:/shell", 10); - */ - +*/ fread(data,0x1000,0x1,fd); fclose(fd); + + if ((data2 = (char *)malloc(384)) == 0x0) { printf("Malloc Failed\n"); @@ -99,18 +101,54 @@ /* we need to move this into the libc for getpwent(), etc */ - foo = auth("root", "user"); - if(foo != -1) - printf("yay\n"); - else - printf("damn\n"); - login: printf("\nUbixOS/IA-32 (devel.ubixos.com) (console)"); printf("\n\nLogin: "); gets((char *)&userName); printf("Password: "); pgets((char *)&passWord); + +if(auth(userName, passWord) != -1) +{ + shellPid = fork(); + if (shellPid == 0x0) + { + if (setuid(data[i].uid) != 0x0) + printf("Set UID Failed\n"); + if (setgid(data[i].gid) != 0x0) + printf("Set GID Failed\n"); + if ((fd = fopen("sys:/motd","r")) == 0x0) + printf("No MOTD"); + else { + fread(data2,384,1,fd); + printf("%s\n",data2); + fclose(fd); + //chdir(data[i].path); + chdir("sys:/"); + exec(data[i].shell,0x0,0x0); + printf("Error: Problem Starting Shell\n"); + exit(-1); + } + } + else + while (pidStatus(shellPid) > 0) { + sched_yield(); + } + + } + else + { + printf("Incorrect Login\n"); + goto login; +} + +return 0x0; + +} + + + +/* for (i=0x0;i<(4096/sizeof(struct passwd));i++) { if (0x0 == strcmp(userName,data[i].username)) { if (0x0 == strcmp(passWord,data[i].password)) { @@ -148,5 +186,6 @@ printf("Login Incorrect!\n"); goto login; return(0x0); - } + +*/ diff --git a/src/bin/ls/main.c b/src/bin/ls/main.c index 861eca8..cdfd2b3 100644 --- a/src/bin/ls/main.c +++ b/src/bin/ls/main.c @@ -120,7 +120,7 @@ if ((tmpPerms & permWrite) == permWrite) permsData[10] = 'W'; if ((tmpPerms & permExecute) == permExecute) permsData[11] = 'E'; if ((tmpPerms & permHidden) == permHidden) permsData[12] = 'H'; - printf("%s %i %i %i %s\n",permsData,(int)dirEntry[i].uid,(int)dirEntry[i].gid,(int)dirEntry[i].size,dirEntry[i].fileName); + printf("%s %i %i %i\t%s\n",permsData,(int)dirEntry[i].uid,(int)dirEntry[i].gid,(int)dirEntry[i].size,dirEntry[i].fileName); next: asm("nop"); }