[GH-ISSUE #1476] SQLite syntax error with sql-sender-login map #1164

Closed
opened 2026-02-27 11:15:38 +03:00 by kerem · 3 comments
Owner

Originally created by @nogweii on GitHub (Apr 24, 2018).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/1476

Impacted versions

  • Modoboa: 1.10.4
  • installer used: No, wrapping around calling modoboa-admin.py with Ansible
  • Webserver: Nginx

Stock generated maps ran manage.py generate_postfix_maps results in this error when someone attempts to log in:

Apr 24 04:31:35 postman.aether.earth postfix/proxymap[9896]: fatal: dict_sqlite_lookup: /etc/postfix/maps/sql-sender-login-map.cf: SQL prepare failed: near "(": syntax error?

Contents of file:

# This file was generated on April 23, 2018, 5:26 a.m. by running:
# manage.py generate_postfix_maps --destdir /etc/postfix/maps --force-overwrite
# DO NOT EDIT!
dbpath = /var/local/modoboa/db.sqlite
query = (SELECT email FROM core_user WHERE email='%s' AND is_active=1) UNION (SELECT mb.address || '@' || dom.name FROM admin_mailbox mb INNER JOIN admin_senderaddress sad ON sad.mailbox_id=mb.id INNER JOIN admin_domain dom ON dom.id=mb.domain_id WHERE sad.address='%s') UNION (SELECT mb.address || '@' || dom.name FROM admin_mailbox mb INNER JOIN modoboa_admin_aliasrecipient alr ON alr.r_mailbox_id=mb.id INNER JOIN admin_domain dom ON dom.id=mb.domain_id INNER JOIN admin_alias al ON alr.alias_id=al.id WHERE al.enabled=1 AND al.address='%s')
Originally created by @nogweii on GitHub (Apr 24, 2018). Original GitHub issue: https://github.com/modoboa/modoboa/issues/1476 # Impacted versions * Modoboa: 1.10.4 * installer used: No, wrapping around calling modoboa-admin.py with Ansible * Webserver: Nginx Stock generated maps ran `manage.py generate_postfix_maps` results in this error when someone attempts to log in: Apr 24 04:31:35 postman.aether.earth postfix/proxymap[9896]: fatal: dict_sqlite_lookup: /etc/postfix/maps/sql-sender-login-map.cf: SQL prepare failed: near "(": syntax error? Contents of file: ``` # This file was generated on April 23, 2018, 5:26 a.m. by running: # manage.py generate_postfix_maps --destdir /etc/postfix/maps --force-overwrite # DO NOT EDIT! dbpath = /var/local/modoboa/db.sqlite query = (SELECT email FROM core_user WHERE email='%s' AND is_active=1) UNION (SELECT mb.address || '@' || dom.name FROM admin_mailbox mb INNER JOIN admin_senderaddress sad ON sad.mailbox_id=mb.id INNER JOIN admin_domain dom ON dom.id=mb.domain_id WHERE sad.address='%s') UNION (SELECT mb.address || '@' || dom.name FROM admin_mailbox mb INNER JOIN modoboa_admin_aliasrecipient alr ON alr.r_mailbox_id=mb.id INNER JOIN admin_domain dom ON dom.id=mb.domain_id INNER JOIN admin_alias al ON alr.alias_id=al.id WHERE al.enabled=1 AND al.address='%s') ```
kerem 2026-02-27 11:15:38 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@nogweii commented on GitHub (Apr 24, 2018):

This seems similar to #711, but that discussion ended up moving to a different repository which seems to have been deleted in the intervening years.

<!-- gh-comment-id:383806572 --> @nogweii commented on GitHub (Apr 24, 2018): This seems similar to #711, but that discussion ended up moving to a different repository which seems to have been deleted in the intervening years.
Author
Owner

@tonioo commented on GitHub (Apr 26, 2018):

@evaryont Looks like SQLite does not like parenthesis. Can you try to remove them from the query?

<!-- gh-comment-id:384556289 --> @tonioo commented on GitHub (Apr 26, 2018): @evaryont Looks like SQLite does not like parenthesis. Can you try to remove them from the query?
Author
Owner

@nogweii commented on GitHub (Apr 27, 2018):

Hey, that works! Simply removing the parentheses lets the query work successfully.

<!-- gh-comment-id:384835362 --> @nogweii commented on GitHub (Apr 27, 2018): Hey, that works! Simply removing the parentheses lets the query work successfully.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1164
No description provided.