diff --git a/src/bin/login/main.c b/src/bin/login/main.c index eca3f00..9055f3f 100644 --- a/src/bin/login/main.c +++ b/src/bin/login/main.c @@ -59,14 +59,13 @@ int main() { FILE *fd; int shellPid = 0,i = 0x0; - char username[10]; - char password[10]; char userName[32]; char passWord[32]; char *data2 = 0x0; struct passwd *data = 0x0; -username[0] = 'c'; -password[0] = 'f'; + int foo; + + if ((getuid() != 0x0) && (getgid() != 0x0)) { printf("This Application Must Be Run As Root.\n"); @@ -100,10 +99,11 @@ /* we need to move this into the libc for getpwent(), etc */ -asm volatile( - "int %0\n" - : : "i" (0x80), "a" (35), "b" (username), "c" (password) - ); + foo = auth("root", "user"); + if(foo != -1) + printf("yay\n"); + else + printf("damn\n"); login: printf("\nUbixOS/IA-32 (devel.ubixos.com) (console)"); diff --git a/src/lib/libc_old/sys/Makefile b/src/lib/libc_old/sys/Makefile index 349709e..27622ec 100644 --- a/src/lib/libc_old/sys/Makefile +++ b/src/lib/libc_old/sys/Makefile @@ -6,7 +6,7 @@ include ../../Makefile.inc #Objects -OBJS = mpi.o startsde.o mmap.o error.o getuptime.o gettime.o getdrives.o setuid.o setgid.o getuid.o getgid.o exec.o getpid.o fork.o pidstatus.o getpage.o sched.o +OBJS = mpi.o startsde.o mmap.o error.o getuptime.o gettime.o getdrives.o setuid.o setgid.o getuid.o getgid.o exec.o getpid.o fork.o pidstatus.o getpage.o sched.o auth.o #Output OUTPUT = sys.so diff --git a/src/sys/kernel/syscall.c b/src/sys/kernel/syscall.c index de54c0f..ce97b0c 100644 --- a/src/sys/kernel/syscall.c +++ b/src/sys/kernel/syscall.c @@ -82,9 +82,27 @@ return; } -void sysAuth(char *user, char *passwd) +typedef struct _UbixUser UbixUser; +struct _UbixUser { - kprintf("authenticating user %s\n", user); + char *username; + char *password; + int uid; + int gid; + char *home; + char *shell; +}; + +void sysAuth(UbixUser *uu) +{ + kprintf("authenticating user %s\n", uu->username); + if(uu->username == "root" && uu->password == "user") + { + uu->uid = 0; + uu->gid = 0; + } + uu->uid = -1; + uu->gid = -1; return; }