| 1063 | } |
| 1064 | |
| 1065 | static int auth_xoauth2(struct imap_store *ctx, const char *prompt UNUSED) |
| 1066 | { |
| 1067 | int ret; |
| 1068 | char *b64; |
| 1069 | |
| 1070 | b64 = xoauth2_base64(ctx->cfg->user, ctx->cfg->pass); |
| 1071 | if (!b64) |
| 1072 | return error("XOAUTH2: base64 encoding failed"); |
| 1073 | |
| 1074 | /* Send the base64-encoded response */ |
| 1075 | ret = socket_write(&ctx->imap->buf.sock, b64, strlen(b64)); |
| 1076 | if (ret != (int)strlen(b64)) { |
| 1077 | free(b64); |
| 1078 | return error("IMAP error: sending XOAUTH2 response failed"); |
| 1079 | } |
| 1080 | |
| 1081 | free(b64); |
| 1082 | return 0; |
| 1083 | } |
| 1084 | |
| 1085 | #else |
| 1086 |
nothing calls this directly
no test coverage detected