user:sachy:lakatux
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
user:sachy:lakatux [2023/02/04 17:52] – external edit 127.0.0.1 | user:sachy:lakatux [2023/09/10 09:16] (current) – novy patch sachy | ||
---|---|---|---|
Line 209: | Line 209: | ||
<code diff mutt_save_file_perm.patch> | <code diff mutt_save_file_perm.patch> | ||
- | --- PATCHES~ | + | diff -Naru /s/mutt-2.2.12/ |
- | +++ PATCHES | + | --- / |
- | @@ -1,0 +1 @@ | + | +++ ./ |
- | +patch.1.14.6.ms.sfp.1 | + | @@ -250,6 +250,8 @@ |
- | diff /s/mutt-1.14.6/globals.h ./globals.h | + | WHERE short ScoreThresholdRead; |
- | 234a235 | + | WHERE short ScoreThresholdFlag; |
- | > WHERE short SaveFilePerm; | + | |
- | diff /s/mutt-1.14.6/init.h ./init.h | + | +WHERE short SaveFilePerm; |
- | 3138a3139,3143 | + | + |
- | > { " | + | # |
- | > /* | + | WHERE short SidebarWidth; |
- | > ** This variable controls the permissions of saved attachments. | + | WHERE LIST *SidebarWhitelist; |
- | > ** Use standard POSIX permissions in octal notation, i.e. 0644. | + | diff -Naru /s/mutt-2.2.12/init.h ./init.h |
- | > */ | + | --- /s/mutt-2.2.12/init.h 2023-09-01 08: |
- | diff /s/mutt-1.14.6/main.c ./main.c | + | +++ ./init.h 2023-09-10 10: |
- | 669c669,672 | + | @@ -3460,6 +3460,11 @@ |
- | < umask (077); | + | ** \fBNote:\fP This only applies to mbox and MMDF folders, Mutt does not |
- | --- | + | ** delete MH and Maildir directories. |
- | > if(SaveFilePerm==600) | + | */ |
- | > umask (077); | + | + |
- | > else | + | + |
- | > umask (000); | + | + |
- | diff /s/mutt-1.14.6/muttlib.c ./ | + | + |
- | 2498a2499,2514 | + | + |
- | > /* Convert file permission from decadic to octal */ | + | { " |
- | > unsigned short own=0; | + | /* |
- | > unsigned short grp=0; | + | ** .pp |
- | > unsigned short oth=0; | + | diff -Naru /s/mutt-2.2.12/main.c ./main.c |
- | > unsigned short SFPoct=0; | + | --- / |
- | > own=SaveFilePerm/ | + | +++ ./ |
- | > grp=(SaveFilePerm-own*100)/ | + | @@ -690,7 +690,10 @@ |
- | > oth=SaveFilePerm-(own*100)-(grp*10); | + | mutt_error = mutt_nocurses_error; |
- | > if(own> | + | |
- | > { | + | SRAND (time (NULL)); |
- | > SFPoct=0600; | + | - |
- | > dprint(1, | + | + |
- | > } | + | + |
- | > else | + | + |
- | > SFPoct=own<< | + | + |
- | > | + | |
- | 2510c2526 | + | |
- | < if ((fd = open (mutt_b2s (safe_file), | + | |
- | --- | + | diff -Naru /s/mutt-2.2.12/muttlib.c ./ |
- | > if ((fd = open (mutt_b2s (safe_file), | + | --- / |
- | 2525c2541 | + | +++ ./ |
- | < if ((fd = open (path, flags & ~O_EXCL, 0600)) < 0) | + | @@ -2562,6 +2562,22 @@ |
- | --- | + | BUFFER *safe_file = NULL; |
- | > if ((fd = open (path, flags & ~O_EXCL, SFPoct)) < 0) | + | |
+ | |||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | + | ||
+ | if (flags & O_EXCL) | ||
+ | { | ||
+ | safe_file = mutt_buffer_pool_get (); | ||
+ | @@ -2573,7 +2589,7 @@ | ||
+ | goto cleanup; | ||
+ | } | ||
+ | |||
+ | - | ||
+ | + | ||
+ | { | ||
+ | rmdir (mutt_b2s (safe_dir)); | ||
+ | goto cleanup; | ||
+ | @@ -2588,7 +2604,7 @@ | ||
+ | } | ||
+ | } | ||
+ | |||
+ | - | ||
+ | + | ||
+ | goto cleanup; | ||
+ | |||
+ | /* make sure the file is not symlink */ | ||
</ | </ | ||
Line 985: | Line 1023: | ||
View=%view{ascii} prettyjson.py %f 2>&1 | View=%view{ascii} prettyjson.py %f 2>&1 | ||
</ | </ | ||
+ | |||
+ | |||
+ | ===== mutt vs Oauth2 ===== | ||
+ | |||
+ | Oauth2 protocol is more and more popular auth mechanism, so mutt - as the least wrong mail client - have support too. Yet the support is a bit tricky... | ||
+ | |||
+ | First, download [[https:// | ||
+ | |||
+ | Then generate new PGP key for encryption of the Oauth secrets. "gpg --gen-key" | ||
+ | |||
+ | Edit the downloaded mutt_oauth2.py and change the following: | ||
+ | |||
+ | <code python> | ||
+ | ENCRYPTION_PIPE = [' | ||
+ | ... | ||
+ | ' | ||
+ | </ | ||
+ | |||
+ | If you want to use your own client_id, search faculty/ | ||
+ | |||
+ | Make first contact: | ||
+ | <code bash> | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | Follow the instructions, | ||
+ | |||
+ | Copy the whole URL to text editor and copy out the content of code= parameter back to the mutt_oauth2 prompt. Its long, invalid, base64 stuff ending prior "& | ||
+ | |||
+ | < | ||
+ | 0.AQIABsRF82hSsEOxn1hi-mgz-LyUX56k6HNOuL5j-LOTOFGARBAGE-REALLYLOTOFGARBAGE-EVENMOREGARBAGE-vUFlgHtUs6n5bmmRQgQ7AMH8zojnZWycMA | ||
+ | </ | ||
+ | |||
+ | Be sure not to copy newlines from vim/nano. Its one string, no newlines. NO NEWLINES! | ||
+ | |||
+ | If done correctly, the script will respond: | ||
+ | < | ||
+ | Exchanging the authorization code for an access token | ||
+ | NOTICE: Obtained new access token, expires 2023-03-23T12: | ||
+ | Access Token: lot-of-garbage | ||
+ | </ | ||
+ | |||
+ | Now is time to test the Oauth2 SMTP/IMAP connection: | ||
+ | < | ||
+ | $ / | ||
+ | Access Token: garbage... | ||
+ | IMAP authentication succeeded | ||
+ | POP authentication succeeded | ||
+ | SMTP authentication succeeded | ||
+ | </ | ||
+ | |||
+ | Good, the last thing is to edit the .mutt/ | ||
+ | |||
+ | <code muttrc> | ||
+ | set imap_user=" | ||
+ | set folder=" | ||
+ | set smtp_url=" | ||
+ | set imap_authenticators=" | ||
+ | set imap_oauth_refresh_command="/ | ||
+ | set smtp_authenticators=${imap_authenticators} | ||
+ | set smtp_oauth_refresh_command=${imap_oauth_refresh_command} | ||
+ | </ | ||
+ | |||
+ | If you have setup for more mailboxes, dont forget to clean the setting for all the others: | ||
+ | |||
+ | <code muttrc> | ||
+ | # reset Oauth2 to normal | ||
+ | set imap_authenticators=" | ||
+ | set imap_oauth_refresh_command="" | ||
+ | set smtp_authenticators=${imap_authenticators} | ||
+ | set smtp_oauth_refresh_command="" | ||
+ | </ | ||
+ | |||
+ | |||
user/sachy/lakatux.1675533137.txt.gz · Last modified: 2023/02/04 17:52 by 127.0.0.1