gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r1692 - in GNUnet: contrib src/conf


From: durner
Subject: [GNUnet-SVN] r1692 - in GNUnet: contrib src/conf
Date: Tue, 16 Aug 2005 12:16:09 -0700 (PDT)

Author: durner
Date: 2005-08-16 12:16:01 -0700 (Tue, 16 Aug 2005)
New Revision: 1692

Modified:
   GNUnet/contrib/config-daemon.in
   GNUnet/src/conf/wizard.c
   GNUnet/src/conf/wizard_callbacks.c
   GNUnet/src/conf/wizard_curs.c
Log:
remember user, group and autostart

Modified: GNUnet/contrib/config-daemon.in
===================================================================
--- GNUnet/contrib/config-daemon.in     2005-08-16 18:34:53 UTC (rev 1691)
+++ GNUnet/contrib/config-daemon.in     2005-08-16 19:16:01 UTC (rev 1692)
@@ -133,7 +133,7 @@
                
                If you do not specify a HOSTLISTURL, you must copy valid 
hostkeys to
                data/hosts manually.
-               Default: HOSTLISTURL = "http://gnunet.org/hostlist 
http://mikael.karlsson.com/hostlist";
+               Default: HOSTLISTURL = "http://gnunet.org/hostlist 
http://mikael.karlsson.com/hostlist http://gnunet.mine.nu:8081/hostlist";
     
   config HTTP-PROXY
   string "HTTP Proxy Server"
@@ -219,6 +219,30 @@
                in mind that values smaller than 0 require root privileges).
                Default is "NORMAL".
 
+       config USER
+       string "GNUnet user"
+       default ""
+       help
+               As which user account should gnunetd run?
+               Empty means "current user". On computer startup, it is 
root/SYSTEM.
+               Under Windows, this setting affects the creation of a new
+               system service only.
+
+       config GROUP
+       string "GNUnet group"
+       default ""
+       help
+               As which group account should gnunetd run?
+               Empty means current group under Unix. It has no meaning under 
Windows.
+
+       config AUTOSTART
+       bool "Start GNUnet daemon automatically"
+       default n
+       depends on Meta::RARE
+       help
+               This is used by the configuration wizards to remember whether 
to start
+               the GNUnet daemon at computer startup.
+
 endmenu
 
 if Meta::ADVANCED      

Modified: GNUnet/src/conf/wizard.c
===================================================================
--- GNUnet/src/conf/wizard.c    2005-08-16 18:34:53 UTC (rev 1691)
+++ GNUnet/src/conf/wizard.c    2005-08-16 19:16:01 UTC (rev 1692)
@@ -25,6 +25,7 @@
  */
 
 #include "gnunet_util.h"
+#include "platform.h"
 
 #ifndef MINGW
 #include <grp.h>
@@ -206,6 +207,7 @@
 
 void load_step4()
 {
+  struct symbol *sym;
   GtkWidget *vbox18, *frame8, *vbox19, *table3, *entUser, *entGroup;
 
   vbox18 = lookup_widget(curwnd, "vbox18");
@@ -215,9 +217,28 @@
   entUser = lookup_widget(table3, "entUser");
   entGroup = lookup_widget(table3, "entGroup");
 
+  if (! user_name)
+  {
+    sym = sym_find("USER", "GNUNETD");
+    if (sym)
+    {
+      sym_calc_value_ext(sym, 1);
+      user_name = sym_get_string_value(sym);
+    }
+  }
 
+  if (! group_name)
+  {
+    sym = sym_find("GROUP", "GNUNETD");
+    if (sym)
+    {
+      sym_calc_value_ext(sym, 1);
+      group_name = sym_get_string_value(sym);
+    }
+  }
+
 #ifndef MINGW
-  if(NULL == user_name)
+  if(NULL == user_name || strlen(user_name) == 0)
   {
     if((geteuid() == 0) || (NULL != getpwnam("gnunet")))
       user_name = STRDUP("gnunet");
@@ -232,7 +253,8 @@
       group_name = STRDUP(getgrgid(getegid())->gr_name);
   }
 #else
-#print PORT-ME
+  if (NULL == user_name || strlen(user_name) == 0)
+    user_name = STRDUP("");
 #endif
 
   if(user_name)
@@ -287,8 +309,13 @@
        if (isOSUserAddCapable())
                gtk_widget_set_sensitive(chkStart, TRUE);
 
-       if (doAutoStart)
-               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chkStart), 1);   
        
+  sym = sym_find("AUTOSTART", "GNUNETD");
+  if (sym)
+  {
+    sym_calc_value_ext(sym, 1);
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chkStart),
+      sym_get_tristate_value(sym) != no);
+  }
 
        if (doOpenEnhConfigurator)
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(chkEnh), 1);     
        

Modified: GNUnet/src/conf/wizard_callbacks.c
===================================================================
--- GNUnet/src/conf/wizard_callbacks.c  2005-08-16 18:34:53 UTC (rev 1691)
+++ GNUnet/src/conf/wizard_callbacks.c  2005-08-16 19:16:01 UTC (rev 1692)
@@ -351,7 +351,10 @@
 void
 on_chkStart_toggled (GtkToggleButton * togglebutton, gpointer user_data)
 {
+  struct symbol *sym = sym_lookup("AUTOSTART", "GNUNETD", 0);
+
        doAutoStart = gtk_toggle_button_get_active(togglebutton);
+  sym_set_tristate_value(sym, doAutoStart ? yes : no);
 }
 
 
@@ -388,18 +391,28 @@
 void
 on_entUser_changed (GtkEditable * editable, gpointer user_data)
 {
+  struct symbol *sym;
+  
        if (user_name)
                free(user_name);
        
        user_name = strdup(gtk_editable_get_chars(editable, 0, -1));
+  
+  sym = sym_lookup("USER", "GNUNETD", 0);
+  sym_set_string_value(sym, user_name);
 }
 
 
 void
 on_entGroup_changed (GtkEditable * editable, gpointer user_data)
 {
+  struct symbol *sym;
+  
        if (group_name)
                free(group_name);
        
        group_name = strdup(gtk_editable_get_chars(editable, 0, -1));
+  
+  sym = sym_lookup("GROUP", "GNUNETD", 0);
+  sym_set_string_value(sym, group_name);
 }

Modified: GNUnet/src/conf/wizard_curs.c
===================================================================
--- GNUnet/src/conf/wizard_curs.c       2005-08-16 18:34:53 UTC (rev 1691)
+++ GNUnet/src/conf/wizard_curs.c       2005-08-16 19:16:01 UTC (rev 1692)
@@ -26,6 +26,10 @@
 
 #include "gnunet_util.h"
 
+#ifndef MINGW
+  #include <grp.h>
+#endif
+
 #define LKC_DIRECT_LINK
 #include "lkc.h"
 
@@ -451,6 +455,32 @@
        /* User */
        if (isOSUserAddCapable()) {
                while(true) {
+      char *defuser;
+      
+      sym = sym_find("USER", "GNUNETD");
+      if (sym)
+      {
+        sym_calc_value_ext(sym, 1);
+        user_name = sym_get_string_value(sym);
+      }
+      
+#ifndef MINGW
+      if(NULL == user_name || strlen(user_name) == 0)
+      {
+        if((geteuid() == 0) || (NULL != getpwnam("gnunet")))
+          defuser = STRDUP("gnunet");
+        else
+          defuser = STRDUP(getenv("USER"));
+      }
+      else
+        defuser = STRDUP(user_name);
+#else
+      if (NULL == user_name || strlen(user_name) == 0)
+        user_name = STRDUP("");
+      else
+        defuser = STRDUP(user_name);
+#endif
+      
                        ret = dialog_inputbox(_("GNUnet configuration"),
                                _("Define the user owning the GNUnet 
service.\n\n"
                                        "For security reasons, it is a good 
idea to let this setup create "
@@ -460,7 +490,8 @@
                                        "This includes files you want to 
publish in GNUnet. You'll have to "
                                        "grant read permissions to the user 
specified below.\n\n"
                                        "Leave the fields empty to run GNUnet 
with system privileges.\n\n"
-                                       "GNUnet user:"), rows, cols - 5, "");
+                                       "GNUnet user:"), rows, cols - 5, 
defuser);
+      FREE(defuser);
                        
                        if (ret == 1) {
                                /* Help */
@@ -478,7 +509,33 @@
 
                /* Group */
                if (isOSGroupAddCapable()) {
+      char *defgroup;
+      
                        while(true) {
+        sym = sym_find("GROUP", "GNUNETD");
+        if (sym)
+        {
+          sym_calc_value_ext(sym, 1);
+          group_name = sym_get_string_value(sym);
+        }
+
+#ifndef MINGW
+        if(NULL == group_name)
+        {
+          if((geteuid() == 0) || (NULL != getgrnam("gnunet")))
+            defgroup = STRDUP("gnunet");
+          else
+            defgroup = STRDUP(getgrgid(getegid())->gr_name);
+        }
+        else
+          defgroup = STRDUP(group_name);
+#else
+        if (NULL == group_name || strlen(group_name) == 0)
+          group_name = STRDUP("");
+        else
+          group_name = STRDUP(group_name);
+#endif
+        
                                ret = dialog_inputbox(_("GNUnet configuration"),
                                        _("Define the group owning the GNUnet 
service.\n\n"
                                                "For security reasons, it is a 
good idea to let this setup create "
@@ -487,7 +544,8 @@
                                                "Only members of this group 
will be allowed to start and stop the "
                                                "the GNUnet server and have 
access to GNUnet server data.\n\n"
                                                "GNUnet group:"),
-                                       rows, cols - 5, "");
+                                       rows, cols - 5, defgroup);
+        FREE(defgroup);
                                
                                if (ret == 1) {
                                        /* Help */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]