Skip to content

Commit

Permalink
fix for #496 (#497)
Browse files Browse the repository at this point in the history
fix for the following warning: comparison between pointer and zero character constant (#496),
and try to solve login problems with certificate only (#375)
  • Loading branch information
mrbaseman authored Dec 3, 2019
1 parent 8230c72 commit 1b81296
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,13 @@ int auth_log_in(struct tunnel *tunnel)

tunnel->cookie[0] = '\0';

if (tunnel->config->use_engine) {
if (tunnel->config->use_engine
|| (username[0] == '\0' && tunnel->config->password[0] == '\0')) {
snprintf(data, sizeof(data), "cert=&nup=1");
ret = http_request(tunnel, "GET", "/remote/login",
data, &res, &response_size);
} else {
if (tunnel->config->password == '\0') {
if (tunnel->config->password[0] == '\0') {
snprintf(data, sizeof(data), "username=%s&realm=%s&ajax=1"
"&redir=%%2Fremote%%2Findex&just_logged_in=1",
username, realm);
Expand Down
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ int main(int argc, char **argv)
goto user_error;
}
// Check username
if (cfg.username[0] == '\0' && cfg.use_engine != 1) {
log_error("Specify an username.\n");
if (cfg.username[0] == '\0' && cfg.user_cert == NULL) {
log_error("Specify a username.\n");
goto user_error;
}
// If username but no password given, interactively ask user
Expand Down

0 comments on commit 1b81296

Please sign in to comment.