aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorJason Cox <me@jasoncarloscox.com>2024-02-22 20:25:20 -0500
committerRobin Jarry <robin@jarry.cc>2024-04-13 21:46:44 +0200
commit480637d9ed8cf979f4be377cb37fdd14b60ceef3 (patch)
treeb4a42644e0e3b1b2718c4f9f4a638828b61bfc94 /main.go
parentf4cf6ca5c13fce8fe1f84f37cdafe62c1d2d8b0c (diff)
downloadaerc-480637d9ed8cf979f4be377cb37fdd14b60ceef3.tar.gz
ipc: disable IPC completely when disable-ipc=true
Truly disable IPC when disable-ipc is set to true in aerc.conf. Don't run commands over IPC and don't start an IPC server. Being able to disable IPC in the config is useful because it allows making aerc open mailto links in a new instance without modifying the aerc.desktop file. There are of course potential security benefits as well. Changelog-changed: The `disable-ipc` option in `aerc.conf` completely disables IPC. Signed-off-by: Jason Cox <me@jasoncarloscox.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'main.go')
-rw-r--r--main.go20
1 files changed, 11 insertions, 9 deletions
diff --git a/main.go b/main.go
index 9558382b..b7437fbd 100644
--- a/main.go
+++ b/main.go
@@ -162,7 +162,16 @@ func main() {
die("%s", err)
}
- if len(opts.Command) > 0 && !opts.NoIPC {
+ err = config.LoadConfigFromFile(
+ nil, opts.Accounts, opts.ConfAerc, opts.ConfBinds, opts.ConfAccounts,
+ )
+ if err != nil {
+ die("%s", err)
+ }
+
+ noIPC := opts.NoIPC || config.General.DisableIPC
+
+ if len(opts.Command) > 0 && !noIPC {
response, err := ipc.ConnectAndExec(opts.Command)
if err == nil {
if response.Error != "" {
@@ -173,13 +182,6 @@ func main() {
// continue with setting up a new aerc instance and retry after init
}
- err = config.LoadConfigFromFile(
- nil, opts.Accounts, opts.ConfAerc, opts.ConfBinds, opts.ConfAccounts,
- )
- if err != nil {
- die("%s", err)
- }
-
log.Infof("Starting up version %s", log.BuildInfo)
deferLoop := make(chan struct{})
@@ -205,7 +207,7 @@ func main() {
startup, startupDone := context.WithCancel(context.Background())
- if !opts.NoIPC {
+ if !noIPC {
as, err := ipc.StartServer(app.IPCHandler(), startup)
if err != nil {
log.Warnf("Failed to start Unix server: %v", err)