diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-06-04 12:32:37 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:56:26 -0500 |
commit | 2d6207add7a2e16db619a4cfc1a94ae4ad2fd9e8 (patch) | |
tree | 41af0c145d0bab545f0f1148143090cf95352751 /source4 | |
parent | 9eb6afb00d85c1a7b367d51a19eed41172f7a2e9 (diff) | |
download | samba-2d6207add7a2e16db619a4cfc1a94ae4ad2fd9e8.tar.gz samba-2d6207add7a2e16db619a4cfc1a94ae4ad2fd9e8.tar.bz2 samba-2d6207add7a2e16db619a4cfc1a94ae4ad2fd9e8.zip |
r1010: make the dcesrv_crypto code a bit more generic...
fix type 'cyrpto' -> 'crypto'
metze
(This used to be commit 90f4777dfcb141b646063128c82f4c03bd176413)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/rpc_server/dcerpc_server.h | 4 | ||||
-rw-r--r-- | source4/rpc_server/dcesrv_crypto.c | 33 | ||||
-rw-r--r-- | source4/rpc_server/dcesrv_crypto_ntlmssp.c | 11 |
3 files changed, 22 insertions, 26 deletions
diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 44726b5828..386da6fc57 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -94,7 +94,7 @@ struct dcesrv_handle { void (*destroy)(struct dcesrv_connection *, struct dcesrv_handle *); }; -struct dcesrv_cyrpto_ops { +struct dcesrv_crypto_ops { const char *name; uint8 auth_type; NTSTATUS (*start)(struct dcesrv_auth *auth); @@ -116,7 +116,7 @@ struct dcesrv_auth { struct dcerpc_auth *auth_info; struct { void *private_data; - const struct dcesrv_cyrpto_ops *ops; + const struct dcesrv_crypto_ops *ops; } crypto_ctx; }; diff --git a/source4/rpc_server/dcesrv_crypto.c b/source4/rpc_server/dcesrv_crypto.c index 11956fe3be..6d46388c97 100644 --- a/source4/rpc_server/dcesrv_crypto.c +++ b/source4/rpc_server/dcesrv_crypto.c @@ -34,8 +34,6 @@ NTSTATUS dcesrv_crypto_select_type(struct dcesrv_connection *dce_conn, struct dcesrv_auth *auth) { - NTSTATUS status; - if (auth->auth_info->auth_level != DCERPC_AUTH_LEVEL_INTEGRITY && auth->auth_info->auth_level != DCERPC_AUTH_LEVEL_PRIVACY) { DEBUG(2,("auth_level %d not supported in dcesrv auth\n", @@ -58,24 +56,13 @@ NTSTATUS dcesrv_crypto_select_type(struct dcesrv_connection *dce_conn, * maybe a dcesrv_crypto_find_backend_by_type() whould be better here * to make thinks more generic */ - switch (auth->auth_info->auth_type) { - -/* case DCERPC_AUTH_TYPE_SCHANNEL: - status = dcesrv_crypto_schannel_get_ops(dce_conn, auth); - break; -*/ - case DCERPC_AUTH_TYPE_NTLMSSP: - status = dcesrv_crypto_ntlmssp_get_ops(dce_conn, auth); - break; - - default: + auth->crypto_ctx.ops = dcesrv_crypto_backend_bytype(auth->auth_info->auth_type); + if (auth->crypto_ctx.ops == NULL) { DEBUG(2,("dcesrv auth_type %d not supported\n", auth->auth_info->auth_type)); return NT_STATUS_INVALID_PARAMETER; } - DEBUG(4,("dcesrv_crypto_startup: %s\n", nt_errstr(status))); - - return status; + return NT_STATUS_OK; } /* @@ -139,3 +126,17 @@ void dcesrv_crypto_end(struct dcesrv_auth *auth) { auth->crypto_ctx.ops->end(auth); } + +const struct dcesrv_crypto_ops *dcesrv_crypto_backend_bytype(uint8_t auth_type) +{ + switch (auth_type) { +#if 0 + case DCERPC_AUTH_TYPE_SCHANNEL: + return dcesrv_crypto_schannel_get_ops(); +#endif + case DCERPC_AUTH_TYPE_NTLMSSP: + return dcesrv_crypto_ntlmssp_get_ops(); + } + + return NULL; +} diff --git a/source4/rpc_server/dcesrv_crypto_ntlmssp.c b/source4/rpc_server/dcesrv_crypto_ntlmssp.c index b894f0f25d..0f1939ea1b 100644 --- a/source4/rpc_server/dcesrv_crypto_ntlmssp.c +++ b/source4/rpc_server/dcesrv_crypto_ntlmssp.c @@ -113,7 +113,7 @@ static void dcesrv_crypto_ntlmssp_end(struct dcesrv_auth *auth) return; } -static const struct dcesrv_cyrpto_ops dcesrv_crypto_ntlmssp_ops = { +static const struct dcesrv_crypto_ops dcesrv_crypto_ntlmssp_ops = { .name = "ntlmssp", .auth_type = DCERPC_AUTH_TYPE_NTLMSSP, .start = dcesrv_crypto_ntlmssp_start, @@ -128,12 +128,7 @@ static const struct dcesrv_cyrpto_ops dcesrv_crypto_ntlmssp_ops = { /* startup the cryptographic side of an authenticated dcerpc server */ -NTSTATUS dcesrv_crypto_ntlmssp_get_ops(struct dcesrv_connection *dce_conn, - struct dcesrv_auth *auth) +const struct dcesrv_crypto_ops *dcesrv_crypto_ntlmssp_get_ops(void) { - NTSTATUS status = NT_STATUS_OK; - - auth->crypto_ctx.ops = &dcesrv_crypto_ntlmssp_ops; - - return status; + return &dcesrv_crypto_ntlmssp_ops; } |