Fixed tokenization (again)
This commit is contained in:
@@ -98,8 +98,8 @@ void runServer(int connfd, Sitefile *site, volatile int *pending, int id) {
|
|||||||
createErrorLog("seteuid() failed", errno);
|
createErrorLog("seteuid() failed", errno);
|
||||||
root = getpwnam("root");
|
root = getpwnam("root");
|
||||||
if (root != NULL) {
|
if (root != NULL) {
|
||||||
/* I don't know why this if statement could be false but we have it
|
/* I don't know why this if statement could be false but we have
|
||||||
* just in case. */
|
* it just in case. */
|
||||||
if (geteuid() == root->pw_uid)
|
if (geteuid() == root->pw_uid)
|
||||||
createLog("swebs probably should not be run as root");
|
createLog("swebs probably should not be run as root");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ static void gettoken(FILE *file, Token *ret) {
|
|||||||
}
|
}
|
||||||
c = fgetc(file);
|
c = fgetc(file);
|
||||||
if (isspace(c) || c == EOF) {
|
if (isspace(c) || c == EOF) {
|
||||||
|
ungetc(c, file);
|
||||||
data[len] = '\0';
|
data[len] = '\0';
|
||||||
ret->type = ARG;
|
ret->type = ARG;
|
||||||
ret->data = data;
|
ret->data = data;
|
||||||
@@ -426,7 +427,7 @@ nextcommand:
|
|||||||
(port->key == NULL ||
|
(port->key == NULL ||
|
||||||
port->cert == NULL)) {
|
port->cert == NULL)) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Port %hu declarS without proper TLS files\n", port->num);
|
"Port %hu declared without proper TLS files\n", port->num);
|
||||||
goto nterror;
|
goto nterror;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,18 +144,18 @@ Stream *createStream(Context *context, int flags, int fd) {
|
|||||||
break;
|
break;
|
||||||
case TLS:
|
case TLS:
|
||||||
if (gnutls_init(&ret->session, GNUTLS_SERVER) < 0) {
|
if (gnutls_init(&ret->session, GNUTLS_SERVER) < 0) {
|
||||||
createErrorLog("gnutls_init() failed", errno);
|
createLog("gnutls_init() failed");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (gnutls_priority_set(ret->session,
|
if (gnutls_priority_set(ret->session,
|
||||||
context->priority) < 0) {
|
context->priority) < 0) {
|
||||||
createErrorLog("gnutls_priority_set() failed", errno);
|
createLog("gnutls_priority_set() failed");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (gnutls_credentials_set(ret->session,
|
if (gnutls_credentials_set(ret->session,
|
||||||
GNUTLS_CRD_CERTIFICATE,
|
GNUTLS_CRD_CERTIFICATE,
|
||||||
context->creds) < 0) {
|
context->creds) < 0) {
|
||||||
createErrorLog("gnutls_credentials_set() failed", errno);
|
createLog("gnutls_credentials_set() failed");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
gnutls_certificate_server_set_request(ret->session,
|
gnutls_certificate_server_set_request(ret->session,
|
||||||
@@ -164,7 +164,7 @@ Stream *createStream(Context *context, int flags, int fd) {
|
|||||||
GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
|
GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT);
|
||||||
gnutls_transport_set_int(ret->session, ret->fd);
|
gnutls_transport_set_int(ret->session, ret->fd);
|
||||||
if (gnutls_handshake(ret->session) < 0) {
|
if (gnutls_handshake(ret->session) < 0) {
|
||||||
createErrorLog("gnutls_handshake() failed", errno);
|
createLog("gnutls_handshake() failed");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user