IMAP auth function fixed;
This commit is contained in:
		
							parent
							
								
									1b399ffdbb
								
							
						
					
					
						commit
						0311922818
					
				@ -57,16 +57,16 @@ int imap_auth(struct tlsport *p, struct ejabber_msg *m)
 | 
			
		||||
      len = tls_io(p, buf, IMAPLINE_LENGTH - sizeof(char), TLSIO_READ);
 | 
			
		||||
    } while(len == IMAPLINE_LENGTH - sizeof(char));
 | 
			
		||||
    memset(buf, '\0', IMAPLINE_LENGTH);
 | 
			
		||||
  } else memset(buf, '\0', len = sizeof(char));
 | 
			
		||||
  } else memset(buf, '\0', len + sizeof(char));
 | 
			
		||||
 | 
			
		||||
  /* try to login with provided credentials */
 | 
			
		||||
  mlen = strlen(m->user) + strlen(m->domain) + strlen(m->password);
 | 
			
		||||
  mlen += 14; /* "a login 11 22" */
 | 
			
		||||
  mlen += 16; /* "a login 11 22" */
 | 
			
		||||
  if(mlen > IMAPLINE_LENGTH - sizeof(char)) return -1; /* too long */
 | 
			
		||||
  /* create a message */
 | 
			
		||||
  snprintf(buf, mlen, "a login \"%s@%s\" \"%s\"", m->user, m->domain,
 | 
			
		||||
  snprintf(buf, mlen, "a login \"%s@%s\" \"%s\"\n", m->user, m->domain,
 | 
			
		||||
           m->password);
 | 
			
		||||
  len = tls_io(p, buf, mlen, TLSIO_WRITE);
 | 
			
		||||
  len = tls_io(p, buf, mlen - sizeof(char), TLSIO_WRITE);
 | 
			
		||||
  if(len < 0) return -1;
 | 
			
		||||
  else memset(buf, '\0', mlen);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user