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
@@ -978,6 +978,7 @@ cb_access_method_params (enum gconf_callback_command cmd,
978 978
979 meth->parmv[i] = xstrdup (vp->v.string); 979 meth->parmv[i] = xstrdup (vp->v.string);
980 } 980 }
981 gl_list_iterator_free (&itr);
981 meth->parmv[i] = NULL; 982 meth->parmv[i] = NULL;
982 } 983 }
983 return 0; 984 return 0;
@@ -1224,6 +1225,82 @@ cb_spool (enum gconf_callback_command cmd,
1224} 1225}
1225 1226
1226 1227
1228static int
1229cb_user (enum gconf_callback_command cmd,
1230 gconf_locus_t *locus,
1231 void *varptr,
1232 gconf_value_t *value,
1233 void *cb_data)
1234{
1235 int rc;
1236 struct passwd *pw;
1237
1238 if (assert_string_arg (locus, cmd, value))
1239 return 1;
1240
1241 pw = getpwnam (value->v.string);
1242 if (!pw)
1243 {
1244 gconf_error (locus, 0, _("no such user: %s"), value->v.string);
1245 return 1;
1246 }
1247
1248 wydawca_uid = pw->pw_uid;
1249 wydawca_gid = pw->pw_gid;
1250 return 0;
1251}
1252
1253static int
1254cb_supp_groups (enum gconf_callback_command cmd,
1255 gconf_locus_t *locus,
1256 void *varptr,
1257 gconf_value_t *value,
1258 void *cb_data)
1259{
1260 if (cmd != gconf_callback_set_value)
1261 {
1262 gconf_error (locus, 0, _("Unexpected block statement"));
1263 return 1;
1264 }
1265 if (!value || value->type != GCONF_TYPE_LIST)
1266 {
1267 gconf_error (locus, 0, _("expected list value"));
1268 return 1;
1269 }
1270
1271 wydawca_supp_groupc = gl_list_size (value->v.list);
1272 if (wydawca_supp_groupc == 0)
1273 wydawca_supp_groups = NULL;
1274 else
1275 {
1276 int i;
1277 gl_list_iterator_t itr;
1278 const void *p;
1279
1280 wydawca_supp_groups = xcalloc (wydawca_supp_groupc,
1281 sizeof (wydawca_supp_groups[0]));
1282 itr = gl_list_iterator (value->v.list);
1283 for (i = 0; gl_list_iterator_next (&itr, &p, NULL); i++)
1284 {
1285 const gconf_value_t *vp = p;
1286 struct group *grp;
1287
1288 if (assert_string_arg (locus, cmd, vp))
1289 break;
1290 grp = getgrnam (vp->v.string);
1291 if (!grp)
1292 {
1293 gconf_error (locus, 0, _("no such group: %s"), value->v.string);
1294 break;
1295 }
1296 wydawca_supp_groups[i] = grp->gr_gid;
1297 }
1298 gl_list_iterator_free (&itr);
1299 }
1300 return 0;
1301}
1302
1303
1227 1304
1228static struct gconf_keyword wydawca_kw[] = { 1305static struct gconf_keyword wydawca_kw[] = {
1229 { "daemon", NULL, N_("Enable daemon mode"), 1306 { "daemon", NULL, N_("Enable daemon mode"),
@@ -1237,6 +1314,11 @@ static struct gconf_keyword wydawca_kw[] = {
1237 { "pidfile", N_("file"), N_("Set pid file name"), 1314 { "pidfile", N_("file"), N_("Set pid file name"),
1238 gconf_type_string, &pidfile }, 1315 gconf_type_string, &pidfile },
1239 1316
1317 { "user", N_("name"), N_("Run with UID and GID of this user"),
1318 gconf_type_string, NULL, 0, cb_user },
1319 { "group", NULL, N_("Retain these supplementary groups"),
1320 gconf_type_string|GCONF_LIST, NULL, 0, cb_supp_groups },
1321
1240 { "locking", NULL, N_("Enable or disable locking"), 1322 { "locking", NULL, N_("Enable or disable locking"),
1241 gconf_type_bool, &enable_locking }, 1323 gconf_type_bool, &enable_locking },
1242 { "lockdir", N_("dir"), N_("Set directory for lock files"), 1324 { "lockdir", N_("dir"), N_("Set directory for lock files"),

Return to:

Send suggestions and report system problems to the System administrator.