diff options
author | Not Zed <NotZed@Ximian.com> | 2003-09-16 07:21:16 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2003-09-16 07:21:16 +0800 |
commit | cf2b82e85864db8c0bfebceb84fd230691adc3f4 (patch) | |
tree | fbbcd7e3e2cb21afb724d6a76e449a43c22408bb /camel/providers/imapp/camel-imapp-store.c | |
parent | 99274a95701e007c22cbfc3f7d42a123b0464ea4 (diff) | |
download | gsoc2013-evolution-cf2b82e85864db8c0bfebceb84fd230691adc3f4.tar gsoc2013-evolution-cf2b82e85864db8c0bfebceb84fd230691adc3f4.tar.gz gsoc2013-evolution-cf2b82e85864db8c0bfebceb84fd230691adc3f4.tar.bz2 gsoc2013-evolution-cf2b82e85864db8c0bfebceb84fd230691adc3f4.tar.lz gsoc2013-evolution-cf2b82e85864db8c0bfebceb84fd230691adc3f4.tar.xz gsoc2013-evolution-cf2b82e85864db8c0bfebceb84fd230691adc3f4.tar.zst gsoc2013-evolution-cf2b82e85864db8c0bfebceb84fd230691adc3f4.zip |
removed dead code.
2003-09-15 Not Zed <NotZed@Ximian.com>
* providers/imapp/camel-imapp-store.c (store_resp_list)
(imap_login, try_sasl, imap_try_authenticate): removed dead code.
* providers/imapp/camel-imapp-stream.c: return -1 if stream not
set.
* providers/imapp/camel-imapp-engine.c (iterate_completion): put
done request on the done queue, so all requests are always
somewhere.
(camel_imapp_engine_command_free): just spit warnings of active
messages being freed, but abort if the item isn't in any list.
Also remove the node from its list before going on.
(iterate_untagged, iterate_continuation, iterate_completion):
staticifiy.
* providers/imapp/camel-imapp-provider.c
(camel_imapp_module_init): move camel_exception_setup call here.
* providers/imapp/camel-imapp-driver.c
(camel_imapp_driver_get_type): remove execption setup here, it
isn't early enough.
(camel_imapp_driver_list): handle exceptions.
svn path=/trunk/; revision=22583
Diffstat (limited to 'camel/providers/imapp/camel-imapp-store.c')
-rw-r--r-- | camel/providers/imapp/camel-imapp-store.c | 215 |
1 files changed, 0 insertions, 215 deletions
diff --git a/camel/providers/imapp/camel-imapp-store.c b/camel/providers/imapp/camel-imapp-store.c index ae02bcb54e..9123102a03 100644 --- a/camel/providers/imapp/camel-imapp-store.c +++ b/camel/providers/imapp/camel-imapp-store.c @@ -337,203 +337,6 @@ imap_query_auth_types (CamelService *service, CamelException *ex) return types; } -#if 0 -static int -try_sasl(CamelIMAPPStore *store, const char *mech, CamelException *ex) -{ - CamelIMAPPStream *stream = store->engine->stream; - unsigned char *line, *resp; - CamelSasl *sasl; - unsigned int len; - int ret; - - sasl = camel_sasl_new("imap", mech, (CamelService *)store); - if (sasl == NULL) { - camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, - _("Unable to connect to POP server.\n" - "No support for requested " - "authentication mechanism.")); - return -1; - } - - if (camel_stream_printf((CamelStream *)stream, "AUTH %s\r\n", mech) == -1) - goto ioerror; - - while (1) { - if (camel_imapp_stream_line(stream, &line, &len) == -1) - goto ioerror; - if (strncmp(line, "+OK", 3) == 0) - break; - if (strncmp(line, "-ERR", 4) == 0) { - camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, - _("SASL `%s' Login failed: %s"), mech, line); - goto done; - } - /* If we dont get continuation, or the sasl object's run out of work, or we dont get a challenge, - its a protocol error, so fail, and try reset the server */ - if (strncmp(line, "+ ", 2) != 0 - || camel_sasl_authenticated(sasl) - || (resp = camel_sasl_challenge_base64(sasl, line+2, ex)) == NULL) { - camel_stream_printf((CamelStream *)stream, "*\r\n"); - camel_imapp_stream_line(stream, &line, &len); - camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, - _("SASL Protocol error")); - goto done; - } - - ret = camel_stream_printf((CamelStream *)stream, "%s\r\n", resp); - g_free(resp); - if (ret == -1) - goto ioerror; - - } - camel_object_unref((CamelObject *)sasl); - return 0; - -ioerror: - camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, - _("I/O Error: %s"), strerror(errno)); -done: - camel_object_unref((CamelObject *)sasl); - return -1; -} - -static gboolean -imap_try_authenticate (CamelService *service, const char *errmsg, CamelException *ex) -{ - CamelIMAPPStore *store = (CamelIMAPPStore *)service; - CamelIMAPPCommand *pcu = NULL, *pcp = NULL; - int status; - - /* override, testing only */ - /*printf("Forcing authmech to 'login'\n"); - service->url->authmech = g_strdup("LOGIN");*/ - - if (!service->url->passwd) { - char *prompt; - - prompt = g_strdup_printf (_("%sPlease enter the POP password for %s@%s"), - errmsg ? errmsg : "", - service->url->user, - service->url->host); - service->url->passwd = camel_session_get_password (camel_service_get_session (service), - prompt, TRUE, service, "password", ex); - g_free (prompt); - if (!service->url->passwd) - return FALSE; - } - - if (!service->url->authmech) { - /* pop engine will take care of pipelining ability */ - pcu = camel_imapp_engine_command_new(store->engine, 0, NULL, NULL, "USER %s\r\n", service->url->user); - pcp = camel_imapp_engine_command_new(store->engine, 0, NULL, NULL, "PASS %s\r\n", service->url->passwd); - } else if (strcmp(service->url->authmech, "+APOP") == 0 && store->engine->apop) { - char *secret, md5asc[33], *d; - unsigned char md5sum[16], *s; - - secret = alloca(strlen(store->engine->apop)+strlen(service->url->passwd)+1); - sprintf(secret, "%s%s", store->engine->apop, service->url->passwd); - md5_get_digest(secret, strlen (secret), md5sum); - - for (s = md5sum, d = md5asc; d < md5asc + 32; s++, d += 2) - sprintf (d, "%.2x", *s); - - pcp = camel_imapp_engine_command_new(store->engine, 0, NULL, NULL, "APOP %s %s\r\n", service->url->user, md5asc); - } else { - CamelServiceAuthType *auth; - GList *l; - - l = store->engine->auth; - while (l) { - auth = l->data; - if (strcmp(auth->authproto, service->url->authmech) == 0) - return try_sasl(store, service->url->authmech, ex) == -1; - l = l->next; - } - - camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, - _("Unable to connect to POP server.\n" - "No support for requested " - "authentication mechanism.")); - return FALSE; - } - - while ((status = camel_imapp_engine_iterate (store->engine, pcp)) > 0) - ; - - if (pcp->state != CAMEL_IMAPP_COMMAND_OK) { - if (status == -1) - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - _("Unable to connect to POP server.\nError sending password: %s"), - errno ? g_strerror (errno) : _("Unknown error")); - else - camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, - _("Unable to connect to POP server.\nError sending password: %s"), - store->engine->line); - } - camel_imapp_engine_command_free(store->engine, pcp); - - if (pcu) - camel_imapp_engine_command_free(store->engine, pcu); - - return status; -} -#endif - -static gboolean -imap_login(CamelService *service, char *msg) -{ - CamelIMAPPStore *store = (CamelIMAPPStore *)service; - CamelIMAPPCommand * volatile ic = NULL; - - /* override, testing only */ - /*printf("Forcing authmech to 'login'\n"); - service->url->authmech = g_strdup("LOGIN");*/ - - CAMEL_TRY { - if (!service->url->passwd) { - char *prompt; - CamelException *ex = camel_exception_new(); - - prompt = g_strdup_printf (_("%sPlease enter the IMAP password for %s@%s"), - msg?msg:"", - service->url->user, - service->url->host); - service->url->passwd = camel_session_get_password(camel_service_get_session(service), prompt, FALSE, TRUE, service, "password", ex); - g_free (prompt); - if (camel_exception_is_set(ex)) - camel_exception_throw_ex(ex); - } - - if (service->url->authmech) { - CamelSasl *sasl = camel_sasl_new("imap", service->url->authmech, service); - - if (sasl == NULL) - camel_exception_throw(1, "unsupported authentication mechanism: %s", service->url->authmech); - ic = camel_imapp_engine_command_new(store->driver->engine, "AUTHENTICATE", NULL, "AUTHENTICATE %A", sasl); - camel_object_unref((CamelObject *)sasl); - } else { - ic = camel_imapp_engine_command_new(store->driver->engine, "LOGIN", NULL, "LOGIN %s %s", service->url->user, service->url->passwd); - } - - camel_imapp_engine_command_queue(store->driver->engine, ic); - while (camel_imapp_engine_iterate(store->driver->engine, ic) > 0) - ; - - if (ic->status->result != IMAP_OK) - camel_exception_throw(CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, "Login failed: %s", ic->status->text); - } CAMEL_CATCH(ex) { - if (ic) - camel_imapp_engine_command_free(store->driver->engine, ic); - camel_exception_throw_ex(ex); - } CAMEL_DONE; - - if (ic) - camel_imapp_engine_command_free(store->driver->engine, ic); - - return TRUE; -} - static void store_get_pass(CamelIMAPPStore *store) { @@ -977,24 +780,6 @@ imap_create_folder(CamelStore *store, const char *parent_name, const char *folde } /* ********************************************************************** */ - -static int store_resp_list(CamelIMAPPEngine *ie, guint32 id, void *data) -{ - struct _list_info *linfo; - CamelIMAPPStore *istore = data; - - linfo = imap_parse_list(ie->stream); - printf("store list: '%s' ('%c')\n", linfo->name, linfo->separator); - if (istore->pending_list) - g_ptr_array_add(istore->pending_list, linfo); - else { - g_warning("unexpected list response\n"); - imap_free_list(linfo); - } - - return camel_imapp_engine_skip(ie); -} - #if 0 static int store_resp_fetch(CamelIMAPPEngine *ie, guint32 id, void *data) { |