summaryrefslogtreecommitdiff
path: root/source3/librpc/rpc/dcerpc_gssapi.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2010-08-25 16:21:51 -0400
committerGünther Deschner <gd@samba.org>2010-08-30 14:34:01 +0200
commit36fdb211a6f2cfa7c939dc40df5094019c6e977f (patch)
tree957157c3469f2b6dd360e52fdebb3f385d9d97af /source3/librpc/rpc/dcerpc_gssapi.c
parentd15d76af5f169d27eeecab909174b67f7b44d0ee (diff)
downloadsamba-36fdb211a6f2cfa7c939dc40df5094019c6e977f.tar.gz
samba-36fdb211a6f2cfa7c939dc40df5094019c6e977f.tar.bz2
samba-36fdb211a6f2cfa7c939dc40df5094019c6e977f.zip
dcerpc-gssapi: add function to retrieve client name
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/librpc/rpc/dcerpc_gssapi.c')
-rw-r--r--source3/librpc/rpc/dcerpc_gssapi.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/librpc/rpc/dcerpc_gssapi.c b/source3/librpc/rpc/dcerpc_gssapi.c
index 03c6ae963f..af94b66780 100644
--- a/source3/librpc/rpc/dcerpc_gssapi.c
+++ b/source3/librpc/rpc/dcerpc_gssapi.c
@@ -629,6 +629,43 @@ DATA_BLOB gse_get_session_key(TALLOC_CTX *mem_ctx,
return ret;
}
+NTSTATUS gse_get_client_name(struct gse_context *gse_ctx,
+ TALLOC_CTX *mem_ctx, char **cli_name)
+{
+ OM_uint32 gss_min, gss_maj;
+ gss_buffer_desc name_buffer;
+
+ if (!gse_ctx->authenticated) {
+ return NT_STATUS_ACCESS_DENIED;
+ }
+
+ if (!gse_ctx->client_name) {
+ return NT_STATUS_NOT_FOUND;
+ }
+
+ /* TODO: check OID matches KRB5 Principal Name OID ? */
+
+ gss_maj = gss_display_name(&gss_min,
+ gse_ctx->client_name,
+ &name_buffer, NULL);
+ if (gss_maj) {
+ DEBUG(0, ("gss_display_name failed [%s]\n",
+ gse_errstr(talloc_tos(), gss_maj, gss_min)));
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+
+ *cli_name = talloc_strndup(talloc_tos(),
+ (char *)name_buffer.value,
+ name_buffer.length);
+
+ gss_maj = gss_release_buffer(&gss_min, &name_buffer);
+
+ if (!*cli_name) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ return NT_STATUS_OK;
+}
NTSTATUS gse_get_authz_data(struct gse_context *gse_ctx,
TALLOC_CTX *mem_ctx, DATA_BLOB *pac)
@@ -947,6 +984,11 @@ DATA_BLOB gse_get_session_key(TALLOC_CTX *mem_ctx,
return data_blob_null;
}
+NTSTATUS gse_get_client_name(struct gse_context *gse_ctx,
+ TALLOC_CTX *mem_ctx, char **client_name)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
NTSTATUS gse_get_authz_data(struct gse_context *gse_ctx,
TALLOC_CTX *mem_ctx, DATA_BLOB *pac)