Skip to content

This adds spawn-filter binary for filtering message passed to qmail-remote/qmail-local - #50

Open
mbhangui wants to merge 10 commits into
mainfrom
spawn-filter
Open

mbhangui wants to merge 10 commits into
mainfrom
spawn-filter

Conversation

@mbhangui

@mbhangui mbhangui commented Jul 29, 2019 •

Copy link
Copy Markdown
Contributor

@schmonz I have created a pull request for the QMAILREMOTE/QMAILLOCAL changes. You can view it now

  1. QMAILREMOTE env variable added to qmail-rspawn.c, taken from Run alternate qmail-remote by setting QMAILREMOTE. #46
  2. Same change added to qmail-lspawn.c using env variable QMAILLOCAL
  3. Modification of man pages qmail-rspawn.8, qmail-lspawn.8 for QMAILREMOTE, QMAILLOCAL
  4. Modification of man page for qmail-control (for new control file filterargs)
  5. addition of a new program spawn-filter (which can be called by setting QMAILREMOTE or QMAILLOCAL. e.g. QMAILREMOTE=/var/qmail/bin/spawn-filter
  6. Addition of a C file wildmat.c for wildmat_internal() function
  7. modification of Makefile, TARGETS
  8. modification of hier.c for installing spawn-filter and spawn-filter man page

@mbhangui mbhangui added the enhancement New feature or request label Jul 29, 2019
@mbhangui mbhangui added this to the 1.08 milestone Jul 29, 2019
Comment thread qmail-rspawn.c Outdated
@DerDakon

Copy link
Copy Markdown
Member

please rebase this on current master so it get's easier to review

@mbhangui

Copy link
Copy Markdown
Contributor Author

please rebase this on current master so it get's easier to review

I am a noob when using git. How do I do that. in the webui, the 'Rebase and Merge' shows greyed out

@DerDakon

Copy link
Copy Markdown
Member

Do it on the commandline:

git fetch
git rebase origin/master
git push --force

@mbhangui

Copy link
Copy Markdown
Contributor Author

I did this and I get this error
argos:/usr/local/src/projects/spawn-filter/notqmail>git fetch
remote: Enumerating objects: 17, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 17 (delta 8), reused 7 (delta 4), pack-reused 0
Unpacking objects: 100% (17/17), done.
From git://github.com/notqmail/notqmail

  • [new branch] sysdeps-not-quite-dead -> origin/sysdeps-not-quite-dead
    argos:/usr/local/src/projects/spawn-filter/notqmail>git rebase origin/master
    Current branch spawn-filter is up to date.
    argos:/usr/local/src/projects/spawn-filter/notqmail>git push --force
    fatal: remote error:
    You can't push to git://github.com/notqmail/notqmail.git
    Use https://github.com/notqmail/notqmail.git

@mbhangui

Copy link
Copy Markdown
Contributor Author

OK. I changed it to https in .git/config and did a push. It has gone through
git push --force
Username for 'https://github.com': mbhangui@gmail.com
Password for 'https://mbhangui@gmail.com@github.com':
Enumerating objects: 16, done.
Counting objects: 100% (16/16), done.
Delta compression using up to 4 threads
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 7.86 KiB | 1.31 MiB/s, done.
Total 10 (delta 6), reused 3 (delta 0)
remote: Resolving deltas: 100% (6/6), completed with 6 local objects.
To https://github.com/notqmail/notqmail.git

@mbhangui mbhangui changed the title This adds spawn-filter binary. Following are the changes This adds spawn-filter binary for filtering message passed to qmail-remote/qmail-local Aug 13, 2019
Comment thread qmail-lspawn.8
then runs
.B qmail-local
under the user's uid and gid.
It does not set up any supplementary groups.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you remove this line?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. That's by mistake

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed it. I think I am making too many mistakes. Somehow I lost the changes made to the three man pages that I had made around few weeks earlier. I have pushed the corrections just now

Comment thread qmail-rspawn.8 Outdated
@alanpost alanpost modified the milestones: 1.08, 1.9 Aug 25, 2019
@schmonz schmonz modified the milestones: 1.9, 1.08 Aug 26, 2019
@schmonz

schmonz commented Aug 26, 2019

Copy link
Copy Markdown
Member

We're agreed on QMAILREMOTE in some form for 1.08. Marking this one 1.08 for consideration alongside #46.

Comment thread Makefile
Comment thread hier.c Outdated
Comment thread wildmat.c Outdated
return matched;
return ABORT;
case '[':
reverse = p[1] == NEGATE_CLASS ? TRUE : FALSE;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that will overflow the input string if passed something that ends in "[" or "[^" as it will go one char too far when entering the for loop below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed yes. I don't like the function now. Is there a better way? spawn-filter already has code to use regexec() if env variable QREGEX is set. I can remove wildmat.c totally and use regexec() instead. Or is there a better function you are aware of that can be used for pattern matching?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking out aloud. Is the need for pattern matching for domains really required. regex matching or using wildmat can be totally avoided if we use exact domains in the control file filterargs.

@DerDakon

DerDakon commented Sep 3, 2019

Copy link
Copy Markdown
Member

If it is ok with you I would rebase the branch on the current master to reduce the complexity in git history.

@mbhangui

mbhangui commented Sep 3, 2019

Copy link
Copy Markdown
Contributor Author

If it is ok with you I would rebase the branch on the current master to reduce the complexity in git history.

That would be awesome. I'm still struggling with knowing how to do things properly with git.

@DerDakon

DerDakon commented Sep 3, 2019

Copy link
Copy Markdown
Member

Ok, I have rebased it and squashed a few of your fix commits to those commits that introduced the error. Please do:

git fetch
git reset --hard origin/spawn-filter

@schmonz schmonz modified the milestones: 1.09, 1.90 Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants