MCPcopy Index your code
hub / github.com/git/git / try_auth_method

Function try_auth_method

imap-send.c:1113–1143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1111}
1112
1113static int try_auth_method(struct imap_server_conf *srvc,
1114 struct imap_store *ctx,
1115 struct imap *imap,
1116 const char *auth_method,
1117 enum CAPABILITY cap,
1118 int (*fn)(struct imap_store *, const char *))
1119{
1120 struct imap_cmd_cb cb = {0};
1121
1122 if (!CAP(cap)) {
1123 fprintf(stderr, "You specified "
1124 "%s as authentication method, "
1125 "but %s doesn't support it.\n",
1126 auth_method, srvc->host);
1127 return -1;
1128 }
1129 cb.cont = fn;
1130
1131 if (NOT_CONSTANT(!cb.cont)) {
1132 fprintf(stderr, "If you want to use %s authentication mechanism, "
1133 "you have to build git-imap-send with OpenSSL library.",
1134 auth_method);
1135 return -1;
1136 }
1137 if (imap_exec(ctx, &cb, "AUTHENTICATE %s", auth_method) != RESP_OK) {
1138 fprintf(stderr, "IMAP error: AUTHENTICATE %s failed\n",
1139 auth_method);
1140 return -1;
1141 }
1142 return 0;
1143}
1144
1145static struct imap_store *imap_open_store(struct imap_server_conf *srvc, const char *folder)
1146{

Callers 1

imap_open_storeFunction · 0.85

Calls 1

imap_execFunction · 0.85

Tested by

no test coverage detected