Usermode/ld-acess - Cleaning out unused/unneeded headers
[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         if(strcmp(Username, "tpg") == 0)        return 1;
29         if(strcmp(Username, "gui") == 0)        return 2;
30         if(strcmp(Username, "gui3") == 0)       return 3;
31         return -1;
32 }
33
34 /**
35  * \fn void GetUserInfo(int UID)
36  * \brief Gets a users information
37  */
38 tUserInfo *GetUserInfo(int UID)
39 {       
40         gUserInfo.UID = UID;
41         gUserInfo.GID = UID;
42         gUserInfo.Shell = "/Acess/Bin/CLIShell";
43         switch(UID)
44         {
45         case 0:
46                 gUserInfo.Home = "/Acess/Root";
47                 break;
48         case 1:
49                 gUserInfo.Home = "/Acess/Users/tpg";
50                 break;
51         case 2:
52                 gUserInfo.UID = 0;      //HACK!
53                 gUserInfo.Home = "/Acess/Users/gui";
54                 gUserInfo.Shell = "/Acess/Apps/AxWin/1.0/AxWinWM";
55                 break;
56         case 3:
57                 gUserInfo.UID = 0;
58                 gUserInfo.Home = "/Acess/Root";
59                 gUserInfo.Shell = "/Acess/Apps/AxWin/3.0/AxWinWM";
60                 break;
61         default:
62                 gUserInfo.Home = "/Acess/Users/Guest";
63                 break;
64         }
65         return &gUserInfo;
66 }
67

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