1 2 /* 3 ** Copyright 2000 Double Precision, Inc. See COPYING for 4 ** distribution information. 5 */ 6 7 #include "courier_auth_config.h" 8 #include "courierauthsasl.h" 9 #include "authsaslclient.h" 10 #include <stdlib.h> 11 #include <stdio.h> 12 #include <ctype.h> 13 #include <string.h> 14 #include <errno.h> 15 authsaslclient_login(const struct authsaslclientinfo * info)16int authsaslclient_login(const struct authsaslclientinfo *info) 17 { 18 const char *p; 19 char *q; 20 int i; 21 22 p=(*info->start_conv_func)("LOGIN", NULL, info->conv_func_arg); 23 if (!p) return (AUTHSASL_CANCELLED); 24 25 q=authsasl_tobase64( info->userid ? info->userid:"", -1); 26 27 if (!q) 28 { 29 perror("malloc"); 30 return (AUTHSASL_ERROR); 31 } 32 p=(*info->conv_func)(q, info->conv_func_arg); 33 free(q); 34 if (!p) return (AUTHSASL_CANCELLED); 35 36 q=authsasl_tobase64( info->password ? info->password:"", -1); 37 38 if (!q) 39 { 40 perror("malloc"); 41 return (AUTHSASL_ERROR); 42 } 43 i=(*info->final_conv_func)(q, info->conv_func_arg); 44 free(q); 45 return (i); 46 } 47