Cyrus SASL API가 EXTERNAL 메커니즘을 지원하지 않습니까? 나는 을 클라이언트로 사용하려고 시도하지만 요청시 SASL_NOMECH
을 반환합니다. Cyrus SASL에서 EXTERNAL 메커니즘 사용
% cat cyrus_sal_ex.c
/* cyrus_sasl_ex.c: Example of using the Cyrus SASL api */
#include <stdio.h> /* for printf() */
#include <sasl/sasl.h> /* for sasl_client_*(), SASL_*, sasl_*_t */
static char const * SASL_return_code(int const code)
{
switch(code)
{
/* ... */
case SASL_OK: return "SASL_OK[0]: successful result";
/* ... */
case SASL_NOMECH: return "SASL_NOMECH[-4]: mechanism not supported";
/* ... */
}
return "unrecognized";
}
int main()
{
char const * output = NULL;
unsigned outlen = 0;
char const * mechanism = NULL;
sasl_conn_t * conn;
# define PRINT_RESULT(x) do\
{\
int const __result = (x);\
printf("%s == %d\n\t%s\n", #x, __result, SASL_return_code(__result));\
if (__result < 0) goto done;\
}\
while (0)
PRINT_RESULT(sasl_client_init(NULL));
PRINT_RESULT(sasl_client_new("fake", "fakey.mcfaker.ton", "127.0.0.1", "127.255.255.1", NULL, 0, &conn));
PRINT_RESULT(sasl_client_start(conn, "EXTERNAL", NULL, &output, &outlen, &mechanism));
done:
# undef PRINT_RESULT
printf("output: [%d bytes] : %s\n", outlen, (output ? output : "NULL"));
printf("mechanism: %s\n", (mechanism ? mechanism : "NULL"));
return 0;
}
% gcc -I/sw/include -L/sw/lib -lsasl2 cyrus_sasl_ex.c -o cyrus_sasl_ex # your header/library locations may vary
% ./cyrus_sasl_ex
sasl_client_init(NULL) == 0
SASL_OK[0]: successful result
sasl_client_new("fake", "fakey.mcfaker.ton", "127.0.0.1", "127.255.255.1", NULL, 0, &conn) == 0
SASL_OK[0]: successful result
sasl_client_start(conn, "EXTERNAL", NULL, &output, &outlen, &mechanism) == -4
SASL_NOMECH[-4]: mechanism not supported
output: [0 bytes] : NULL
mechanism: EXTERNAL
%
나는 비록
source을 통해 탐색, 모든 클라이언트가 외부 메커니즘을 지원해야 것 같습니다 :
cyrus-sasl-2.1.22/lib/client.c:
196 int sasl_client_init(const sasl_callback_t *callbacks)
197 {
...
227
228 sasl_client_add_plugin("EXTERNAL", &external_client_plug_init);
229
그래서 내가 여기에 뭔가를 잘못하고 있어요 같은데요. 나는 을 모두 덧붙이려고했는데, sasl_client_*()
으로 생각할 수는 있었지만, 아무도 불리지 않았다. EXTERNAL이 받아 들일 수있는 메커니즘이라고 주장하는 몇 가지 주장이 있습니까? 또는 SASL_NOMECH가 항상 EXTERNAL에 대해 반환됩니다. - b/c가 옳지 않은 것처럼 보입니다.
아무도 도와 줄 수 있습니까?