mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-09 20:53:12 +02:00
Fixes after clang-format, as planned. These are whitespace only.
These were not a surprise, but deliberate: we let the previous clang-format commit be 100% clang-format job (so reproducable) and after that we planend and did this commit, because we chose to leave some stuff alone and do it manually. This commit will (also) be added to .git-blame-ignore-revs
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@
|
||||
*/
|
||||
typedef struct dbuf {
|
||||
u_int length; /* Current number of bytes stored */
|
||||
// u_int offset; /* Offset to the first byte */
|
||||
// u_int offset; /* Offset to the first byte */
|
||||
struct list_head dbuf_list;
|
||||
} dbuf;
|
||||
|
||||
|
||||
+7
-7
@@ -1539,13 +1539,13 @@ extern LogType log_type_stringtoval(const char *str);
|
||||
extern const char *log_type_valtostring(LogType v);
|
||||
#ifdef DEBUGMODE
|
||||
/* In debug mode we include file/linenumber. We put this arg at the end, however
|
||||
* there is an issue if unreal_log() is used with a parameter like xyz ? log_data_string("zzz") : NULL,
|
||||
* since then our log_data_source() would be beyond NULL and thus would never be freed,
|
||||
* so we allocate and handle that differently. File/line would still be lost but at
|
||||
* least there is no memory leak. Alternative solution is to specify first couple of
|
||||
* parameters explicitly, put log_data_source() at the beginning of the argument list
|
||||
* and then use non-portable ## __VA_ARGS__ for the remainder.
|
||||
*/
|
||||
* there is an issue if unreal_log() is used with a parameter like xyz ? log_data_string("zzz") : NULL,
|
||||
* since then our log_data_source() would be beyond NULL and thus would never be freed,
|
||||
* so we allocate and handle that differently. File/line would still be lost but at
|
||||
* least there is no memory leak. Alternative solution is to specify first couple of
|
||||
* parameters explicitly, put log_data_source() at the beginning of the argument list
|
||||
* and then use non-portable ## __VA_ARGS__ for the remainder.
|
||||
*/
|
||||
#define unreal_log(level, sys, id, ...) \
|
||||
do \
|
||||
{ \
|
||||
|
||||
+6
-6
@@ -65,30 +65,30 @@ struct mp_pool_t {
|
||||
mp_pool_t *next;
|
||||
|
||||
/** Doubly-linked list of chunks in which no items have been allocated.
|
||||
* The front of the list is the most recently emptied chunk. */
|
||||
* The front of the list is the most recently emptied chunk. */
|
||||
struct mp_chunk_t *empty_chunks;
|
||||
|
||||
/** Doubly-linked list of chunks in which some items have been allocated,
|
||||
* but which are not yet full. The front of the list is the chunk that has
|
||||
* most recently been modified. */
|
||||
* but which are not yet full. The front of the list is the chunk that has
|
||||
* most recently been modified. */
|
||||
struct mp_chunk_t *used_chunks;
|
||||
|
||||
/** Doubly-linked list of chunks in which no more items can be allocated.
|
||||
* The front of the list is the chunk that has most recently become full. */
|
||||
* The front of the list is the chunk that has most recently become full. */
|
||||
struct mp_chunk_t *full_chunks;
|
||||
|
||||
/** Length of <b>empty_chunks</b>. */
|
||||
int n_empty_chunks;
|
||||
|
||||
/** Lowest value of <b>empty_chunks</b> since last call to
|
||||
* mp_pool_clean(-1). */
|
||||
* mp_pool_clean(-1). */
|
||||
int min_empty_chunks;
|
||||
|
||||
/** Size of each chunk (in items). */
|
||||
int new_chunk_capacity;
|
||||
|
||||
/** Size to allocate for each item, including overhead and alignment
|
||||
* padding. */
|
||||
* padding. */
|
||||
size_t item_alloc_size;
|
||||
#ifdef MEMPOOL_STATS
|
||||
/** Total number of items allocated ever. */
|
||||
|
||||
+32
-32
@@ -957,44 +957,44 @@ extern void RPCHandlerDel(RPCHandler *m);
|
||||
|
||||
#ifndef GCC_TYPECHECKING
|
||||
/** Add a hook that returns an int.
|
||||
* @param module The module adding the hook
|
||||
* @param hooktype The hook type (HOOKTYPE_*)
|
||||
* @param priority Priority for hook execution order. Lower value = called first. Use 0 for normal.
|
||||
* @param func The hook function to add
|
||||
* @returns The Hook pointer, or NULL on failure.
|
||||
* @note Call this from MOD_INIT(), except for HOOKTYPE_CONFIGTEST and
|
||||
* HOOKTYPE_CONFIGPOSTTEST hooks which should be added in MOD_TEST().
|
||||
*/
|
||||
* @param module The module adding the hook
|
||||
* @param hooktype The hook type (HOOKTYPE_*)
|
||||
* @param priority Priority for hook execution order. Lower value = called first. Use 0 for normal.
|
||||
* @param func The hook function to add
|
||||
* @returns The Hook pointer, or NULL on failure.
|
||||
* @note Call this from MOD_INIT(), except for HOOKTYPE_CONFIGTEST and
|
||||
* HOOKTYPE_CONFIGPOSTTEST hooks which should be added in MOD_TEST().
|
||||
*/
|
||||
#define HookAdd(module, hooktype, priority, func) HookAddMain(module, hooktype, priority, func, NULL, NULL, NULL)
|
||||
/** Add a hook that returns void.
|
||||
* @param module The module adding the hook
|
||||
* @param hooktype The hook type (HOOKTYPE_*)
|
||||
* @param priority Priority for hook execution order. Lower value = called first. Use 0 for normal.
|
||||
* @param func The hook function to add
|
||||
* @returns The Hook pointer, or NULL on failure.
|
||||
* @note Call this from MOD_INIT(), except for HOOKTYPE_CONFIGTEST and
|
||||
* HOOKTYPE_CONFIGPOSTTEST hooks which should be added in MOD_TEST().
|
||||
*/
|
||||
* @param module The module adding the hook
|
||||
* @param hooktype The hook type (HOOKTYPE_*)
|
||||
* @param priority Priority for hook execution order. Lower value = called first. Use 0 for normal.
|
||||
* @param func The hook function to add
|
||||
* @returns The Hook pointer, or NULL on failure.
|
||||
* @note Call this from MOD_INIT(), except for HOOKTYPE_CONFIGTEST and
|
||||
* HOOKTYPE_CONFIGPOSTTEST hooks which should be added in MOD_TEST().
|
||||
*/
|
||||
#define HookAddVoid(module, hooktype, priority, func) HookAddMain(module, hooktype, priority, NULL, func, NULL, NULL)
|
||||
/** Add a hook that returns a string (char *).
|
||||
* @param module The module adding the hook
|
||||
* @param hooktype The hook type (HOOKTYPE_*)
|
||||
* @param priority Priority for hook execution order. Lower value = called first. Use 0 for normal.
|
||||
* @param func The hook function to add
|
||||
* @returns The Hook pointer, or NULL on failure.
|
||||
* @note Call this from MOD_INIT(), except for HOOKTYPE_CONFIGTEST and
|
||||
* HOOKTYPE_CONFIGPOSTTEST hooks which should be added in MOD_TEST().
|
||||
*/
|
||||
* @param module The module adding the hook
|
||||
* @param hooktype The hook type (HOOKTYPE_*)
|
||||
* @param priority Priority for hook execution order. Lower value = called first. Use 0 for normal.
|
||||
* @param func The hook function to add
|
||||
* @returns The Hook pointer, or NULL on failure.
|
||||
* @note Call this from MOD_INIT(), except for HOOKTYPE_CONFIGTEST and
|
||||
* HOOKTYPE_CONFIGPOSTTEST hooks which should be added in MOD_TEST().
|
||||
*/
|
||||
#define HookAddString(module, hooktype, priority, func) HookAddMain(module, hooktype, priority, NULL, NULL, func, NULL)
|
||||
/** Add a hook that returns a const string (const char *).
|
||||
* @param module The module adding the hook
|
||||
* @param hooktype The hook type (HOOKTYPE_*)
|
||||
* @param priority Priority for hook execution order. Lower value = called first. Use 0 for normal.
|
||||
* @param func The hook function to add
|
||||
* @returns The Hook pointer, or NULL on failure.
|
||||
* @note Call this from MOD_INIT(), except for HOOKTYPE_CONFIGTEST and
|
||||
* HOOKTYPE_CONFIGPOSTTEST hooks which should be added in MOD_TEST().
|
||||
*/
|
||||
* @param module The module adding the hook
|
||||
* @param hooktype The hook type (HOOKTYPE_*)
|
||||
* @param priority Priority for hook execution order. Lower value = called first. Use 0 for normal.
|
||||
* @param func The hook function to add
|
||||
* @returns The Hook pointer, or NULL on failure.
|
||||
* @note Call this from MOD_INIT(), except for HOOKTYPE_CONFIGTEST and
|
||||
* HOOKTYPE_CONFIGPOSTTEST hooks which should be added in MOD_TEST().
|
||||
*/
|
||||
#define HookAddConstString(module, hooktype, priority, func) HookAddMain(module, hooktype, priority, NULL, NULL, NULL, func)
|
||||
#else
|
||||
#define HookAdd(module, hooktype, priority, func) \
|
||||
|
||||
+3
-3
@@ -1195,9 +1195,9 @@ struct CRuleNode {
|
||||
crule_funcptr funcptr; /**< Evaluation function for this node. */
|
||||
int numargs; /**< Number of arguments. */
|
||||
/** Array of arguments. For operators, each arg
|
||||
* is a tree element; for functions, each arg is
|
||||
* a string.
|
||||
*/
|
||||
* is a tree element; for functions, each arg is
|
||||
* a string.
|
||||
*/
|
||||
void *arg[CR_MAXARGS];
|
||||
int func_test_type; /* for >, < and == */
|
||||
int func_test_value; /* integer value to compare against */
|
||||
|
||||
+3
-3
@@ -32,11 +32,11 @@ MODVAR char serveropts[] = {
|
||||
#ifdef DEBUGMODE
|
||||
'D',
|
||||
#endif
|
||||
/* FDLIST (always) */
|
||||
/* FDLIST (always) */
|
||||
'F',
|
||||
/* Hub (always) */
|
||||
/* Hub (always) */
|
||||
'h',
|
||||
/* NOSPOOF (always) */
|
||||
/* NOSPOOF (always) */
|
||||
'n',
|
||||
#ifdef VALLOC
|
||||
'V',
|
||||
|
||||
+2
-2
@@ -171,11 +171,11 @@ void check_ping(Client *client)
|
||||
return; /* some recent command was executed */
|
||||
|
||||
if (
|
||||
/* If we have sent a ping */
|
||||
/* If we have sent a ping */
|
||||
(IsPingSent(client)
|
||||
/* And they had 2x ping frequency to respond */
|
||||
&& ((TStime() - client->local->last_msg_received) >= (2 * ping))) ||
|
||||
/* Or isn't registered and time spent is larger than ping (CONNECTTIMEOUT).. */
|
||||
/* Or isn't registered and time spent is larger than ping (CONNECTTIMEOUT).. */
|
||||
(!IsRegistered(client) && (TStime() - client->local->fake_lag >= ping)))
|
||||
{
|
||||
if (IsServer(client) || IsConnecting(client) ||
|
||||
|
||||
+7
-7
@@ -17,13 +17,13 @@ LoopStruct loop;
|
||||
MODVAR IRCCounts irccounts;
|
||||
MODVAR Client me; /* That's me */
|
||||
MODVAR char *me_hash;
|
||||
char *configfile = NULL; /* Server configuration file */
|
||||
int debuglevel = 0; /* Server debug level */
|
||||
int bootopt = 0; /* Server boot option flags */
|
||||
char *debugmode = ""; /* -"- -"- -"- */
|
||||
int dorehash = 0; /**< Rehash server on next socket loop */
|
||||
int dorestart = 0; /**< Restart server on next socket loop */
|
||||
int doreloadcert = 0; /**< Reload TLS certificate on next socket loop */
|
||||
char *configfile = NULL; /* Server configuration file */
|
||||
int debuglevel = 0; /* Server debug level */
|
||||
int bootopt = 0; /* Server boot option flags */
|
||||
char *debugmode = ""; /* -"- -"- -"- */
|
||||
int dorehash = 0; /**< Rehash server on next socket loop */
|
||||
int dorestart = 0; /**< Restart server on next socket loop */
|
||||
int doreloadcert = 0; /**< Reload TLS certificate on next socket loop */
|
||||
MODVAR int quick_close = 0; /**< Quickly close client connections (1) or be friendly to TLS users (0) */
|
||||
MODVAR int connections_past_period = 0; /**< Number of new connections past period, used for set::high-connection-rate */
|
||||
#ifndef _WIN32
|
||||
|
||||
+8
-8
@@ -42,15 +42,15 @@ MODVAR int numclients = 0;
|
||||
|
||||
// TODO: Document whether servers are included or excluded in these lists...
|
||||
|
||||
MODVAR struct list_head unknown_list; /**< Local clients in handshake (may become a user or server later) */
|
||||
MODVAR struct list_head control_list; /**< Local "control channel" clients */
|
||||
MODVAR struct list_head lclient_list; /**< Local clients (users only, right?) */
|
||||
MODVAR struct list_head client_list; /**< All clients - local and remote (not in handshake) */
|
||||
MODVAR struct list_head server_list; /**< Locally connected servers */
|
||||
MODVAR struct list_head oper_list; /**< Locally connected IRC Operators */
|
||||
MODVAR struct list_head unknown_list; /**< Local clients in handshake (may become a user or server later) */
|
||||
MODVAR struct list_head control_list; /**< Local "control channel" clients */
|
||||
MODVAR struct list_head lclient_list; /**< Local clients (users only, right?) */
|
||||
MODVAR struct list_head client_list; /**< All clients - local and remote (not in handshake) */
|
||||
MODVAR struct list_head server_list; /**< Locally connected servers */
|
||||
MODVAR struct list_head oper_list; /**< Locally connected IRC Operators */
|
||||
MODVAR struct list_head global_server_list; /**< All servers (local and remote) */
|
||||
MODVAR struct list_head dead_list; /**< All dead clients (local and remote) that will soon be freed in the main loop */
|
||||
MODVAR struct list_head rpc_remote_list; /**< All remote RPC clients (very specific use-case) */
|
||||
MODVAR struct list_head dead_list; /**< All dead clients (local and remote) that will soon be freed in the main loop */
|
||||
MODVAR struct list_head rpc_remote_list; /**< All remote RPC clients (very specific use-case) */
|
||||
|
||||
static mp_pool_t *client_pool = NULL;
|
||||
static mp_pool_t *local_client_pool = NULL;
|
||||
|
||||
+63
-63
@@ -57,10 +57,10 @@ void mp_pool_init(void)
|
||||
mp_pool_t *mp_pool_new(size_t sz, size_t ignored)
|
||||
{
|
||||
mp_pool_t *m = safe_alloc(sizeof(mp_pool_t));
|
||||
/* We (mis)use the item_alloc_size. It has a slightly different
|
||||
* meaning in the real mempool code where it's aligned, rounded, etc.
|
||||
* That is something we don't want as it would hide small overflows.
|
||||
*/
|
||||
/* We (mis)use the item_alloc_size. It has a slightly different
|
||||
* meaning in the real mempool code where it's aligned, rounded, etc.
|
||||
* That is something we don't want as it would hide small overflows.
|
||||
*/
|
||||
m->item_alloc_size = sz;
|
||||
return m;
|
||||
}
|
||||
@@ -206,20 +206,20 @@ typedef struct mp_chunk_t mp_chunk_t;
|
||||
|
||||
/** Holds a single allocated item, allocated as part of a chunk. */
|
||||
struct mp_allocated_t {
|
||||
/** The chunk that this item is allocated in. This adds overhead to each
|
||||
* allocated item, thus making this implementation inappropriate for
|
||||
* very small items. */
|
||||
/** The chunk that this item is allocated in. This adds overhead to each
|
||||
* allocated item, thus making this implementation inappropriate for
|
||||
* very small items. */
|
||||
mp_chunk_t *in_chunk;
|
||||
|
||||
union {
|
||||
/** If this item is free, the next item on the free list. */
|
||||
/** If this item is free, the next item on the free list. */
|
||||
mp_allocated_t *next_free;
|
||||
|
||||
/** If this item is not free, the actual memory contents of this item.
|
||||
* (Not actual size.) */
|
||||
/** If this item is not free, the actual memory contents of this item.
|
||||
* (Not actual size.) */
|
||||
char mem[1];
|
||||
|
||||
/** An extra element to the union to insure correct alignment. */
|
||||
/** An extra element to the union to insure correct alignment. */
|
||||
ALIGNMENT_TYPE dummy_;
|
||||
} u;
|
||||
};
|
||||
@@ -234,10 +234,10 @@ struct mp_chunk_t {
|
||||
mp_chunk_t *prev; /**< The previous free, used, or full chunk in sequence. */
|
||||
mp_pool_t *pool; /**< The pool that this chunk is part of. */
|
||||
|
||||
/** First free item in the freelist for this chunk. Note that this may be
|
||||
* NULL even if this chunk is not at capacity: if so, the free memory at
|
||||
* next_mem has not yet been carved into items.
|
||||
*/
|
||||
/** First free item in the freelist for this chunk. Note that this may be
|
||||
* NULL even if this chunk is not at capacity: if so, the free memory at
|
||||
* next_mem has not yet been carved into items.
|
||||
*/
|
||||
mp_allocated_t *first_free;
|
||||
int n_allocated; /**< Number of currently allocated items in this chunk. */
|
||||
int capacity; /**< Number of items that can be fit into this chunk. */
|
||||
@@ -304,28 +304,28 @@ mp_pool_get(mp_pool_t *pool)
|
||||
|
||||
if (pool->used_chunks != NULL)
|
||||
{
|
||||
/*
|
||||
* Common case: there is some chunk that is neither full nor empty. Use
|
||||
* that one. (We can't use the full ones, obviously, and we should fill
|
||||
* up the used ones before we start on any empty ones.
|
||||
*/
|
||||
/*
|
||||
* Common case: there is some chunk that is neither full nor empty. Use
|
||||
* that one. (We can't use the full ones, obviously, and we should fill
|
||||
* up the used ones before we start on any empty ones.
|
||||
*/
|
||||
chunk = pool->used_chunks;
|
||||
|
||||
} else if (pool->empty_chunks)
|
||||
{
|
||||
/*
|
||||
* We have no used chunks, but we have an empty chunk that we haven't
|
||||
* freed yet: use that. (We pull from the front of the list, which should
|
||||
* get us the most recently emptied chunk.)
|
||||
*/
|
||||
/*
|
||||
* We have no used chunks, but we have an empty chunk that we haven't
|
||||
* freed yet: use that. (We pull from the front of the list, which should
|
||||
* get us the most recently emptied chunk.)
|
||||
*/
|
||||
chunk = pool->empty_chunks;
|
||||
|
||||
/* Remove the chunk from the empty list. */
|
||||
/* Remove the chunk from the empty list. */
|
||||
pool->empty_chunks = chunk->next;
|
||||
if (chunk->next)
|
||||
chunk->next->prev = NULL;
|
||||
|
||||
/* Put the chunk on the 'used' list*/
|
||||
/* Put the chunk on the 'used' list*/
|
||||
add_newly_used_chunk_to_used_list(pool, chunk);
|
||||
|
||||
assert(!chunk->prev);
|
||||
@@ -334,10 +334,10 @@ mp_pool_get(mp_pool_t *pool)
|
||||
pool->min_empty_chunks = pool->n_empty_chunks;
|
||||
} else
|
||||
{
|
||||
/* We have no used or empty chunks: allocate a new chunk. */
|
||||
/* We have no used or empty chunks: allocate a new chunk. */
|
||||
chunk = mp_chunk_new(pool);
|
||||
|
||||
/* Add the new chunk to the used list. */
|
||||
/* Add the new chunk to the used list. */
|
||||
add_newly_used_chunk_to_used_list(pool, chunk);
|
||||
}
|
||||
|
||||
@@ -345,19 +345,19 @@ mp_pool_get(mp_pool_t *pool)
|
||||
|
||||
if (chunk->first_free)
|
||||
{
|
||||
/* If there's anything on the chunk's freelist, unlink it and use it. */
|
||||
/* If there's anything on the chunk's freelist, unlink it and use it. */
|
||||
allocated = chunk->first_free;
|
||||
chunk->first_free = allocated->u.next_free;
|
||||
allocated->u.next_free = NULL; /* For debugging; not really needed. */
|
||||
assert(allocated->in_chunk == chunk);
|
||||
} else
|
||||
{
|
||||
/* Otherwise, the chunk had better have some free space left on it. */
|
||||
/* Otherwise, the chunk had better have some free space left on it. */
|
||||
assert(chunk->next_mem + pool->item_alloc_size <=
|
||||
chunk->mem + chunk->mem_size);
|
||||
|
||||
/* Good, it did. Let's carve off a bit of that free space, and use
|
||||
* that. */
|
||||
/* Good, it did. Let's carve off a bit of that free space, and use
|
||||
* that. */
|
||||
allocated = (void *)chunk->next_mem;
|
||||
chunk->next_mem += pool->item_alloc_size;
|
||||
allocated->in_chunk = chunk;
|
||||
@@ -371,22 +371,22 @@ mp_pool_get(mp_pool_t *pool)
|
||||
|
||||
if (chunk->n_allocated == chunk->capacity)
|
||||
{
|
||||
/* This chunk just became full. */
|
||||
/* This chunk just became full. */
|
||||
assert(chunk == pool->used_chunks);
|
||||
assert(chunk->prev == NULL);
|
||||
|
||||
/* Take it off the used list. */
|
||||
/* Take it off the used list. */
|
||||
pool->used_chunks = chunk->next;
|
||||
if (chunk->next)
|
||||
chunk->next->prev = NULL;
|
||||
|
||||
/* Put it on the full list. */
|
||||
/* Put it on the full list. */
|
||||
chunk->next = pool->full_chunks;
|
||||
if (chunk->next)
|
||||
chunk->next->prev = chunk;
|
||||
pool->full_chunks = chunk;
|
||||
}
|
||||
/* And return the memory portion of the mp_allocated_t. */
|
||||
/* And return the memory portion of the mp_allocated_t. */
|
||||
return A2M(allocated);
|
||||
}
|
||||
|
||||
@@ -405,9 +405,9 @@ void mp_pool_release(void *item)
|
||||
|
||||
if (chunk->n_allocated == chunk->capacity)
|
||||
{
|
||||
/* This chunk was full and is about to be used. */
|
||||
/* This chunk was full and is about to be used. */
|
||||
mp_pool_t *pool = chunk->pool;
|
||||
/* unlink from the full list */
|
||||
/* unlink from the full list */
|
||||
if (chunk->prev)
|
||||
chunk->prev->next = chunk->next;
|
||||
if (chunk->next)
|
||||
@@ -415,7 +415,7 @@ void mp_pool_release(void *item)
|
||||
if (chunk == pool->full_chunks)
|
||||
pool->full_chunks = chunk->next;
|
||||
|
||||
/* link to the used list. */
|
||||
/* link to the used list. */
|
||||
chunk->next = pool->used_chunks;
|
||||
chunk->prev = NULL;
|
||||
if (chunk->next)
|
||||
@@ -423,10 +423,10 @@ void mp_pool_release(void *item)
|
||||
pool->used_chunks = chunk;
|
||||
} else if (chunk->n_allocated == 1)
|
||||
{
|
||||
/* This was used and is about to be empty. */
|
||||
/* This was used and is about to be empty. */
|
||||
mp_pool_t *pool = chunk->pool;
|
||||
|
||||
/* Unlink from the used list */
|
||||
/* Unlink from the used list */
|
||||
if (chunk->prev)
|
||||
chunk->prev->next = chunk->next;
|
||||
if (chunk->next)
|
||||
@@ -434,15 +434,15 @@ void mp_pool_release(void *item)
|
||||
if (chunk == pool->used_chunks)
|
||||
pool->used_chunks = chunk->next;
|
||||
|
||||
/* Link to the empty list */
|
||||
/* Link to the empty list */
|
||||
chunk->next = pool->empty_chunks;
|
||||
chunk->prev = NULL;
|
||||
if (chunk->next)
|
||||
chunk->next->prev = chunk;
|
||||
pool->empty_chunks = chunk;
|
||||
|
||||
/* Reset the guts of this chunk to defragment it, in case it gets
|
||||
* used again. */
|
||||
/* Reset the guts of this chunk to defragment it, in case it gets
|
||||
* used again. */
|
||||
chunk->first_free = NULL;
|
||||
chunk->next_mem = chunk->mem;
|
||||
|
||||
@@ -465,19 +465,19 @@ mp_pool_new(size_t item_size, size_t chunk_capacity)
|
||||
assert(SIZE_T_CEILING / item_size > chunk_capacity);
|
||||
*/
|
||||
pool = safe_alloc(sizeof(mp_pool_t));
|
||||
/*
|
||||
* First, we figure out how much space to allow per item. We'll want to
|
||||
* use make sure we have enough for the overhead plus the item size.
|
||||
*/
|
||||
/*
|
||||
* First, we figure out how much space to allow per item. We'll want to
|
||||
* use make sure we have enough for the overhead plus the item size.
|
||||
*/
|
||||
alloc_size = (size_t)(offsetof(mp_allocated_t, u.mem) + item_size);
|
||||
/*
|
||||
* If the item_size is less than sizeof(next_free), we need to make
|
||||
* the allocation bigger.
|
||||
*/
|
||||
/*
|
||||
* If the item_size is less than sizeof(next_free), we need to make
|
||||
* the allocation bigger.
|
||||
*/
|
||||
if (alloc_size < sizeof(mp_allocated_t))
|
||||
alloc_size = sizeof(mp_allocated_t);
|
||||
|
||||
/* If we're not an even multiple of ALIGNMENT, round up. */
|
||||
/* If we're not an even multiple of ALIGNMENT, round up. */
|
||||
if (alloc_size % ALIGNMENT)
|
||||
{
|
||||
alloc_size = alloc_size + ALIGNMENT - (alloc_size % ALIGNMENT);
|
||||
@@ -486,18 +486,18 @@ mp_pool_new(size_t item_size, size_t chunk_capacity)
|
||||
alloc_size = ALIGNMENT;
|
||||
assert((alloc_size % ALIGNMENT) == 0);
|
||||
|
||||
/*
|
||||
* Now we figure out how many items fit in each chunk. We need to fit at
|
||||
* least 2 items per chunk. No chunk can be more than MAX_CHUNK bytes long,
|
||||
* or less than MIN_CHUNK.
|
||||
*/
|
||||
/*
|
||||
* Now we figure out how many items fit in each chunk. We need to fit at
|
||||
* least 2 items per chunk. No chunk can be more than MAX_CHUNK bytes long,
|
||||
* or less than MIN_CHUNK.
|
||||
*/
|
||||
if (chunk_capacity > MAX_CHUNK)
|
||||
chunk_capacity = MAX_CHUNK;
|
||||
|
||||
/*
|
||||
* Try to be around a power of 2 in size, since that's what allocators like
|
||||
* handing out. 512K-1 byte is a lot better than 512K+1 byte.
|
||||
*/
|
||||
/*
|
||||
* Try to be around a power of 2 in size, since that's what allocators like
|
||||
* handing out. 512K-1 byte is a lot better than 512K+1 byte.
|
||||
*/
|
||||
chunk_capacity = (size_t)round_to_power_of_2(chunk_capacity);
|
||||
while (chunk_capacity < alloc_size * 2 + CHUNK_OVERHEAD)
|
||||
chunk_capacity *= 2;
|
||||
|
||||
+10
-10
@@ -2875,42 +2875,42 @@ const char *StripControlCodesEx(const char *text, char *output, size_t outputlen
|
||||
switch (*text)
|
||||
{
|
||||
case 3:
|
||||
/* color */
|
||||
/* color */
|
||||
col = 1;
|
||||
nc = 0;
|
||||
break;
|
||||
case 4:
|
||||
/* RGB */
|
||||
/* RGB */
|
||||
save_text = text;
|
||||
save_len = len;
|
||||
rgb = 1;
|
||||
nc = 0;
|
||||
break;
|
||||
case 2:
|
||||
/* bold */
|
||||
/* bold */
|
||||
break;
|
||||
case 31:
|
||||
/* underline */
|
||||
/* underline */
|
||||
break;
|
||||
case 22:
|
||||
/* reverse */
|
||||
/* reverse */
|
||||
break;
|
||||
case 15:
|
||||
/* plain */
|
||||
/* plain */
|
||||
break;
|
||||
case 29:
|
||||
/* italic */
|
||||
/* italic */
|
||||
break;
|
||||
case 30:
|
||||
/* strikethrough */
|
||||
/* strikethrough */
|
||||
break;
|
||||
case 17:
|
||||
/* monospace */
|
||||
/* monospace */
|
||||
break;
|
||||
case 0xe2:
|
||||
if (!strncmp(text + 1, "\x80\x8b", 2))
|
||||
{
|
||||
/* +2 means we skip 3 */
|
||||
/* +2 means we skip 3 */
|
||||
text += 2;
|
||||
len -= 2;
|
||||
break;
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include "unrealircd.h"
|
||||
|
||||
ModuleHeader MOD_HEADER = {
|
||||
"account-notify", /* Name of module */
|
||||
"5.0", /* Version */
|
||||
"account-notify", /* Name of module */
|
||||
"5.0", /* Version */
|
||||
"account-notify CAP", /* Short description of module */
|
||||
"UnrealIRCd Team",
|
||||
"unrealircd-6",
|
||||
|
||||
@@ -137,14 +137,14 @@ typedef struct ChannelFloodBlocks {
|
||||
ModDataInfo *md_channelflood_blocked = NULL;
|
||||
/* Friendly type names for the efunc/crule, indexed by enum Flood. KEEP IN SYNC. */
|
||||
static const char *channelfloodtype_names[NUMFLD] = {
|
||||
"ctcp", /* CHFLD_CTCP */
|
||||
"join", /* CHFLD_JOIN */
|
||||
"knock", /* CHFLD_KNOCK */
|
||||
"msg", /* CHFLD_MSG */
|
||||
"nick", /* CHFLD_NICK */
|
||||
"text", /* CHFLD_TEXT */
|
||||
"ctcp", /* CHFLD_CTCP */
|
||||
"join", /* CHFLD_JOIN */
|
||||
"knock", /* CHFLD_KNOCK */
|
||||
"msg", /* CHFLD_MSG */
|
||||
"nick", /* CHFLD_NICK */
|
||||
"text", /* CHFLD_TEXT */
|
||||
"repeat", /* CHFLD_REPEAT */
|
||||
"paste", /* CHFLD_PASTE */
|
||||
"paste", /* CHFLD_PASTE */
|
||||
};
|
||||
Cmode_t EXTMODE_FLOODLIMIT = 0L;
|
||||
Cmode_t EXTMODE_FLOOD_PROFILE = 0L;
|
||||
|
||||
@@ -55,9 +55,9 @@ MOD_UNLOAD()
|
||||
* cmd_connect() - Added by Jto 11 Feb 1989
|
||||
***********************************************************************/
|
||||
/*
|
||||
** cmd_connect
|
||||
** parv[1] = servername
|
||||
*/
|
||||
** cmd_connect
|
||||
** parv[1] = servername
|
||||
*/
|
||||
CMD_FUNC(cmd_connect)
|
||||
{
|
||||
int retval;
|
||||
|
||||
+10
-10
@@ -49,15 +49,15 @@ typedef struct {
|
||||
|
||||
typedef struct UCounter UCounter;
|
||||
struct UCounter {
|
||||
ThrottleCounter local; /**< Local counter */
|
||||
ThrottleCounter global; /**< Global counter */
|
||||
int rejected_clients; /**< Number of rejected clients this minute */
|
||||
int allowed_except; /**< Number of allowed clients - on except list */
|
||||
int allowed_unknown_users; /**< Number of allowed clients - not on except list */
|
||||
char disabled; /**< Module disabled by oper? */
|
||||
int throttling_this_minute; /**< Did we do any throttling this minute? */
|
||||
ThrottleCounter local; /**< Local counter */
|
||||
ThrottleCounter global; /**< Global counter */
|
||||
int rejected_clients; /**< Number of rejected clients this minute */
|
||||
int allowed_except; /**< Number of allowed clients - on except list */
|
||||
int allowed_unknown_users; /**< Number of allowed clients - not on except list */
|
||||
char disabled; /**< Module disabled by oper? */
|
||||
int throttling_this_minute; /**< Did we do any throttling this minute? */
|
||||
int throttling_previous_minute; /**< Did we do any throttling previous minute? */
|
||||
int throttling_banner_displayed;/**< Big we-are-now-throttling banner displayed? */
|
||||
int throttling_banner_displayed; /**< Big we-are-now-throttling banner displayed? */
|
||||
time_t next_event; /**< When is next event? (for "last 60 seconds" stats) */
|
||||
};
|
||||
UCounter *ucounter = NULL;
|
||||
@@ -160,8 +160,8 @@ MOD_TEST()
|
||||
cfg.except->reputation_score = 24;
|
||||
cfg.except->identified = 1;
|
||||
cfg.except->webirc = 0;
|
||||
cfg.ipv6_unknown_users_limit[0] = 8; /* /56 */
|
||||
cfg.ipv6_unknown_users_limit[1] = 32; /* /48 */
|
||||
cfg.ipv6_unknown_users_limit[0] = 8; /* /56 */
|
||||
cfg.ipv6_unknown_users_limit[1] = 32; /* /48 */
|
||||
cfg.ipv6_unknown_users_limit[2] = 256; /* /32 */
|
||||
|
||||
HookAdd(modinfo->handle, HOOKTYPE_CONFIGTEST, 0, ct_config_test);
|
||||
|
||||
+8
-8
@@ -189,15 +189,15 @@ static int crule_parsearglist(CRuleNode *, crule_token *, const char **);
|
||||
|
||||
/* error messages */
|
||||
char *crule_errstr[] = {
|
||||
"Unknown error", /* NOERR? - for completeness */
|
||||
"Unexpected token", /* UNEXPCTTOK */
|
||||
"Unknown token", /* UNKNWTOK */
|
||||
"Unknown error", /* NOERR? - for completeness */
|
||||
"Unexpected token", /* UNEXPCTTOK */
|
||||
"Unknown token", /* UNKNWTOK */
|
||||
"And expr expected", /* EXPCTAND */
|
||||
"Or expr expected", /* EXPCTOR */
|
||||
"Primary expected", /* EXPCTPRIM */
|
||||
"( expected", /* EXPCTOPEN */
|
||||
") expected", /* EXPCTCLOSE */
|
||||
"Unknown function", /* UNKNWFUNC */
|
||||
"Or expr expected", /* EXPCTOR */
|
||||
"Primary expected", /* EXPCTPRIM */
|
||||
"( expected", /* EXPCTOPEN */
|
||||
") expected", /* EXPCTCLOSE */
|
||||
"Unknown function", /* UNKNWFUNC */
|
||||
"Argument mismatch", /* ARGMISMAT */
|
||||
"Missing value in comparisson", /* CR_EXPCTVALUE */
|
||||
};
|
||||
|
||||
+1
-1
@@ -1252,7 +1252,7 @@ CMD_FUNC(_cmd_umode)
|
||||
}
|
||||
goto def;
|
||||
case UHALLOW_REJOIN:
|
||||
/* Handled later */
|
||||
/* Handled later */
|
||||
goto def;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -42,17 +42,17 @@ struct {
|
||||
typedef struct MultilineBatch MultilineBatch;
|
||||
struct MultilineBatch {
|
||||
char batch_id[MAXBATCHREFLEN + 1]; /**< Client-chosen batch reference tag */
|
||||
char *target; /**< Target channel or nick */
|
||||
SendType sendtype; /**< SEND_TYPE_PRIVMSG or SEND_TYPE_NOTICE */
|
||||
int sendtype_set; /**< Has sendtype been determined (from first line)? */
|
||||
char member_modes[2]; /**< Member mode filter from STATUSMSG prefix (e.g. "o"), or empty string */
|
||||
char *target; /**< Target channel or nick */
|
||||
SendType sendtype; /**< SEND_TYPE_PRIVMSG or SEND_TYPE_NOTICE */
|
||||
int sendtype_set; /**< Has sendtype been determined (from first line)? */
|
||||
char member_modes[2]; /**< Member mode filter from STATUSMSG prefix (e.g. "o"), or empty string */
|
||||
MessageTag *client_mtags; /**< Tags from the opening BATCH command */
|
||||
int line_count;
|
||||
int received_bytes; /**< Total user-sent content bytes (for max-bytes policy) */
|
||||
time_t start_time;
|
||||
int failed; /**< Batch marked as failed — consume remaining lines, send error at BATCH close */
|
||||
char *fail_message; /**< FAIL response to send at BATCH close (if failed) */
|
||||
char label[256]; /**< Saved label for echo-message + labeled-response interaction */
|
||||
int failed; /**< Batch marked as failed — consume remaining lines, send error at BATCH close */
|
||||
char *fail_message; /**< FAIL response to send at BATCH close (if failed) */
|
||||
char label[256]; /**< Saved label for echo-message + labeled-response interaction */
|
||||
/* Buffered lines */
|
||||
MLine *lines;
|
||||
MLine *lines_tail;
|
||||
|
||||
+2
-2
@@ -343,10 +343,10 @@ CMD_FUNC(cmd_nick_local)
|
||||
/* Changing cAsE */
|
||||
removemoder = 0;
|
||||
} else
|
||||
/* Collision with a nick of a session that is still in handshake */
|
||||
/* Collision with a nick of a session that is still in handshake */
|
||||
if (IsUnknown(acptr) && MyConnect(acptr))
|
||||
{
|
||||
/* Kill the other connection that is still in progress */
|
||||
/* Kill the other connection that is still in progress */
|
||||
SetKilled(acptr);
|
||||
exit_client(acptr, NULL, "Overridden");
|
||||
} else
|
||||
|
||||
@@ -57,7 +57,7 @@ CMD_OVERRIDE_FUNC(rcmd_override);
|
||||
static ModuleInfo ModInf;
|
||||
RestrictedCommand *RestrictedCommandList = NULL;
|
||||
CmdMap conf_cmdmaps[] = {
|
||||
// These are special cases in which we can't override the command, so they are handled through hooks instead
|
||||
// These are special cases in which we can't override the command, so they are handled through hooks instead
|
||||
{"channel-message", "PRIVMSG"},
|
||||
{"channel-notice", "NOTICE"},
|
||||
{"channel-create", "JOIN"},
|
||||
|
||||
@@ -64,11 +64,11 @@ CMD_FUNC(cmd_sqline)
|
||||
char mo[32];
|
||||
const char *comment = (parc == 3) ? parv[2] : NULL;
|
||||
const char *tkllayer[9] = {
|
||||
me.name, /*0 server.name */
|
||||
"+", /*1 +|- */
|
||||
"Q", /*2 G */
|
||||
"*", /*3 user */
|
||||
parv[1], /*4 host */
|
||||
me.name, /*0 server.name */
|
||||
"+", /*1 +|- */
|
||||
"Q", /*2 G */
|
||||
"*", /*3 user */
|
||||
parv[1], /*4 host */
|
||||
client->name, /*5 setby */
|
||||
"0", /*6 expire_at */
|
||||
NULL, /*7 set_at */
|
||||
|
||||
+38
-38
@@ -2205,14 +2205,14 @@ void cmd_tkl_line(Client *client, int parc, const char *parv[], char *type)
|
||||
char mo[64], mo2[64], reasonbuf[512];
|
||||
char *p, *usermask, *hostmask;
|
||||
const char *tkllayer[10] = {
|
||||
me.name, /*0 server.name */
|
||||
NULL, /*1 +|- */
|
||||
NULL, /*2 G */
|
||||
NULL, /*3 user */
|
||||
NULL, /*4 host */
|
||||
NULL, /*5 set_by */
|
||||
"0", /*6 expire_at */
|
||||
NULL, /*7 set_at */
|
||||
me.name, /*0 server.name */
|
||||
NULL, /*1 +|- */
|
||||
NULL, /*2 G */
|
||||
NULL, /*3 user */
|
||||
NULL, /*4 host */
|
||||
NULL, /*5 set_by */
|
||||
"0", /*6 expire_at */
|
||||
NULL, /*7 set_at */
|
||||
"no reason", /*8 reason */
|
||||
NULL,
|
||||
};
|
||||
@@ -2551,16 +2551,16 @@ CMD_FUNC(cmd_eline)
|
||||
const char *p, *bantypes = NULL, *reason = NULL;
|
||||
char *usermask, *hostmask;
|
||||
const char *tkllayer[11] = {
|
||||
me.name, /*0 server.name */
|
||||
NULL, /*1 +|- */
|
||||
NULL, /*2 E */
|
||||
NULL, /*3 user */
|
||||
NULL, /*4 host */
|
||||
NULL, /*5 set_by */
|
||||
"0", /*6 expire_at */
|
||||
"-", /*7 set_at */
|
||||
"-", /*8 ban types */
|
||||
"-", /*9 reason */
|
||||
me.name, /*0 server.name */
|
||||
NULL, /*1 +|- */
|
||||
NULL, /*2 E */
|
||||
NULL, /*3 user */
|
||||
NULL, /*4 host */
|
||||
NULL, /*5 set_by */
|
||||
"0", /*6 expire_at */
|
||||
"-", /*7 set_at */
|
||||
"-", /*8 ban types */
|
||||
"-", /*9 reason */
|
||||
NULL,
|
||||
};
|
||||
TKLTypeTable *t;
|
||||
@@ -2696,13 +2696,13 @@ void spamfilter_del_by_id(Client *client, const char *id)
|
||||
char mo[32], mo2[32];
|
||||
const char *tkllayer[13] = {
|
||||
me.name, /* 0 server.name */
|
||||
NULL, /* 1 +|- */
|
||||
"F", /* 2 F */
|
||||
NULL, /* 3 usermask (targets) */
|
||||
NULL, /* 4 hostmask (action) */
|
||||
NULL, /* 5 set_by */
|
||||
"0", /* 6 expire_at */
|
||||
"0", /* 7 set_at */
|
||||
NULL, /* 1 +|- */
|
||||
"F", /* 2 F */
|
||||
NULL, /* 3 usermask (targets) */
|
||||
NULL, /* 4 hostmask (action) */
|
||||
NULL, /* 5 set_by */
|
||||
"0", /* 6 expire_at */
|
||||
"0", /* 7 set_at */
|
||||
"", /* 8 tkl time */
|
||||
"", /* 9 tkl reason */
|
||||
"", /* 10 match method */
|
||||
@@ -2768,13 +2768,13 @@ CMD_FUNC(cmd_spamfilter)
|
||||
char mo[32], mo2[32];
|
||||
const char *tkllayer[13] = {
|
||||
me.name, /* 0 server.name */
|
||||
NULL, /* 1 +|- */
|
||||
"F", /* 2 F */
|
||||
NULL, /* 3 usermask (targets) */
|
||||
NULL, /* 4 hostmask (action) */
|
||||
NULL, /* 5 set_by */
|
||||
"0", /* 6 expire_at */
|
||||
"0", /* 7 set_at */
|
||||
NULL, /* 1 +|- */
|
||||
"F", /* 2 F */
|
||||
NULL, /* 3 usermask (targets) */
|
||||
NULL, /* 4 hostmask (action) */
|
||||
NULL, /* 5 set_by */
|
||||
"0", /* 6 expire_at */
|
||||
"0", /* 7 set_at */
|
||||
"", /* 8 tkl time */
|
||||
"", /* 9 tkl reason */
|
||||
"", /* 10 match method */
|
||||
@@ -3810,11 +3810,11 @@ void _tkl_check_local_remove_shun(TKL *tmp)
|
||||
if (tk != tmp && match_simple(tk->ptr.serverban->usermask, cname))
|
||||
{
|
||||
if ((*tk->ptr.serverban->hostmask >= '0') && (*tk->ptr.serverban->hostmask <= '9')
|
||||
/* the hostmask is an IP */
|
||||
/* the hostmask is an IP */
|
||||
&& (match_simple(tk->ptr.serverban->hostmask, chost) || match_simple(tk->ptr.serverban->hostmask, cip)))
|
||||
keep_shun = 1;
|
||||
else
|
||||
/* the hostmask is not an IP */
|
||||
/* the hostmask is not an IP */
|
||||
if (match_simple(tk->ptr.serverban->hostmask, chost) && match_simple(tk->ptr.serverban->usermask, cname))
|
||||
keep_shun = 1;
|
||||
}
|
||||
@@ -5718,10 +5718,10 @@ static int take_action_ex(Client *client, BanAction *actions, const char *reason
|
||||
char ip[128], user[USERLEN + 3], mo[100], mo2[100];
|
||||
const char *tkllayer[9] = {
|
||||
me.name, /*0 server.name */
|
||||
"+", /*1 +|- */
|
||||
"?", /*2 type */
|
||||
"*", /*3 user */
|
||||
NULL, /*4 host */
|
||||
"+", /*1 +|- */
|
||||
"?", /*2 type */
|
||||
"*", /*3 user */
|
||||
NULL, /*4 host */
|
||||
NULL,
|
||||
NULL, /*6 expire_at */
|
||||
NULL, /*7 set_at */
|
||||
|
||||
@@ -5754,17 +5754,17 @@ int utf32_to_utf8(char *buf, uint32_t code)
|
||||
}
|
||||
if (code <= 0xFFFF)
|
||||
{
|
||||
buf[0] = 0xE0 | (code >> 12); /* 1110xxxx */
|
||||
buf[1] = 0x80 | ((code >> 6) & 0x3F); /* 10xxxxxx */
|
||||
buf[2] = 0x80 | (code & 0x3F); /* 10xxxxxx */
|
||||
buf[0] = 0xE0 | (code >> 12); /* 1110xxxx */
|
||||
buf[1] = 0x80 | ((code >> 6) & 0x3F); /* 10xxxxxx */
|
||||
buf[2] = 0x80 | (code & 0x3F); /* 10xxxxxx */
|
||||
return 3;
|
||||
}
|
||||
if (code <= 0x10FFFF)
|
||||
{
|
||||
buf[0] = 0xF0 | (code >> 18); /* 11110xxx */
|
||||
buf[1] = 0x80 | ((code >> 12) & 0x3F); /* 10xxxxxx */
|
||||
buf[2] = 0x80 | ((code >> 6) & 0x3F); /* 10xxxxxx */
|
||||
buf[3] = 0x80 | (code & 0x3F); /* 10xxxxxx */
|
||||
buf[0] = 0xF0 | (code >> 18); /* 11110xxx */
|
||||
buf[1] = 0x80 | ((code >> 12) & 0x3F); /* 10xxxxxx */
|
||||
buf[2] = 0x80 | ((code >> 6) & 0x3F); /* 10xxxxxx */
|
||||
buf[3] = 0x80 | (code & 0x3F); /* 10xxxxxx */
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
|
||||
+7
-7
@@ -34,13 +34,13 @@ ModuleHeader MOD_HEADER = {
|
||||
typedef struct ConfigItem_vhost ConfigItem_vhost;
|
||||
struct ConfigItem_vhost {
|
||||
ConfigItem_vhost *prev, *next;
|
||||
int auto_login; /**< Auto-login users on connect? If they match 'auth' */
|
||||
SecurityGroup *match; /**< Match criteria for user */
|
||||
char *login; /**< Login name for 'VHOST login pass' */
|
||||
AuthConfig *auth; /**< Password for 'VHOST login pass */
|
||||
char *virtuser; /**< Virtual ident to set */
|
||||
char *virthost; /**< Virtual host to set */
|
||||
SWhois *swhois; /**< SWhois items to set */
|
||||
int auto_login; /**< Auto-login users on connect? If they match 'auth' */
|
||||
SecurityGroup *match; /**< Match criteria for user */
|
||||
char *login; /**< Login name for 'VHOST login pass' */
|
||||
AuthConfig *auth; /**< Password for 'VHOST login pass */
|
||||
char *virtuser; /**< Virtual ident to set */
|
||||
char *virthost; /**< Virtual host to set */
|
||||
SWhois *swhois; /**< SWhois items to set */
|
||||
};
|
||||
|
||||
/* Variables */
|
||||
|
||||
@@ -766,7 +766,7 @@ static void send_who_reply(Client *client, Client *acptr,
|
||||
sendnumeric(client, RPL_WHOREPLY,
|
||||
channel, /* channel name */
|
||||
acptr->user->username, /* user name */
|
||||
host, /* hostname */
|
||||
host, /* hostname */
|
||||
"hidden", /* let's hide the server from normal users if the server is a uline and HIDE_ULINES is on */
|
||||
acptr->name, /* nick */
|
||||
stat, /* status */
|
||||
@@ -779,7 +779,7 @@ static void send_who_reply(Client *client, Client *acptr,
|
||||
sendnumeric(client, RPL_WHOREPLY,
|
||||
channel, /* channel name */
|
||||
acptr->user->username, /* user name */
|
||||
host, /* hostname */
|
||||
host, /* hostname */
|
||||
acptr->user->server, /* server name */
|
||||
acptr->name, /* nick */
|
||||
stat, /* status */
|
||||
|
||||
+4
-4
@@ -227,7 +227,7 @@ chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes)
|
||||
if (!j12)
|
||||
{
|
||||
j13 = PLUSONE(j13);
|
||||
/* stopping at 2^70 bytes per nonce is user's responsibility */
|
||||
/* stopping at 2^70 bytes per nonce is user's responsibility */
|
||||
}
|
||||
|
||||
U32TO8_LITTLE(c + 0, x0);
|
||||
@@ -302,10 +302,10 @@ chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes)
|
||||
#define BLOCKSZ 64
|
||||
#define RSBUFSZ (16 * BLOCKSZ)
|
||||
static int rs_initialized;
|
||||
static chacha_ctx rs; /* chacha context for random keystream */
|
||||
static chacha_ctx rs; /* chacha context for random keystream */
|
||||
static u_char rs_buf[RSBUFSZ]; /* keystream blocks */
|
||||
static size_t rs_have; /* valid bytes at end of rs_buf */
|
||||
static size_t rs_count; /* bytes till reseed */
|
||||
static size_t rs_have; /* valid bytes at end of rs_buf */
|
||||
static size_t rs_count; /* bytes till reseed */
|
||||
|
||||
static inline void _rs_rekey(u_char *dat, size_t datlen);
|
||||
|
||||
|
||||
+2
-2
@@ -564,11 +564,11 @@ int b64_decode(char const *src, unsigned char *target, size_t targsize)
|
||||
return (-1);
|
||||
|
||||
case 2: /* Valid, means one byte of info */
|
||||
/* Skip any number of spaces. */
|
||||
/* Skip any number of spaces. */
|
||||
for (; ch != '\0'; ch = *src++)
|
||||
if (!isspace(ch))
|
||||
break;
|
||||
/* Make sure there is another trailing = sign. */
|
||||
/* Make sure there is another trailing = sign. */
|
||||
if (ch != Pad64)
|
||||
return (-1);
|
||||
ch = *src++; /* Skip the = */
|
||||
|
||||
@@ -1793,7 +1793,7 @@ int check_certificate_expiry_ctx(SSL_CTX *ctx, char **errstr)
|
||||
*errstr = errbuf;
|
||||
return 1;
|
||||
} else
|
||||
/* or near-expiry? */
|
||||
/* or near-expiry? */
|
||||
if (((days_expiry < 0) || (seconds_expiry < 0)) && (days_expiry > -7))
|
||||
{
|
||||
snprintf(errbuf, sizeof(errbuf), "certificate will expire in %s", pretty_time_val(0 - duration));
|
||||
|
||||
+3
-3
@@ -68,9 +68,9 @@ struct Download {
|
||||
int port; /**< Parsed port (from 'url') */
|
||||
char *username;
|
||||
char *password;
|
||||
char *document; /**< Parsed document (from 'url') */
|
||||
char *ip4; /**< Resolved IP (IPv4) */
|
||||
char *ip6; /**< Resolved IP (IPv6) */
|
||||
char *document; /**< Parsed document (from 'url') */
|
||||
char *ip4; /**< Resolved IP (IPv4) */
|
||||
char *ip6; /**< Resolved IP (IPv6) */
|
||||
SocketType socket_type; /**< Socket type that we are trying (SOCKET_TYPE_IPV4 or SOCKET_TYPE_IPV6) */
|
||||
SSL *ssl;
|
||||
int fd; /**< Socket */
|
||||
|
||||
+8
-8
@@ -965,15 +965,15 @@ MODVAR const char *floodoption_names[] = {
|
||||
* soft penalty rather than a block, and multiline is not counted.
|
||||
*/
|
||||
MODVAR const char *floodoption_shortnames[] = {
|
||||
"nick", /* FLD_NICK */
|
||||
"join", /* FLD_JOIN */
|
||||
"away", /* FLD_AWAY */
|
||||
"invite", /* FLD_INVITE */
|
||||
"knock", /* FLD_KNOCK */
|
||||
"nick", /* FLD_NICK */
|
||||
"join", /* FLD_JOIN */
|
||||
"away", /* FLD_AWAY */
|
||||
"invite", /* FLD_INVITE */
|
||||
"knock", /* FLD_KNOCK */
|
||||
"conversations", /* FLD_CONVERSATIONS */
|
||||
NULL, /* FLD_LAG_PENALTY: not counted (soft penalty, not a block) */
|
||||
"vhost", /* FLD_VHOST */
|
||||
NULL, /* FLD_MULTILINE: not counted */
|
||||
NULL, /* FLD_LAG_PENALTY: not counted (soft penalty, not a block) */
|
||||
"vhost", /* FLD_VHOST */
|
||||
NULL, /* FLD_MULTILINE: not counted */
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
+4
-4
@@ -145,7 +145,7 @@ int GetOSName(char *pszOS)
|
||||
if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi)))
|
||||
return -1;
|
||||
|
||||
// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
|
||||
// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
|
||||
|
||||
pGNSI = (PGNSI)GetProcAddress(
|
||||
GetModuleHandle(TEXT("kernel32.dll")),
|
||||
@@ -160,7 +160,7 @@ int GetOSName(char *pszOS)
|
||||
{
|
||||
StringCchCopy(pszOS, OSVER_SIZE, TEXT("Microsoft "));
|
||||
|
||||
// Test for the specific product.
|
||||
// Test for the specific product.
|
||||
|
||||
if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
|
||||
{
|
||||
@@ -258,7 +258,7 @@ int GetOSName(char *pszOS)
|
||||
} else
|
||||
StringCchCat(pszOS, OSVER_SIZE, TEXT("Windows Server 2003, "));
|
||||
|
||||
// Test for the server type.
|
||||
// Test for the server type.
|
||||
if (osvi.wProductType != VER_NT_WORKSTATION)
|
||||
{
|
||||
if (si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_IA64)
|
||||
@@ -322,7 +322,7 @@ int GetOSName(char *pszOS)
|
||||
}
|
||||
}
|
||||
|
||||
// Include service pack (if any) and build number.
|
||||
// Include service pack (if any) and build number.
|
||||
|
||||
if (_tcslen(osvi.szCSDVersion) > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user