summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiscomfitor <michael.blumenkrantz@gmail.com>2013-03-22 18:29:45 +0000
committerdiscomfitor <michael.blumenkrantz@gmail.com>2013-03-22 18:30:38 +0000
commitcfbe460e1196bc691ecf4f225de2afe7485922ab (patch)
treea7e7528ebdc33255c4d0587da1b84196c24e03da
parente32f0e563c4ed59125490c7f9e3613f97c1cf45d (diff)
clean up all email warnings
-rw-r--r--src/include/email/email_private.h5
-rw-r--r--src/lib/email/email_utils.c4
-rw-r--r--src/lib/email/pop_handlers.c14
-rw-r--r--src/lib/email/pop_list.c10
-rw-r--r--src/lib/email/smtp_handlers.c18
-rw-r--r--src/lib/email/smtp_login.c18
6 files changed, 35 insertions, 34 deletions
diff --git a/src/include/email/email_private.h b/src/include/email/email_private.h
index de6505a..507f002 100644
--- a/src/include/email/email_private.h
+++ b/src/include/email/email_private.h
@@ -59,7 +59,8 @@ typedef enum
59 59
60typedef enum 60typedef enum
61{ 61{
62 EMAIL_SMTP_STATE_FROM = 1, 62 EMAIL_SMTP_STATE_NONE,
63 EMAIL_SMTP_STATE_FROM,
63 EMAIL_SMTP_STATE_TO, 64 EMAIL_SMTP_STATE_TO,
64 EMAIL_SMTP_STATE_DATA, 65 EMAIL_SMTP_STATE_DATA,
65 EMAIL_SMTP_STATE_BODY, 66 EMAIL_SMTP_STATE_BODY,
@@ -189,7 +190,7 @@ void email_login_smtp(Email *e, Ecore_Con_Event_Server_Data *ev);
189 190
190void email_fake_free(void *d, void *e); 191void email_fake_free(void *d, void *e);
191char *email_base64_encode(const char *string, double len, int *); 192char *email_base64_encode(const char *string, double len, int *);
192char *email_base64_decode(const char *string, int len, int *); 193unsigned char *email_base64_decode(const char *string, int len, int *);
193void email_md5_digest_to_str(unsigned char *digest, char *ret); 194void email_md5_digest_to_str(unsigned char *digest, char *ret);
194void email_md5_hmac_encode(unsigned char *digest, const char *string, size_t size, const char *key, size_t ksize); 195void email_md5_hmac_encode(unsigned char *digest, const char *string, size_t size, const char *key, size_t ksize);
195#endif 196#endif
diff --git a/src/lib/email/email_utils.c b/src/lib/email/email_utils.c
index 4f7d69a..5864590 100644
--- a/src/lib/email/email_utils.c
+++ b/src/lib/email/email_utils.c
@@ -26,11 +26,11 @@ email_base64_encode(const char *string, double len, int *retlen)
26 return ret; 26 return ret;
27} 27}
28 28
29char * 29unsigned char *
30email_base64_decode(const char *string, int len, int *retlen) 30email_base64_decode(const char *string, int len, int *retlen)
31{ 31{
32 base64_decodestate s; 32 base64_decodestate s;
33 char *ret = NULL; 33 unsigned char *ret = NULL;
34 34
35 if ((len < 1) || (!string)) return NULL; 35 if ((len < 1) || (!string)) return NULL;
36 36
diff --git a/src/lib/email/pop_handlers.c b/src/lib/email/pop_handlers.c
index fa50983..d11d2f5 100644
--- a/src/lib/email/pop_handlers.c
+++ b/src/lib/email/pop_handlers.c
@@ -29,12 +29,12 @@ next_pop(Email *e)
29 email_write(e, EMAIL_POP3_RSET, sizeof(EMAIL_POP3_RSET) - 1); 29 email_write(e, EMAIL_POP3_RSET, sizeof(EMAIL_POP3_RSET) - 1);
30 break; 30 break;
31 case EMAIL_OP_DELE: 31 case EMAIL_OP_DELE:
32 snprintf(buf, sizeof(buf), EMAIL_POP3_DELE, (uintptr_t)e->op_ids->data); 32 snprintf(buf, sizeof(buf), EMAIL_POP3_DELE, (unsigned int)(uintptr_t)e->op_ids->data);
33 e->op_ids = eina_list_remove_list(e->op_ids, e->op_ids); 33 e->op_ids = eina_list_remove_list(e->op_ids, e->op_ids);
34 email_write(e, buf, strlen(buf)); 34 email_write(e, buf, strlen(buf));
35 break; 35 break;
36 case EMAIL_OP_RETR: 36 case EMAIL_OP_RETR:
37 snprintf(buf, sizeof(buf), EMAIL_POP3_RETR, (uintptr_t)e->op_ids->data); 37 snprintf(buf, sizeof(buf), EMAIL_POP3_RETR, (unsigned int)(uintptr_t)e->op_ids->data);
38 e->op_ids = eina_list_remove_list(e->op_ids, e->op_ids); 38 e->op_ids = eina_list_remove_list(e->op_ids, e->op_ids);
39 email_write(e, buf, strlen(buf)); 39 email_write(e, buf, strlen(buf));
40 break; 40 break;
@@ -59,7 +59,7 @@ upgrade_pop(Email *e, int type EINA_UNUSED, Ecore_Con_Event_Server_Upgrade *ev)
59Eina_Bool 59Eina_Bool
60data_pop(Email *e, int type EINA_UNUSED, Ecore_Con_Event_Server_Data *ev) 60data_pop(Email *e, int type EINA_UNUSED, Ecore_Con_Event_Server_Data *ev)
61{ 61{
62 char *recv; 62 char *recvbuf;
63 63
64 if (e != ecore_con_server_data_get(ev->server)) 64 if (e != ecore_con_server_data_get(ev->server))
65 { 65 {
@@ -69,10 +69,10 @@ data_pop(Email *e, int type EINA_UNUSED, Ecore_Con_Event_Server_Data *ev)
69 69
70 if (eina_log_domain_level_check(email_log_dom, EINA_LOG_LEVEL_DBG)) 70 if (eina_log_domain_level_check(email_log_dom, EINA_LOG_LEVEL_DBG))
71 { 71 {
72 recv = alloca(ev->size + 1); 72 recvbuf = alloca(ev->size + 1);
73 memcpy(recv, ev->data, ev->size); 73 memcpy(recvbuf, ev->data, ev->size);
74 recv[ev->size] = 0; 74 recvbuf[ev->size] = 0;
75 DBG("Receiving %i bytes:\n%s", ev->size, recv); 75 DBG("Receiving %i bytes:\n%s", ev->size, recvbuf);
76 } 76 }
77 77
78 if (e->state < EMAIL_STATE_CONNECTED) 78 if (e->state < EMAIL_STATE_CONNECTED)
diff --git a/src/lib/email/pop_list.c b/src/lib/email/pop_list.c
index 7329868..5ee42d5 100644
--- a/src/lib/email/pop_list.c
+++ b/src/lib/email/pop_list.c
@@ -65,7 +65,7 @@ email_delete(Email *e, unsigned int id, Email_Cb cb)
65 } 65 }
66 else 66 else
67 { 67 {
68 e->op_ids = eina_list_append(e->op_ids, (uintptr_t*)id); 68 e->op_ids = eina_list_append(e->op_ids, (uintptr_t*)(unsigned long)id);
69 e->ops = eina_list_append(e->ops, (uintptr_t*)EMAIL_OP_DELE); 69 e->ops = eina_list_append(e->ops, (uintptr_t*)EMAIL_OP_DELE);
70 } 70 }
71 return EINA_TRUE; 71 return EINA_TRUE;
@@ -87,22 +87,22 @@ email_retrieve(Email *e, unsigned int id, Email_Retr_Cb cb)
87 } 87 }
88 else 88 else
89 { 89 {
90 e->op_ids = eina_list_append(e->op_ids, (uintptr_t*)id); 90 e->op_ids = eina_list_append(e->op_ids, (uintptr_t*)(unsigned long)id);
91 e->ops = eina_list_append(e->ops, (uintptr_t*)EMAIL_OP_RETR); 91 e->ops = eina_list_append(e->ops, (uintptr_t*)EMAIL_OP_RETR);
92 } 92 }
93 return EINA_TRUE; 93 return EINA_TRUE;
94} 94}
95 95
96Eina_Bool 96Eina_Bool
97email_pop3_stat_read(Email *e, const unsigned char *recv, size_t size) 97email_pop3_stat_read(Email *e, const unsigned char *recvbuf, size_t size)
98{ 98{
99 Email_Stat_Cb cb; 99 Email_Stat_Cb cb;
100 int num; 100 int num;
101 size_t len; 101 size_t len;
102 102
103 cb = eina_list_data_get(e->cbs); 103 cb = eina_list_data_get(e->cbs);
104 if ((!email_op_ok((const unsigned char *)recv, size)) || 104 if ((!email_op_ok((const unsigned char *)recvbuf, size)) ||
105 (sscanf((char*)recv, "+OK %u %zu", &num, &len) != 2)) 105 (sscanf((char*)recvbuf, "+OK %u %zu", &num, &len) != 2))
106 { 106 {
107 ERR("Error with STAT"); 107 ERR("Error with STAT");
108 if (cb) cb(e, 0, 0); 108 if (cb) cb(e, 0, 0);
diff --git a/src/lib/email/smtp_handlers.c b/src/lib/email/smtp_handlers.c
index 944de3f..a3133b8 100644
--- a/src/lib/email/smtp_handlers.c
+++ b/src/lib/email/smtp_handlers.c
@@ -49,14 +49,14 @@ send_smtp(Email *e)
49 msg = e->op_ids->data; 49 msg = e->op_ids->data;
50 switch (e->smtp_state) 50 switch (e->smtp_state)
51 { 51 {
52 case 0: 52 case EMAIL_SMTP_STATE_NONE:
53 e->smtp_state++; 53 e->smtp_state++;
54 case EMAIL_SMTP_STATE_FROM: 54 case EMAIL_SMTP_STATE_FROM:
55 if ((!msg->from) && (!msg->sender)) 55 if ((!msg->from) && (!msg->sender))
56 { 56 {
57 char buf[1024]; 57 char buf2[1024];
58 snprintf(buf, sizeof(buf), "%s@%s", e->username, e->features.smtp_features.domain); 58 snprintf(buf2, sizeof(buf2), "%s@%s", e->username, e->features.smtp_features.domain);
59 msg->sender = email_contact_new(buf); 59 msg->sender = email_contact_new(buf2);
60 } 60 }
61 ec = msg->sender; 61 ec = msg->sender;
62 size = sizeof(char) * (sizeof(EMAIL_SMTP_FROM) + strlen(ec->address)) - 2; 62 size = sizeof(char) * (sizeof(EMAIL_SMTP_FROM) + strlen(ec->address)) - 2;
@@ -118,7 +118,7 @@ upgrade_smtp(Email *e, int type EINA_UNUSED, Ecore_Con_Event_Server_Upgrade *ev)
118Eina_Bool 118Eina_Bool
119data_smtp(Email *e, int type EINA_UNUSED, Ecore_Con_Event_Server_Data *ev) 119data_smtp(Email *e, int type EINA_UNUSED, Ecore_Con_Event_Server_Data *ev)
120{ 120{
121 char *recv; 121 char *recvbuf;
122 Email_Send_Cb cb; 122 Email_Send_Cb cb;
123 Email_Cb qcb; 123 Email_Cb qcb;
124 124
@@ -130,10 +130,10 @@ data_smtp(Email *e, int type EINA_UNUSED, Ecore_Con_Event_Server_Data *ev)
130 130
131 if (eina_log_domain_level_check(email_log_dom, EINA_LOG_LEVEL_DBG)) 131 if (eina_log_domain_level_check(email_log_dom, EINA_LOG_LEVEL_DBG))
132 { 132 {
133 recv = alloca(ev->size + 1); 133 recvbuf = alloca(ev->size + 1);
134 memcpy(recv, ev->data, ev->size); 134 memcpy(recvbuf, ev->data, ev->size);
135 recv[ev->size] = 0; 135 recvbuf[ev->size] = 0;
136 DBG("Receiving %i bytes:\n%s", ev->size, recv); 136 DBG("Receiving %i bytes:\n%s", ev->size, recvbuf);
137 } 137 }
138 138
139 if (e->state < EMAIL_STATE_CONNECTED) 139 if (e->state < EMAIL_STATE_CONNECTED)
diff --git a/src/lib/email/smtp_login.c b/src/lib/email/smtp_login.c
index a3d0d99..e6afb47 100644
--- a/src/lib/email/smtp_login.c
+++ b/src/lib/email/smtp_login.c
@@ -170,18 +170,18 @@ email_login_smtp(Email *e, Ecore_Con_Event_Server_Data *ev)
170 if (e->features.smtp_features.cram) 170 if (e->features.smtp_features.cram)
171 { 171 {
172 char *b64, md5sum[33]; 172 char *b64, md5sum[33];
173 unsigned char digest[16]; 173 unsigned char *bin, digest[16];
174 int bsize; 174 int bsize;
175 Eina_Strbuf *buf; 175 Eina_Strbuf *sbuf;
176 176
177 b64 = email_base64_decode(ev->data + 4, ev->size - 6, &bsize); 177 bin = email_base64_decode(ev->data + 4, ev->size - 6, &bsize);
178 email_md5_hmac_encode(digest, b64, bsize, e->password, strlen(e->password)); 178 email_md5_hmac_encode(digest, (char*)bin, bsize, e->password, strlen(e->password));
179 free(b64); 179 free(bin);
180 email_md5_digest_to_str(digest, md5sum); 180 email_md5_digest_to_str(digest, md5sum);
181 buf = eina_strbuf_new(); 181 sbuf = eina_strbuf_new();
182 eina_strbuf_append_printf(buf, "%s %s", e->username, md5sum); 182 eina_strbuf_append_printf(sbuf, "%s %s", e->username, md5sum);
183 b64 = email_base64_encode(eina_strbuf_string_get(buf), eina_strbuf_length_get(buf), &bsize); 183 b64 = email_base64_encode(eina_strbuf_string_get(sbuf), eina_strbuf_length_get(sbuf), &bsize);
184 eina_strbuf_free(buf); 184 eina_strbuf_free(sbuf);
185 ecore_con_server_send(e->svr, b64, bsize); 185 ecore_con_server_send(e->svr, b64, bsize);
186 ecore_con_server_send(e->svr, "\r\n", 2); 186 ecore_con_server_send(e->svr, "\r\n", 2);
187 free(b64); 187 free(b64);