Skip to content

Commit

Permalink
Implement disable_hostname_check config option.
Browse files Browse the repository at this point in the history
Patch by Sam Hartman.
  • Loading branch information
Linus Nordberg committed Oct 3, 2013
1 parent a6ea0fa commit 787ccb8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
pskhexstr = STRING # Transport pre-shared key, ASCII hex form.
pskid = STRING
pskex = "PSK"|"DHE_PSK"|"RSA_PSK"
disable_hostname_check = "yes"|"no"
}

# client specific realm config options
Expand Down Expand Up @@ -73,6 +74,7 @@ rs_context_read_config(struct rs_context *ctx, const char *config_file)
CFG_STR ("pskhexstr", NULL, CFGF_NONE),
CFG_STR ("pskid", NULL, CFGF_NONE),
CFG_STR ("pskex", "PSK", CFGF_NONE),
CFG_BOOL ("disable_hostname_check", cfg_false, CFGF_NONE),
CFG_SEC ("server", server_opts, CFGF_MULTI),
CFG_END ()
};
Expand Down Expand Up @@ -150,6 +152,7 @@ rs_context_read_config(struct rs_context *ctx, const char *config_file)
r->name, typestr);
r->timeout = cfg_getint (cfg_realm, "timeout");
r->retries = cfg_getint (cfg_realm, "retries");
r->disable_hostname_check = cfg_getbool (cfg_realm, "disable_hostname_check");

r->cacertfile = cfg_getstr (cfg_realm, "cacertfile");
/*r->cacertpath = cfg_getstr (cfg_realm, "cacertpath");*/
Expand Down
1 change: 1 addition & 0 deletions lib/include/radsec/radsec-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct rs_realm {
char *cacertpath;
char *certfile;
char *certkeyfile;
int disable_hostname_check;
struct rs_credentials *transport_cred;
struct rs_peer *peers;
struct rs_realm *next;
Expand Down
2 changes: 2 additions & 0 deletions lib/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ tls_verify_cert (struct rs_connection *conn)
if (!success)
success = (cnregexp (peer_cert, hostname, NULL) == 1);

if (conn->realm->disable_hostname_check)
success = 1;
if (!success)
err = rs_err_conn_push (conn, RSE_CERT, "server certificate doesn't "
"match configured hostname \"%s\"", hostname);
Expand Down

0 comments on commit 787ccb8

Please sign in to comment.