|
63 | 63 | #define spnego_log_error(fmt, args...) \ |
64 | 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 | 71 | /* Module handler */ |
67 | 72 | static ngx_int_t ngx_http_auth_spnego_handler(ngx_http_request_t *); |
68 | 73 |
|
@@ -1195,12 +1200,12 @@ static krb5_error_code ngx_http_auth_spnego_verify_server_credentials( |
1195 | 1200 | } |
1196 | 1201 |
|
1197 | 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 | 1204 | tgs_principal_name = (char *)ngx_pcalloc(r->pool, tgs_principal_name_size); |
1200 | 1205 | ngx_snprintf((u_char *)tgs_principal_name, tgs_principal_name_size, |
1201 | | - "%s/%*s@%*s", KRB5_TGS_NAME, principal->realm.length, |
1202 | | - principal->realm.data, principal->realm.length, |
1203 | | - principal->realm.data); |
| 1206 | + "%s/%*s@%*s", KRB5_TGS_NAME, krb5_realm_length(principal->realm), |
| 1207 | + krb5_realm_data(principal->realm), krb5_realm_length(principal->realm), |
| 1208 | + krb5_realm_data(principal->realm)); |
1204 | 1209 |
|
1205 | 1210 | if ((kerr = krb5_parse_name(kcontext, tgs_principal_name, |
1206 | 1211 | &match_creds.server))) { |
@@ -1341,13 +1346,13 @@ static ngx_int_t ngx_http_auth_spnego_obtain_server_credentials( |
1341 | 1346 | krb5_get_init_creds_opt_set_forwardable(&gicopts, 1); |
1342 | 1347 |
|
1343 | 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 | 1350 | tgs_principal_name = (char *)ngx_pcalloc(r->pool, tgs_principal_name_size); |
1346 | 1351 |
|
1347 | 1352 | ngx_snprintf((u_char *)tgs_principal_name, tgs_principal_name_size, |
1348 | | - "%s/%*s@%*s", KRB5_TGS_NAME, principal->realm.length, |
1349 | | - principal->realm.data, principal->realm.length, |
1350 | | - principal->realm.data); |
| 1353 | + "%s/%*s@%*s", KRB5_TGS_NAME, krb5_realm_length(principal->realm), |
| 1354 | + krb5_realm_data(principal->realm), krb5_realm_length(principal->realm), |
| 1355 | + krb5_realm_data(principal->realm)); |
1351 | 1356 |
|
1352 | 1357 | kerr = krb5_get_init_creds_keytab(kcontext, &creds, principal, keytab, 0, |
1353 | 1358 | tgs_principal_name, &gicopts); |
|
0 commit comments