2 Unix SMB/CIFS implementation.
3 Grops and Users Management System initializations.
4 Copyright (C) Simo Sorce 2002
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
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 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #define DBGC_CLASS DBGC_GUMS*/
29 GUMS_FUNCTIONS *gums_storage;
30 static void *dl_handle;
33 {PRIV_NONE, "no_privs", "No privilege"}, /* this one MUST be first */
34 {PRIV_CREATE_TOKEN, "SeCreateToken", "Create Token"},
35 {PRIV_ASSIGNPRIMARYTOKEN, "SeAssignPrimaryToken", "Assign Primary Token"},
36 {PRIV_LOCK_MEMORY, "SeLockMemory", "Lock Memory"},
37 {PRIV_INCREASE_QUOTA, "SeIncreaseQuotaPrivilege", "Increase Quota Privilege"},
38 {PRIV_MACHINE_ACCOUNT, "SeMachineAccount", "Machine Account"},
39 {PRIV_TCB, "SeTCB", "TCB"},
40 {PRIV_SECURITY, "SeSecurityPrivilege", "Security Privilege"},
41 {PRIV_TAKE_OWNERSHIP, "SeTakeOwnershipPrivilege", "Take Ownership Privilege"},
42 {PRIV_LOAD_DRIVER, "SeLocalDriverPrivilege", "Local Driver Privilege"},
43 {PRIV_SYSTEM_PROFILE, "SeSystemProfilePrivilege", "System Profile Privilege"},
44 {PRIV_SYSTEMTIME, "SeSystemtimePrivilege", "System Time"},
45 {PRIV_PROF_SINGLE_PROCESS, "SeProfileSingleProcessPrivilege", "Profile Single Process Privilege"},
46 {PRIV_INC_BASE_PRIORITY, "SeIncreaseBasePriorityPrivilege", "Increase Base Priority Privilege"},
47 {PRIV_CREATE_PAGEFILE, "SeCreatePagefilePrivilege", "Create Pagefile Privilege"},
48 {PRIV_CREATE_PERMANENT, "SeCreatePermanent", "Create Permanent"},
49 {PRIV_BACKUP, "SeBackupPrivilege", "Backup Privilege"},
50 {PRIV_RESTORE, "SeRestorePrivilege", "Restore Privilege"},
51 {PRIV_SHUTDOWN, "SeShutdownPrivilege", "Shutdown Privilege"},
52 {PRIV_DEBUG, "SeDebugPrivilege", "Debug Privilege"},
53 {PRIV_AUDIT, "SeAudit", "Audit"},
54 {PRIV_SYSTEM_ENVIRONMENT, "SeSystemEnvironmentPrivilege", "System Environment Privilege"},
55 {PRIV_CHANGE_NOTIFY, "SeChangeNotify", "Change Notify"},
56 {PRIV_REMOTE_SHUTDOWN, "SeRemoteShutdownPrivilege", "Remote Shutdown Privilege"},
57 {PRIV_UNDOCK, "SeUndock", "Undock"},
58 {PRIV_SYNC_AGENT, "SeSynchronizationAgent", "Synchronization Agent"},
59 {PRIV_ENABLE_DELEGATION, "SeEnableDelegation", "Enable Delegation"},
60 {PRIV_ALL, "SaAllPrivs", "All Privileges"}
63 NTSTATUS gums_init(const char *module_name)
65 int (*module_version)(int);
66 NTSTATUS (*module_init)();
67 /* gums_module_init module_init;*/
68 NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
70 DEBUG(5, ("Opening gums module %s\n", module_name));
71 dl_handle = sys_dlopen(module_name, RTLD_NOW);
73 DEBUG(0, ("ERROR: Failed to load gums module %s, error: %s\n", module_name, sys_dlerror()));
74 return NT_STATUS_UNSUCCESSFUL;
77 module_version = sys_dlsym(dl_handle, "gumm_version");
78 if (!module_version) {
79 DEBUG(0, ("ERROR: Failed to find gums module version!\n"));
83 if (module_version(GMV_MAJOR) != GUMS_VERSION_MAJOR) {
84 DEBUG(0, ("ERROR: Module's major version does not match gums version!\n"));
88 if (module_version(GMV_MINOR) != GUMS_VERSION_MINOR) {
89 DEBUG(1, ("WARNING: Module's minor version does not match gums version!\n"));
92 module_init = sys_dlsym(dl_handle, "gumm_init");
94 DEBUG(0, ("ERROR: Failed to find gums module's init function!\n"));
98 DEBUG(5, ("Initializing module %s\n", module_name));
100 ret = module_init(&gums_storage);
104 ret = NT_STATUS_UNSUCCESSFUL;
105 sys_dlclose(dl_handle);
111 NTSTATUS gums_unload(void)
114 NTSTATUS (*module_finalize)();
117 return NT_STATUS_UNSUCCESSFUL;
119 module_close = sys_dlsym(dl_handle, "gumm_finalize");
120 if (!module_finalize) {
121 DEBUG(0, ("ERROR: Failed to find gums module's init function!\n"));
122 return NT_STATUS_UNSUCCESSFUL;
125 DEBUG(5, ("Finalizing module %s\n", module_name));
127 ret = module_finalize();
128 sys_dlclose(dl_handle);