diff options
Diffstat (limited to 'source3/lib/util.c')
-rw-r--r-- | source3/lib/util.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c index ec0f9f0efc..96c0774e92 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -4509,6 +4509,28 @@ char *tab_depth(int depth) return spaces; } + +/* array lookup of well-known RID aliases. the purpose of these escapes me.. */ +static struct +{ + uint32 rid; + char *rid_name; + +} rid_lookups[] = +{ + { DOMAIN_ALIAS_RID_ADMINS , "admins" }, + { DOMAIN_ALIAS_RID_USERS , "users" }, + { DOMAIN_ALIAS_RID_GUESTS , "guests" }, + { DOMAIN_ALIAS_RID_POWER_USERS , "power_users" }, + + { DOMAIN_ALIAS_RID_ACCOUNT_OPS , "account_ops" }, + { DOMAIN_ALIAS_RID_SYSTEM_OPS , "system_ops" }, + { DOMAIN_ALIAS_RID_PRINT_OPS , "print_ops" }, + { DOMAIN_ALIAS_RID_BACKUP_OPS , "backup_ops" }, + { DOMAIN_ALIAS_RID_REPLICATOR , "replicator" }, + { 0 , NULL } +}; + int make_domain_gids(char *gids_str, DOM_GID *gids) { char *ptr; @@ -4523,12 +4545,26 @@ int make_domain_gids(char *gids_str, DOM_GID *gids) { /* the entries are of the form GID/ATTR, ATTR being optional.*/ char *attr; + uint32 rid = 0; + int i; attr = strchr(s2,'/'); if (attr) *attr++ = 0; if (!attr || !*attr) attr = "7"; /* default value for attribute is 7 */ - gids[count].gid = atoi(s2); + /* look up the RID string and see if we can turn it into a rid number */ + for (i = 0; rid_lookups[i].rid_name != NULL; i++) + { + if (strequal(rid_lookups[i].rid_name, s2)) + { + rid = rid_lookups[i].rid; + break; + } + } + + if (rid == 0) rid = atoi(s2); + + gids[count].gid = rid; gids[count].attr = atoi(attr); DEBUG(5,("group id: %d attr: %d\n", gids[count].gid, gids[count].attr)); @@ -4536,3 +4572,4 @@ int make_domain_gids(char *gids_str, DOM_GID *gids) return count; } + |