projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move intl.h into lib-lib/macros.h
[apps/madmutt.git]
/
mutt_sasl.c
diff --git
a/mutt_sasl.c
b/mutt_sasl.c
index
6b6f0ea
..
5bc1b70
100644
(file)
--- a/
mutt_sasl.c
+++ b/
mutt_sasl.c
@@
-13,12
+13,13
@@
# include "config.h"
#endif
# include "config.h"
#endif
+#include <lib-lib/mem.h>
+
#include "mutt.h"
#include "account.h"
#include "mutt_sasl.h"
#include "mutt_socket.h"
#include "mutt.h"
#include "account.h"
#include "mutt_sasl.h"
#include "mutt_socket.h"
-#include "lib/mem.h"
#include "lib/debug.h"
#include <errno.h>
#include "lib/debug.h"
#include <errno.h>
@@
-331,9
+332,7
@@
int mutt_sasl_interact (sasl_interact_t * interaction)
return SASL_FAIL;
interaction->len = str_len (resp) + 1;
return SASL_FAIL;
interaction->len = str_len (resp) + 1;
- interaction->result = mem_malloc (interaction->len);
- memcpy ((char*) interaction->result, resp, interaction->len);
-
+ interaction->result = p_dupstr(resp, interaction->len - 1);
interaction++;
}
interaction++;
}
@@
-358,7
+357,7
@@
int mutt_sasl_interact (sasl_interact_t * interaction)
* for the read/write methods. */
void mutt_sasl_setup_conn (CONNECTION * conn, sasl_conn_t * saslconn)
{
* for the read/write methods. */
void mutt_sasl_setup_conn (CONNECTION * conn, sasl_conn_t * saslconn)
{
- SASL_DATA *sasldata =
(SASL_DATA *) mem_malloc (sizeof (SASL_DATA)
);
+ SASL_DATA *sasldata =
p_new(SASL_DATA, 1
);
sasldata->saslconn = saslconn;
/* get ssf so we know whether we have to (en|de)code read/write */
sasldata->saslconn = saslconn;
/* get ssf so we know whether we have to (en|de)code read/write */
@@
-452,7
+451,7
@@
static int mutt_sasl_cb_pass (sasl_conn_t * conn, void *context, int id,
len = str_len (account->pass);
len = str_len (account->pass);
- *psecret =
(sasl_secret_t *) mem_malloc (sizeof
(sasl_secret_t) + len);
+ *psecret =
xmalloc(sizeof
(sasl_secret_t) + len);
(*psecret)->len = len;
strcpy ((char*) (*psecret)->data, account->pass); /* __STRCPY_CHECKED__ */
(*psecret)->len = len;
strcpy ((char*) (*psecret)->data, account->pass); /* __STRCPY_CHECKED__ */
@@
-494,8
+493,8
@@
static int mutt_sasl_conn_close (CONNECTION * conn)
/* release sasl resources */
sasl_dispose (&sasldata->saslconn);
/* release sasl resources */
sasl_dispose (&sasldata->saslconn);
-
mem_free
(&sasldata->buf);
-
mem_free
(&sasldata);
+
p_delete
(&sasldata->buf);
+
p_delete
(&sasldata);
/* call underlying close */
rc = (conn->conn_close) (conn);
/* call underlying close */
rc = (conn->conn_close) (conn);
@@
-525,7
+524,7
@@
static int mutt_sasl_conn_read (CONNECTION * conn, char *buf, size_t len)
conn->sockdata = sasldata->sockdata;
conn->sockdata = sasldata->sockdata;
-
mem_free
(&sasldata->buf);
+
p_delete
(&sasldata->buf);
sasldata->bpos = 0;
sasldata->blen = 0;
sasldata->bpos = 0;
sasldata->blen = 0;
@@
-590,7
+589,7
@@
static int mutt_sasl_conn_write (CONNECTION * conn, const char *buf,
}
rc = (sasldata->msasl_write) (conn, pbuf, plen);
}
rc = (sasldata->msasl_write) (conn, pbuf, plen);
-
mem_free
(&pbuf);
+
p_delete
(&pbuf);
if (rc != plen)
goto fail;
if (rc != plen)
goto fail;