{"action":"created","comment":{"url":"https://api.github.com/repos/corecode/dma/pulls/comments/44604525","id":44604525,"diff_hunk":"@@ -348,10 +354,115 @@ close_connection(int fd)\n \tclose(fd);\n }\n \n+static void parse_auth_line(char* line, struct smtp_auth_mechanisms* auth) {\n+\t// Skip the auth prefix\n+\tline += strlen(\"AUTH \");\n+\n+\tchar* method = strtok(line, \" \");\n+\twhile (method) {\n+\t\tif (strcmp(method, \"CRAM-MD5\") == 0)\n+\t\t\tauth->cram_md5 = 1;\n+\n+\t\telse if (strcmp(method, \"LOGIN\") == 0)\n+\t\t\tauth->login = 1;\n+\n+\t\tmethod = strtok(NULL, \" \");\n+\t}\n+}\n+\n+int perform_server_greeting(int fd, struct smtp_features* features) {\n+\t/*\n+\t\tSend EHLO\n+\t\tXXX allow HELO fallback\n+\t*/\n+\tsend_remote_command(fd, \"EHLO %s\", hostname());\n+\n+\tchar buffer[EHLO_RESPONSE_SIZE];\n+\tmemset(buffer, 0, sizeof(buffer));\n+\n+\tint res = read_remote(fd, sizeof(buffer) - 1, buffer);\n+\n+\t// Got an unexpected response\n+\tif (res != 2)\n+\t\treturn -1;\n+\n+\t// Reset all features\n+\tmemset(features, 0, sizeof(*features));\n+\n+\t// Run through the buffer line by line\n+\tchar linebuffer[EHLO_RESPONSE_SIZE];\n+\tchar* p = buffer;\n+\n+\twhile (*p) {","path":"net.c","position":161,"original_position":161,"commit_id":"1fa7a882dd22d5f619b3645c6597a419034e9b4e","original_commit_id":"1fa7a882dd22d5f619b3645c6597a419034e9b4e","user":{"login":"mtremer","id":6318738,"avatar_url":"https://avatars.githubusercontent.com/u/6318738?v=3","gravatar_id":"","url":"https://api.github.com/users/mtremer","html_url":"https://github.com/mtremer","followers_url":"https://api.github.com/users/mtremer/followers","following_url":"https://api.github.com/users/mtremer/following{/other_user}","gists_url":"https://api.github.com/users/mtremer/gists{/gist_id}","starred_url":"https://api.github.com/users/mtremer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtremer/subscriptions","organizations_url":"https://api.github.com/users/mtremer/orgs","repos_url":"https://api.github.com/users/mtremer/repos","events_url":"https://api.github.com/users/mtremer/events{/privacy}","received_events_url":"https://api.github.com/users/mtremer/received_events","type":"User","site_admin":false},"body":"What do you mean? This is pretty much everywhere done this way. I didn't feel that using strstr() for searching for certain keywords would be a good idea.","created_at":"2015-11-11T23:49:08Z","updated_at":"2015-11-11T23:49:08Z","html_url":"https://github.com/corecode/dma/pull/34#discussion_r44604525","pull_request_url":"https://api.github.com/repos/corecode/dma/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/corecode/dma/pulls/comments/44604525"},"html":{"href":"https://github.com/corecode/dma/pull/34#discussion_r44604525"},"pull_request":{"href":"https://api.github.com/repos/corecode/dma/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/corecode/dma/pulls/34","id":50323044,"html_url":"https://github.com/corecode/dma/pull/34","diff_url":"https://github.com/corecode/dma/pull/34.diff","patch_url":"https://github.com/corecode/dma/pull/34.patch","issue_url":"https://api.github.com/repos/corecode/dma/issues/34","number":34,"state":"open","locked":false,"title":"Implement better authentication","user":{"login":"mtremer","id":6318738,"avatar_url":"https://avatars.githubusercontent.com/u/6318738?v=3","gravatar_id":"","url":"https://api.github.com/users/mtremer","html_url":"https://github.com/mtremer","followers_url":"https://api.github.com/users/mtremer/followers","following_url":"https://api.github.com/users/mtremer/following{/other_user}","gists_url":"https://api.github.com/users/mtremer/gists{/gist_id}","starred_url":"https://api.github.com/users/mtremer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtremer/subscriptions","organizations_url":"https://api.github.com/users/mtremer/orgs","repos_url":"https://api.github.com/users/mtremer/repos","events_url":"https://api.github.com/users/mtremer/events{/privacy}","received_events_url":"https://api.github.com/users/mtremer/received_events","type":"User","site_admin":false},"body":"DMA tries to authenticate by simply trying various authentication\r\nmechanisms. This is obviously not conforming to RFC and some mail\r\nproviders detect this is spam and reject all emails.\r\n\r\nThis patch parses the EHLO response and reads various keywords\r\nfrom it that can then later in the program be used to jump into\r\ncertain code paths.\r\n\r\nCurrently this is used to only authenticate with CRAM-MD5 and/or\r\nLOGIN if the server supports one or both of these. The\r\nimplementation can be easily be extended though.\r\n\r\nSigned-off-by: Michael Tremer <michael.tremer@ipfire.org>","created_at":"2015-11-10T22:46:19Z","updated_at":"2015-11-11T23:49:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f29afb7d0bbe0c72ee34f2e620a356d7b3739a36","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/corecode/dma/pulls/34/commits","review_comments_url":"https://api.github.com/repos/corecode/dma/pulls/34/comments","review_comment_url":"https://api.github.com/repos/corecode/dma/pulls/comments{/number}","comments_url":"https://api.github.com/repos/corecode/dma/issues/34/comments","statuses_url":"https://api.github.com/repos/corecode/dma/statuses/1fa7a882dd22d5f619b3645c6597a419034e9b4e","head":{"label":"mtremer:better-authentication","ref":"better-authentication","sha":"1fa7a882dd22d5f619b3645c6597a419034e9b4e","user":{"login":"mtremer","id":6318738,"avatar_url":"https://avatars.githubusercontent.com/u/6318738?v=3","gravatar_id":"","url":"https://api.github.com/users/mtremer","html_url":"https://github.com/mtremer","followers_url":"https://api.github.com/users/mtremer/followers","following_url":"https://api.github.com/users/mtremer/following{/other_user}","gists_url":"https://api.github.com/users/mtremer/gists{/gist_id}","starred_url":"https://api.github.com/users/mtremer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtremer/subscriptions","organizations_url":"https://api.github.com/users/mtremer/orgs","repos_url":"https://api.github.com/users/mtremer/repos","events_url":"https://api.github.com/users/mtremer/events{/privacy}","received_events_url":"https://api.github.com/users/mtremer/received_events","type":"User","site_admin":false},"repo":{"id":45945248,"name":"dma","full_name":"mtremer/dma","owner":{"login":"mtremer","id":6318738,"avatar_url":"https://avatars.githubusercontent.com/u/6318738?v=3","gravatar_id":"","url":"https://api.github.com/users/mtremer","html_url":"https://github.com/mtremer","followers_url":"https://api.github.com/users/mtremer/followers","following_url":"https://api.github.com/users/mtremer/following{/other_user}","gists_url":"https://api.github.com/users/mtremer/gists{/gist_id}","starred_url":"https://api.github.com/users/mtremer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtremer/subscriptions","organizations_url":"https://api.github.com/users/mtremer/orgs","repos_url":"https://api.github.com/users/mtremer/repos","events_url":"https://api.github.com/users/mtremer/events{/privacy}","received_events_url":"https://api.github.com/users/mtremer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mtremer/dma","description":"The DragonFly Mail Agent, a small Mail Transport Agent (MTA), designed for home and office use.","fork":true,"url":"https://api.github.com/repos/mtremer/dma","forks_url":"https://api.github.com/repos/mtremer/dma/forks","keys_url":"https://api.github.com/repos/mtremer/dma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mtremer/dma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mtremer/dma/teams","hooks_url":"https://api.github.com/repos/mtremer/dma/hooks","issue_events_url":"https://api.github.com/repos/mtremer/dma/issues/events{/number}","events_url":"https://api.github.com/repos/mtremer/dma/events","assignees_url":"https://api.github.com/repos/mtremer/dma/assignees{/user}","branches_url":"https://api.github.com/repos/mtremer/dma/branches{/branch}","tags_url":"https://api.github.com/repos/mtremer/dma/tags","blobs_url":"https://api.github.com/repos/mtremer/dma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mtremer/dma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mtremer/dma/git/refs{/sha}","trees_url":"https://api.github.com/repos/mtremer/dma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mtremer/dma/statuses/{sha}","languages_url":"https://api.github.com/repos/mtremer/dma/languages","stargazers_url":"https://api.github.com/repos/mtremer/dma/stargazers","contributors_url":"https://api.github.com/repos/mtremer/dma/contributors","subscribers_url":"https://api.github.com/repos/mtremer/dma/subscribers","subscription_url":"https://api.github.com/repos/mtremer/dma/subscription","commits_url":"https://api.github.com/repos/mtremer/dma/commits{/sha}","git_commits_url":"https://api.github.com/repos/mtremer/dma/git/commits{/sha}","comments_url":"https://api.github.com/repos/mtremer/dma/comments{/number}","issue_comment_url":"https://api.github.com/repos/mtremer/dma/issues/comments{/number}","contents_url":"https://api.github.com/repos/mtremer/dma/contents/{+path}","compare_url":"https://api.github.com/repos/mtremer/dma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mtremer/dma/merges","archive_url":"https://api.github.com/repos/mtremer/dma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mtremer/dma/downloads","issues_url":"https://api.github.com/repos/mtremer/dma/issues{/number}","pulls_url":"https://api.github.com/repos/mtremer/dma/pulls{/number}","milestones_url":"https://api.github.com/repos/mtremer/dma/milestones{/number}","notifications_url":"https://api.github.com/repos/mtremer/dma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mtremer/dma/labels{/name}","releases_url":"https://api.github.com/repos/mtremer/dma/releases{/id}","created_at":"2015-11-10T22:44:39Z","updated_at":"2015-11-10T22:44:39Z","pushed_at":"2015-11-10T22:45:43Z","git_url":"git://github.com/mtremer/dma.git","ssh_url":"git@github.com:mtremer/dma.git","clone_url":"https://github.com/mtremer/dma.git","svn_url":"https://github.com/mtremer/dma","homepage":"","size":650,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"corecode:master","ref":"master","sha":"c17554544edbf3089ff3b196ef8c4dab3bc8290c","user":{"login":"corecode","id":177979,"avatar_url":"https://avatars.githubusercontent.com/u/177979?v=3","gravatar_id":"","url":"https://api.github.com/users/corecode","html_url":"https://github.com/corecode","followers_url":"https://api.github.com/users/corecode/followers","following_url":"https://api.github.com/users/corecode/following{/other_user}","gists_url":"https://api.github.com/users/corecode/gists{/gist_id}","starred_url":"https://api.github.com/users/corecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corecode/subscriptions","organizations_url":"https://api.github.com/users/corecode/orgs","repos_url":"https://api.github.com/users/corecode/repos","events_url":"https://api.github.com/users/corecode/events{/privacy}","received_events_url":"https://api.github.com/users/corecode/received_events","type":"User","site_admin":false},"repo":{"id":2784124,"name":"dma","full_name":"corecode/dma","owner":{"login":"corecode","id":177979,"avatar_url":"https://avatars.githubusercontent.com/u/177979?v=3","gravatar_id":"","url":"https://api.github.com/users/corecode","html_url":"https://github.com/corecode","followers_url":"https://api.github.com/users/corecode/followers","following_url":"https://api.github.com/users/corecode/following{/other_user}","gists_url":"https://api.github.com/users/corecode/gists{/gist_id}","starred_url":"https://api.github.com/users/corecode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/corecode/subscriptions","organizations_url":"https://api.github.com/users/corecode/orgs","repos_url":"https://api.github.com/users/corecode/repos","events_url":"https://api.github.com/users/corecode/events{/privacy}","received_events_url":"https://api.github.com/users/corecode/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/corecode/dma","description":"The DragonFly Mail Agent, a small Mail Transport Agent (MTA), designed for home and office use.","fork":false,"url":"https://api.github.com/repos/corecode/dma","forks_url":"https://api.github.com/repos/corecode/dma/forks","keys_url":"https://api.github.com/repos/corecode/dma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/corecode/dma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/corecode/dma/teams","hooks_url":"https://api.github.com/repos/corecode/dma/hooks","issue_events_url":"https://api.github.com/repos/corecode/dma/issues/events{/number}","events_url":"https://api.github.com/repos/corecode/dma/events","assignees_url":"https://api.github.com/repos/corecode/dma/assignees{/user}","branches_url":"https://api.github.com/repos/corecode/dma/branches{/branch}","tags_url":"https://api.github.com/repos/corecode/dma/tags","blobs_url":"https://api.github.com/repos/corecode/dma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/corecode/dma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/corecode/dma/git/refs{/sha}","trees_url":"https://api.github.com/repos/corecode/dma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/corecode/dma/statuses/{sha}","languages_url":"https://api.github.com/repos/corecode/dma/languages","stargazers_url":"https://api.github.com/repos/corecode/dma/stargazers","contributors_url":"https://api.github.com/repos/corecode/dma/contributors","subscribers_url":"https://api.github.com/repos/corecode/dma/subscribers","subscription_url":"https://api.github.com/repos/corecode/dma/subscription","commits_url":"https://api.github.com/repos/corecode/dma/commits{/sha}","git_commits_url":"https://api.github.com/repos/corecode/dma/git/commits{/sha}","comments_url":"https://api.github.com/repos/corecode/dma/comments{/number}","issue_comment_url":"https://api.github.com/repos/corecode/dma/issues/comments{/number}","contents_url":"https://api.github.com/repos/corecode/dma/contents/{+path}","compare_url":"https://api.github.com/repos/corecode/dma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/corecode/dma/merges","archive_url":"https://api.github.com/repos/corecode/dma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/corecode/dma/downloads","issues_url":"https://api.github.com/repos/corecode/dma/issues{/number}","pulls_url":"https://api.github.com/repos/corecode/dma/pulls{/number}","milestones_url":"https://api.github.com/repos/corecode/dma/milestones{/number}","notifications_url":"https://api.github.com/repos/corecode/dma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/corecode/dma/labels{/name}","releases_url":"https://api.github.com/repos/corecode/dma/releases{/id}","created_at":"2011-11-15T23:21:01Z","updated_at":"2015-10-27T13:31:28Z","pushed_at":"2015-11-10T22:46:20Z","git_url":"git://github.com/corecode/dma.git","ssh_url":"git@github.com:corecode/dma.git","clone_url":"https://github.com/corecode/dma.git","svn_url":"https://github.com/corecode/dma","homepage":"","size":876,"stargazers_count":41,"watchers_count":41,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":17,"forks":13,"open_issues":17,"watchers":41,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/corecode/dma/pulls/34"},"html":{"href":"https://github.com/corecode/dma/pull/34"},"issue":{"href":"https://api.github.com/repos/corecode/dma/issues/34"},"comments":{"href":"https://api.github.com/repos/corecode/dma/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/corecode/dma/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/corecode/dma/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/corecode/dma/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/corecode/dma/statuses/1fa7a882dd22d5f619b3645c6597a419034e9b4e"}}}}