make sure we dont print off the end of the gss_buffer_t, they are defined to not included NULL, in heimdal they are but thats an implementation detail, dont teach people about that. From: Christian Krause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24035 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -265,7 +265,8 @@ gss_adat(void *app_data, void *buf, size_t len)
|
|||||||
GSS_C_NO_OID,
|
GSS_C_NO_OID,
|
||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
syslog(LOG_ERR, "gss_accept_sec_context: %s",
|
syslog(LOG_ERR, "gss_accept_sec_context: %.*s",
|
||||||
|
(int)status_string.length,
|
||||||
(char*)status_string.value);
|
(char*)status_string.value);
|
||||||
gss_release_buffer(&new_stat, &status_string);
|
gss_release_buffer(&new_stat, &status_string);
|
||||||
reply(431, "Security resource unavailable");
|
reply(431, "Security resource unavailable");
|
||||||
@@ -331,8 +332,10 @@ import_name(const char *kname, const char *host, gss_name_t *target_name)
|
|||||||
GSS_C_NO_OID,
|
GSS_C_NO_OID,
|
||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
printf("Error importing name %s: %s\n",
|
printf("Error importing name %.*s: %.*s\n",
|
||||||
|
(int)name.length,
|
||||||
(char *)name.value,
|
(char *)name.value,
|
||||||
|
(int)status_string.length,
|
||||||
(char *)status_string.value);
|
(char *)status_string.value);
|
||||||
free(name.value);
|
free(name.value);
|
||||||
gss_release_buffer(&new_stat, &status_string);
|
gss_release_buffer(&new_stat, &status_string);
|
||||||
@@ -427,7 +430,8 @@ gss_auth(void *app_data, char *host)
|
|||||||
GSS_C_NO_OID,
|
GSS_C_NO_OID,
|
||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
printf("Error initializing security context: %s\n",
|
printf("Error initializing security context: %.*s\n",
|
||||||
|
(int)status_string.length,
|
||||||
(char*)status_string.value);
|
(char*)status_string.value);
|
||||||
gss_release_buffer(&new_stat, &status_string);
|
gss_release_buffer(&new_stat, &status_string);
|
||||||
return AUTH_CONTINUE;
|
return AUTH_CONTINUE;
|
||||||
@@ -501,7 +505,9 @@ gss_auth(void *app_data, char *host)
|
|||||||
&name,
|
&name,
|
||||||
NULL);
|
NULL);
|
||||||
if (GSS_ERROR(maj_stat) == 0) {
|
if (GSS_ERROR(maj_stat) == 0) {
|
||||||
printf("Authenticated to <%s>\n", (char *)name.value);
|
printf("Authenticated to <%.*s>\n",
|
||||||
|
(int)name.length,
|
||||||
|
(char *)name.value);
|
||||||
gss_release_buffer(&min_stat, &name);
|
gss_release_buffer(&min_stat, &name);
|
||||||
}
|
}
|
||||||
gss_release_name(&min_stat, &targ_name);
|
gss_release_name(&min_stat, &targ_name);
|
||||||
|
@@ -58,13 +58,18 @@ gss_set_error (struct gss_state *gs, int min_stat)
|
|||||||
OM_uint32 ret;
|
OM_uint32 ret;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
char * cstr;
|
||||||
|
|
||||||
ret = gss_display_status (&new_stat,
|
ret = gss_display_status (&new_stat,
|
||||||
min_stat,
|
min_stat,
|
||||||
GSS_C_MECH_CODE,
|
GSS_C_MECH_CODE,
|
||||||
gs->mech_oid,
|
gs->mech_oid,
|
||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
pop_auth_set_error(status_string.value);
|
asprintf(&cstr, "%.*s", (int)status_string.length,
|
||||||
|
(const char *)status_string.value);
|
||||||
|
pop_auth_set_error(cstr);
|
||||||
|
free(cstr);
|
||||||
gss_release_buffer (&new_stat, &status_string);
|
gss_release_buffer (&new_stat, &status_string);
|
||||||
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
||||||
}
|
}
|
||||||
|
@@ -237,7 +237,9 @@ spx_send(ap)
|
|||||||
&output_name_buffer,
|
&output_name_buffer,
|
||||||
&output_name_type);
|
&output_name_type);
|
||||||
|
|
||||||
printf("target is '%s'\n", output_name_buffer.value); fflush(stdout);
|
printf("target is '%.*s'\n", (int)output_name_buffer.length,
|
||||||
|
(char*)output_name_buffer.value);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
major_status = gss_release_buffer(&status, &output_name_buffer);
|
major_status = gss_release_buffer(&status, &output_name_buffer);
|
||||||
|
|
||||||
@@ -290,7 +292,8 @@ spx_send(ap)
|
|||||||
GSS_C_NULL_OID,
|
GSS_C_NULL_OID,
|
||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
printf("%s\n", status_string.value);
|
printf("%.*s\n", (int)status_string.length,
|
||||||
|
(char*)status_string.value);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,8 +460,9 @@ spx_reply(ap, data, cnt)
|
|||||||
GSS_C_NULL_OID,
|
GSS_C_NULL_OID,
|
||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
printf("[ SPX mutual response fails ... '%s' ]\r\n",
|
printf("[ SPX mutual response fails ... '%.*s' ]\r\n",
|
||||||
status_string.value);
|
(int)status_string.length,
|
||||||
|
(char*)status_string.value);
|
||||||
auth_send_retry();
|
auth_send_retry();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -107,7 +107,9 @@ gss_print_errors (int min_stat)
|
|||||||
GSS_C_NO_OID,
|
GSS_C_NO_OID,
|
||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
fprintf (stderr, "%s\n", (char *)status_string.value);
|
fprintf (stderr, "%.*s\n",
|
||||||
|
(int)status_string.length,
|
||||||
|
(char *)status_string.value);
|
||||||
gss_release_buffer (&new_stat, &status_string);
|
gss_release_buffer (&new_stat, &status_string);
|
||||||
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,8 @@ gss_print_errors (int min_stat)
|
|||||||
GSS_C_NO_OID,
|
GSS_C_NO_OID,
|
||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
fprintf (stderr, "%s\n", (char *)status_string.value);
|
fprintf (stderr, "%.*s\n", (int)status_string.legnth,
|
||||||
|
(char *)status_string.value);
|
||||||
gss_release_buffer (&new_stat, &status_string);
|
gss_release_buffer (&new_stat, &status_string);
|
||||||
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
||||||
}
|
}
|
||||||
|
@@ -45,8 +45,7 @@ main(int argc, char **argv)
|
|||||||
maj_stat = gss_oid_to_str(&minor_status, GSS_KRB5_MECHANISM, &data);
|
maj_stat = gss_oid_to_str(&minor_status, GSS_KRB5_MECHANISM, &data);
|
||||||
if (GSS_ERROR(maj_stat))
|
if (GSS_ERROR(maj_stat))
|
||||||
errx(1, "gss_oid_to_str failed");
|
errx(1, "gss_oid_to_str failed");
|
||||||
|
ret = strncmp(data.value, "1 2 840 113554 1 2 2", data.length);
|
||||||
ret = strcmp(data.value, "1 2 840 113554 1 2 2");
|
|
||||||
gss_release_buffer(&maj_stat, &data);
|
gss_release_buffer(&maj_stat, &data);
|
||||||
if (ret)
|
if (ret)
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -62,7 +62,8 @@ gss_print_errors (int min_stat)
|
|||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
if (!GSS_ERROR(ret)) {
|
if (!GSS_ERROR(ret)) {
|
||||||
fprintf (stderr, "%s\n", (char *)status_string.value);
|
fprintf (stderr, "%.*s\n", (int)status_string.value,
|
||||||
|
(char *)status_string.value);
|
||||||
gss_release_buffer (&new_stat, &status_string);
|
gss_release_buffer (&new_stat, &status_string);
|
||||||
}
|
}
|
||||||
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
||||||
|
@@ -62,7 +62,8 @@ gss_print_errors (int min_stat)
|
|||||||
&msg_ctx,
|
&msg_ctx,
|
||||||
&status_string);
|
&status_string);
|
||||||
if (!GSS_ERROR(ret)) {
|
if (!GSS_ERROR(ret)) {
|
||||||
fprintf (stderr, "%s\n", (char *)status_string.value);
|
fprintf (stderr, "%.*s\n", (int)status_string.length,
|
||||||
|
(char *)status_string.value);
|
||||||
gss_release_buffer (&new_stat, &status_string);
|
gss_release_buffer (&new_stat, &status_string);
|
||||||
}
|
}
|
||||||
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
} while (!GSS_ERROR(ret) && msg_ctx != 0);
|
||||||
|
@@ -53,7 +53,7 @@ main(int argc, char **argv)
|
|||||||
if (GSS_ERROR(maj_stat))
|
if (GSS_ERROR(maj_stat))
|
||||||
errx(1, "gss_oid_to_str failed");
|
errx(1, "gss_oid_to_str failed");
|
||||||
|
|
||||||
ret = strcmp(data.value, "1 2 840 113554 1 2 2");
|
ret = strncmp(data.value, "1 2 840 113554 1 2 2", data.length);
|
||||||
gss_release_buffer(&maj_stat, &data);
|
gss_release_buffer(&maj_stat, &data);
|
||||||
if (ret)
|
if (ret)
|
||||||
return 1;
|
return 1;
|
||||||
@@ -62,7 +62,7 @@ main(int argc, char **argv)
|
|||||||
if (GSS_ERROR(maj_stat))
|
if (GSS_ERROR(maj_stat))
|
||||||
errx(1, "gss_oid_to_str failed");
|
errx(1, "gss_oid_to_str failed");
|
||||||
|
|
||||||
ret = strcmp(data.value, "1 3 6 1 5 6 4");
|
ret = strnncmp(data.value, "1 3 6 1 5 6 4", data.length);
|
||||||
gss_release_buffer(&maj_stat, &data);
|
gss_release_buffer(&maj_stat, &data);
|
||||||
if (ret)
|
if (ret)
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user