imclient_authenticate wrong prompt order.

jesper at schmitz.computer jesper at schmitz.computer
Sat Sep 24 11:28:32 EDT 2016


Hello list.

This is a question about using libcyrus, hope this is the place for such 
questions?

The following sample prompts for entering the password after ones actually 
did
enter the password. 1) Why is that e.g why does this sample write "please 
enter your password: " after the password is entered, and then exits?
The authentication works. Only the prompting is a problem.

I've tried with adding different sasl_callback_t callbacks to 
imclient_connects but cannot get it to work as I expect it to.

My goal is to authenticate fully programmatically. 2) 
How to supply username and password without user inetercaction?

#include <cstring>
#include <sasl/sasl.h>
#include <sasl/saslutil.h>
extern "C" {
#include <cyrus/xmalloc.h>
}

extern "C" {
#include <cyrus/imclient.h>
}
#include <cstdio>
      
 
struct imclient *imclient;

char server[] = "192.168.1.1" ;
char port[] = "imap";
char mech[] ="CRAM-MD5";
char service[] = "imap";
void fatal(const char* message, int rc) {
    fprintf(stderr, "fatal error: %s\n", message);
    exit(rc);
}
int main() {
     if(imclient_connect(&imclient, server, port,NULL)) {
     fprintf(stderr,
     "error: Couldn't connect to %s %s\n",
      server, port);
     }

imclient_authenticate(imclient, mech,service,NULL, 0,256);
}

c++ testcyrus.cpp -I /usr/local/include/ -L /usr/local/lib -lcyrus_min 
-lcyrus -o testcyrus
 c++ --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
uname -a
FreeBSD freebsd2.openbsd.lan 10.3-RELEASE FreeBSD 10.3-RELEASE 
cyrus-imapd25-2.5.8 


More information about the Info-cyrus mailing list