Fixed tokenization (again)

This commit is contained in:
2022-07-31 00:32:22 -05:00
parent 92eda6f326
commit df9484283e
3 changed files with 8 additions and 7 deletions

View File

@@ -98,8 +98,8 @@ void runServer(int connfd, Sitefile *site, volatile int *pending, int id) {
createErrorLog("seteuid() failed", errno);
root = getpwnam("root");
if (root != NULL) {
/* I don't know why this if statement could be false but we have it
* just in case. */
/* I don't know why this if statement could be false but we have
* it just in case. */
if (geteuid() == root->pw_uid)
createLog("swebs probably should not be run as root");
}

View File

@@ -94,6 +94,7 @@ static void gettoken(FILE *file, Token *ret) {
}
c = fgetc(file);
if (isspace(c) || c == EOF) {
ungetc(c, file);
data[len] = '\0';
ret->type = ARG;
ret->data = data;
@@ -426,7 +427,7 @@ nextcommand:
(port->key == NULL ||
port->cert == NULL)) {
fprintf(stderr,
"Port %hu declarS without proper TLS files\n", port->num);
"Port %hu declared without proper TLS files\n", port->num);
goto nterror;
}
}

View File

@@ -144,18 +144,18 @@ Stream *createStream(Context *context, int flags, int fd) {
break;
case TLS:
if (gnutls_init(&ret->session, GNUTLS_SERVER) < 0) {
createErrorLog("gnutls_init() failed", errno);
createLog("gnutls_init() failed");
goto error;
}
if (gnutls_priority_set(ret->session,
context->priority) < 0) {
createErrorLog("gnutls_priority_set() failed", errno);
createLog("gnutls_priority_set() failed");
goto error;
}
if (gnutls_credentials_set(ret->session,
GNUTLS_CRD_CERTIFICATE,
context->creds) < 0) {
createErrorLog("gnutls_credentials_set() failed", errno);
createLog("gnutls_credentials_set() failed");
goto error;
}
gnutls_certificate_server_set_request(ret->session,
@@ -164,7 +164,7 @@ Stream *createStream(Context *context, int flags, int fd) {
GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
gnutls_transport_set_int(ret->session, ret->fd);
if (gnutls_handshake(ret->session) < 0) {
createErrorLog("gnutls_handshake() failed", errno);
createLog("gnutls_handshake() failed");
goto error;
}
break;