mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
auth/ntlmssp: add gensec_ntlmssp_server_domain()
This is a hack in order to temporary export the server domain from NTLMSSP through the gensec stack. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Günther Deschner <gd@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
0a9e37a0db
commit
a85a02b631
@ -209,13 +209,48 @@ _PUBLIC_ NTSTATUS gensec_ntlmssp_init(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct gensec_security *gensec_find_child_by_ops(struct gensec_security *gensec_security,
|
||||
const struct gensec_security_ops *ops)
|
||||
{
|
||||
struct gensec_security *current = gensec_security;
|
||||
|
||||
while (current != NULL) {
|
||||
if (current->ops == ops) {
|
||||
return current;
|
||||
}
|
||||
|
||||
current = current->child_security;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32_t gensec_ntlmssp_neg_flags(struct gensec_security *gensec_security)
|
||||
{
|
||||
struct gensec_ntlmssp_context *gensec_ntlmssp;
|
||||
if (gensec_security->ops != &gensec_ntlmssp_security_ops) {
|
||||
|
||||
gensec_security = gensec_find_child_by_ops(gensec_security,
|
||||
&gensec_ntlmssp_security_ops);
|
||||
if (gensec_security == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
gensec_ntlmssp = talloc_get_type_abort(gensec_security->private_data,
|
||||
struct gensec_ntlmssp_context);
|
||||
return gensec_ntlmssp->ntlmssp_state->neg_flags;
|
||||
}
|
||||
|
||||
const char *gensec_ntlmssp_server_domain(struct gensec_security *gensec_security)
|
||||
{
|
||||
struct gensec_ntlmssp_context *gensec_ntlmssp;
|
||||
|
||||
gensec_security = gensec_find_child_by_ops(gensec_security,
|
||||
&gensec_ntlmssp_security_ops);
|
||||
if (gensec_security == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gensec_ntlmssp = talloc_get_type_abort(gensec_security->private_data,
|
||||
struct gensec_ntlmssp_context);
|
||||
return gensec_ntlmssp->ntlmssp_state->server.netbios_domain;
|
||||
}
|
||||
|
@ -132,3 +132,4 @@ bool ntlmssp_blob_matches_magic(const DATA_BLOB *blob);
|
||||
NTSTATUS gensec_ntlmssp_init(void);
|
||||
|
||||
uint32_t gensec_ntlmssp_neg_flags(struct gensec_security *gensec_security);
|
||||
const char *gensec_ntlmssp_server_domain(struct gensec_security *gensec_security);
|
||||
|
Loading…
Reference in New Issue
Block a user