summaryrefslogtreecommitdiff
path: root/libcli/security
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-08-27 10:21:13 +1000
committerAndrew Bartlett <abartlet@samba.org>2010-09-11 18:46:07 +1000
commit9fb92c6014e48b000b26010bc21aa3821bab10cf (patch)
tree1006b6c5893b9144f0fcee571a318098f27a613b /libcli/security
parentdbee98d30fc9c7db6693170215b8c1819b3e2f3d (diff)
downloadsamba-9fb92c6014e48b000b26010bc21aa3821bab10cf.tar.gz
samba-9fb92c6014e48b000b26010bc21aa3821bab10cf.tar.bz2
samba-9fb92c6014e48b000b26010bc21aa3821bab10cf.zip
libcli/security Make the two privileges tables share a common struct definition
Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'libcli/security')
-rw-r--r--libcli/security/privileges.c47
-rw-r--r--libcli/security/privileges.h2
2 files changed, 22 insertions, 27 deletions
diff --git a/libcli/security/privileges.c b/libcli/security/privileges.c
index 3919ce8380..c230692101 100644
--- a/libcli/security/privileges.c
+++ b/libcli/security/privileges.c
@@ -58,22 +58,22 @@ PRIVS privs[] = {
#if 0 /* usrmgr will display these twice if you include them. We don't
use them but we'll keep the bitmasks reserved in privileges.h anyways */
- {SE_NETWORK_LOGON, "SeNetworkLogonRight", "Access this computer from network", 0x0},
- {SE_INTERACTIVE_LOGON, "SeInteractiveLogonRight", "Log on locally", 0x0},
- {SE_BATCH_LOGON, "SeBatchLogonRight", "Log on as a batch job", 0x0},
- {SE_SERVICE_LOGON, "SeServiceLogonRight", "Log on as a service", 0x0},
+ {0x0, SE_NETWORK_LOGON, "SeNetworkLogonRight", "Access this computer from network"},
+ {0x0, SE_INTERACTIVE_LOGON, "SeInteractiveLogonRight", "Log on locally"},
+ {0x0, SE_BATCH_LOGON, "SeBatchLogonRight", "Log on as a batch job"},
+ {0x0, SE_SERVICE_LOGON, "SeServiceLogonRight", "Log on as a service"},
#endif
- {SE_MACHINE_ACCOUNT, "SeMachineAccountPrivilege", "Add machines to domain", SEC_PRIV_MACHINE_ACCOUNT},
- {SE_TAKE_OWNERSHIP, "SeTakeOwnershipPrivilege", "Take ownership of files or other objects",SEC_PRIV_TAKE_OWNERSHIP},
- {SE_BACKUP, "SeBackupPrivilege", "Back up files and directories", SEC_PRIV_BACKUP},
- {SE_RESTORE, "SeRestorePrivilege", "Restore files and directories", SEC_PRIV_RESTORE},
- {SE_REMOTE_SHUTDOWN, "SeRemoteShutdownPrivilege", "Force shutdown from a remote system", SEC_PRIV_REMOTE_SHUTDOWN},
+ {SEC_PRIV_MACHINE_ACCOUNT, SE_MACHINE_ACCOUNT, "SeMachineAccountPrivilege", "Add machines to domain"},
+ {SEC_PRIV_TAKE_OWNERSHIP, SE_TAKE_OWNERSHIP, "SeTakeOwnershipPrivilege", "Take ownership of files or other objects"},
+ {SEC_PRIV_BACKUP, SE_BACKUP, "SeBackupPrivilege", "Back up files and directories"},
+ {SEC_PRIV_RESTORE, SE_RESTORE, "SeRestorePrivilege", "Restore files and directories"},
+ {SEC_PRIV_REMOTE_SHUTDOWN, SE_REMOTE_SHUTDOWN, "SeRemoteShutdownPrivilege", "Force shutdown from a remote system"},
- {SE_PRINT_OPERATOR, "SePrintOperatorPrivilege", "Manage printers", SEC_PRIV_PRINT_OPERATOR},
- {SE_ADD_USERS, "SeAddUsersPrivilege", "Add users and groups to the domain", SEC_PRIV_ADD_USERS},
- {SE_DISK_OPERATOR, "SeDiskOperatorPrivilege", "Manage disk shares", SEC_PRIV_DISK_OPERATOR},
+ {SEC_PRIV_PRINT_OPERATOR, SE_PRINT_OPERATOR, "SePrintOperatorPrivilege", "Manage printers"},
+ {SEC_PRIV_ADD_USERS, SE_ADD_USERS, "SeAddUsersPrivilege", "Add users and groups to the domain"},
+ {SEC_PRIV_DISK_OPERATOR, SE_DISK_OPERATOR, "SeDiskOperatorPrivilege", "Manage disk shares"},
- {SE_END, "", "", 0x0}
+ {0x0, SE_END, "", ""}
};
/***************************************************************************
@@ -453,12 +453,7 @@ bool privilege_set_to_se_priv( uint64_t *privilege_mask, struct lsa_PrivilegeSet
return true;
}
-static const struct {
- enum sec_privilege privilege;
- uint64_t privilege_mask;
- const char *name;
- const char *display_name;
-} privilege_names[] = {
+static const PRIVS privilege_names[] = {
{SEC_PRIV_SECURITY,
SE_SECURITY,
"SeSecurityPrivilege",
@@ -609,7 +604,7 @@ const char *sec_privilege_name(enum sec_privilege privilege)
{
int i;
for (i=0;i<ARRAY_SIZE(privilege_names);i++) {
- if (privilege_names[i].privilege == privilege) {
+ if (privilege_names[i].luid == privilege) {
return privilege_names[i].name;
}
}
@@ -628,8 +623,8 @@ const char *sec_privilege_display_name(enum sec_privilege privilege, uint16_t *l
return NULL;
}
for (i=0;i<ARRAY_SIZE(privilege_names);i++) {
- if (privilege_names[i].privilege == privilege) {
- return privilege_names[i].display_name;
+ if (privilege_names[i].luid == privilege) {
+ return privilege_names[i].description;
}
}
return NULL;
@@ -643,7 +638,7 @@ enum sec_privilege sec_privilege_id(const char *name)
int i;
for (i=0;i<ARRAY_SIZE(privilege_names);i++) {
if (strcasecmp(privilege_names[i].name, name) == 0) {
- return privilege_names[i].privilege;
+ return privilege_names[i].luid;
}
}
return -1;
@@ -657,7 +652,7 @@ enum sec_privilege sec_privilege_from_mask(uint64_t mask)
int i;
for (i=0;i<ARRAY_SIZE(privilege_names);i++) {
if (privilege_names[i].privilege_mask == mask) {
- return privilege_names[i].privilege;
+ return privilege_names[i].luid;
}
}
return -1;
@@ -669,7 +664,7 @@ enum sec_privilege sec_privilege_from_mask(uint64_t mask)
enum sec_privilege sec_privilege_from_index(int idx)
{
if (idx >= 0 && idx<ARRAY_SIZE(privilege_names)) {
- return privilege_names[idx].privilege;
+ return privilege_names[idx].luid;
}
return -1;
}
@@ -682,7 +677,7 @@ static uint64_t sec_privilege_mask(enum sec_privilege privilege)
{
int i;
for (i=0;i<ARRAY_SIZE(privilege_names);i++) {
- if (privilege_names[i].privilege == privilege) {
+ if (privilege_names[i].luid == privilege) {
return privilege_names[i].privilege_mask;
}
}
diff --git a/libcli/security/privileges.h b/libcli/security/privileges.h
index 69c7dbcec3..f3fd75f8fb 100644
--- a/libcli/security/privileges.h
+++ b/libcli/security/privileges.h
@@ -64,10 +64,10 @@ typedef struct {
} PRIVILEGE_SET;
typedef struct {
+ enum sec_privilege luid;
uint64_t privilege_mask;
const char *name;
const char *description;
- enum sec_privilege luid;
} PRIVS;
/***************************************************************************