GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
* @author Christian Grothoff
*/
#include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_crypto_lib.h"
-#include "gnunet_directories.h"
-#include "gnunet_disk_lib.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_os_lib.h"
+#include "gnunet_util_lib.h"
#include "gnunet_protocols.h"
+#include "gnunet_directories.h"
#include "gnunet_resolver_service.h"
-#include "gnunet_server_lib.h"
-#include "gnunet_service_lib.h"
#if HAVE_MALLINFO
#include <malloc.h>
};
+/**
+ * Start task that may speed up our system clock artificially
+ *
+ * @param cfg configuration to use
+ * @return GNUNET_OK on success, GNUNET_SYSERR if the speedup was not configured
+ */
int
GNUNET_SPEEDUP_start_ (const struct GNUNET_CONFIGURATION_Handle *cfg);
-int
+/**
+ * Stop tasks that modify clock behavior.
+ */
+void
GNUNET_SPEEDUP_stop_ (void);
* with a semicolon). The network must be given in dotted-decimal
* notation. The netmask can be given in CIDR notation (/16) or
* in dotted-decimal (/255.255.0.0).
- *
+ *
* @param routeList a string specifying the forbidden networks
* @return the converted list, NULL if the synatx is flawed
*/
* with a semicolon). The network must be given in colon-hex
* notation. The netmask must be given in CIDR notation (/16) or
* can be omitted to specify a single host.
- *
+ *
* @param routeListX a string specifying the forbidden networks
* @return the converted list, NULL if the synatx is flawed
*/
#ifndef WINDOWS
case AF_UNIX:
ret = GNUNET_OK; /* always OK for now */
- if (GNUNET_YES == sctx->match_uid)
+ if (GNUNET_YES == sctx->match_uid)
{
/* UID match required */
ret = (NULL != uc) && ( (0 == uc->uid) || (uc->uid == geteuid ()) );
}
else if ( (GNUNET_YES == sctx->match_gid) &&
- ( (NULL == uc) ||
+ ( (NULL == uc) ||
( (0 != uc->uid) &&
(uc->uid != geteuid ()) ) ) )
{
/* group match required and UID does not match */
- if (NULL == uc)
+ if (NULL == uc)
{
/* no credentials, group match not possible */
ret = GNUNET_NO;
if (GNUNET_OK != ret)
{
LOG (GNUNET_ERROR_TYPE_WARNING,
- _("Access from `%s' denied to service `%s'\n"),
+ _("Access from `%s' denied to service `%s'\n"),
GNUNET_a2s (addr, addrlen),
sctx->service_name);
}
* Parse an IPv4 access control list.
*
* @param ret location where to write the ACL (set)
- * @param sctx service context to use to get the configuration
+ * @param sctx service context to use to get the configuration
* @param option name of the ACL option to parse
- * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including
+ * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including
* no ACL configured)
*/
static int
if (!GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name, option))
{
- *ret = NULL;
+ *ret = NULL;
return GNUNET_OK;
}
GNUNET_break (GNUNET_OK ==
* Parse an IPv6 access control list.
*
* @param ret location where to write the ACL (set)
- * @param sctx service context to use to get the configuration
+ * @param sctx service context to use to get the configuration
* @param option name of the ACL option to parse
- * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including
+ * @return GNUNET_SYSERR on parse error, GNUNET_OK on success (including
* no ACL configured)
*/
static int
unixpath = GNUNET_NETWORK_shorten_unixpath (unixpath);
LOG (GNUNET_ERROR_TYPE_INFO,
_("Using `%s' instead\n"), unixpath);
-
}
}
if (NULL != unixpath)
int tolerant;
#ifndef MINGW
- const char *lpid;
- unsigned int pid;
const char *nfds;
unsigned int cnt;
int flags;
#ifndef MINGW
errno = 0;
- if ((NULL != (lpid = getenv ("LISTEN_PID"))) &&
- (1 == SSCANF (lpid, "%u", &pid)) && (getpid () == (pid_t) pid) &&
- (NULL != (nfds = getenv ("LISTEN_FDS"))) &&
+ if ((NULL != (nfds = getenv ("LISTEN_FDS"))) &&
(1 == SSCANF (nfds, "%u", &cnt)) && (cnt > 0) && (cnt < FD_SETSIZE) &&
(cnt + 4 < FD_SETSIZE))
{
break;
}
}
- unsetenv ("LISTEN_PID");
unsetenv ("LISTEN_FDS");
}
#else
{
/* we get to create a directory -- and claim it
* as ours! */
- GNUNET_DISK_directory_create (rdir);
+ (void) GNUNET_DISK_directory_create (rdir);
if ((NULL != user) && (0 < strlen (user)))
GNUNET_DISK_file_change_owner (rdir, user);
}
if (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason))
return;
- GNUNET_SPEEDUP_start_ (sctx->cfg);
+ (void) GNUNET_SPEEDUP_start_ (sctx->cfg);
GNUNET_RESOLVER_connect (sctx->cfg);
if (NULL != sctx->lsocks)
sctx->server =
* Detach from terminal.
*
* @param sctx service context
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
static int
detach_terminal (struct GNUNET_SERVICE_Context *sctx)
#if HAVE_MALLINFO
{
char *counter;
-
+
if ( (GNUNET_YES ==
GNUNET_CONFIGURATION_have_value (sctx.cfg, service_name,
"GAUGER_HEAP")) &&
&counter)) )
{
struct mallinfo mi;
-
+
mi = mallinfo ();
GAUGER (service_name, counter, mi.usmblks, "blocks");
GNUNET_free (counter);
- }
+ }
}
#endif
GNUNET_SPEEDUP_stop_ ();
#if HAVE_MALLINFO
{
char *counter;
-
+
if ( (GNUNET_YES ==
GNUNET_CONFIGURATION_have_value (sctx->cfg, sctx->service_name,
"GAUGER_HEAP")) &&
&counter)) )
{
struct mallinfo mi;
-
+
mi = mallinfo ();
GAUGER (sctx->service_name, counter, mi.usmblks, "blocks");
GNUNET_free (counter);
- }
+ }
}
#endif
if (GNUNET_SCHEDULER_NO_TASK != sctx->shutdown_task)