int edit_src(struct tab *t, struct karg *args) { WebKitWebFrame *frame; WebKitWebDataSource *ds; GString *contents; struct edit_src_cb_args *ext_args; if (external_editor == NULL){ show_oops(t,"Setting external_editor not set"); return (1); } frame = webkit_web_view_get_focused_frame(t->wv); ds = webkit_web_frame_get_data_source(frame); if (webkit_web_data_source_is_loading(ds)) { show_oops(t,"Webpage is still loading."); return (1); } contents = webkit_web_data_source_get_data(ds); if (!contents) show_oops(t,"No contents - opening empty file"); ext_args = g_malloc(sizeof(struct edit_src_cb_args)); ext_args->frame = frame; ext_args->data_src = ds; /* Check every 100 ms if file has changed */ open_external_editor(t, contents ? contents->str : "", &edit_src_cb, ext_args); return (0); }
int add_favorite(struct tab *t, struct karg *args) { char file[PATH_MAX]; FILE *f; char *line = NULL; size_t urilen, linelen; const gchar *uri, *title; if (t == NULL) return (1); /* don't allow adding of xtp pages to favorites */ if (t->xtp_meaning != XT_XTP_TAB_MEANING_NORMAL) { show_oops(t, "%s: can't add xtp pages to favorites", __func__); return (1); } snprintf(file, sizeof file, "%s" PS "%s", work_dir, XT_FAVS_FILE); if ((f = fopen(file, "r+")) == NULL) { show_oops(t, "Can't open favorites file: %s", strerror(errno)); return (1); } title = get_title(t, FALSE); uri = get_uri(t); if (title == NULL || uri == NULL) { show_oops(t, "can't add page to favorites"); goto done; } urilen = strlen(uri); for (;;) { if ((line = fparseln(f, &linelen, NULL, NULL, 0)) == NULL) if (feof(f) || ferror(f)) break; if (linelen == urilen && !strcmp(line, uri)) goto done; free(line); line = NULL; } fprintf(f, "\n%s\n%s", title, uri); done: if (line) free(line); fclose(f); update_favorite_tabs(NULL); return (0); }
/* * cancel, remove, etc. downloads */ void xtp_handle_dl(struct tab *t, uint8_t cmd, int id) { struct download find, *d = NULL; DNPRINTF(XT_D_DOWNLOAD, "download control: cmd %d, id %d\n", cmd, id); /* some commands require a valid download id */ if (cmd != XT_XTP_DL_LIST) { /* lookup download in question */ find.id = id; d = RB_FIND(download_list, &downloads, &find); if (d == NULL) { show_oops(t, "%s: no such download", __func__); return; } } /* decide what to do */ switch (cmd) { case XT_XTP_DL_START: /* our downloads always needs to be * restarted if called from here */ download_start(t, d, XT_DL_RESTART); break; case XT_XTP_DL_CANCEL: webkit_download_cancel(d->download); g_object_unref(d->download); RB_REMOVE(download_list, &downloads, d); break; case XT_XTP_DL_UNLINK: #ifdef __MINGW32__ unlink(webkit_download_get_destination_uri(d->download)); #else unlink(webkit_download_get_destination_uri(d->download) + strlen("file://")); #endif /* FALLTHROUGH */ case XT_XTP_DL_REMOVE: webkit_download_cancel(d->download); /* just incase */ g_object_unref(d->download); RB_REMOVE(download_list, &downloads, d); break; case XT_XTP_DL_LIST: /* Nothing */ break; default: show_oops(t, "%s: unknown command", __func__); break; }; xtp_page_dl(t, NULL); }
int ca_cmd(struct tab *t, struct karg *args) { FILE *f = NULL; int rv = 1, certs = 0, certs_read; struct stat sb; gnutls_datum_t dt; gnutls_x509_crt_t *c = NULL; char *certs_buf = NULL, *s; if ((f = fopen(ssl_ca_file, "r")) == NULL) { show_oops(t, "Can't open CA file: %s", ssl_ca_file); return (1); } if (fstat(fileno(f), &sb) == -1) { show_oops(t, "Can't stat CA file: %s", ssl_ca_file); goto done; } certs_buf = g_malloc(sb.st_size + 1); if (fread(certs_buf, 1, sb.st_size, f) != sb.st_size) { show_oops(t, "Can't read CA file: %s", strerror(errno)); goto done; } certs_buf[sb.st_size] = '\0'; s = certs_buf; while ((s = strstr(s, "BEGIN CERTIFICATE"))) { certs++; s += strlen("BEGIN CERTIFICATE"); } bzero(&dt, sizeof dt); dt.data = (unsigned char *)certs_buf; dt.size = sb.st_size; c = g_malloc(sizeof(gnutls_x509_crt_t) * certs); certs_read = gnutls_x509_crt_list_import(c, (unsigned int *)&certs, &dt, GNUTLS_X509_FMT_PEM, 0); if (certs_read <= 0) { show_oops(t, "No cert(s) available"); goto done; } show_certs(t, c, certs_read, "Certificate Authority Certificates"); done: if (c) g_free(c); if (certs_buf) g_free(certs_buf); if (f) fclose(f); return (rv); }
/* * Actions on history, only does one thing for now, but * we provide the function for future actions */ void xtp_handle_hl(struct tab *t, uint8_t cmd, int id) { struct history *h, *next; int i = 1; switch (cmd) { case XT_XTP_HL_REMOVE: /* walk backwards, as listed in reverse */ for (h = RB_MAX(history_list, &hl); h != NULL; h = next) { next = RB_PREV(history_list, &hl, h); if (id == i) { RB_REMOVE(history_list, &hl, h); g_free((gpointer) h->title); g_free((gpointer) h->uri); g_free(h); break; } i++; } break; case XT_XTP_HL_LIST: /* Nothing - just xtp_page_hl() below */ break; default: show_oops(t, "%s: unknown command", __func__); break; }; xtp_page_hl(t, NULL); }
int stats(struct tab *t, struct karg *args) { char *page, *body, *s, line[64 * 1024]; uint64_t line_count = 0; FILE *r_cookie_f; if (t == NULL) show_oops(NULL, "stats invalid parameters"); line[0] = '\0'; if (save_rejected_cookies) { if ((r_cookie_f = fopen(rc_fname, "r"))) { for (;;) { s = fgets(line, sizeof line, r_cookie_f); if (s == NULL || feof(r_cookie_f) || ferror(r_cookie_f)) break; line_count++; } fclose(r_cookie_f); snprintf(line, sizeof line, "<br/>Cookies blocked(*) total: %" PRIu64, line_count); } else show_oops(t, "Can't open blocked cookies file: %s", strerror(errno)); } body = g_strdup_printf( "Cookies blocked(*) this session: %" PRIu64 "%s" "<p><small><b>*</b> results vary based on settings</small></p>", blocked_cookies, line); page = get_html_page("Statistics", body, "", 0); g_free(body); load_webkit_string(t, page, XT_URI_ABOUT_STATS); g_free(page); return (0); }
int edit_element(struct tab *t, struct karg *a) { WebKitDOMHTMLDocument *doc; WebKitDOMElement *active_element; WebKitDOMHTMLTextAreaElement *ta; WebKitDOMHTMLInputElement *el; char *contents; struct edit_element_cb_args *args; if (external_editor == NULL){ show_oops(t,"Setting external_editor not set"); return (0); } doc = (WebKitDOMHTMLDocument*)webkit_web_view_get_dom_document(t->wv); active_element = webkit_dom_html_document_get_active_element(doc); el = (WebKitDOMHTMLInputElement*)active_element; ta = (WebKitDOMHTMLTextAreaElement*)active_element; if (doc == NULL || active_element == NULL || (WEBKIT_DOM_IS_HTML_INPUT_ELEMENT(el) == 0 && WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(ta) == 0)) { show_oops(t, "No active text element!"); return (1); } contents = ""; if (WEBKIT_DOM_IS_HTML_INPUT_ELEMENT(el)) contents = webkit_dom_html_input_element_get_value(el); else if (WEBKIT_DOM_IS_HTML_TEXT_AREA_ELEMENT(ta)) contents = webkit_dom_html_text_area_element_get_value(ta); if ((args = g_malloc(sizeof(struct edit_element_cb_args))) == NULL) return (1); args->tab = t; args->active = active_element; open_external_editor(t, contents, &edit_element_cb, args); return (0); }
int blank(struct tab *t, struct karg *args) { if (t == NULL) show_oops(NULL, "blank invalid parameters"); load_webkit_string(t, "", XT_URI_ABOUT_BLANK); return (0); }
int update_contents(struct external_editor_args *args) { struct stat st; int fd = -1; int rv, nb; GString *contents = NULL; char buf[XT_EE_BUFSZ]; rv = stat(args->path, &st); if (rv == -1 && errno == ENOENT) return (1); else if (rv == 0 && st.st_mtime > args->mtime) { DPRINTF("File %s has been modified\n", args->path); args->mtime = st.st_mtime; contents = g_string_sized_new(XT_EE_BUFSZ); fd = open(args->path, O_RDONLY); if (fd == -1) { DPRINTF("open_external_editor_cb, open error, %s\n", strerror(errno)); goto done; } for (;;) { nb = read(fd, buf, XT_EE_BUFSZ); if (nb < 0) { g_string_free(contents, TRUE); show_oops(args->tab, strerror(errno)); goto done; } buf[nb] = '\0'; contents = g_string_append(contents, buf); if (nb < XT_EE_BUFSZ) break; } close(fd); fd = -1; DPRINTF("external_editor_cb: contents updated\n"); if (args->callback) args->callback(contents->str, args->cb_data); g_string_free(contents, TRUE); return (0); } done: if (fd != -1) close(fd); return (0); }
/* * validate a xtp session key. * return (1) if OK */ int validate_xtp_session_key(struct tab *t, char *trusted, char *untrusted) { if (strcmp(trusted, untrusted) != 0) { show_oops(t, "%s: xtp session key mismatch possible spoof", __func__); return (0); } return (1); }
int about(struct tab *t, struct karg *args) { char *page, *body; if (t == NULL) show_oops(NULL, "about invalid parameters"); body = g_strdup_printf("<b>Version: %s</b>" #ifdef XXXTERM_BUILDSTR "<br><b>Build: %s</b>" #endif "<br><b>WebKit: %d.%d.%d</b>" "<br><b>User Agent: %d.%d</b>" #ifdef WEBKITGTK_API_VERSION "<br><b>WebKit API: %.1f</b>" #endif "<p>" "Authors:" "<ul>" "<li>Marco Peereboom <[email protected]></li>" "<li>Stevan Andjelkovic <[email protected]></li>" "<li>Edd Barrett <[email protected]></li>" "<li>Todd T. Fries <[email protected]></li>" "<li>Raphael Graf <[email protected]></li>" "<li>Michal Mazurek <[email protected]></li>" "</ul>" "Copyrights and licenses can be found on the XXXTerm " "<a href=\"http://opensource.conformal.com/wiki/XXXTerm\">website</a>" "</p>", #ifdef XXXTERM_BUILDSTR version, XXXTERM_BUILDSTR, #else version, #endif WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION, WEBKIT_MICRO_VERSION, WEBKIT_USER_AGENT_MAJOR_VERSION, WEBKIT_USER_AGENT_MINOR_VERSION #ifdef WEBKITGTK_API_VERSION ,WEBKITGTK_API_VERSION #endif ); page = get_html_page("About", body, "", 0); g_free(body); load_webkit_string(t, page, XT_URI_ABOUT_ABOUT); g_free(page); return (0); }
int pl_cmd(struct tab *t, struct karg *args) { if (args->i & XT_SHOW) wl_show(t, args, "Plugin White List", &pl_wl); else if (args->i & XT_SAVE) { args->i |= XT_WL_RELOAD; wl_save(t, args, XT_WL_PLUGIN); } else if (args->i & XT_WL_TOGGLE) { args->i |= XT_WL_RELOAD; toggle_pl(t, args); } else if (args->i & XT_DELETE) show_oops(t, "'plugin delete' currently unimplemented"); return (0); }
int js_cmd(struct tab *t, struct karg *args) { if (args->i & XT_SHOW) wl_show(t, args, "JavaScript White List", &js_wl); else if (args->i & XT_SAVE) { args->i |= XT_WL_RELOAD; wl_save(t, args, XT_WL_JAVASCRIPT); } else if (args->i & XT_WL_TOGGLE) { args->i |= XT_WL_RELOAD; toggle_js(t, args); } else if (args->i & XT_DELETE) show_oops(t, "'js delete' currently unimplemented"); return (0); }
void xtp_handle_fl(struct tab *t, uint8_t cmd, int arg) { switch (cmd) { case XT_XTP_FL_LIST: /* nothing, just the below call to xtp_page_fl() */ break; case XT_XTP_FL_REMOVE: remove_favorite(t, arg); break; default: show_oops(t, "%s: invalid favorites command", __func__); break; }; xtp_page_fl(t, NULL); }
int help(struct tab *t, struct karg *args) { char *page, *head, *body; if (t == NULL) show_oops(NULL, "help invalid parameters"); head = "<meta http-equiv=\"REFRESH\" content=\"0;" "url=http://opensource.conformal.com/cgi-bin/man-cgi?xxxterm\">" "</head>\n"; body = "XXXTerm man page <a href=\"http://opensource.conformal.com/" "cgi-bin/man-cgi?xxxterm\">http://opensource.conformal.com/" "cgi-bin/man-cgi?xxxterm</a>"; page = get_html_page(XT_NAME, body, head, FALSE); load_webkit_string(t, page, XT_URI_ABOUT_HELP); g_free(page); return (0); }
void xtp_handle_cl(struct tab *t, uint8_t cmd, int arg) { switch (cmd) { case XT_XTP_CL_LIST: /* nothing, just xtp_page_cl() */ break; case XT_XTP_CL_REMOVE: remove_cookie(arg); break; case XT_XTP_CL_REMOVE_DOMAIN: remove_cookie_domain(arg); break; case XT_XTP_CL_REMOVE_ALL: remove_cookie_all(); break; default: show_oops(t, "%s: unknown cookie xtp command", __func__); break; }; xtp_page_cl(t, NULL); }
int edit_src(struct tab *t, struct karg *args) { show_oops(t, "external editor feature requires webkit >= 1.5.0"); return (1); }
/* remove a favorite */ void remove_favorite(struct tab *t, int index) { char file[PATH_MAX], *title, *uri = NULL; char *new_favs, *tmp; FILE *f; int i; size_t len, lineno; /* open favorites */ snprintf(file, sizeof file, "%s" PS "%s", work_dir, XT_FAVS_FILE); if ((f = fopen(file, "r")) == NULL) { show_oops(t, "%s: can't open favorites: %s", __func__, strerror(errno)); return; } /* build a string which will become the new favroites file */ new_favs = g_strdup(""); for (i = 1;;) { if ((title = fparseln(f, &len, &lineno, NULL, 0)) == NULL) if (feof(f) || ferror(f)) break; /* XXX THIS IS NOT THE RIGHT HEURISTIC */ if (len == 0) { free(title); title = NULL; continue; } if ((uri = fparseln(f, &len, &lineno, NULL, 0)) == NULL) { if (feof(f) || ferror(f)) { show_oops(t, "%s: can't parse favorites %s", __func__, strerror(errno)); goto clean; } } /* as long as this isn't the one we are deleting add to file */ if (i != index) { tmp = new_favs; new_favs = g_strdup_printf("%s%s\n%s\n", new_favs, title, uri); g_free(tmp); } free(uri); uri = NULL; free(title); title = NULL; i++; } fclose(f); /* write back new favorites file */ if ((f = fopen(file, "w")) == NULL) { show_oops(t, "%s: can't open favorites: %s", __func__, strerror(errno)); goto clean; } if (fwrite(new_favs, strlen(new_favs), 1, f) != 1) show_oops(t, "%s: can't fwrite", __func__); fclose(f); clean: if (uri) free(uri); if (title) free(title); g_free(new_favs); }
int open_external_editor(struct tab *t, const char *contents, int (*callback)(const char *, gpointer), gpointer cb_data) { struct stat st; struct external_editor_args *a; GPid pid; char *cmdstr; char filename[PATH_MAX]; char **sv; int fd; int nb, rv; int cnt; if (external_editor == NULL) return (0); snprintf(filename, sizeof filename, "%s" PS "xombreroXXXXXX", temp_dir); /* Create a temporary file */ fd = g_mkstemp(filename); if (fd == -1) { show_oops(t, "Cannot create temporary file"); return (1); } nb = 0; while (contents && nb < strlen(contents)) { if (strlen(contents) - nb > XT_EE_BUFSZ) cnt = XT_EE_BUFSZ; else cnt = strlen(contents) - nb; rv = write(fd, contents+nb, cnt); if (rv < 0) { close(fd); show_oops(t,strerror(errno)); return (1); } nb += rv; } rv = fstat(fd, &st); if (rv == -1) { close(fd); show_oops(t,"Cannot stat file: %s\n", strerror(errno)); return (1); } close(fd); DPRINTF("edit_src: external_editor: %s\n", external_editor); sv = g_strsplit(external_editor, "<file>", -1); cmdstr = g_strjoinv(filename, sv); g_strfreev(sv); sv = g_strsplit_set(cmdstr, " \t", -1); if (!g_spawn_async(NULL, sv, NULL, (G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD), NULL, NULL, &pid, NULL)) { show_oops(t, "%s: could not spawn process"); g_strfreev(sv); g_free(cmdstr); return (1); } g_strfreev(sv); g_free(cmdstr); a = g_malloc(sizeof(struct external_editor_args)); a->child_pid = pid; a->path = g_strdup(filename); a->tab = t; a->mtime = st.st_mtime; a->callback = callback; a->cb_data = cb_data; /* Check every 100 ms if file has changed */ g_timeout_add(100, (GSourceFunc)open_external_editor_cb, (gpointer)a); /* Stop loop child has terminated */ g_child_watch_add(pid, external_editor_closed, (gpointer)a); return (0); }
void soup_cookie_jar_add_cookie(SoupCookieJar *jar, SoupCookie *cookie) { struct wl_entry *w = NULL; SoupCookie *c; FILE *r_cookie_f; char *public_suffix; DNPRINTF(XT_D_COOKIE, "soup_cookie_jar_add_cookie: %p %p %p\n", jar, p_cookiejar, s_cookiejar); if (cookies_enabled == 0) return; /* see if we are up and running */ if (p_cookiejar == NULL) { _soup_cookie_jar_add_cookie(jar, cookie); return; } /* disallow p_cookiejar adds, shouldn't happen */ if (jar == p_cookiejar) return; /* sanity */ if (jar == NULL || cookie == NULL) return; /* check if domain is valid */ public_suffix = tld_get_suffix(cookie->domain[0] == '.' ? cookie->domain + 1 : cookie->domain); if (public_suffix == NULL || (enable_cookie_whitelist && (w = wl_find(cookie->domain, &c_wl)) == NULL)) { blocked_cookies++; DNPRINTF(XT_D_COOKIE, "soup_cookie_jar_add_cookie: reject %s\n", cookie->domain); if (save_rejected_cookies) { if ((r_cookie_f = fopen(rc_fname, "a+")) == NULL) { show_oops(NULL, "can't open reject cookie file"); return; } fseek(r_cookie_f, 0, SEEK_END); fprintf(r_cookie_f, "%s%s\t%s\t%s\t%s\t%lu\t%s\t%s\n", cookie->http_only ? "#HttpOnly_" : "", cookie->domain, *cookie->domain == '.' ? "TRUE" : "FALSE", cookie->path, cookie->secure ? "TRUE" : "FALSE", cookie->expires ? (gulong)soup_date_to_time_t(cookie->expires) : 0, cookie->name, cookie->value); fflush(r_cookie_f); fclose(r_cookie_f); } if (!allow_volatile_cookies) return; } if (cookie->expires == NULL && session_timeout) { soup_cookie_set_expires(cookie, soup_date_new_from_now(session_timeout)); print_cookie("modified add cookie", cookie); } /* see if we are white listed for persistence */ if ((w && w->handy) || (enable_cookie_whitelist == 0)) { /* add to persistent jar */ c = soup_cookie_copy(cookie); print_cookie("soup_cookie_jar_add_cookie p_cookiejar", c); _soup_cookie_jar_add_cookie(p_cookiejar, c); } /* add to session jar */ print_cookie("soup_cookie_jar_add_cookie s_cookiejar", cookie); _soup_cookie_jar_add_cookie(s_cookiejar, cookie); }
int wl_save(struct tab *t, struct karg *args, int list) { char file[PATH_MAX], *lst_str = NULL; FILE *f = NULL; char *line = NULL, *lt = NULL, *dom; size_t linelen; const gchar *uri; struct karg a; struct domain *d; GSList *cf; SoupCookie *ci, *c; if (t == NULL || args == NULL) return (1); if (runtime_settings[0] == '\0') return (1); switch (list) { case XT_WL_JAVASCRIPT: lst_str = "JavaScript"; break; case XT_WL_COOKIE: lst_str = "Cookie"; break; case XT_WL_PLUGIN: lst_str = "Plugin"; break; default: show_oops(t, "Invalid list id: %d", list); return (1); } uri = get_uri(t); dom = find_domain(uri, args->i & XT_WL_TOPLEVEL); if (uri == NULL || dom == NULL || webkit_web_view_get_load_status(t->wv) == WEBKIT_LOAD_FAILED) { show_oops(t, "Can't add domain to %s white list", lst_str); goto done; } switch (list) { case XT_WL_JAVASCRIPT: lt = g_strdup_printf("js_wl=%s", dom); break; case XT_WL_COOKIE: lt = g_strdup_printf("cookie_wl=%s", dom); break; case XT_WL_PLUGIN: lt = g_strdup_printf("pl_wl=%s", dom); break; default: /* can't happen */ show_oops(t, "Invalid list id: %d", list); goto done; } snprintf(file, sizeof file, "%s" PS "%s", work_dir, runtime_settings); if ((f = fopen(file, "r+")) == NULL) { show_oops(t, "can't open file %s"); goto done; } while (!feof(f)) { line = fparseln(f, &linelen, NULL, NULL, 0); if (line == NULL) continue; if (!strcmp(line, lt)) goto done; free(line); line = NULL; } fprintf(f, "%s\n", lt); a.i = XT_WL_ENABLE; a.i |= args->i; switch (list) { case XT_WL_JAVASCRIPT: d = wl_find(dom, &js_wl); if (!d) { settings_add("js_wl", dom); d = wl_find(dom, &js_wl); } toggle_js(t, &a); break; case XT_WL_COOKIE: d = wl_find(dom, &c_wl); if (!d) { settings_add("cookie_wl", dom); d = wl_find(dom, &c_wl); } toggle_cwl(t, &a); /* find and add to persistent jar */ cf = soup_cookie_jar_all_cookies(s_cookiejar); for (;cf; cf = cf->next) { ci = cf->data; if (!strcmp(dom, ci->domain) || !strcmp(&dom[1], ci->domain)) /* deal with leading . */ { c = soup_cookie_copy(ci); _soup_cookie_jar_add_cookie(p_cookiejar, c); } } soup_cookies_free(cf); break; case XT_WL_PLUGIN: d = wl_find(dom, &pl_wl); if (!d) { settings_add("pl_wl", dom); d = wl_find(dom, &pl_wl); } toggle_pl(t, &a); break; default: abort(); /* can't happen */ } if (d) d->handy = 1; done: if (line) free(line); if (dom) g_free(dom); if (lt) g_free(lt); if (f) fclose(f); return (0); }
/* * is the url xtp protocol? (xxxt://) * if so, parse and despatch correct bahvior */ int parse_xtp_url(struct tab *t, const char *url) { char *dup = NULL, *p, *last = NULL; uint8_t n_tokens = 0; char *tokens[4] = {NULL, NULL, NULL, ""}; struct xtp_despatch *dsp, *dsp_match = NULL; uint8_t req_class; int ret = FALSE; /* * tokens array meaning: * tokens[0] = class * tokens[1] = session key * tokens[2] = action * tokens[3] = optional argument */ DNPRINTF(XT_D_URL, "%s: url %s\n", __func__, url); if (strncmp(url, XT_XTP_STR, strlen(XT_XTP_STR))) goto clean; dup = g_strdup(url + strlen(XT_XTP_STR)); /* split out the url */ for ((p = strtok_r(dup, "/", &last)); p; (p = strtok_r(NULL, "/", &last))) { if (n_tokens < 4) tokens[n_tokens++] = p; } /* should be atleast three fields 'class/seskey/command/arg' */ if (n_tokens < 3) goto clean; dsp = xtp_despatches; req_class = atoi(tokens[0]); while (dsp->xtp_class) { if (dsp->xtp_class == req_class) { dsp_match = dsp; break; } dsp++; } /* did we find one atall? */ if (dsp_match == NULL) { show_oops(t, "%s: no matching xtp despatch found", __func__); goto clean; } /* check session key and call despatch function */ if (validate_xtp_session_key(t, *(dsp_match->session_key), tokens[1])) { ret = TRUE; /* all is well, this was a valid xtp request */ dsp_match->handle_func(t, atoi(tokens[2]), atoi(tokens[3])); } clean: if (dup) g_free(dup); return (ret); }