[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r2378 - in GNUnet: doc/man src/server
From: |
grothoff |
Subject: |
[GNUnet-SVN] r2378 - in GNUnet: doc/man src/server |
Date: |
Fri, 23 Dec 2005 11:50:06 -0800 (PST) |
Author: grothoff
Date: 2005-12-23 11:50:03 -0800 (Fri, 23 Dec 2005)
New Revision: 2378
Modified:
GNUnet/doc/man/gnunet-transport-check.1
GNUnet/doc/man/gnunet-update.1
GNUnet/src/server/Makefile.am
GNUnet/src/server/gnunet-transport-check.c
GNUnet/src/server/gnunet-update.c
GNUnet/src/server/gnunetd.c
GNUnet/src/server/startup.c
GNUnet/src/server/startup.h
Log:
added -u / chuser support to gnunet-update and gnunet-transport-check
Modified: GNUnet/doc/man/gnunet-transport-check.1
===================================================================
--- GNUnet/doc/man/gnunet-transport-check.1 2005-12-23 19:32:20 UTC (rev
2377)
+++ GNUnet/doc/man/gnunet-transport-check.1 2005-12-23 19:50:03 UTC (rev
2378)
@@ -73,6 +73,10 @@
run using the specified transport, if not given the transports
configured in the configuration file are used.
.TP
+\fB\-u \fIUSER\fR, \fB\-\-user=USER\fR
+run as user USER (and if available as group USER). Note that to use this
option, you will probably have to start gnunet-transport-check as
+root. It is typically better to directly start gnunet-transport-check as that
user instead.
+.TP
\fB\-v\fR, \fB\-\-version\fR
print the version number
.TP
Modified: GNUnet/doc/man/gnunet-update.1
===================================================================
--- GNUnet/doc/man/gnunet-update.1 2005-12-23 19:32:20 UTC (rev 2377)
+++ GNUnet/doc/man/gnunet-update.1 2005-12-23 19:50:03 UTC (rev 2378)
@@ -21,9 +21,13 @@
\fB\-L \fILOGLEVEL\fR, \fB\-\-loglevel=LOGLEVEL\fR
change the loglevel. Possible values for LOGLEVEL are NOTHING, FATAL, ERROR,
FAILURE, WARNING, MESSAGE, INFO, DEBUG, CRON and EVERYTHING.
.TP
-\fB\-u\fR, \fB\-\-user\fR
-run in user mode (required to get values from the user configuration). This
option must be used only together with the \-g option.
+\fB\-U\fR, \fB\-\-client\fR
+run in client mode (required to get values from the client configuration).
This option must be used only together with the \-g option.
.TP
+\fB\-u \fIUSER\fR, \fB\-\-user=USER\fR
+run as user USER (and if available as group USER). Note that to use this
option, you will probably have to start gnunet-update as
+root. It is typically better to directly start gnunet-update as that user
instead.
+.TP
\fB\-v\fR, \fB\-\-version\fR
print the version number
.TP
Modified: GNUnet/src/server/Makefile.am
===================================================================
--- GNUnet/src/server/Makefile.am 2005-12-23 19:32:20 UTC (rev 2377)
+++ GNUnet/src/server/Makefile.am 2005-12-23 19:50:03 UTC (rev 2378)
@@ -15,13 +15,13 @@
core.c \
handler.c handler.h \
tcpserver.c tcpserver.h \
+ startup.c startup.h \
version.c version.h
libgnunetcore_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la
gnunetd_SOURCES = \
- gnunetd.c \
- startup.c startup.h
+ gnunetd.c
gnunetd_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/server/libgnunetcore.la
Modified: GNUnet/src/server/gnunet-transport-check.c
===================================================================
--- GNUnet/src/server/gnunet-transport-check.c 2005-12-23 19:32:20 UTC (rev
2377)
+++ GNUnet/src/server/gnunet-transport-check.c 2005-12-23 19:50:03 UTC (rev
2378)
@@ -37,6 +37,7 @@
#include "core.h"
#include "connection.h"
#include "handler.h"
+#include "startup.h"
#define DEBUG_TRANSPORT_CHECK NO
@@ -355,18 +356,21 @@
while (1) {
int option_index = 0;
static struct GNoption long_options[] = {
- { "loglevel",1, 0, 'L' },
{ "config", 1, 0, 'c' },
- { "version", 0, 0, 'v' },
{ "help", 0, 0, 'h' },
- { "transport", 1, 0, 't' },
+ { "loglevel",1, 0, 'L' },
+ { "ping", 0, 0, 'p' },
+ { "Xport", 1, 0, 'P' },
{ "repeat", 1, 0, 'r' },
{ "size", 1, 0, 's'},
- { "Xrepeat", 1, 0, 'x' },
+ { "transport", 1, 0, 't' },
{ "timeout", 1, 0, 'T' },
- { "ping", 0, 0, 'p' },
- { "Xport", 1, 0, 'P' },
+#ifndef MINGW /* not supported */
+ { "user", 0, 0, 'u' },
+#endif
+ { "version", 0, 0, 'v' },
{ "verbose", 0, 0, 'V' },
+ { "Xrepeat", 1, 0, 'X' },
{ 0,0,0,0 }
};
@@ -380,6 +384,45 @@
break; /* No more flags to process */
switch(c) {
+ case 'c':
+ FREENONNULL(setConfigurationString("FILES",
+ "gnunet.conf",
+ GNoptarg));
+ break;
+ case 'h': {
+ static Help help[] = {
+ HELP_CONFIG,
+ HELP_HELP,
+ HELP_LOGLEVEL,
+ { 'p', "ping", NULL,
+ gettext_noop("ping peers from HOSTLISTURL that match transports") },
+ { 'r', "repeat", "COUNT",
+ gettext_noop("send COUNT messages") },
+ { 's', "size", "SIZE",
+ gettext_noop("send messages with SIZE bytes payload") },
+ { 't', "transport", "TRANSPORT",
+ gettext_noop("specifies which TRANSPORT should be tested") },
+ { 'T', "timeout", "MS",
+ gettext_noop("specifies after how many MS to time-out") },
+#ifndef MINGW /* not supported */
+ { 'u', "user", "LOGIN",
+ gettext_noop("run as user LOGIN") },
+#endif
+ HELP_VERSION,
+ HELP_VERBOSE,
+ HELP_END,
+ };
+ formatHelp("gnunet-transport-check [OPTIONS]",
+ _("Tool to test if GNUnet transport services are
operational."),
+ help);
+ cont = SYSERR;
+ break;
+ }
+ case 'L':
+ FREENONNULL(setConfigurationString("GNUNETD",
+ "LOGLEVEL",
+ GNoptarg));
+ break;
case 'p':
FREENONNULL(setConfigurationString("TRANSPORT-CHECK",
"PING",
@@ -400,24 +443,6 @@
}
break;
}
- case 's':{
- unsigned int size;
- if (1 != sscanf(GNoptarg, "%ud", &size)) {
- LOG(LOG_FAILURE,
- _("You must pass a number to the `%s' option.\n"),
- "-s");
- return SYSERR;
- } else {
- if (size == 0)
- size = 1;
- expectedSize = size;
- expectedValue = MALLOC(size);
- expectedValue[--size] = '\0';
- while (size > 0)
- expectedValue[--size] = 'A';
- }
- break;
- }
case 'r':{
unsigned int repeat;
if (1 != sscanf(GNoptarg, "%ud", &repeat)) {
@@ -432,17 +457,21 @@
}
break;
}
- case 'X':{
- unsigned int repeat;
- if (1 != sscanf(GNoptarg, "%ud", &repeat)) {
+ case 's':{
+ unsigned int size;
+ if (1 != sscanf(GNoptarg, "%ud", &size)) {
LOG(LOG_FAILURE,
_("You must pass a number to the `%s' option.\n"),
- "-X");
+ "-s");
return SYSERR;
} else {
- setConfigurationInt("TRANSPORT-CHECK",
- "X-REPEAT",
- repeat);
+ if (size == 0)
+ size = 1;
+ expectedSize = size;
+ expectedValue = MALLOC(size);
+ expectedValue[--size] = '\0';
+ while (size > 0)
+ expectedValue[--size] = 'A';
}
break;
}
@@ -455,16 +484,16 @@
}
break;
}
- case 'c':
- FREENONNULL(setConfigurationString("FILES",
- "gnunet.conf",
- GNoptarg));
- break;
case 't':
FREENONNULL(setConfigurationString("GNUNETD",
"TRANSPORTS",
GNoptarg));
break;
+#ifndef MINGW /* not supported */
+ case 'u':
+ changeUser(GNoptarg);
+ break;
+#endif
case 'v':
printf("gnunet-transport-check v%s\n",
VERSION);
@@ -475,36 +504,20 @@
"VERBOSE",
"YES"));
break;
- case 'h': {
- static Help help[] = {
- HELP_CONFIG,
- HELP_HELP,
- HELP_LOGLEVEL,
- { 'p', "ping", NULL,
- gettext_noop("ping peers from HOSTLISTURL that match transports") },
- { 'r', "repeat", "COUNT",
- gettext_noop("send COUNT messages") },
- { 's', "size", "SIZE",
- gettext_noop("send messages with SIZE bytes payload") },
- { 't', "transport", "TRANSPORT",
- gettext_noop("specifies which TRANSPORT should be tested") },
- { 'T', "timeout", "MS",
- gettext_noop("specifies after how many MS to time-out") },
- HELP_VERSION,
- HELP_VERBOSE,
- HELP_END,
- };
- formatHelp("gnunet-transport-check [OPTIONS]",
- _("Tool to test if GNUnet transport services are
operational."),
- help);
- cont = SYSERR;
+ case 'X':{
+ unsigned int repeat;
+ if (1 != sscanf(GNoptarg, "%ud", &repeat)) {
+ LOG(LOG_FAILURE,
+ _("You must pass a number to the `%s' option.\n"),
+ "-X");
+ return SYSERR;
+ } else {
+ setConfigurationInt("TRANSPORT-CHECK",
+ "X-REPEAT",
+ repeat);
+ }
break;
}
- case 'L':
- FREENONNULL(setConfigurationString("GNUNETD",
- "LOGLEVEL",
- GNoptarg));
- break;
default:
LOG(LOG_FAILURE,
_("Use --help to get a list of options.\n"));
@@ -529,12 +542,20 @@
int res;
int Xrepeat;
char * trans;
+ char * user;
int ping;
int stats[3];
if (OK != initUtil(argc, argv, &parser)) {
return SYSERR;
}
+#ifndef MINGW
+ user = getConfigurationString("GNUNETD", "USER");
+ if (user && strlen(user))
+ changeUser(user);
+ FREENONNULL(user);
+#endif
+
if (expectedValue == NULL) {
expectedValue = STRDUP(DEFAULT_MSG);
expectedSize = strlen(DEFAULT_MSG);
Modified: GNUnet/src/server/gnunet-update.c
===================================================================
--- GNUnet/src/server/gnunet-update.c 2005-12-23 19:32:20 UTC (rev 2377)
+++ GNUnet/src/server/gnunet-update.c 2005-12-23 19:50:03 UTC (rev 2378)
@@ -28,6 +28,7 @@
#include "gnunet_util.h"
#include "gnunet_core.h"
#include "core.h"
+#include "startup.h"
#include "version.h"
/**
@@ -49,8 +50,12 @@
gettext_noop("print a value from the configuration file to stdout") },
HELP_HELP,
HELP_LOGLEVEL,
- { 'u', "user", NULL,
- gettext_noop("run in user mode (for getting user configuration values)")
},
+#ifndef MINGW /* not supported */
+ { 'u', "user", "LOGIN",
+ gettext_noop("run as user LOGIN") },
+#endif
+ { 'U', "client", NULL,
+ gettext_noop("run in client mode (for getting client configuration
values)") },
HELP_VERSION,
HELP_VERBOSE,
HELP_END,
@@ -83,7 +88,10 @@
static struct GNoption long_options[] = {
LONG_DEFAULT_OPTIONS,
{ "get", 1, 0, 'g' },
+#ifndef MINGW /* not supported */
{ "user", 0, 0, 'u' },
+#endif
+ { "client", 0, 0, 'U' },
{ "verbose", 0, 0, 'V' },
{ 0,0,0,0 }
};
@@ -112,7 +120,12 @@
case 'h':
printhelp();
return SYSERR;
+#ifndef MINGW /* not supported */
case 'u':
+ changeUser(GNoptarg);
+ break;
+#endif
+ case 'U':
FREENONNULL(setConfigurationString("GNUNETD",
"_MAGIC_",
"NO"));
@@ -302,9 +315,17 @@
int main(int argc,
char * argv[]) {
char * get;
+ char * user;
if (SYSERR == initUtil(argc, argv, &parseCommandLine))
return 0;
+#ifndef MINGW
+ user = getConfigurationString("GNUNETD", "USER");
+ if (user && strlen(user))
+ changeUser(user);
+ FREENONNULL(user);
+#endif
+
get = getConfigurationString("GNUNET-UPDATE",
"GET");
if (get != NULL)
Modified: GNUnet/src/server/gnunetd.c
===================================================================
--- GNUnet/src/server/gnunetd.c 2005-12-23 19:32:20 UTC (rev 2377)
+++ GNUnet/src/server/gnunetd.c 2005-12-23 19:50:03 UTC (rev 2378)
@@ -36,17 +36,6 @@
#include "startup.h"
#include "version.h"
-/**
- * This flag is set if gnunetd is not (to be) detached from the
- * console.
- */
-int debug_flag = NO;
-
-/**
- * This flag is set if gnunetd was started as windows service
- */
-int win_service = NO;
-
void gnunet_main();
#ifdef MINGW
@@ -174,7 +163,7 @@
checkCompiler();
umask(0);
/* init 1: get options and basic services up */
- if (SYSERR == initUtil(argc, argv, &parseCommandLine))
+ if (SYSERR == initUtil(argc, argv, &parseGnunetdCommandLine))
return 0; /* parse error, --help, etc. */
#ifdef MINGW
Modified: GNUnet/src/server/startup.c
===================================================================
--- GNUnet/src/server/startup.c 2005-12-23 19:32:20 UTC (rev 2377)
+++ GNUnet/src/server/startup.c 2005-12-23 19:50:03 UTC (rev 2378)
@@ -39,7 +39,28 @@
#include "tcpserver.h"
#include "core.h"
-extern int debug_flag, win_service;
+
+
+/**
+ * This flag is set if gnunetd is not (to be) detached from the
+ * console.
+ */
+static int debug_flag_ = NO;
+
+/**
+ * This flag is set if gnunetd was started as windows service
+ */
+static int win_service_ = NO;
+
+int debug_flag() {
+ return debug_flag_;
+}
+
+int win_service() {
+ return win_service_;
+}
+
+
#ifdef MINGW
extern SERVICE_STATUS theServiceStatus;
extern SERVICE_STATUS_HANDLE hService;
@@ -389,8 +410,10 @@
"be written to stderr instead of a logfile") },
HELP_HELP,
HELP_LOGLEVEL,
+#ifndef MINGW /* not supported */
{ 'u', "user", "LOGIN",
gettext_noop("run as user LOGIN") },
+#endif
HELP_VERSION,
HELP_END,
};
@@ -427,8 +450,8 @@
/**
* Perform option parsing from the command line.
*/
-int parseCommandLine(int argc,
- char * argv[]) {
+int parseGnunetdCommandLine(int argc,
+ char * argv[]) {
int cont = OK;
int c;
@@ -496,7 +519,7 @@
GNoptarg));
break;
case 'd':
- debug_flag = YES;
+ debug_flag_ = YES;
FREENONNULL(setConfigurationString("GNUNETD",
"LOGFILE",
NULL));
@@ -508,7 +531,7 @@
#endif
#ifdef MINGW
case '@':
- win_service = YES;
+ win_service_ = YES;
break;
#endif
default:
Modified: GNUnet/src/server/startup.h
===================================================================
--- GNUnet/src/server/startup.h 2005-12-23 19:32:20 UTC (rev 2377)
+++ GNUnet/src/server/startup.h 2005-12-23 19:50:03 UTC (rev 2378)
@@ -34,6 +34,10 @@
#include "gnunet_util.h"
#include "platform.h"
+int debug_flag();
+
+int win_service();
+
/**
* Check if the compiler did a decent job.
**/
@@ -42,8 +46,8 @@
/**
* Perform option parsing from the command line.
**/
-int parseCommandLine(int argc,
- char * argv[]);
+int parseGnunetdCommandLine(int argc,
+ char * argv[]);
/**
* Initialize signal handlers
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r2378 - in GNUnet: doc/man src/server,
grothoff <=