summaryrefslogtreecommitdiffstats
path: root/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-01-24 16:38:01 +0100
committerGünther Deschner <gd@samba.org>2014-02-13 11:54:14 +0100
commit77d009898412cfef8f9773152f0728011ec7e304 (patch)
tree1decf1ac07d91090a77f974a27f372f946f7786c /librpc
parent9f5a59eb536b3dcf98f90259877d55c58d8c7f9a (diff)
downloadsamba-77d009898412cfef8f9773152f0728011ec7e304.tar.gz
samba-77d009898412cfef8f9773152f0728011ec7e304.tar.xz
samba-77d009898412cfef8f9773152f0728011ec7e304.zip
librpc/rpc: add dcerpc_binding_get_auth_info()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'librpc')
-rw-r--r--librpc/rpc/binding.c40
-rw-r--r--librpc/rpc/rpc_common.h3
2 files changed, 43 insertions, 0 deletions
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index c2798e6c1ff..588738645ea 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -428,6 +428,46 @@ _PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *_s, stru
return NT_STATUS_OK;
}
+_PUBLIC_ void dcerpc_binding_get_auth_info(const struct dcerpc_binding *b,
+ enum dcerpc_AuthType *_auth_type,
+ enum dcerpc_AuthLevel *_auth_level)
+{
+ enum dcerpc_AuthType auth_type;
+ enum dcerpc_AuthLevel auth_level;
+
+ if (b->flags & DCERPC_AUTH_SPNEGO) {
+ auth_type = DCERPC_AUTH_TYPE_SPNEGO;
+ } else if (b->flags & DCERPC_AUTH_KRB5) {
+ auth_type = DCERPC_AUTH_TYPE_KRB5;
+ } else if (b->flags & DCERPC_SCHANNEL) {
+ auth_type = DCERPC_AUTH_TYPE_SCHANNEL;
+ } else if (b->flags & DCERPC_AUTH_NTLM) {
+ auth_type = DCERPC_AUTH_TYPE_NTLMSSP;
+ } else {
+ auth_type = DCERPC_AUTH_TYPE_NONE;
+ }
+
+ if (b->flags & DCERPC_SEAL) {
+ auth_level = DCERPC_AUTH_LEVEL_PRIVACY;
+ } else if (b->flags & DCERPC_SIGN) {
+ auth_level = DCERPC_AUTH_LEVEL_INTEGRITY;
+ } else if (b->flags & DCERPC_CONNECT) {
+ auth_level = DCERPC_AUTH_LEVEL_CONNECT;
+ } else if (auth_type != DCERPC_AUTH_TYPE_NONE) {
+ auth_level = DCERPC_AUTH_LEVEL_CONNECT;
+ } else {
+ auth_level = DCERPC_AUTH_LEVEL_NONE;
+ }
+
+ if (_auth_type == NULL) {
+ *_auth_type = auth_type;
+ }
+
+ if (_auth_level == NULL) {
+ *_auth_level = auth_level;
+ }
+}
+
_PUBLIC_ const char *dcerpc_binding_get_string_option(const struct dcerpc_binding *b,
const char *name)
{
diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h
index a7a081c1b1c..7cab8a6792b 100644
--- a/librpc/rpc/rpc_common.h
+++ b/librpc/rpc/rpc_common.h
@@ -133,6 +133,9 @@ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx,
struct dcerpc_binding **b_out);
NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out);
char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b);
+void dcerpc_binding_get_auth_info(const struct dcerpc_binding *b,
+ enum dcerpc_AuthType *_auth_type,
+ enum dcerpc_AuthLevel *_auth_level);
const char *dcerpc_binding_get_string_option(const struct dcerpc_binding *b,
const char *name);
char *dcerpc_binding_copy_string_option(TALLOC_CTX *mem_ctx,