user.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * user.h
  3. *
  4. * Copyright (C) 2017 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __MONOLITHIUM_USER_H__
  20. #define __MONOLITHIUM_USER_H__
  21. #include "defs.h"
  22. #define ALL_USERS (uid_t)-1
  23. #define MAX_USERNAME_LENGTH 32
  24. #define PRIVILEGE_LOGON_USER (1ULL << 0)
  25. #define PRIVILEGE_NETWORK_ACCESS (1ULL << 1)
  26. #define PRIVILEGE_MOUNT_UNMOUNT (1ULL << 2)
  27. #define PRIVILEGE_UNNAMED3 (1ULL << 3)
  28. #define PRIVILEGE_UNNAMED4 (1ULL << 4)
  29. #define PRIVILEGE_UNNAMED5 (1ULL << 5)
  30. #define PRIVILEGE_UNNAMED6 (1ULL << 6)
  31. #define PRIVILEGE_UNNAMED7 (1ULL << 7)
  32. #define PRIVILEGE_UNNAMED8 (1ULL << 8)
  33. #define PRIVILEGE_UNNAMED9 (1ULL << 9)
  34. #define PRIVILEGE_UNNAMED10 (1ULL << 10)
  35. #define PRIVILEGE_UNNAMED11 (1ULL << 11)
  36. #define PRIVILEGE_UNNAMED12 (1ULL << 12)
  37. #define PRIVILEGE_UNNAMED13 (1ULL << 13)
  38. #define PRIVILEGE_UNNAMED14 (1ULL << 14)
  39. #define PRIVILEGE_UNNAMED15 (1ULL << 15)
  40. #define PRIVILEGE_UNNAMED16 (1ULL << 16)
  41. #define PRIVILEGE_UNNAMED17 (1ULL << 17)
  42. #define PRIVILEGE_UNNAMED18 (1ULL << 18)
  43. #define PRIVILEGE_UNNAMED19 (1ULL << 19)
  44. #define PRIVILEGE_UNNAMED20 (1ULL << 20)
  45. #define PRIVILEGE_UNNAMED21 (1ULL << 21)
  46. #define PRIVILEGE_UNNAMED22 (1ULL << 22)
  47. #define PRIVILEGE_UNNAMED23 (1ULL << 23)
  48. #define PRIVILEGE_UNNAMED24 (1ULL << 24)
  49. #define PRIVILEGE_UNNAMED25 (1ULL << 25)
  50. #define PRIVILEGE_UNNAMED26 (1ULL << 26)
  51. #define PRIVILEGE_UNNAMED27 (1ULL << 27)
  52. #define PRIVILEGE_UNNAMED28 (1ULL << 28)
  53. #define PRIVILEGE_UNNAMED29 (1ULL << 29)
  54. #define PRIVILEGE_UNNAMED30 (1ULL << 30)
  55. #define PRIVILEGE_SET_TIME (1ULL << 31)
  56. #define PRIVILEGE_ACCESS_ALL (1ULL << 32)
  57. #define PRIVILEGE_CHARACTER_DEVICE (1ULL << 33)
  58. #define PRIVILEGE_BLOCK_DEVICE (1ULL << 34)
  59. #define PRIVILEGE_UNNAMED35 (1ULL << 35)
  60. #define PRIVILEGE_UNNAMED36 (1ULL << 36)
  61. #define PRIVILEGE_UNNAMED37 (1ULL << 37)
  62. #define PRIVILEGE_UNNAMED38 (1ULL << 38)
  63. #define PRIVILEGE_UNNAMED39 (1ULL << 39)
  64. #define PRIVILEGE_UNNAMED40 (1ULL << 40)
  65. #define PRIVILEGE_UNNAMED41 (1ULL << 41)
  66. #define PRIVILEGE_UNNAMED42 (1ULL << 42)
  67. #define PRIVILEGE_UNNAMED43 (1ULL << 43)
  68. #define PRIVILEGE_UNNAMED44 (1ULL << 44)
  69. #define PRIVILEGE_UNNAMED45 (1ULL << 45)
  70. #define PRIVILEGE_UNNAMED46 (1ULL << 46)
  71. #define PRIVILEGE_UNNAMED47 (1ULL << 47)
  72. #define PRIVILEGE_UNNAMED48 (1ULL << 48)
  73. #define PRIVILEGE_UNNAMED49 (1ULL << 49)
  74. #define PRIVILEGE_UNNAMED50 (1ULL << 50)
  75. #define PRIVILEGE_UNNAMED51 (1ULL << 51)
  76. #define PRIVILEGE_UNNAMED52 (1ULL << 52)
  77. #define PRIVILEGE_UNNAMED53 (1ULL << 53)
  78. #define PRIVILEGE_UNNAMED54 (1ULL << 54)
  79. #define PRIVILEGE_UNNAMED55 (1ULL << 55)
  80. #define PRIVILEGE_UNNAMED56 (1ULL << 56)
  81. #define PRIVILEGE_UNNAMED57 (1ULL << 57)
  82. #define PRIVILEGE_UNNAMED58 (1ULL << 58)
  83. #define PRIVILEGE_MANAGE_USERS (1ULL << 59)
  84. #define PRIVILEGE_PROCESS_CONTROL (1ULL << 60)
  85. #define PRIVILEGE_SET_PAGE_FILE (1ULL << 61)
  86. #define PRIVILEGE_POWER_CONTROL (1ULL << 62)
  87. #define PRIVILEGE_CHANGE_UID (1ULL << 63)
  88. #define ALL_PRIVILEGES 0xFFFFFFFFFFFFFFFFULL
  89. typedef dword_t uid_t;
  90. typedef enum
  91. {
  92. USER_NAME_INFO,
  93. USER_PRIVILEGE_INFO,
  94. } user_info_t;
  95. sysret_t syscall_create_user(uid_t uid, const char *name, dword_t *password_hash, qword_t privileges);
  96. sysret_t syscall_delete_user(uid_t uid);
  97. sysret_t syscall_set_user_id(uid_t uid);
  98. sysret_t syscall_revert_user(void);
  99. sysret_t syscall_logon_user(uid_t uid, const char *password);
  100. sysret_t syscall_query_user(uid_t uid, user_info_t info_type, void *buffer, dword_t size);
  101. #endif