|
Lines 63-68
Link Here
|
| 63 |
#define spnego_log_error(fmt, args...) \ |
63 |
#define spnego_log_error(fmt, args...) \ |
| 64 |
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, fmt, ##args) |
64 |
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, fmt, ##args) |
| 65 |
|
65 |
|
|
|
66 |
#ifndef krb5_realm_length |
| 67 |
#define krb5_realm_length(r) ((r).length) |
| 68 |
#define krb5_realm_data(r) ((r).data) |
| 69 |
#endif |
| 70 |
|
| 66 |
/* Module handler */ |
71 |
/* Module handler */ |
| 67 |
static ngx_int_t ngx_http_auth_spnego_handler(ngx_http_request_t *); |
72 |
static ngx_int_t ngx_http_auth_spnego_handler(ngx_http_request_t *); |
| 68 |
|
73 |
|
|
Lines 1195-1206
static krb5_error_code ngx_http_auth_spnego_verify_server_credentials(
Link Here
|
| 1195 |
} |
1200 |
} |
| 1196 |
|
1201 |
|
| 1197 |
size_t tgs_principal_name_size = |
1202 |
size_t tgs_principal_name_size = |
| 1198 |
(ngx_strlen(KRB5_TGS_NAME) + (principal->realm.length * 2) + 2) + 1; |
1203 |
(ngx_strlen(KRB5_TGS_NAME) + (krb5_realm_length(principal->realm) * 2) + 2) + 1; |
| 1199 |
tgs_principal_name = (char *)ngx_pcalloc(r->pool, tgs_principal_name_size); |
1204 |
tgs_principal_name = (char *)ngx_pcalloc(r->pool, tgs_principal_name_size); |
| 1200 |
ngx_snprintf((u_char *)tgs_principal_name, tgs_principal_name_size, |
1205 |
ngx_snprintf((u_char *)tgs_principal_name, tgs_principal_name_size, |
| 1201 |
"%s/%*s@%*s", KRB5_TGS_NAME, principal->realm.length, |
1206 |
"%s/%*s@%*s", KRB5_TGS_NAME, krb5_realm_length(principal->realm), |
| 1202 |
principal->realm.data, principal->realm.length, |
1207 |
krb5_realm_data(principal->realm), krb5_realm_length(principal->realm), |
| 1203 |
principal->realm.data); |
1208 |
krb5_realm_data(principal->realm)); |
| 1204 |
|
1209 |
|
| 1205 |
if ((kerr = krb5_parse_name(kcontext, tgs_principal_name, |
1210 |
if ((kerr = krb5_parse_name(kcontext, tgs_principal_name, |
| 1206 |
&match_creds.server))) { |
1211 |
&match_creds.server))) { |
|
Lines 1341-1353
static ngx_int_t ngx_http_auth_spnego_obtain_server_credentials(
Link Here
|
| 1341 |
krb5_get_init_creds_opt_set_forwardable(&gicopts, 1); |
1346 |
krb5_get_init_creds_opt_set_forwardable(&gicopts, 1); |
| 1342 |
|
1347 |
|
| 1343 |
size_t tgs_principal_name_size = |
1348 |
size_t tgs_principal_name_size = |
| 1344 |
(ngx_strlen(KRB5_TGS_NAME) + (principal->realm.length * 2) + 2) + 1; |
1349 |
(ngx_strlen(KRB5_TGS_NAME) + (krb5_realm_length(principal->realm) * 2) + 2) + 1; |
| 1345 |
tgs_principal_name = (char *)ngx_pcalloc(r->pool, tgs_principal_name_size); |
1350 |
tgs_principal_name = (char *)ngx_pcalloc(r->pool, tgs_principal_name_size); |
| 1346 |
|
1351 |
|
| 1347 |
ngx_snprintf((u_char *)tgs_principal_name, tgs_principal_name_size, |
1352 |
ngx_snprintf((u_char *)tgs_principal_name, tgs_principal_name_size, |
| 1348 |
"%s/%*s@%*s", KRB5_TGS_NAME, principal->realm.length, |
1353 |
"%s/%*s@%*s", KRB5_TGS_NAME, krb5_realm_length(principal->realm), |
| 1349 |
principal->realm.data, principal->realm.length, |
1354 |
krb5_realm_data(principal->realm), krb5_realm_length(principal->realm), |
| 1350 |
principal->realm.data); |
1355 |
krb5_realm_data(principal->realm)); |
| 1351 |
|
1356 |
|
| 1352 |
kerr = krb5_get_init_creds_keytab(kcontext, &creds, principal, keytab, 0, |
1357 |
kerr = krb5_get_init_creds_keytab(kcontext, &creds, principal, keytab, 0, |
| 1353 |
tgs_principal_name, &gicopts); |
1358 |
tgs_principal_name, &gicopts); |