[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3813 - in GNUnet: . contrib src/include src/server src/set
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3813 - in GNUnet: . contrib src/include src/server src/setup src/setup/gtk src/util/os |
Date: |
Wed, 22 Nov 2006 20:30:37 -0800 (PST) |
Author: grothoff
Date: 2006-11-22 20:30:30 -0800 (Wed, 22 Nov 2006)
New Revision: 3813
Modified:
GNUnet/contrib/config-daemon.scm
GNUnet/src/include/gnunet_protocols.h
GNUnet/src/server/connection.c
GNUnet/src/setup/gnunet-setup.c
GNUnet/src/setup/gtk/gconf.c
GNUnet/src/setup/gtk/gconf.h
GNUnet/src/setup/gtk/wizard_gtk.c
GNUnet/src/util/os/osconfig.c
GNUnet/todo
Log:
fixing gnunet-setup gtk-wizard problems
Modified: GNUnet/contrib/config-daemon.scm
===================================================================
--- GNUnet/contrib/config-daemon.scm 2006-11-23 03:50:14 UTC (rev 3812)
+++ GNUnet/contrib/config-daemon.scm 2006-11-23 04:30:30 UTC (rev 3813)
@@ -435,6 +435,43 @@
'()
'rare))
+(define (username builder)
+ (builder
+ "GNUNETD"
+ "USER"
+ (_ "Run gnunetd as this user.")
+ (_ "When started as root, gnunetd will change permissions to the given user.")
+ '()
+ #t
+ "gnunetd"
+ '()
+ 'advanced))
+
+(define (groupname builder)
+ (builder
+ "GNUNETD"
+ "GROUP"
+ (_ "Run gnunetd as this group.")
+ (_ "When started as root, gnunetd will change permissions to the given
group.")
+ '()
+ #t
+ "gnunetd"
+ '()
+ 'advanced))
+
+(define (autostart builder)
+ (builder
+ "GNUNETD"
+ "AUTOSTART"
+ (_ "Run gnunetd during system startup?")
+ (nohelp)
+ '()
+ #t
+ #t
+ '()
+ 'rare))
+
+
(define (limit-deny builder)
(builder
"GNUNETD"
@@ -475,6 +512,9 @@
(_ "Settings that change the behavior of GNUnet in general")
(list
(general-path builder)
+ (username builder)
+ (groupname builder)
+ (autostart builder)
(fs-path builder)
(index-path builder)
(general-pidfile builder)
Modified: GNUnet/src/include/gnunet_protocols.h
===================================================================
--- GNUnet/src/include/gnunet_protocols.h 2006-11-23 03:50:14 UTC (rev
3812)
+++ GNUnet/src/include/gnunet_protocols.h 2006-11-23 04:30:30 UTC (rev
3813)
@@ -362,6 +362,7 @@
*/
#define P2P_PROTO_noise 6
+
/* ************* p2p GAP application messages *********** */
/**
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2006-11-23 03:50:14 UTC (rev 3812)
+++ GNUnet/src/server/connection.c 2006-11-23 04:30:30 UTC (rev 3813)
@@ -1825,15 +1825,16 @@
static void shutdownConnection(BufferEntry * be) {
P2P_hangup_MESSAGE hangup;
unsigned int i;
-#if DEBUG_CONNECTION
+#if DEBUG_CONNECTION || 1
EncName enc;
#endif
ENTRY();
-#if DEBUG_CONNECTION
+#if DEBUG_CONNECTION || 1
IF_GELOG(ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
- hash2enc(&be->session.sender.hashPubKey, &enc));
+ hash2enc(&be->session.sender.hashPubKey,
+ &enc));
GE_LOG(ectx,
GE_DEBUG | GE_REQUEST | GE_USER,
"Shutting down connection with `%s'\n",
@@ -2545,8 +2546,14 @@
&((P2P_hangup_MESSAGE *) msg)->sender,
sizeof(PeerIdentity)))
return SYSERR;
- IF_GELOG(ectx, GE_INFO | GE_BULK | GE_USER, hash2enc(&sender->hashPubKey,
&enc));
- GE_LOG(ectx, GE_INFO | GE_BULK | GE_USER, "received HANGUP from `%s'\n",
&enc);
+ IF_GELOG(ectx,
+ GE_INFO | GE_BULK | GE_USER,
+ hash2enc(&sender->hashPubKey,
+ &enc));
+ GE_LOG(ectx,
+ GE_INFO | GE_BULK | GE_USER,
+ "received HANGUP from `%s'\n",
+ &enc);
MUTEX_LOCK(lock);
be = lookForHost(sender);
if(be == NULL) {
Modified: GNUnet/src/setup/gnunet-setup.c
===================================================================
--- GNUnet/src/setup/gnunet-setup.c 2006-11-23 03:50:14 UTC (rev 3812)
+++ GNUnet/src/setup/gnunet-setup.c 2006-11-23 04:30:30 UTC (rev 3813)
@@ -198,7 +198,8 @@
} else {
operation = argv[i];
}
-
+ if (NULL != strstr(operation, "wizard"))
+ config_daemon = YES; /* wizard implies daemon! */
if (cfgFilename == NULL)
cfgFilename = config_daemon
? STRDUP(DEFAULT_DAEMON_CONFIG_FILE)
Modified: GNUnet/src/setup/gtk/gconf.c
===================================================================
--- GNUnet/src/setup/gtk/gconf.c 2006-11-23 03:50:14 UTC (rev 3812)
+++ GNUnet/src/setup/gtk/gconf.c 2006-11-23 04:30:30 UTC (rev 3813)
@@ -26,6 +26,7 @@
#include "gnunet_setup_lib.h"
#include "glade_support.h"
+#include "gconf.h"
#include "platform.h"
/**
Modified: GNUnet/src/setup/gtk/gconf.h
===================================================================
--- GNUnet/src/setup/gtk/gconf.h 2006-11-23 03:50:14 UTC (rev 3812)
+++ GNUnet/src/setup/gtk/gconf.h 2006-11-23 04:30:30 UTC (rev 3813)
@@ -37,6 +37,11 @@
const char * filename,
int is_daemon);
-void gconf_main_post_init(struct PluginHandle * lib);
+int gconf_main_post_init(struct PluginHandle * lib,
+ struct GE_Context * e,
+ struct GC_Configuration * c,
+ struct GNS_Context * gns,
+ const char * filename,
+ int is_daemon);
#endif
Modified: GNUnet/src/setup/gtk/wizard_gtk.c
===================================================================
--- GNUnet/src/setup/gtk/wizard_gtk.c 2006-11-23 03:50:14 UTC (rev 3812)
+++ GNUnet/src/setup/gtk/wizard_gtk.c 2006-11-23 04:30:30 UTC (rev 3813)
@@ -120,10 +120,16 @@
#else
nic = entry;
#endif
- GC_set_configuration_value_string(editCfg, err_ctx, "NETWORK", "INTERFACE",
- nic);
- GC_set_configuration_value_string(editCfg, err_ctx, "LOAD", "INTERFACE",
- nic);
+ GC_set_configuration_value_string(editCfg,
+ err_ctx,
+ "NETWORK",
+ "INTERFACE",
+ nic);
+ GC_set_configuration_value_string(editCfg,
+ err_ctx,
+ "LOAD",
+ "INTERFACES",
+ nic);
}
static int insert_nic(const char *name,
@@ -170,8 +176,11 @@
os_list_network_interfaces(err_ctx, &insert_nic, &cls);
if (cls.nic_item_count != 0) {
- GC_get_configuration_value_string(editCfg, "NETWORK", "INTERFACE", "eth0",
- &val);
+ GC_get_configuration_value_string(editCfg,
+ "NETWORK",
+ "INTERFACE",
+ "eth0",
+ &val);
gtk_combo_box_append_text(GTK_COMBO_BOX(cls.cmbNIC), val);
gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model),
&iter);
@@ -183,20 +192,26 @@
gtk_widget_set_usize(cls.cmbNIC, 10, -1);
entIP = lookup_widget("entIP");
- GC_get_configuration_value_string(editCfg, "NETWORK", "IP", "",
- &val);
+ GC_get_configuration_value_string(editCfg,
+ "NETWORK",
+ "IP",
+ "",
+ &val);
gtk_entry_set_text(GTK_ENTRY(entIP), val);
FREE(val);
chkFW = lookup_widget("chkFW");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chkFW),
- GC_get_configuration_value_yesno(editCfg, "NAT", "LIMITED", NO) == YES);
+ GC_get_configuration_value_yesno(editCfg,
+ "NAT",
+ "LIMITED",
+ NO) == YES);
gtk_widget_show(curwnd);
}
void load_step3setup_gtk(GtkButton * button,
- gpointer prev_window) {
+ gpointer prev_window) {
GtkWidget * entUp;
GtkWidget * entDown;
GtkWidget * radGNUnet;
@@ -210,27 +225,35 @@
entDown = lookup_widget("entDown");
radGNUnet = lookup_widget("radGNUnet");
radShare = lookup_widget("radShare");
- entCPU = lookup_widget("entCPU");
-
- GC_get_configuration_value_string(editCfg, "LOAD", "MAXNETUPBPSTOTAL",
"50000",
- &val);
+ entCPU = lookup_widget("entCPU");
+ GC_get_configuration_value_string(editCfg,
+ "LOAD",
+ "MAXNETUPBPS",
+ "50000",
+ &val);
gtk_entry_set_text(GTK_ENTRY(entUp), val);
FREE(val);
-
- GC_get_configuration_value_string(editCfg, "LOAD", "MAXNETDOWNBPSTOTAL",
"50000",
- &val);
+ GC_get_configuration_value_string(editCfg,
+ "LOAD",
+ "MAXNETDOWNBPS",
+ "50000",
+ &val);
gtk_entry_set_text(GTK_ENTRY(entDown), val);
FREE(val);
-
-
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
- (GC_get_configuration_value_yesno(editCfg, "LOAD", "BASICLIMITING", NO) ==
YES)
- ? radGNUnet
- : radShare ),
- TRUE);
-
- GC_get_configuration_value_string(editCfg, "LOAD", "MAXCPULOAD", "50",
- &val);
+ gtk_toggle_button_set_active
+ (GTK_TOGGLE_BUTTON
+ ((GC_get_configuration_value_yesno(editCfg,
+ "LOAD",
+ "BASICLIMITING",
+ NO) == YES)
+ ? radGNUnet
+ : radShare ),
+ TRUE);
+ GC_get_configuration_value_string(editCfg,
+ "LOAD",
+ "MAXCPULOAD",
+ "50",
+ &val);
gtk_entry_set_text(GTK_ENTRY(entCPU), val);
FREE(val);
@@ -251,13 +274,19 @@
entGroup = lookup_widget("entGroup");
if (NULL != user_name) {
- GC_get_configuration_value_string(editCfg, "GNUNETD", "USER",
- "gnunet", &uname);
+ GC_get_configuration_value_string(editCfg,
+ "GNUNETD",
+ "USER",
+ "gnunet",
+ &uname);
}
if (NULL != group_name) {
- GC_get_configuration_value_string(editCfg, "GNUNETD", "GROUP",
- "gnunet", &gname);
+ GC_get_configuration_value_string(editCfg,
+ "GNUNETD",
+ "GROUP",
+ "gnunet",
+ &gname);
}
#ifndef MINGW
@@ -306,8 +335,12 @@
gtk_entry_set_text(GTK_ENTRY(entUser), user_name);
if (group_name != NULL)
gtk_entry_set_text(GTK_ENTRY(entGroup), group_name);
-
- cap = os_modify_autostart(err_ctx, 1, 1, NULL, NULL, NULL);
+ cap = os_modify_autostart(err_ctx,
+ 1,
+ 1,
+ NULL,
+ NULL,
+ NULL);
gtk_widget_set_sensitive(entUser, cap);
#ifdef WINDOWS
cap = FALSE;
@@ -431,7 +464,9 @@
}
void on_finish_clickedsetup_gtk (GtkButton * button,
- gpointer user_data) {
+ gpointer user_data) {
+ char * gup;
+ char * bin;
if (doAutoStart && (user_name != NULL))
if (!wiz_createGroupUser(group_name, user_name)) {
#ifndef MINGW
@@ -449,11 +484,21 @@
if (OK != save_conf())
return;
- if (doUpdate &&
- (system("gnunet-update") != 0) )
- showErr(_("gnunet-update failed. Please run gnunet-update manually."), "");
- else
- gtk_widget_destroy(curwnd);
+
+ if (doUpdate) {
+ bin = os_get_installation_path(IPK_BINDIR);
+ gup = MALLOC(strlen(bin) + 30 + strlen(cfg_fn));
+ strcpy(gup, bin);
+ FREE(bin);
+ strcat(gup, "/gnunet-update -c ");
+ strcat(gup, cfg_fn);
+ if (system(gup) != 0)
+ showErr(_("Running gnunet-update failed.\n"
+ "This maybe due to insufficient permissions, please check your
configuration.\n"
+ "Finally, run gnunet-update manually."), "");
+ FREE(gup);
+ }
+ gtk_widget_destroy(curwnd);
}
void on_updateFailedOK_clickedsetup_gtk (GtkButton * button,
@@ -467,7 +512,11 @@
gchar * ret;
ret = gtk_editable_get_chars(editable, 0, -1);
- GC_set_configuration_value_string(editCfg, err_ctx, "NETWORK", "IP", ret);
+ GC_set_configuration_value_string(editCfg,
+ err_ctx,
+ "NETWORK",
+ "IP",
+ ret);
g_free(ret);
}
@@ -483,17 +532,25 @@
gchar * ret;
ret = gtk_editable_get_chars(editable, 0, -1);
- GC_set_configuration_value_string(editCfg, err_ctx, "LOAD",
"MAXNETUPBPSTOTAL", ret);
+ GC_set_configuration_value_string(editCfg,
+ err_ctx,
+ "LOAD",
+ "MAXNETUPBPS",
+ ret);
g_free(ret);
}
void on_entDown_changedsetup_gtk (GtkEditable * editable,
- gpointer user_data) {
+ gpointer user_data) {
gchar * ret;
ret = gtk_editable_get_chars(editable, 0, -1);
- GC_set_configuration_value_string(editCfg, err_ctx, "LOAD",
"MAXNETDOWNBPSTOTAL", ret);
+ GC_set_configuration_value_string(editCfg,
+ err_ctx,
+ "LOAD",
+ "MAXNETDOWNBPS",
+ ret);
g_free(ret);
}
@@ -540,25 +597,28 @@
void on_chkStart_toggledsetup_gtk (GtkToggleButton * togglebutton,
- gpointer user_data) {
+ gpointer user_data) {
doAutoStart = gtk_toggle_button_get_active(togglebutton);
- GC_set_configuration_value_choice(editCfg, err_ctx, "AUTOSTART", "GNUNETD",
- doAutoStart ? "YES" : "NO");
+ GC_set_configuration_value_choice(editCfg,
+ err_ctx,
+ "AUTOSTART",
+ "GNUNETD",
+ doAutoStart ? "YES" : "NO");
}
void on_chkEnh_toggledsetup_gtk (GtkToggleButton * togglebutton,
- gpointer user_data) {
+ gpointer user_data) {
doOpenEnhConfigurator = gtk_toggle_button_get_active(togglebutton);
}
void on_chkUpdate_toggledsetup_gtk(GtkToggleButton * togglebutton,
- gpointer user_data) {
+ gpointer user_data) {
doUpdate = gtk_toggle_button_get_active(togglebutton);
}
void on_entUser_changedsetup_gtk (GtkEditable * editable,
- gpointer user_data) {
+ gpointer user_data) {
gchar * ret;
ret = gtk_editable_get_chars(editable, 0, -1);
@@ -580,7 +640,11 @@
FREENONNULL(group_name);
ret = gtk_editable_get_chars(editable, 0, -1);
GE_ASSERT(err_ctx, ret != NULL);
- GC_set_configuration_value_string(editCfg, err_ctx, "GNUNETD", "GROUP", ret);
+ GC_set_configuration_value_string(editCfg,
+ err_ctx,
+ "GNUNETD",
+ "GROUP",
+ ret);
if (strlen(ret) != 0)
group_name = STRDUP(ret);
else
@@ -596,6 +660,7 @@
struct GNS_Context * gns,
const char * filename,
int is_daemon) {
+ GE_ASSERT(ectx, is_daemon);
g_thread_init(NULL);
gtk_init(&argc, (char ***) &argv);
#ifdef ENABLE_NLS
@@ -617,7 +682,12 @@
gdk_threads_leave();
destroyMainXML();
if (doOpenEnhConfigurator)
- gconf_main_post_init(self);
+ gconf_main_post_init(self,
+ ectx,
+ cfg,
+ gns,
+ filename,
+ is_daemon);
FREENONNULL(user_name);
FREENONNULL(group_name);
setLibrary(NULL);
Modified: GNUnet/src/util/os/osconfig.c
===================================================================
--- GNUnet/src/util/os/osconfig.c 2006-11-23 03:50:14 UTC (rev 3812)
+++ GNUnet/src/util/os/osconfig.c 2006-11-23 04:30:30 UTC (rev 3813)
@@ -258,34 +258,35 @@
return YES;
#else
struct stat buf;
+ int ret;
/* Unix */
- if((ACCESS("/usr/sbin/update-rc.d", X_OK) != 0))
- {
+ if ((ACCESS("/usr/sbin/update-rc.d",
+ X_OK) != 0)) {
GE_LOG_STRERROR_FILE(ectx,
GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
- "access", "/usr/sbin/update-rc.d");
+ "access",
+ "/usr/sbin/update-rc.d");
return SYSERR;
}
/* Debian */
- if(doAutoStart)
- {
- if(ACCESS(application, X_OK) != 0)
- {
+ if (doAutoStart) {
+
+ if (ACCESS(application, X_OK) != 0) {
GE_LOG_STRERROR_FILE(ectx,
GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
- "access", application);
+ "access",
+ application);
}
- if(STAT("/etc/init.d/gnunetd", &buf) == -1)
- {
+ if (STAT("/etc/init.d/gnunetd", &buf) == -1) {
/* create init file */
FILE *f = FOPEN("/etc/init.d/gnunetd", "w");
- if(!f)
- {
+ if (f == NULL) {
GE_LOG_STRERROR_FILE(ectx,
GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
- "fopen", "/etc/init.d/gnunetd");
+ "fopen",
+ "/etc/init.d/gnunetd");
return 2;
}
@@ -320,42 +321,54 @@
" echo \"Usage: /etc/init.d/gnunetd
{start|stop|reload|restart|force-reload}\" >&2\n"
" exit 1\n"
" ;;\n"
- "\n" "esac\n" "exit 0\n", "gnunet-setup", application);
+ "\n" "esac\n" "exit 0\n",
+ "gnunet-setup",
+ application);
fclose(f);
- if(0 != CHMOD("/etc/init.d/gnunetd",
- S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH))
- {
+ if (0 != CHMOD("/etc/init.d/gnunetd",
+ S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)) {
GE_LOG_STRERROR_FILE(ectx,
GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE,
- "chmod", "/etc/init.d/gnunetd");
+ "chmod",
+ "/etc/init.d/gnunetd");
return SYSERR;
}
}
- errno = 0;
- if(-1 == system("/usr/sbin/update-rc.d gnunetd defaults"))
- {
- GE_LOG_STRERROR_FILE(ectx,
- GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE,
- "system", "/usr/sbin/update-rc.d");
- return SYSERR;
+ if (STAT("/etc/init.d/gnunetd", &buf) != -1) {
+ errno = 0;
+ ret = system("/usr/sbin/update-rc.d gnunetd defaults");
+ if (ret != 0) {
+ if (errno != 0) {
+ GE_LOG_STRERROR_FILE(ectx,
+ GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ "system",
+ "/usr/sbin/update-rc.d");
+ } else {
+ GE_LOG(ectx,
+ GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE,
+ _("Command `%s' failed with error code %u\n"),
+ "/usr/sbin/update-rc.d gnunetd defaults",
+ WEXITSTATUS(ret));
+ }
+ return SYSERR;
+ }
}
return YES;
- }
- else
- { /* REMOVE autostart */
- if((UNLINK("/etc/init.d/gnunetd") == -1) && (errno != ENOENT))
- {
+ } else { /* REMOVE autostart */
+ if ( (UNLINK("/etc/init.d/gnunetd") == -1) &&
+ (errno != ENOENT)) {
GE_LOG_STRERROR_FILE(ectx,
GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE,
- "unlink", "/etc/init.d/gnunetd");
+ "unlink",
+ "/etc/init.d/gnunetd");
return SYSERR;
}
errno = 0;
- if(-1 != system("/usr/sbin/update-rc.d gnunetd remove"))
- {
+ if(-1 != system("/usr/sbin/update-rc.d gnunetd remove")) {
GE_LOG_STRERROR_FILE(ectx,
GE_WARNING | GE_USER | GE_ADMIN | GE_IMMEDIATE,
- "system", "/usr/sbin/update-rc.d");
+ "system",
+ "/usr/sbin/update-rc.d");
return SYSERR;
}
return YES;
Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-11-23 03:50:14 UTC (rev 3812)
+++ GNUnet/todo 2006-11-23 04:30:30 UTC (rev 3813)
@@ -18,19 +18,6 @@
+ uninstall: Remove account
+ libcurl, guile [RCpre0]
* file/socket leak (#955) - possibly fixed
- * gnunet-setup gtk-wizard problems: [RCpre1]
- + running gnunet-setup with gtk-wizard should imply running with -d
- + gnunet-setup wizard looks for INTERFACE/MAXNET*BPS in section LOAD,
- and GROUP in section GNUNETD but it is not there!
- + at the end: Unable to change startup process: no such file or directory
- -- which file (something about gnunet-setup's main run)
- + also, running gnunet-update fails
- + error messages about failed accesses to /etc, /etc/init.d/ are
- printed to console, not to GUI
- + call to updateTreeModel from gconf_main_post_init
- is illegal -- setup resources have already been freed
- (in doOpenEnhConfigurator branch from main method of gnunet-setup)
- => segfault!
- finish util refactoring:
* error handling: [RCpre1]
+ fs/fsui: capture ectx errors and convert to event error msgs!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3813 - in GNUnet: . contrib src/include src/server src/setup src/setup/gtk src/util/os,
grothoff <=