Print this page
uts: add a concept of a 'default' set of privileges, separate from 'basic'

@@ -56,10 +56,20 @@
         LOADPRIVDATA(d);
 
         return (d->pd_basicset);
 }
 
+priv_set_t *
+priv_default(void)
+{
+        priv_data_t *d;
+
+        LOADPRIVDATA(d);
+
+        return (d->pd_defaultset);
+}
+
 /*
  *      Name:   priv_str_to_set()
  *
  *      Description:    Given a buffer with privilege strings, the
  *      equivalent privilege set is returned.

@@ -78,12 +88,13 @@
 
         char *base;
         char *offset;
         char *last;
         priv_set_t *pset = NULL;
-        priv_set_t *zone;
-        priv_set_t *basic;
+        priv_set_t *zone = NULL;
+        priv_set_t *basic = NULL;
+        priv_set_t *deflt = NULL;
 
         if (endptr != NULL)
                 *endptr = NULL;
 
         if ((base = libc_strdup(priv_names)) == NULL ||

@@ -93,10 +104,11 @@
                 return (NULL);
         }
 
         priv_emptyset(pset);
         basic = priv_basic();
+        deflt = priv_default();
         zone = privdata->pd_zoneset;
 
         /* This is how to use strtok_r nicely in a while loop ... */
         last = base;
 

@@ -104,10 +116,13 @@
                 /*
                  * Search for these special case strings.
                  */
                 if (basic != NULL && strcasecmp(offset, "basic") == 0) {
                         priv_union(basic, pset);
+                } else if (deflt != NULL && strcasecmp(offset,
+                    "default") == 0) {
+                        priv_union(deflt, pset);
                 } else if (strcasecmp(offset, "none") == 0) {
                         priv_emptyset(pset);
                 } else if (strcasecmp(offset, "all") == 0) {
                         priv_fillset(pset);
                 } else if (strcasecmp(offset, "zone") == 0) {