View Issue Details

IDProjectCategoryView StatusLast Update
0006114unrealircdpublic2022-05-26 07:18
ReporterZarTek-Creole Assigned Tosyzop  
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version6.0.3 
Fixed in Version6.0.4-rc2 
Summary0006114: When using channel mode history +H with modes-on-join it does not apply.
DescriptionValue of modes-on-join "+GntCKMfHL [30j#i10,40m#m10,7c#C15,10n#N15,30k#K10]:15 15:1440 #Full";

When you join a room it puts the CModes :

[25-05/23:54] * Now talking in #123
[25-05/23:54] * irc.extra-cool.fr sets mode: +ntCGKMfHL [7c#C15,30j#i10,30k#K10,40m#m10,10n#N15]:15 15:1d #Full
[25-05/23:54] <@ZarTek> dfggfd
[25-05/23:54] -irc.extra-cool.fr- history.BUG_HISTORY_ADD_NO_LIMIT [warn] [BUG] hbm_history_add() called for #123, which has no limit set
[26-05/00:24] <@ZarTek> sfdfds
[26-05/00:24] * Attempting to rejoin channel #123
[26-05/00:24] * Rejoined channel #123
[26-05/00:24] * irc.extra-cool.fr sets mode: +ntCGKMfHL [7c#C15,30j#i10,30k#K10,40m#m10,10n#N15]:15 15:1d #Full
[26-05/00:25] <@ZarTek> fdsdffds
[26-05/00:25] -irc.extra-cool.fr- history.BUG_HISTORY_ADD_NO_LIMIT [warn] [BUG] hbm_history_add() called for #123, which has no limit set
[26-05/00:25] <@ZarTek> 5245


but we can notice a history.BUG_HISTORY_ADD_NO_LIMIT [warn] [BUG] hbm_history_add() called for #123, which has no limit set

now when I change the value manually:

[26-05/00:43] * Now talking in #321
[26-05/00:43] * irc.extra-cool.fr sets mode: +ntCGKMfHL [7c#C15,30j#i10,30k#K10,40m#m10,10n#N15]:15 15:1d #Full
[26-05/00:44] -irc.extra-cool.fr- operoverride.OPEROVERRIDE_MODE [info] OperOverride: ZarTek!ZarTek@vps-043a38a4.vps.ovh.net changed channel mode of #321 to: +PH 20:1h
[26-05/00:44] * ZarTek sets mode: +PH 20:1h
[26-05/00:44] <@ZarTek> Hello
[26-05/00:44] * Attempting to rejoin channel #321
[26-05/00:44] * Rejoined channel #321
[26-05/00:44] <ZarTek> Hello <= replay

It works. that's why I think it misapplies mode +H with modes-on-join. at least for the value (max-value) that it should not be loaded correctly
https://github.com/unrealircd/unrealircd/blob/unreal60_dev/src/modules/history_backend_mem.c#L596

Steps To Reproduceset {
    modes-on-join "+GntCKMfHL [30j#i10,40m#m10,7c#C15,10n#N15,30k#K10]:15 15:1440 #Full";
}

 /* Configure settings related to Channel history:
 * https://www.unrealircd.org/docs/Channel_history
 *
 * https://www.unrealircd.org/docs/Set_block#set::history
 *
 * The set::history::channel::playback-on-join block describes the behavior
 * when a user joins a +H channel.
 *
 * The set::history::channel::max-storage-per-channel block sets limits on what
 * can be set via /MODE #chan +H.
 *
 * Note that these are separate things:
 * only a few lines of history are shown on-join, many more lines can be
 * fetched via the HISTORY command (and possibly other commands in the future).
 *
 * This shows the default settings:
 */
 
set {
    history {
        channel {
            /* How many lines to playback on join? */
            playback-on-join {
                lines 15;
                time 1d;
            }
            /* How much history to keep. These are the
             * upper maximums for channel mode +H lines:time
             */
            max-storage-per-channel {
                /* +r channels have larger maximums: */
                registered {
                    lines 5000;
                    time 31d;
                }
                /* -r channels have less: */
                unregistered {
                    lines 200;
                    time 31d;
                }
            }
        }
    }
}
/*
 * Persistent channel history
 *
 * You can also store channel history encrypted on disk.
 * This means channel history is preserved across IRCd restarts.
 * UnrealIRCd will only store channel history for channels that have both
 * channel mode +H and +P set.
 *
 * To enable this you need to create a Secret block like this:
 * This is only a simple example with passwords stored directly in the
 * configuration file.
 *
 * To get better security, read https://www.unrealircd.org/docs/Secret_block
 * on alternative ways so you don't store passwords directly in the config.
 */
secret historydb {
        password "Maxime02031997";
}

/*
 * And then refer to that secret block which we named historydb:
 */
set {
    history {
        channel {
            persist yes;
            db-secret "historydb";
        }
    }
}
/*
 * UnrealIRCd has the following goals for storing channel history on disk:
 *
 * - All data within the .db's is encrypted
 * - We use a well-known encryption library, a good cipher and KDF,
 * see Dev:UnrealDB for in-depth technical details.
 * - By default the log databases are stored in the data/history/ directory
 * - All .db files are cryptographically hashed so a third party can't tell
 * which .db file belongs to which channel
 * - A 'master.db' file is present too, to achieve the above in a consistent
 * and safe manner. Don't delete this file.
 * - Be sure to look at Secret block to see the various ways to store the key
 * (password) and pick one acceptable to your environment
 */
Additional InformationUnrealircd 4 ever
Tagshistory, mode, modes-on-join
3rd party modules

Activities

ZarTek-Creole

2022-05-26 02:32

reporter   ~0022521

same issue with modes-on-join "+H 15:1440";

westor

2022-05-26 02:56

reporter   ~0022522

Confirmed! When you set {{persist yes;}} and {{db-secret "historydb";}} and having {{modes-on-join "+H 15:1d";}} when you join on a channel, server sets the +H correctly but when you speak on channel then https://github.com/unrealircd/unrealircd/blob/unreal60_dev/src/modules/history_backend_mem.c#L598 is triggered.

syzop

2022-05-26 07:18

administrator   ~0022523

Last edited: 2022-05-26 07:18

Seems +H was not working at all in set::modes-on-join indeed. Strange, I thought I tested that but i must have only tested it in +P then, I guess.

Anyway, thanks for the report! Fixed now.

https://github.com/unrealircd/unrealircd/commit/fe11f77be6fca18907ffeee498af7101c2d91417

commit fe11f77be6fca18907ffeee498af7101c2d91417 (HEAD -> unreal60_dev)
Author: Bram Matthys <syzop@vulnscan.org>
Date: Thu May 26 07:14:12 2022 +0200

    Fix +H not working in set::modes-on-join.
    Reported by ZarTek-Creole in https://bugs.unrealircd.org/view.php?id=6114
    
    We now call HOOKTYPE_LOCAL_CHANMODE on the modes we set in modes-on-join,
    where 'client' is '&me'. Should be fine, as we already did the same for
    +P modes (indirectly) in channeldb.

Issue History

Date Modified Username Field Change
2022-05-26 01:46 ZarTek-Creole New Issue
2022-05-26 01:46 ZarTek-Creole Tag Attached: history
2022-05-26 01:46 ZarTek-Creole Tag Attached: mode
2022-05-26 01:46 ZarTek-Creole Tag Attached: modes-on-join
2022-05-26 02:32 ZarTek-Creole Note Added: 0022521
2022-05-26 02:56 westor Note Added: 0022522
2022-05-26 07:18 syzop Assigned To => syzop
2022-05-26 07:18 syzop Status new => resolved
2022-05-26 07:18 syzop Resolution open => fixed
2022-05-26 07:18 syzop Fixed in Version => 6.0.4-rc2
2022-05-26 07:18 syzop Note Added: 0022523
2022-05-26 07:18 syzop Note Edited: 0022523