de903d5932e55be9d7f38ba78c3678763ed452b2
[tpg/acess2.git] / Usermode / Applications / login_src / database_tpl.c
1 /*
2  * Acess 2 Login
3  */
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include "header.h"
7
8 // === CONSTANTS ===
9
10 // === PROTOTYPES ===
11  int    ValidateUser(char *Username, char *Password);
12 tUserInfo       *GetUserInfo(int UID);
13
14 // === GLOBALS ===
15 tUserInfo       gUserInfo;
16
17 // === CODE ===
18 /**
19  * \fn int ValidateUser(char *Username, char *Password)
20  * \brief Validates a users credentials
21  * \return UID on success, -1 on failure
22  */
23 int ValidateUser(char *Username, char *Password)
24 {
25         if(Username == NULL)    return -1;
26         if(Password == NULL)    return -1;
27         if(strcmp(Username, "root") == 0)       return 0;
28         return -1;
29 }
30
31 /**
32  * \fn void GetUserInfo(int UID)
33  * \brief Gets a users information
34  */
35 tUserInfo *GetUserInfo(int UID)
36 {
37         if(UID != 0)    return NULL;
38         
39         gUserInfo.UID = 0;
40         gUserInfo.GID = 0;
41         gUserInfo.Shell = "/Acess/Bin/CLIShell";
42         gUserInfo.Home = "/Acess/Root";
43         return &gUserInfo;
44 }
45

UCC git Repository :: git.ucc.asn.au