Skip to content

IMAP SSL, FreeBSD#2

Open
tcanich wants to merge 5 commits intovandry:masterfrom
tcanich:master
Open

IMAP SSL, FreeBSD#2
tcanich wants to merge 5 commits intovandry:masterfrom
tcanich:master

Conversation

@tcanich
Copy link

@tcanich tcanich commented Jun 28, 2017

These changes include additional headers to build on FreeBSD 11, use the default location for SSL certificates when verifying an IMAP server certificate, and how comments in mairixrc are handled.

This last change makes the program compatible with the manual page and allows for using special characters in passwords -- the previous behavior would strip passwords from a special character to the end of the line. I've added text to the mairixrc manual page to clarify that trailing comments are not allowed.

SSL certificates are now loaded from the system default location, or a location specified by the user's environment.

Also included is some preliminary work to allow the tests to run on FreeBSD; there is more to do, here, due to differences in BSD versus GNU utilities options.

tcanich and others added 5 commits June 26, 2017 09:17
Use the default certificate store location -- this seems to vary by system.
Can be set at runtime with environment variables for non-default locations.
…es starting with "#". Previous functionality discarded data following one of "!#;%". This causes problems when parsing imap_password where the password value may contain one of these characters. The mairixrc(5) manual page indicates comment lines begin with "#".

Update mairixrc.5 to clarify trailing comments are not allowed.
Address compiler warning regarding possible uninitialized used of
got_uid_len and raw_len.  Initialize both to 0.
Copy link
Owner

@vandry vandry left a comment

Choose a reason for hiding this comment

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

Thanks. Please see suggestions.

for (p=line; *p && !strchr("#!;%", *p); p++) ;
if (*p) *p = '\0';
/* Discard comment lines. */
if (strchr("#", line[0])) {
Copy link
Owner

Choose a reason for hiding this comment

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

This seems like it might be a bit strict. How about allowing whitespace before the # that introduces a comment. Maybe not. I can be convinced otherwise.

Also, this usage of strchr looks very odd to me. Although it is correct, I had to read it again to determine that.

exit 1
fi
;;
*)
Copy link
Owner

Choose a reason for hiding this comment

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

This cannot just handle Linux and FreeBSD and bail on everything else.

I suggest testing stat itself, not uname, to determine what stat is available. Something like

if stat --version | grep 'GNU coreutils' >/dev/null; then
  # use the GNU syntax
elif
  ...
fi

SSL_library_init();
sslctx = SSL_CTX_new(SSLv23_client_method());
sslctx = SSL_CTX_new(TLSv1_client_method());
SSL_CTX_set_options(sslctx, SSL_OP_NO_SSL_MASK);
Copy link
Owner

Choose a reason for hiding this comment

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

nit: use tabs, like on the other lines.

vandry pushed a commit that referenced this pull request Jan 1, 2022
This now outputs usage information if there is more than one argument,
or if the first argument starts with a "-".

This also returns non-exit-0, so that if we add command line arguments
in the future, and somehow someone gets rolled back to an old version of
the binary, then the program will exit unsuccessfully, which hopefully
will make it clearer what happened (esp if someone has some kind of
integration test).

This continues to improve the situation in issue #2, but I don't think
it really resolves it yet.  I've not yet come to a conclusion about what
I want to do with command line arguments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants