return -EAGAIN;
}
-static int urldecode_inplace(char *p)
-{
- char *q;
- if (!p)
- return -EINVAL;
-
- for (q = p; *p; p++, q++) {
- if (*p == '+') {
- *q = ' ';
- } else if (*p == '%' && isxdigit((int)(unsigned char)p[1]) &&
- isxdigit((int)(unsigned char)p[2])) {
- *q = unhex(p + 1);
- p += 2;
- } else
- *q = *p;
- }
- *q = 0;
- return 0;
-}
-
/* Parse gateway login response (POST /ssl-vpn/login.esp)
*
* Extracts the relevant arguments from the XML (<jnlp><application-desc><argument>...</argument></application-desc></jnlp>)
return 0;
}
+int urldecode_inplace(char *p)
+{
+ char *q;
+ if (!p)
+ return -EINVAL;
+
+ for (q = p; *p; p++, q++) {
+ if (*p == '+') {
+ *q = ' ';
+ } else if (*p == '%' && isxdigit((int)(unsigned char)p[1]) &&
+ isxdigit((int)(unsigned char)p[2])) {
+ *q = unhex(p + 1);
+ p += 2;
+ } else
+ *q = *p;
+ }
+ *q = 0;
+ return 0;
+}
+
/* Read one HTTP header line into hdrbuf, potentially allowing for
* continuation lines. Will never leave a character in 'nextchar' when
* an empty line (signifying end of headers) is received. Will only
int http_add_cookie(struct openconnect_info *vpninfo, const char *option,
const char *value, int replace);
int internal_split_cookies(struct openconnect_info *vpninfo, int replace, const char *def_cookie);
+int urldecode_inplace(char *p);
int process_http_response(struct openconnect_info *vpninfo, int connect,
int (*header_cb)(struct openconnect_info *, char *, char *),
struct oc_text_buf *body);
print_esp_keys(vpninfo, _("new outgoing"), &vpninfo->esp_out);
continue;
+ case 0x93: {
+ /* Expected contents are "errorType=%d errorString=%s\n". Known values:
+ * 6: "agentd error" (another session started and kicked this one off)
+ * 7: "session has been terminated" (by client)
+ * 8: "session timed out" (idle timeout)
+ */
+ if (payload_len < 12 || strncmp("errorType=", (const char *)pkt->data, 10))
+ goto unknown_pkt;
+ pkt->data[payload_len - 1] = '\0'; /* overwrite final '\n' */
+
+ char *endp;
+ unsigned long reason = strtol((const char *)pkt->data + 10, &endp, 10);
+ if (strncmp(" errorString=", endp, 13))
+ goto unknown_pkt;
+
+ urldecode_inplace(endp+1);
+
+ vpn_progress(vpninfo, PRG_ERR, _("Pulse fatal error (reason: %ld): %s\n"),
+ reason, endp+13);
+ vpninfo->quit_reason = strdup(endp+13);
+ return -EPIPE;
+ }
+
case 0x96:
/* It sends the licence information once the connection is set up. For
* now, abuse this to deal with the race condition in ESP setup — it looks