aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index b1f339f..b6e2533 100644
--- a/src/config.c
+++ b/src/config.c
@@ -980,2 +980,3 @@ cb_access_method_params (enum gconf_callback_command cmd,
}
+ gl_list_iterator_free (&itr);
meth->parmv[i] = NULL;
@@ -1226,2 +1227,78 @@ cb_spool (enum gconf_callback_command cmd,
+static int
+cb_user (enum gconf_callback_command cmd,
+ gconf_locus_t *locus,
+ void *varptr,
+ gconf_value_t *value,
+ void *cb_data)
+{
+ int rc;
+ struct passwd *pw;
+
+ if (assert_string_arg (locus, cmd, value))
+ return 1;
+
+ pw = getpwnam (value->v.string);
+ if (!pw)
+ {
+ gconf_error (locus, 0, _("no such user: %s"), value->v.string);
+ return 1;
+ }
+
+ wydawca_uid = pw->pw_uid;
+ wydawca_gid = pw->pw_gid;
+ return 0;
+}
+
+static int
+cb_supp_groups (enum gconf_callback_command cmd,
+ gconf_locus_t *locus,
+ void *varptr,
+ gconf_value_t *value,
+ void *cb_data)
+{
+ if (cmd != gconf_callback_set_value)
+ {
+ gconf_error (locus, 0, _("Unexpected block statement"));
+ return 1;
+ }
+ if (!value || value->type != GCONF_TYPE_LIST)
+ {
+ gconf_error (locus, 0, _("expected list value"));
+ return 1;
+ }
+
+ wydawca_supp_groupc = gl_list_size (value->v.list);
+ if (wydawca_supp_groupc == 0)
+ wydawca_supp_groups = NULL;
+ else
+ {
+ int i;
+ gl_list_iterator_t itr;
+ const void *p;
+
+ wydawca_supp_groups = xcalloc (wydawca_supp_groupc,
+ sizeof (wydawca_supp_groups[0]));
+ itr = gl_list_iterator (value->v.list);
+ for (i = 0; gl_list_iterator_next (&itr, &p, NULL); i++)
+ {
+ const gconf_value_t *vp = p;
+ struct group *grp;
+
+ if (assert_string_arg (locus, cmd, vp))
+ break;
+ grp = getgrnam (vp->v.string);
+ if (!grp)
+ {
+ gconf_error (locus, 0, _("no such group: %s"), value->v.string);
+ break;
+ }
+ wydawca_supp_groups[i] = grp->gr_gid;
+ }
+ gl_list_iterator_free (&itr);
+ }
+ return 0;
+}
+
+
@@ -1239,2 +1316,7 @@ static struct gconf_keyword wydawca_kw[] = {
+ { "user", N_("name"), N_("Run with UID and GID of this user"),
+ gconf_type_string, NULL, 0, cb_user },
+ { "group", NULL, N_("Retain these supplementary groups"),
+ gconf_type_string|GCONF_LIST, NULL, 0, cb_supp_groups },
+
{ "locking", NULL, N_("Enable or disable locking"),

Return to:

Send suggestions and report system problems to the System administrator.