--- vchkpw.c.orig Fri Mar 28 11:09:51 2003 +++ vchkpw.c Tue Jun 17 19:25:44 2003 @@ -103,45 +103,62 @@ { char *tmpstr; + char *smtpstr; + int smtpPort; + char *pop3str; + int pop3Port; + char *imapstr; + int imapPort; + char *smtpsstr; + int smtpsPort; + char *imapsstr; + int imapsPort; + char *pop3sstr; + int pop3sPort; + if ( (IpAddr = getenv("TCPREMOTEIP")) == NULL) IpAddr=""; if ( (tmpstr = getenv("TCPLOCALPORT")) == NULL) LocalPort = 110; else LocalPort = atoi(tmpstr); + if ( (smtpstr = getenv("SMTPPORT")) == NULL) smtpPort = 25; + else smtpPort = atoi(smtpstr); + if ( (pop3str = getenv("POP3PORT")) == NULL) pop3Port = 110; + else pop3Port = atoi(pop3str); + if ( (imapstr = getenv("IMAPPORT")) == NULL) imapPort = 143; + else imapPort = atoi(imapstr); + if ( (smtpsstr = getenv("SMTPSPORT")) == NULL) smtpsPort = 465; + else smtpsPort = atoi(smtpsstr); + if ( (imapsstr = getenv("IMAPSPORT")) == NULL) imapsPort = 993; + else imapsPort = atoi(imapsstr); + if ( (pop3sstr = getenv("POP3SPORT")) == NULL) pop3sPort = 995; + else pop3sPort = atoi(pop3sstr); + /* Check which port they are coming in on and * setup the log name and connection type */ - switch(LocalPort) { - case 25: + if( LocalPort == 25 || LocalPort == smtpPort ) { strcpy(VchkpwLogName, "vchkpw-smtp"); ConnType = SMTP_CONN; - break; - case 110: + } else if( LocalPort == 110 || LocalPort == pop3Port ) { strcpy(VchkpwLogName, "vchkpw-pop3"); ConnType = POP_CONN; - break; - case 143: + } else if( LocalPort == 143 || LocalPort == imapPort ) { strcpy(VchkpwLogName, "vchkpw-imap"); ConnType = IMAP_CONN; - break; - case 465: + } else if( LocalPort == 465 || LocalPort == smtpsPort ) { strcpy(VchkpwLogName, "vchkpw-smtps"); ConnType = SMTP_CONN; - break; - case 993: + } else if( LocalPort == 993 || LocalPort == imapsPort ) { strcpy(VchkpwLogName, "vchkpw-imaps"); ConnType = IMAP_CONN; - break; - case 995: + } else if( LocalPort == 995 || LocalPort == pop3sPort ) { strcpy(VchkpwLogName, "vchkpw-pop3s"); ConnType = POP_CONN; - break; - default: + } else { strcpy(VchkpwLogName, "vchkpw-pop3"); ConnType = POP_CONN; - break; } - /* read in the user name and password from file descriptor 3 */ read_user_pass(); @@ -390,7 +407,7 @@ #ifdef CLEAR_PASS /* Check CRAM-MD5 auth */ if(ConnType == SMTP_CONN) { - printf("vchkpw: smtp auth\n"); + /* printf("vchkpw: smtp auth\n"); */ cramaccepted = authcram(ThePass,TheResponse,vpw->pw_clear_passwd); if(cramaccepted == 0) strcpy(AuthType, "CRAM-MD5"); } @@ -651,7 +668,6 @@ h=digest[j] & 0x0f; digascii[(2*j)+1]=hextab[h]; } - printf("digascii: %s, response: %s", digascii, response); return(strcmp(digascii,response)); }