Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 160873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:06:44+00:00 2026-05-11T11:06:44+00:00

Does the Cyrus SASL api not support the EXTERNAL mechanism? I’m trying to use

  • 0

Does the Cyrus SASL api not support the EXTERNAL mechanism? I’m trying to use it as a client, but it returns SASL_NOMECH when asked.

% 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 % 

I browsed through the source though, and it looks like all the clients should support the EXTERNAL mechanism:

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 

So I’m guessing I’m doing something wrong here. I tried adding all the sasl_callback_ts I could think of to sasl_client_*(), but none of them even got called. Is there some argument I should pass that asserts that EXTERNAL is an acceptable mechanism? Or is SASL_NOMECH always returned for EXTERNAL – b/c that doesn’t seem right.

Can anyone help me out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:06:45+00:00Added an answer on May 11, 2026 at 11:06 am

    Ok, I found the left out step.

    According to sasl/sasl.h, I needed to set the SASL_AUTH_EXTERNAL property for my sasl_conn_t first:

    /* set property in SASL connection state  * returns:  *  SASL_OK       -- value set  *  SASL_BADPARAM -- invalid property or value  */ LIBSASL_API int sasl_setprop(sasl_conn_t *conn,                  int propnum,                  const void *value); #define SASL_SSF_EXTERNAL  100  /* external SSF active (sasl_ssf_t *) */ #define SASL_SEC_PROPS     101  /* sasl_security_properties_t */ #define SASL_AUTH_EXTERNAL 102  /* external authentication ID (const char *) */  /* If the SASL_AUTH_EXTERNAL value is non-NULL, then a special version of the  * EXTERNAL mechanism is enabled (one for server-embedded EXTERNAL mechanisms).  * Otherwise, the EXTERNAL mechanism will be absent unless a plug-in  * including EXTERNAL is present.  */ 

    Once I did that, the rest worked out:

    % cat 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 */  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_errstring(__result,NULL,NULL));\         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_setprop( conn, SASL_AUTH_EXTERNAL, 'fake authority' ) );     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 % ./cyrus_sasl_ex sasl_client_init( NULL ) == 0         successful result sasl_client_new( 'fake', 'fakey.mcfaker.ton', '127.0.0.1', '127.255.255.1', NULL, 0, &conn) == 0         successful result sasl_setprop( conn, SASL_AUTH_EXTERNAL, 'fake authority' ) == 0         successful result sasl_client_start( conn, 'EXTERNAL', NULL, &output, &outlen, &mechanism) == 0         successful result output: [0 bytes] : mechanism: EXTERNAL 

    However, since the version of Cyrus SASL that comes pre-installed on OS X 10.5 has a bug in it that makes the external plugin require a SASL_CB_USER callback and passes it a NULL pointer to store its return value in, this still means I’ll have to update Cyrus SASL on all those machines.

    Or maybe I’ll just code around the bug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of a mechanism in Sybase ASA 9 / Sybase SQL Anywhere
Does anyone know of a Mootools script that provides nested sortable but also works
Does jQuery 1.5.1 support attribute selectors in the closest method? Given the structure below,
Does jq.carousel support dynamically added images? I have 'some' button, o I have a
Does the Date object in Javascript ever use a non-Gregorian calendar? The MDN and
does anyone know if iOS Simulator (that goes with XCode) support any kind of
Does OpenJPA have any support for batch insert similar to Hibernate ? I haven't
Does SQL Server 2008 support the CREATE ASSERTION syntax? I haven't been able to
Does anyone out there know if it is possible to use sharding with a
Does the Windows API provide a way to notify a running Delphi application in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.