Skip to content

Commit edc1b99

Browse files
committed
Fix: Setting Env Var, when it is not used
When instead of the environment variable a given config path or the default is used, set the environment variable accordingly. This is necessary, as the GSSAPI does get the path via the env variable only.
1 parent b55122b commit edc1b99

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

misc/openvas-krb5.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,8 @@ okrb5_gss_free_context (struct OKrb5GSSContext *context)
413413
}
414414
if (context->gss_ctx != GSS_C_NO_CONTEXT)
415415
{
416-
gss_delete_sec_context (&min_stat, &context->gss_ctx, GSS_C_NO_BUFFER);
416+
gss_delete_sec_context (&min_stat, &context->gss_ctx,
417+
GSS_C_NO_BUFFER);
417418
}
418419
if (context->gss_target != GSS_C_NO_NAME)
419420
{
@@ -482,7 +483,7 @@ o_krb5_gss_prepare_context (const OKrb5Credential *creds,
482483
(char *) target->host_name.data, (char *) creds->realm.data);
483484
}
484485

485-
targetbuf = (gss_buffer_desc){
486+
targetbuf = (gss_buffer_desc) {
486487
.value = target_principal_str,
487488
.length = strlen (target_principal_str),
488489
};

nasl/nasl_krb5.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ static char *generated_config_path = NULL;
6363
{ \
6464
okrb5_set_slice_from_str (slice, getenv (env_name)); \
6565
} \
66+
else \
67+
{ \
68+
setenv (env_name, get_str_var_by_name (lexic, name), 1); \
69+
} \
6670
} \
6771
while (0)
6872

@@ -101,6 +105,7 @@ build_krb5_credential (lex_ctxt *lexic)
101105
char default_config_path[256];
102106
snprintf (default_config_path, sizeof (default_config_path),
103107
"/tmp/krb5_%s.conf", ip_str);
108+
setenv ("KRB5_CONFIG", default_config_path, 1);
104109
okrb5_set_slice_from_str (credential.config_path, default_config_path);
105110
}
106111

0 commit comments

Comments
 (0)