X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=rpa.c;h=3f236ce945c40f56154aa9e75fc033b62e2519ef;hb=87bcf29364c4640edb87cc2186b965d1a564d70c;hp=faa771bd529e5f817c628bef504912ca35d35ec0;hpb=ed588a2f2f6f387be5645ed38b8077e9f01a1291;p=~andy%2Ffetchmail diff --git a/rpa.c b/rpa.c index faa771bd..3f236ce9 100644 --- a/rpa.c +++ b/rpa.c @@ -9,19 +9,24 @@ The sole entry point is POP3_auth_rpa() + For license terms, see the file COPYING in this directory. + ***********************************************************************/ #include "config.h" #if defined(POP3_ENABLE) && defined(RPA_ENABLE) #include +#include #include #include -#include +#include +#include #include "socket.h" #include "fetchmail.h" -#include "md5.h" +#include "fm_md5.h" +#include "gettext.h" #ifdef TESTMODE extern unsigned char line1[]; @@ -31,23 +36,21 @@ extern unsigned char line3[]; extern int linecount; #endif -#ifndef NO_PROTO - /* prototypes for internal functions */ - static int POP3_rpa_resp(unsigned char* argbuf, int socket ); - static void LenAppend(unsigned char** pptr, int len); - static int LenSkip(unsigned char** pptr, int rxlen); - static int DecBase64(unsigned char* bufp); - static void EncBase64(unsigned char* bufp, int len); - static void ToUnicode(unsigned char** pptr, unsigned char delim, - unsigned char* buf, int* plen, int conv); - static int SetRealmService(unsigned char* bufp); - static void GenChallenge(unsigned char* buf, int len); - static int DigestPassphrase(unsigned char* passphrase, +/* prototypes for internal functions */ +static int POP3_rpa_resp(char* argbuf, int socket ); +static void LenAppend(char** pptr, int len); +static int LenSkip(char** pptr, int rxlen); +static int DecBase64(char* bufp); +static void EncBase64(char* bufp, int len); +static void ToUnicode(char** pptr, char delim, unsigned char* buf, int* plen, + int conv); +static int SetRealmService(char* bufp); +static void GenChallenge(unsigned char* buf, int len); +static int DigestPassphrase(char* passphrase, unsigned char* rbuf, int unicodeit); - static void CompUserResp(); - static int CheckUserAuth(); - static void md5(unsigned char* in, int len, unsigned char* out); -#endif +static void CompUserResp(void); +static int CheckUserAuth(void); +static void md5(const void* in, int len, unsigned char* out); /* RPA protocol definitions */ @@ -104,23 +107,23 @@ unsigned char Kus[Kusl]; /* Session key */ globals: read outlevel. *********************************************************************/ -int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) +int POP3_auth_rpa (char *userid, char *passphrase, int socket) { int ok,rxlen,verh,verl,i,rll; - unsigned char buf [POPBUFSIZE]; - unsigned char *bufp; + char buf [POPBUFSIZE]; + char *bufp; int status,aulin,kuslin; - char* stdec[4] = { "Success" , - "Restricted user (something wrong with account)" , - "Invalid userid or passphrase" , - "Deity error" }; + const char* stdec[4] = { N_("Success") , + N_("Restricted user (something wrong with account)") , + N_("Invalid userid or passphrase") , + N_("Deity error") }; /* Initiate RPA authorisation */ SockPrintf(socket,"AUTH RPA\r\n"); - if (outlevel == O_VERBOSE) - fprintf(stderr,"> AUTH RPA\n"); + if (outlevel >= O_MONITOR) + report(stdout, "> AUTH RPA\n"); /* Create unicode user name in Nu. */ /* Create MD5 digest of user's passphrase in Pu */ @@ -133,8 +136,8 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) if ((ok = POP3_rpa_resp(buf,socket)) != 0) { - if (outlevel > O_SILENT && outlevel < O_VERBOSE) - fprintf(stderr,"%s\n",buf); + if (outlevel > O_SILENT && outlevel < O_MONITOR) + report(stdout, "%s\n",buf); return(ok); } @@ -155,18 +158,18 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) #ifndef TESTMODE SockPrintf(socket,"%s\r\n",buf); #endif - if (outlevel == O_VERBOSE) - fprintf(stderr,"> %s\n",buf); + if (outlevel >= O_MONITOR) + report(stdout, "> %s\n",buf); if ((ok = POP3_rpa_resp(buf,socket)) != 0) { - if (outlevel > O_SILENT && outlevel < O_VERBOSE) - fprintf(stderr,"%s\n",buf); + if (outlevel > O_SILENT && outlevel < O_MONITOR) + report(stdout, "%s\n",buf); return(ok); } if ((rxlen = DecBase64(buf)) == 0) { if (outlevel > O_SILENT) - fprintf(stderr,"RPA token 2: Base64 decode error\n"); + report(stderr, GT_("RPA token 2: Base64 decode error\n")); return(PS_RPA); } bufp = buf; @@ -175,36 +178,37 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) /* Interpret Token 2 */ - verh = *(bufp++); verl = *(bufp++); - if (outlevel == O_VERBOSE) - fprintf(stderr,"Service chose RPA version %d.%d\n",verh,verl); - Csl = *(bufp++); + verh = (unsigned char)*(bufp++); verl = (unsigned char)*(bufp++); + if (outlevel >= O_DEBUG) + report(stdout, GT_("Service chose RPA version %d.%d\n"),verh,verl); + Csl = (unsigned char)*(bufp++); memcpy(Cs, bufp, Csl); bufp += Csl; - if (outlevel == O_VERBOSE) + if (outlevel >= O_DEBUG) { - fprintf(stderr,"Service challenge (l=%d):",Csl); - for (i=0; i= O_DEBUG) + report(stdout, GT_("Service timestamp %s\n"),Ts); + rll = (unsigned char)*(bufp++) << 8; rll = rll | (unsigned char)*(bufp++); if ((bufp-buf+rll) != rxlen) { if (outlevel > O_SILENT) - fprintf(stderr,"RPA token 2 length error\n"); + report(stderr, GT_("RPA token 2 length error\n")); return(PS_RPA); } - if (outlevel == O_VERBOSE) - fprintf(stderr,"Realm list: %s\n",bufp); + if (outlevel >= O_DEBUG) + report(stdout, GT_("Realm list: %s\n"),bufp); if (SetRealmService(bufp) != 0) { if (outlevel > O_SILENT) - fprintf(stderr,"RPA error in service@realm string\n"); + report(stderr, GT_("RPA error in service@realm string\n")); return(PS_RPA); } @@ -214,126 +218,131 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) *(bufp++) = HDR; LenAppend(&bufp, 11+2+strlen(userid)+1+Cul+1+Rul ); memcpy(bufp, MECH, 11); bufp += 11; - *(bufp++) = 0; - *(bufp++) = strlen(userid); - memcpy(bufp,userid,strlen(userid)); bufp += strlen(userid); - GenChallenge(Cu,Cul); - *(bufp++) = Cul; - memcpy(bufp, Cu, Cul); bufp += Cul; - CompUserResp(); - *(bufp++) = Rul; - memcpy(bufp, Ru, Rul); bufp += Rul; - - /* Send Token 3, receive Token 4 */ - - EncBase64(buf,bufp-buf); + *(bufp++) = 0; + *(bufp++) = strlen(userid); + memcpy(bufp,userid,strlen(userid)); bufp += strlen(userid); + GenChallenge(Cu,Cul); + *(bufp++) = Cul; + memcpy(bufp, Cu, Cul); bufp += Cul; + CompUserResp(); + *(bufp++) = Rul; + memcpy(bufp, Ru, Rul); bufp += Rul; + + /* Send Token 3, receive Token 4 */ + + EncBase64(buf,bufp-buf); #ifndef TESTMODE - SockPrintf(socket,"%s\r\n",buf); + SockPrintf(socket,"%s\r\n",buf); #endif - if (outlevel == O_VERBOSE) - fprintf(stderr,"> %s\n",buf); - if ((ok = POP3_rpa_resp(buf,socket)) != 0) + if (outlevel >= O_MONITOR) + report(stdout, "> %s\n",buf); + if ((ok = POP3_rpa_resp(buf,socket)) != 0) { - if (outlevel > O_SILENT && outlevel < O_VERBOSE) - fprintf(stderr,"%s\n",buf); - return(ok); + if (outlevel > O_SILENT && outlevel < O_MONITOR) + report(stdout, "%s\n",buf); + return(ok); } - if ((rxlen = DecBase64(buf)) == 0) + if ((rxlen = DecBase64(buf)) == 0) { - if (outlevel > O_SILENT) - fprintf(stderr,"RPA token 4: Base64 decode error\n"); - return(PS_RPA); + if (outlevel > O_SILENT) + report(stderr, GT_("RPA token 4: Base64 decode error\n")); + return(PS_RPA); } - bufp = buf; - if (LenSkip(&bufp,rxlen) == 0) return(PS_RPA); + bufp = buf; + if (LenSkip(&bufp,rxlen) == 0) return(PS_RPA); - /* Interpret Token 4 */ + /* Interpret Token 4 */ - aulin = *(bufp++); - if (outlevel == O_VERBOSE) + aulin = (unsigned char)*(bufp++); + if (outlevel >= O_DEBUG) { - fprintf(stderr,"User authentication (l=%d):",aulin); - for (i=0; i= O_DEBUG) + report(stdout, GT_("RPA status: %02X\n"),status); } - else status = 0; - if ((bufp - buf) != rxlen) + else status = 0; + if ((bufp - buf) != rxlen) { - if (outlevel > O_SILENT) - fprintf(stderr,"RPA token 4 length error\n"); - return(PS_RPA); + if (outlevel > O_SILENT) + report(stderr, GT_("RPA token 4 length error\n")); + return(PS_RPA); } - if (status != 0) + if (status != 0) { - if (outlevel > O_SILENT) - if (status < 4) - fprintf(stderr,"RPA rejects you: %s\n",stdec[status]); - else - fprintf(stderr,"RPA rejects you, reason unknown\n"); - return(PS_AUTHFAIL); + if (outlevel > O_SILENT) { + if (status < 4) { + report(stderr, GT_("RPA rejects you: %s\n"),GT_(stdec[status])); + } else { + report(stderr, GT_("RPA rejects you, reason unknown\n")); + } + } + return(PS_AUTHFAIL); } - if (Aul != aulin) + if (Aul != aulin) { - fprintf(stderr,"RPA User Authentication length error: %d\n",aulin); - return(PS_RPA); + report(stderr, + GT_("RPA User Authentication length error: %d\n"),aulin); + return(PS_RPA); } - if (Kusl != kuslin) + if (Kusl != kuslin) { - fprintf(stderr,"RPA Session key length error: %d\n",kuslin); - return(PS_RPA); + report(stderr, GT_("RPA Session key length error: %d\n"),kuslin); + return(PS_RPA); } - if (CheckUserAuth() != 0) + if (CheckUserAuth() != 0) { - if (outlevel > O_SILENT) - fprintf(stderr,"RPA _service_ auth fail. Spoof server?\n"); - return(PS_AUTHFAIL); + if (outlevel > O_SILENT) + report(stderr, GT_("RPA _service_ auth fail. Spoof server?\n")); + return(PS_AUTHFAIL); } - if (outlevel == O_VERBOSE) + if (outlevel >= O_DEBUG) { - fprintf(stderr,"Session key established:"); - for (i=0; i %s\n",buf); - if ((ok = POP3_rpa_resp(buf,socket)) != 0) - { - if (outlevel > O_SILENT && outlevel < O_VERBOSE) - fprintf(stderr,"%s\n",buf); - return(ok); - } + if (outlevel >= O_MONITOR) + report(stdout, "> %s\n",buf); + if ((ok = POP3_rpa_resp(buf,socket)) != 0) + { + if (outlevel > O_SILENT && outlevel < O_MONITOR) + report(stdout, "%s\n",buf); + return(ok); + } } - if (outlevel > O_SILENT) - fprintf(stderr,"RPA authorisation complete\n"); + if (outlevel > O_SILENT) + report(stdout, GT_("RPA authorisation complete\n")); - return(PS_SUCCESS); + return(PS_SUCCESS); } @@ -350,46 +359,47 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) globals: reads outlevel. *********************************************************************/ -static int POP3_rpa_resp (argbuf,socket) -unsigned char *argbuf; -int socket; +static int POP3_rpa_resp (char *argbuf, int socket) { - int ok; - char buf [POPBUFSIZE]; - char *bufp; - int sockrc; - fprintf(stderr, "Get response\n"); + int ok; + char buf [POPBUFSIZE]; + char *bufp; + int sockrc; + + if (outlevel >= O_DEBUG) + report(stdout, GT_("Get response\n")); #ifndef TESTMODE - sockrc = gen_recv(socket, buf, sizeof(buf)); + sockrc = gen_recv(socket, buf, sizeof(buf)); #else - linecount++; - if (linecount == 1) strcpy(buf,line1); - if (linecount == 2) strcpy(buf,line2); - if (linecount == 3) strcpy(buf,line3); -/* fprintf(stderr,"--> "); fflush(stderr); */ + linecount++; + if (linecount == 1) strcpy(buf,line1); + if (linecount == 2) strcpy(buf,line2); + if (linecount == 3) strcpy(buf,line3); +/* report(stdout, "--> "); fflush(stderr); */ /* scanf("%s",&buf) */ - sockrc = PS_SUCCESS; + sockrc = PS_SUCCESS; #endif - if (sockrc == PS_SUCCESS) { - bufp = buf; - if ((*buf) == '+') - { - bufp++; + if (sockrc == PS_SUCCESS) { + bufp = buf; + if ((*buf) == '+') + { + bufp++; /* if (*bufp == ' ') bufp++; */ - if (argbuf != NULL) - strcpy(argbuf,bufp); - ok=0; - } - else if (strcmp(buf,"-ERR") == 0) - ok = PS_ERROR; - else ok = PS_PROTOCOL; - - } - else - ok = PS_SOCKET; - fprintf(stderr, "Get response return %d [%s]\n", ok, buf); - buf[sockrc] = 0; - return(ok); + if (argbuf != NULL) + strcpy(argbuf,bufp); + ok=0; + } + else if (strcmp(buf,"-ERR") == 0) + ok = PS_ERROR; + else ok = PS_PROTOCOL; + + } + else + ok = PS_SOCKET; + if (outlevel >= O_DEBUG) + report(stdout, GT_("Get response return %d [%s]\n"), ok, buf); + buf[sockrc] = 0; + return(ok); } /********************************************************************* @@ -406,24 +416,24 @@ int socket; globals: none *********************************************************************/ -static void LenAppend(pptr,len) -unsigned char **pptr; -int len; +static void LenAppend(char **pptr_, int len) { - if (len < 0x80) + unsigned char **pptr = (unsigned char **)pptr_; + + if (len < 0x80) { - **pptr = len; (*pptr)++; + **pptr = len; (*pptr)++; } - else if (len < 0x100) + else if (len < 0x100) { - **pptr = 0x81; (*pptr)++; - **pptr = len; (*pptr)++; + **pptr = 0x81; (*pptr)++; + **pptr = len; (*pptr)++; } - else + else { - **pptr = 0x82; (*pptr)++; - **pptr = len >> 8; (*pptr)++; - **pptr = len & 0xFF; (*pptr)++; + **pptr = 0x82; (*pptr)++; + **pptr = len >> 8; (*pptr)++; + **pptr = len & 0xFF; (*pptr)++; } } @@ -440,52 +450,51 @@ int len; globals: reads outlevel. *********************************************************************/ -int LenSkip(pptr,rxlen) -unsigned char **pptr; -int rxlen; +int LenSkip(char **pptr, int rxlen) { - int len; - unsigned char *save; - save = *pptr; - if (**pptr != HDR) + int len; + char *save; + save = *pptr; + if ((unsigned char)**pptr != HDR) { - if (outlevel > O_SILENT) fprintf(stderr,"Hdr not 60\n"); - return(0); + if (outlevel > O_SILENT) + report(stderr, GT_("Hdr not 60\n")); + return(0); } - (*pptr)++; - if (((**pptr) & 0x80) == 0 ) + (*pptr)++; + if (((unsigned char)(**pptr) & 0x80) == 0 ) { - len = **pptr; (*pptr)++; + len = (unsigned char)**pptr; (*pptr)++; } - else if ((**pptr) == 0x81) + else if ((unsigned char)(**pptr) == 0x81) { - len = *(*pptr+1); (*pptr) += 2; + len = (unsigned char)*(*pptr+1); (*pptr) += 2; } - else if ((**pptr) == 0x82) + else if ((unsigned char)(**pptr) == 0x82) { - len = ((*(*pptr+1)) << 8) | *(*pptr+2); - (*pptr) += 3; + len = ((unsigned char)(*(*pptr+1)) << 8) | (unsigned char)*(*pptr+2); + (*pptr) += 3; } - else len = 0; - if (len==0) + else len = 0; + if (len==0) { - if (outlevel>O_SILENT) - fprintf(stderr,"Token length error\n"); + if (outlevel>O_SILENT) + report(stderr, GT_("Token length error\n")); } - else if (((*pptr-save)+len) != rxlen) + else if (((*pptr-save)+len) != rxlen) { - if (outlevel>O_SILENT) - fprintf(stderr,"Token Length %d disagrees with rxlen %d\n",len,rxlen); - len = 0; + if (outlevel>O_SILENT) + report(stderr, GT_("Token Length %d disagrees with rxlen %d\n"),len,rxlen); + len = 0; } - else if (memcmp(*pptr,MECH,11)) + else if (memcmp(*pptr,MECH,11)) { - if (outlevel > O_SILENT) - fprintf(stderr,"Mechanism field incorrect\n"); - len = 0; + if (outlevel > O_SILENT) + report(stderr, GT_("Mechanism field incorrect\n")); + len = 0; } - else (*pptr) += 11; /* Skip mechanism field */ - return(len); + else (*pptr) += 11; /* Skip mechanism field */ + return(len); } /********************************************************************* @@ -501,47 +510,46 @@ int rxlen; globals: reads outlevel. *********************************************************************/ -static int DecBase64(bufp) -unsigned char *bufp; +static int DecBase64(char *bufp) { - unsigned int new, bits=0, cnt=0, i, part=0; - unsigned char ch; - unsigned char* outp=bufp; - unsigned char* inp=bufp; - while((ch=*(inp++)) != 0) - { - if ((ch != '=') && (ch != ' ') && (ch != '\n') && (ch != '\r')) - { - if ((ch>='A') && (ch <= 'Z')) new = ch - 'A'; - else if ((ch>='a') && (ch <= 'z')) new = ch - 'a' + 26; - else if ((ch>='0') && (ch <= '9')) new = ch - '0' + 52; - else if ( ch=='+' ) new = 62; - else if ( ch=='/' ) new = 63; - else { - fprintf(stderr, "dec64 error at char %d: %x\n", inp - bufp, ch); - return(0); - } - part=((part & 0x3F)*64) + new; - bits += 6; - if (bits >= 8) - { - bits -= 8; - *outp = (part >> bits); - cnt++; outp++; - } - } - } - if (outlevel == O_VERBOSE) - { - fprintf(stderr,"Inbound binary data:\n"); - for (i=0; i='A') && (ch <= 'Z')) newx = ch - 'A'; + else if ((ch>='a') && (ch <= 'z')) newx = ch - 'a' + 26; + else if ((ch>='0') && (ch <= '9')) newx = ch - '0' + 52; + else if ( ch=='+' ) newx = 62; + else if ( ch=='/' ) newx = 63; + else { + report(stderr, GT_("dec64 error at char %d: %x\n"), (int)(inp - bufp), ch); + return(0); + } + part=((part & 0x3F)*64) + newx; + bits += 6; + if (bits >= 8) + { + bits -= 8; + *outp = (part >> bits); + cnt++; outp++; + } + } + } + if (outlevel >= O_MONITOR) + { + report(stdout, GT_("Inbound binary data:\n")); + for (i=0; i=0; i-=3) - { - c1 = bufp[i]; - if ((i+1) < len) c2 = bufp[i+1]; else c2=0; - if ((i+2) < len) c3 = bufp[i+2]; else c3=0; - *(outp) = x[c1/4]; - *(outp+1) = x[((c1 & 3)*16) + (c2/16)]; - if ((i+1) < len) *(outp+2) = x[((c2 & 0x0F)*4) + (c3/64)]; - else *(outp+2) = '='; - if ((i+2) < len) *(outp+3) = x[c3 & 0x3F]; - else *(outp+3) = '='; - outp -= 4; + char* outp; + unsigned char c1,c2,c3; + char x[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + int i; + + if (outlevel >= O_MONITOR) + { + report(stdout, GT_("Outbound data:\n")); + for (i=0; i=0; i-=3) + { + c1 = (unsigned char)bufp[i]; + if ((i+1) < len) c2 = (unsigned char)bufp[i+1]; else c2=0; + if ((i+2) < len) c3 = (unsigned char)bufp[i+2]; else c3=0; + *(outp) = x[c1/4]; + *(outp+1) = x[((c1 & 3)*16) + (c2/16)]; + if ((i+1) < len) *(outp+2) = x[((c2 & 0x0F)*4) + (c3/64)]; + else *(outp+2) = '='; + if ((i+2) < len) *(outp+3) = x[c3 & 0x3F]; + else *(outp+3) = '='; + outp -= 4; } } @@ -614,37 +620,38 @@ int len; globals: reads outlevel; *********************************************************************/ -static void ToUnicode(pptr,delim,buf,plen,conv) -unsigned char **pptr; /* input string */ -unsigned char delim; -unsigned char *buf; /* output buffer */ -int *plen; -int conv; +static void ToUnicode(char **pptr /* input string*/, + char delim, unsigned char *buf /* output buffer */, + int *plen, int conv) { - unsigned char *p; - int i; - *plen = 0; p=buf; - while ( ((**pptr)!=delim) && ((**pptr)!=0) && ((*plen) O_SILENT) - fprintf(stderr,"RPA String too long\n"); - *plen = 0; + if (outlevel > O_SILENT) + report(stderr, GT_("RPA String too long\n")); + *plen = 0; } - if (outlevel == O_VERBOSE) + if (outlevel >= O_DEBUG) { - fprintf(stderr,"Unicode:"); - for (i=0; i<(*plen); i++) fprintf(stderr,"%02X ",buf[i]); - fprintf(stderr,"\n"); + report(stdout, GT_("Unicode:\n")); + for (i=0; i<(*plen); i++) + { + report_build(stdout, "%02X ",buf[i]); + if (((i % 16)==15) || (i==((*plen)-1))) + report_complete(stdout, "\n"); + } } } @@ -661,19 +668,18 @@ int conv; writes Ns Nsl Nr Nrl *********************************************************************/ -static int SetRealmService(bufp) -unsigned char* bufp; +static int SetRealmService(char *bufp) { - /* For the moment we pick the first available realm. It would */ - /* make more sense to verify that the realm which the user */ - /* has given (as part of id) is in the list, and select it's */ - /* corresponding service name. */ - ToUnicode(&bufp, '@', Ns, &Nsl, 1); /* Service */ - bufp++; /* Skip the @ */ - ToUnicode(&bufp, ' ', Nr, &Nrl, 1); /* Realm name */ - if ((Nrl == 0) || (Nsl == 0)) - return(PS_RPA); - return(0); + /* For the moment we pick the first available realm. It would */ + /* make more sense to verify that the realm which the user */ + /* has given (as part of id) is in the list, and select it's */ + /* corresponding service name. */ + ToUnicode(&bufp, '@', Ns, &Nsl, 1); /* Service */ + bufp++; /* Skip the @ */ + ToUnicode(&bufp, ' ', Nr, &Nrl, 1); /* Realm name */ + if ((Nrl == 0) || (Nsl == 0)) + return(PS_RPA); + return(0); } /********************************************************************* @@ -690,30 +696,36 @@ unsigned char* bufp; reads /dev/random *********************************************************************/ -static void GenChallenge(buf,len) -unsigned char *buf; -int len; +static void GenChallenge(unsigned char *buf, int len) { - int i; - FILE *devrandom; - devrandom = fopen("/dev/urandom","rb"); - if (devrandom == NULL) + int i; + FILE *devrandom; + + devrandom = fopen("/dev/urandom","rb"); + if (devrandom == NULL && outlevel > O_SILENT) { - if (outlevel > O_SILENT) - fprintf(stderr,"RPA Failed open of /dev/random. This shouldn't\n"); - fprintf(stderr," prevent you logging in, but means you\n"); - fprintf(stderr," cannot be sure you are talking to the\n"); - fprintf(stderr," service that you think you are (replay\n"); - fprintf(stderr," attacks by a dishonest service are possible.)\n"); + report(stdout, GT_("RPA Failed open of /dev/urandom. This shouldn't\n")); + report(stdout, GT_(" prevent you logging in, but means you\n")); + report(stdout, GT_(" cannot be sure you are talking to the\n")); + report(stdout, GT_(" service that you think you are (replay\n")); + report(stdout, GT_(" attacks by a dishonest service are possible.)\n")); } - for (i=0; i= O_DEBUG) { - fprintf(stderr,"User challenge:"); - for (i=0; i= O_DEBUG) + { + report(stdout, GT_("MD5 being applied to data block:\n")); + for (i=0; i= O_DEBUG) + { + report(stdout, GT_("MD5 result is:\n")); + for (i=0; i<16; i++) + { + report_build(stdout, "%02X ",out[i]); + } + report_complete(stdout, "\n"); } } #endif /* POP3_ENABLE && RPA_ENABLE */