summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2014-08-08 09:27:48 -0400
committerSimo Sorce <simo@redhat.com>2014-08-08 10:11:05 -0400
commit77b7dd9436db7f1b3a2f2110a58e90341de420c9 (patch)
tree4adddd0b5898beb710f4c0abea886215b77f34d3
parentcda830c9f99e0528297243a376545aca2d9bc45c (diff)
downloadgss-ntlmssp-77b7dd9436db7f1b3a2f2110a58e90341de420c9.tar.gz
gss-ntlmssp-77b7dd9436db7f1b3a2f2110a58e90341de420c9.tar.xz
gss-ntlmssp-77b7dd9436db7f1b3a2f2110a58e90341de420c9.zip
Fetch server names much earier in the process
This is needed to find out if we are "domain joined" by way of checking nb_domain_name, in following patches.
-rw-r--r--src/gss_sec_ctx.c80
1 files changed, 40 insertions, 40 deletions
diff --git a/src/gss_sec_ctx.c b/src/gss_sec_ctx.c
index d79670b..40817b8 100644
--- a/src/gss_sec_ctx.c
+++ b/src/gss_sec_ctx.c
@@ -591,6 +591,46 @@ uint32_t gssntlm_accept_sec_context(uint32_t *minor_status,
goto done;
}
+ /* acquire our own name */
+ if (!server_name) {
+ gss_buffer_desc tmpbuf;
+ tmpbuf.value = discard_const("");
+ tmpbuf.length = 0;
+ retmaj = gssntlm_import_name_by_mech(&retmin,
+ &gssntlm_oid,
+ &tmpbuf,
+ GSS_C_NT_HOSTBASED_SERVICE,
+ (gss_name_t *)&server_name);
+ if (retmaj) goto done;
+ }
+
+ retmin = gssntlm_copy_name(server_name, &ctx->target_name);
+ if (retmin) {
+ retmaj = GSS_S_FAILURE;
+ goto done;
+ }
+
+ computer_name = strdup(server_name->data.server.name);
+ if (!computer_name) {
+ retmin = ENOMEM;
+ retmaj = GSS_S_FAILURE;
+ goto done;
+ }
+
+ retmin = netbios_get_names(computer_name,
+ &nb_computer_name, &nb_domain_name);
+ if (retmin) {
+ retmaj = GSS_S_FAILURE;
+ goto done;
+ }
+
+ ctx->workstation = strdup(nb_computer_name);
+ if (!ctx->workstation) {
+ retmin = ENOMEM;
+ retmaj = GSS_S_FAILURE;
+ goto done;
+ }
+
/* FIXME: add call to determine if we are any other type of
* server, including setting up callbacks to perform validation
* against a remote DC */
@@ -692,46 +732,6 @@ uint32_t gssntlm_accept_sec_context(uint32_t *minor_status,
goto done;
}
- /* acquire our own name */
- if (!server_name) {
- gss_buffer_desc tmpbuf;
- tmpbuf.value = discard_const("");
- tmpbuf.length = 0;
- retmaj = gssntlm_import_name_by_mech(&retmin,
- &gssntlm_oid,
- &tmpbuf,
- GSS_C_NT_HOSTBASED_SERVICE,
- (gss_name_t *)&server_name);
- if (retmaj) goto done;
- }
-
- retmin = gssntlm_copy_name(server_name, &ctx->target_name);
- if (retmin) {
- retmaj = GSS_S_FAILURE;
- goto done;
- }
-
- computer_name = strdup(server_name->data.server.name);
- if (!computer_name) {
- retmin = ENOMEM;
- retmaj = GSS_S_FAILURE;
- goto done;
- }
-
- retmin = netbios_get_names(computer_name,
- &nb_computer_name, &nb_domain_name);
- if (retmin) {
- retmaj = GSS_S_FAILURE;
- goto done;
- }
-
- ctx->workstation = strdup(nb_computer_name);
- if (!ctx->workstation) {
- retmin = ENOMEM;
- retmaj = GSS_S_FAILURE;
- goto done;
- }
-
timestamp = ntlm_timestamp_now();
retmin = ntlm_encode_target_info(ctx->ntlm,