The branch, v3-2-test has been updated via 95129a28cfa57d8e5bd767b92f065abd1d32a569 (commit) via 8f411753b2130e9c1f260a15d031f57ba07b62a1 (commit) from 7b3724fe861408c393e94260f8a8cc504f2a48d0 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test - Log ----------------------------------------------------------------- commit 95129a28cfa57d8e5bd767b92f065abd1d32a569 Author: Günther Deschner <[EMAIL PROTECTED]> Date: Tue Jan 8 18:59:57 2008 +0100 Add libnet_join_derive_salting_principal(). Guenther commit 8f411753b2130e9c1f260a15d031f57ba07b62a1 Author: Günther Deschner <[EMAIL PROTECTED]> Date: Tue Jan 8 16:57:16 2008 +0100 Fix build warning for libsmbclient example. Guenther ----------------------------------------------------------------------- Summary of changes: examples/libsmbclient/tree.c | 2 + source/libnet/libnet_join.c | 55 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 0 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/libsmbclient/tree.c b/examples/libsmbclient/tree.c index d5a71e2..6e34cd0 100644 --- a/examples/libsmbclient/tree.c +++ b/examples/libsmbclient/tree.c @@ -24,6 +24,8 @@ #include <stdio.h> #include <errno.h> +#include <string.h> +#include <stdlib.h> #include <gtk/gtk.h> #include "libsmbclient.h" diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c index 454c1f2..d139fa0 100644 --- a/source/libnet/libnet_join.c +++ b/source/libnet/libnet_join.c @@ -438,6 +438,57 @@ static bool libnet_join_create_keytab(TALLOC_CTX *mem_ctx, return true; } +#ifdef HAVE_LDAP + +/**************************************************************** +****************************************************************/ + +static bool libnet_join_derive_salting_principal(TALLOC_CTX *mem_ctx, + struct libnet_JoinCtx *r) +{ + uint32_t domain_func; + ADS_STATUS status; + const char *salt = NULL; + char *std_salt = NULL; + + status = ads_domain_func_level(r->in.ads, &domain_func); + if (!ADS_ERR_OK(status)) { + libnet_join_set_error_string(mem_ctx, r, + "Failed to determine domain functional level!\n"); + return false; + } + + std_salt = kerberos_standard_des_salt(); + if (!std_salt) { + libnet_join_set_error_string(mem_ctx, r, + "failed to obtain standard DES salt\n"); + return false; + } + + salt = talloc_strdup(mem_ctx, std_salt); + if (!salt) { + return false; + } + + SAFE_FREE(std_salt); + + if (domain_func == DS_DOMAIN_FUNCTION_2000) { + char *upn; + + upn = ads_get_upn(r->in.ads, mem_ctx, + r->in.machine_name); + if (upn) { + salt = talloc_strdup(mem_ctx, upn); + if (!salt) { + return false; + } + } + } + + return kerberos_secrets_store_des_salt(salt); +} +#endif + /**************************************************************** ****************************************************************/ @@ -1020,6 +1071,10 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx, ads_errstr(ads_status)); return WERR_GENERAL_FAILURE; } + + if (!libnet_join_derive_salting_principal(mem_ctx, r)) { + return WERR_GENERAL_FAILURE; + } #endif if (!libnet_join_create_keytab(mem_ctx, r)) { libnet_join_set_error_string(mem_ctx, r, -- Samba Shared Repository