p = buffer + LWS_PRE;
end = p + sizeof(buffer) - LWS_PRE;
- if (!strncmp((const char *)in, "/auth_token.js", 14)) {
+ if (!strncmp((const char *) in, "/auth_token.js", 14)) {
size_t n = server->credential != NULL ? sprintf(buf, "var tty_auth_token = '%s';", server->credential) : 0;
if (lws_add_http_header_status(wsi, HTTP_STATUS_OK, &p, end))
return 1;
goto try_to_reuse;
case LWS_CALLBACK_OPENSSL_PERFORM_CLIENT_CERT_VERIFICATION:
- if (!len || (SSL_get_verify_result((SSL*)in) != X509_V_OK)) {
- int err = X509_STORE_CTX_get_error((X509_STORE_CTX*)user);
- int depth = X509_STORE_CTX_get_error_depth((X509_STORE_CTX*)user);
- const char* msg = X509_verify_cert_error_string(err);
+ if (!len || (SSL_get_verify_result((SSL *) in) != X509_V_OK)) {
+ int err = X509_STORE_CTX_get_error((X509_STORE_CTX *) user);
+ int depth = X509_STORE_CTX_get_error_depth((X509_STORE_CTX *) user);
+ const char *msg = X509_verify_cert_error_string(err);
lwsl_err("client certificate verification error: %s (%d), depth: %d\n", msg, err, depth);
return 1;
}
// command line options
static const struct option options[] = {
- {"port", required_argument, NULL, 'p'},
- {"interface", required_argument, NULL, 'i'},
- {"credential", required_argument, NULL, 'c'},
- {"uid", required_argument, NULL, 'u'},
- {"gid", required_argument, NULL, 'g'},
- {"signal", required_argument, NULL, 's'},
- {"reconnect", required_argument, NULL, 'r'},
- {"ssl", no_argument, NULL, 'S'},
- {"ssl-cert", required_argument, NULL, 'C'},
- {"ssl-key", required_argument, NULL, 'K'},
- {"ssl-ca", required_argument, NULL, 'A'},
- {"readonly", no_argument, NULL, 'R'},
- {"check-origin", no_argument, NULL, 'O'},
- {"once", no_argument, NULL, 'o'},
- {"debug", required_argument, NULL, 'd'},
- {"version", no_argument, NULL, 'v'},
- {"help", no_argument, NULL, 'h'},
- {NULL, 0, 0, 0}
+ {"port", required_argument, NULL, 'p'},
+ {"interface", required_argument, NULL, 'i'},
+ {"credential", required_argument, NULL, 'c'},
+ {"uid", required_argument, NULL, 'u'},
+ {"gid", required_argument, NULL, 'g'},
+ {"signal", required_argument, NULL, 's'},
+ {"reconnect", required_argument, NULL, 'r'},
+ {"ssl", no_argument, NULL, 'S'},
+ {"ssl-cert", required_argument, NULL, 'C'},
+ {"ssl-key", required_argument, NULL, 'K'},
+ {"ssl-ca", required_argument, NULL, 'A'},
+ {"readonly", no_argument, NULL, 'R'},
+ {"check-origin", no_argument, NULL, 'O'},
+ {"once", no_argument, NULL, 'o'},
+ {"debug", required_argument, NULL, 'd'},
+ {"version", no_argument, NULL, 'v'},
+ {"help", no_argument, NULL, 'h'},
+ {NULL, 0, 0, 0}
};
static const char *opt_string = "p:i:c:u:g:s:r:aSC:K:A:Rt:Ood:vh";
break;
case 't':
optind--;
- for(;optind < start && *argv[optind] != '-'; optind++){
- char *option =strdup(optarg);
+ for (; optind < start && *argv[optind] != '-'; optind++) {
+ char *option = strdup(optarg);
char *key = strsep(&option, "=");
if (key == NULL) {
fprintf(stderr, "ttyd: invalid client option: %s, format: key=value\n", optarg);